@elyx-code/project-logic-tree 0.0.6180 → 0.0.6181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -66447,7 +66447,8 @@ const Pn = {}, bs = {}, Zs = {
66447
66447
  enrich: !0,
66448
66448
  mock: !1,
66449
66449
  ignoreCache: !1,
66450
- onFetch: async () => null
66450
+ onFetch: async () => null,
66451
+ manuallyInit: !1
66451
66452
  };
66452
66453
  function rJ(i, { enrich: s } = { enrich: !0 }) {
66453
66454
  const e = i.project, t = i.record, r = new ip(e), a = /* @__PURE__ */ new Set();
@@ -66529,16 +66530,18 @@ async function iJ(i, s = Zs) {
66529
66530
  }
66530
66531
  };
66531
66532
  }
66532
- return console.log("Fetching project from external API"), new Promise(async (r) => {
66533
- if (e.onFetch) {
66534
- const a = await e.onFetch(i.id);
66535
- if (a) {
66536
- r({ data: a });
66537
- return;
66538
- }
66539
- } else
66540
- r({ data: null });
66541
- });
66533
+ return console.log("Fetching project from external API"), new Promise(
66534
+ async (r) => {
66535
+ if (e.onFetch) {
66536
+ const a = await e.onFetch(i.id);
66537
+ if (a) {
66538
+ r({ data: a });
66539
+ return;
66540
+ }
66541
+ } else
66542
+ r({ data: null });
66543
+ }
66544
+ );
66542
66545
  }
66543
66546
  function up(i) {
66544
66547
  const s = new b(i);
@@ -66654,7 +66657,7 @@ async function Xq(i, s = Zs) {
66654
66657
  let a;
66655
66658
  return e.mock ? a = nJ(om, {
66656
66659
  enrich: !!e.enrich
66657
- }) : a = rJ(r.data, {
66660
+ }) : r.data instanceof b ? a = r.data : a = rJ(r.data, {
66658
66661
  enrich: !!e.enrich
66659
66662
  }), Pn[i.id] = a, i.id && delete bs[i.id], a;
66660
66663
  }
@@ -405,4 +405,4 @@ If an entity is called by another, they must be in the same scope, which means t
405
405
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:p,added:h,removed:c}=this.remove({ignoreUpstream:!1},r);a.push(...p),d.push(...h),o.push(...c)}if(t==="parent"){const{updated:p,added:h,removed:c}=this.remove({ignoreUpstream:!1},r);a.push(...p),d.push(...h),o.push(...c)}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:p,added:h,removed:c}=this.restore({},r);a.push(...p),d.push(...h),o.push(...c)}if(t==="parent"){const{updated:p,added:h,removed:c}=this.restore({},r);a.push(...p),d.push(...h),o.push(...c)}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){var e;return(e=this.parent)==null||e.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new ke(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.inputs=this.inputs,e.outputs=this.outputs,e.error=this.error,e.successCalls=this.successCalls,e.errorCalls=this.errorCalls,e.process=this.process,e.declaration=this.declaration,e.calledBySuccess=this.calledBySuccess,e.calledByError=this.calledByError,e.calledByEntry=this.calledByEntry,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const p=new Map;for(const[h,c]of this.knownVersions||new Map){if(p.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)p.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const p=await this.APILoadVersion({},e);if(!p)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new ke(p,this.project)}return this.metaSync(o.toShallowJSON(),null),this.inputs=o.inputs,this.outputs=o.outputs,this.error=o.error,this.successCalls=o.successCalls,this.errorCalls=o.errorCalls,this.process=o.process,this.declaration=o.declaration,this.calledBySuccess=o.calledBySuccess,this.calledByError=o.calledByError,this.calledByEntry=o.calledByEntry,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const d=B(this.initialData.declaration),o=this.project.get(d);o&&(this.setDeclaration(o),e.push(o))}return this.initialData.calledByEntry.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addEntryCaller(l,null),e.push(l))}),this.initialData.calledBySuccess.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addSuccessCaller(l,null),e.push(l))}),this.initialData.calledByError.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addErrorCaller(l,null),e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:p}=this.syncMissingFixedInputs(e),{updated:h,added:c,removed:v}=this.syncMissingFixedOutputs(e);return t.push(...o,...h),r.push(...l,...c),a.push(...p,...v),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){var o;const t=[this],r=[],a=[],d=[];return this.parent===this.project&&this.project.addFunctionCall(this),(o=this.process)==null||o.writesValues.forEach(l=>{l.setValueWriter(this.process),t.push(l)}),this.successCalls.forEach(l=>{l.addSuccessCaller(this,e),t.push(l)}),this.errorCalls.forEach(l=>{l.addErrorCaller(this,e),t.push(l)}),this.calledBySuccess.forEach(l=>{l.addSuccessCall(this),t.push(l)}),this.calledByError.forEach(l=>{l.addErrorCall(this),t.push(l)}),this.calledByEntry.forEach(l=>{l.addCall(this),t.push(l)}),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(r=>r.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this.outputs.includes(e)?this:(this.outputs.push(e),this)}removeOutput(e){const t=this.outputs.findIndex(r=>r.id===e.id);return t>-1&&this.outputs.splice(t,1),this}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),this}addSuccessCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-success-caller"))){return this.calledBySuccess.find(r=>r.id===e.id)||(this.calledBySuccess.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-success-caller",this.id)),this}addErrorCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-error-caller"))){return this.calledByError.find(r=>r.id===e.id)||(this.calledByError.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-error-caller",this.id)),this}addEntryCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-entry-caller"))){return this.calledByEntry.find(r=>r.id===e.id)||(this.calledByEntry.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-entry-caller",this.id)),this}addErrorCall(e){return this.errorCalls.find(t=>t.id===e.id)||this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.find(t=>t.id===e.id)||this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const r=this.errorCalls.findIndex(a=>a.id===e.id);return r>-1&&this.errorCalls.splice(r,1),this}removeCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-caller"))){return this.calledBySuccess=this.calledBySuccess.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByError=this.calledByError.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByEntry=this.calledByEntry.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),t==null||t.attemptAutoclose("remove-caller",this.id),this}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===n.FunctionDeclaration){const t=w(this.initialData.declaration,this.project);this.declaration=t}else{const t=B(this.initialData.declaration),r=this.project.get(t);this.declaration=r}return this.successCalls=this.initialData.successCalls.map(t=>{const r=w(t,this.project);return r.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.errorCalls=this.initialData.errorCalls.map(t=>{const r=w(t,this.project);return r.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.inputs=this.initialData.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.initialData.process&&(this.process=w(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(e)),this.initialData.error&&(this.error=w(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(e)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await ke.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await ke.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await ke.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await ke.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await ke.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await ke.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){var l;const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(p=>{const{updated:h,removed:c,added:v}=p.entity.onDetachedDependencyRemoved(this,p.field,t);r.push(...h),a.push(...c),d.push(...v)}),this.process){const{updated:p,removed:h}=(l=this.process)==null?void 0:l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}if(this.inputs.forEach(p=>{const{updated:h,removed:c}=p.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...c)}),this.outputs.forEach(p=>{const{updated:h,removed:c}=p.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...c)}),this.error){const{updated:p,removed:h}=this.error.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}return this.successCalls.forEach(p=>{r.push(p),p.removeCaller(this)}),this.errorCalls.forEach(p=>{r.push(p),p.removeCaller(this)}),e||this.calledBy.forEach(p=>{r.push(p),p.removeCall(this)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.process){const{updated:o}=this.process.restore({},e);r.push(...o)}return this.inputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.outputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.successCalls.forEach(o=>{r.push(o),o.addSuccessCaller(this)}),this.errorCalls.forEach(o=>{r.push(o),o.addErrorCaller(this)}),this.calledBySuccess.forEach(o=>{r.push(o),o.addSuccessCall(this)}),this.calledByError.forEach(o=>{r.push(o),o.addErrorCall(this)}),this.calledByEntry.forEach(o=>{r.push(o),o.addCall(this)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(r=>r.toFlat(e)),...this.errorCalls.flatMap(r=>r.toFlat(e)),...this.inputs.flatMap(r=>r.toFlat(e)),...this.outputs.flatMap(r=>r.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(r=>r.toFlatIds(e)),...this.errorCalls.flatMap(r=>r.toFlatIds(e)),...this.inputs.flatMap(r=>r.toFlatIds(e)),...this.outputs.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){var t,r;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(a=>a.toJSON(e)),errorCalls:this.errorCalls.map(a=>a.toJSON(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference()),calledByError:this.calledByError.map(a=>a.toReference()),calledByEntry:this.calledByEntry.map(a=>a.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(a=>a.toJSON(e)),outputs:this.outputs.map(a=>a.toJSON(e)),parent:this.parent.toReference(),error:(r=this.error)==null?void 0:r.toJSON(e)})}toJSONClone(e=Z){var r,a,d,o,l,p,h;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,createdAt:e.timestamp||T().toISOString(),previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(c=>c.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(c=>c.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),process:(p=this.process)==null?void 0:p.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(c=>c.toJSONClone({...e,newId:null})),outputs:this.outputs.map(c=>c.toJSONClone({...e,newId:null})),error:(h=this.error)==null?void 0:h.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference(e):null,inputs:this.inputs.map(a=>a.toReference(e)),outputs:this.outputs.map(a=>a.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(a=>a.toReference(e)),errorCalls:this.errorCalls.map(a=>a.toReference(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference(e)),calledByError:this.calledByError.map(a=>a.toReference(e)),calledByEntry:this.calledByEntry.map(a=>a.toReference(e)),error:this.error?this.error.toReference(e):null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(r=>r.toFlatJSON(e)),...this.errorCalls.flatMap(r=>r.toFlatJSON(e)),...this.inputs.flatMap(r=>r.toFlatJSON(e)),...this.outputs.flatMap(r=>r.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.inputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.outputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(r=>r.clearErrors()),this.outputs.forEach(r=>r.clearErrors()),this.successCalls.forEach(r=>r.clearErrors()),this.errorCalls.forEach(r=>r.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=Nq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var O,V;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.inputs=[];const p=l.split("-id"),h=p[p.length-1||0]||l;o.id=l,o.version=R.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t?c.setParent(t,null):c.setParent(this.parent,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(O=this.inputs)==null?void 0:O.map((C,U)=>C.clone(e,c,h+"-input-map-"+U+"-id",a));c.inputs=v;const E=(V=this.outputs)==null?void 0:V.map((C,U)=>C.clone(e,c,h+"-output-map-"+U+"-id",a));return c.outputs=E,this.error&&(c.error=this.error.clone(e,c,h+"-error-map-id",a)),this.process&&(c.process=this.process.clone(e,c,h+"-process-id",a)),e==null||e.attemptAutoclose("clone-entity",this.id),c}removeUnrecognizedInputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-inputs"))){const t=[],r=[],a=[],d=[];return this.inputs.forEach(o=>{if(!this.declaration.inputs.find(p=>{var h;return p.id===((h=o.declaration)==null?void 0:h.id)})){const p=o.remove({ignoreUpstream:!1},e);a.push(...p.removed),t.push(...p.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}removeUnrecognizedOutputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-outputs"))){const t=[],r=[],a=[],d=[];return this.outputs.forEach(o=>{if(!this.declaration.getUniqueReturnDeclarations().find(p=>{var h;return p.id===((h=o.declaration)==null?void 0:h.id)})){const p=o.remove({ignoreUpstream:!1},e);a.push(...p.removed),t.push(...p.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}syncMissingFixedInputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const t=[],r=[],a=[],d=[],o=this.declaration.inputs.filter(c=>!this.inputs.find(v=>v.declaration.id===c.id));this.inputs.sort((c,v)=>c.index-v.index),o.forEach(c=>{this.inputs.forEach(O=>{O.index>=c.index&&O.metaSync({index:O.index+1},e)});const v={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.InputMap,declaration:c.toJSON(),readsValue:null,defaultValue:null,index:c.index,name:null,description:null,parent:this.toReference()},E=w(v,this.project);E.setParent(this,e),E.initChildren(e),e==null||e.add(E,b.Added),E.addSelfToProject(e),r.push(E)}),this.inputs.sort((c,v)=>c.index-v.index);const{updated:l,added:p,removed:h}=this.removeUnrecognizedInputs(e);return t.push(...l),r.push(...p),a.push(...h),e==null||e.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}syncMissingFixedOutputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const t=[],r=[],a=[],d=[],o=[];this.outputs=this.initialData.outputs.map(v=>{const E=w(v,this.project);return o.push(E.index),E.setParent(this,null),E.initChildren(e),E});const l=this.declaration.getUniqueReturnDeclarations().filter(v=>!this.outputs.find(E=>E.declaration.id===v.id));this.outputs.sort((v,E)=>v.index-E.index),l.forEach((v,E)=>{this.outputs.forEach(U=>{U.index>=v.index&&U.index++});const O=o.includes(v.index)?this.outputs.length-1+E:v.index,V={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.OutputMap,declaration:v.toJSON(),defaultValue:null,writesValues:[],index:O,parent:this.toReference()},C=w(V,this.project);C.setParent(this,e),C.initChildren(e),e==null||e.add(C,b.Added),C.addSelfToProject(e)}),this.outputs.sort((v,E)=>v.index-E.index);const{updated:p,added:h,removed:c}=this.removeUnrecognizedOutputs(e);return t.push(...p),r.push(...h),a.push(...c),e==null||e.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}};f(ke,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(ke,"type",n.FunctionCall),f(ke,"USER_MANAGED_PARENT_TYPES",[...mt,n.Project]),f(ke,"PARENT_TYPES",[...ke.USER_MANAGED_PARENT_TYPES]),f(ke,"MUTABLE_BASE_PROPERTIES",[]),f(ke,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(ke,"BASE_PROPERTIES",[...ke.MUTABLE_BASE_PROPERTIES,...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"MUTABLE_META_PROPERTIES",["x","y"]),f(ke,"INMUTABLE_META_PROPERTIES",[...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"META_PROPERTIES",[...ke.MUTABLE_META_PROPERTIES,...ke.INMUTABLE_META_PROPERTIES]),f(ke,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),f(ke,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),f(ke,"UPSTREAM_PROPERTIES",[...ke.MUTABLE_UPSTREAM_PROPERTIES,...ke.INMUTABLE_UPSTREAM_PROPERTIES]),f(ke,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),f(ke,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(ke,"DOWNSTREAM_PROPERTIES",[...ke.MUTABLE_DOWNSTREAM_PROPERTIES,...ke.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(ke,"PROPERTIES",[...ke.META_PROPERTIES,...ke.UPSTREAM_PROPERTIES,...ke.DOWNSTREAM_PROPERTIES]);let qi=ke;function Lc(i){return i&&typeof i.then=="function"}class Sd{constructor(s){f(this,"order",[]);f(this,"flatRecord",{});f(this,"allBuiltInEntityIds",Vr());f(this,"onGoingVisits",{});this.flatten(s),this.orderEntities()}flatten(s){const e=new Set(Vr()),t=u(N(s,e,{ignoreBuiltInBaseEntities:!0})),r=new Set;for(const a of t)this.flatRecord[a.id]=a,r.add(a.id);this.order=Array.from(r)}moveEntityAfterDependencies(s){const{upstream:e}=Wd(s,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const t of Object.keys(e)){const r=this.order.indexOf(t),a=this.order.indexOf(s.id);if(r>a)return this.order.splice(a,1),this.order.splice(r,0,s.id),!0}return!1}orderEntities(){let s=!1;for(let e=0;e<this.order.length;e++){const t=this.order[e],r=this.flatRecord[t];if(this.moveEntityAfterDependencies(r)){s=!0;break}}s&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(s,e){const{upstream:t}=Wd(this.flatRecord[s],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),r={};return Object.entries(this.onGoingVisits[e]||{}).forEach(([a,d])=>{Object.keys(t).includes(a)&&(r[a]=d)}),r}getDownstreamOngoingDependenciesVisits(s,e){const t=Object.keys(this.onGoingVisits[e]||{}),r=new Set(t.flatMap(d=>Object.keys(Wd(this.flatRecord[d],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),a={};return Array.from(r).forEach(d=>{d===s&&(a[d]=this.onGoingVisits[e][d])}),a}async settlePromises(s,e){const t=Object.values(s);t.length&&await Promise.all(t),Object.keys(s).forEach(r=>{delete this.onGoingVisits[e][r]})}visit(s){const e=this.order;for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}reverseVisit(s){const e=this.order.slice().reverse();for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}async visitAsync(s){const e=this.order,t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getUpstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Lc(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}async reverseVisitAsync(s){const e=this.order.slice().reverse(),t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getDownstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Lc(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}}function bO(i,s){switch(i.id){case S["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const e=i.project.entities.filter(l=>!!l.implements.find(p=>p.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(e.find(l=>!!l.properties.find(p=>{var h;return p.implements&&p.implements.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=p.getDefaultValue())==null?void 0:h.value)===!0}))){const p=e[0].properties.find(c=>c.implements&&c.implements.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=p==null?void 0:p.defaultValue;if(h)h.value=!0;else if(p!=null&&p.dataType){const c={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:p==null?void 0:p.dataType.toReference()},v=w(c,i.project);return v.setParent(p==null?void 0:p.dataType,s),v.initChildren(s),s==null||s.add(v,b.Added),v.addSelfToProject(s),{newEntities:[v]}}return{newEntities:[]}}const r=i.project.get(S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),a=xd(r,"Main database",s);if(a.errors.length>0)return{newEntities:[]};const d=a.implemented.properties.find(l=>l.implements&&l.implements.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),o=d==null?void 0:d.defaultValue;if(o)o.value=!0;else if(d!=null&&d.dataType){const l={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},p=w(l,i.project);p.setParent(d==null?void 0:d.dataType,s),p.initChildren(s),s==null||s.add(p,b.Added),p.addSelfToProject(s)}return{newEntities:[a.implemented]}}}return{newEntities:[]}}function RO(i,s){return i.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{switch(t.id){case S["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=i.project.entities.filter(l=>l.implements.find(p=>p.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(l=>!!l.properties.find(p=>{var h;return p.implements&&p.implements.id===S["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=p.getDefaultValue())==null?void 0:h.value)===!0}));if(!a)return{newEntities:[]};const d=i.properties.find(l=>l.implements&&l.implements.id===S["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=d==null?void 0:d.defaultValue;if(d&&(d!=null&&d.dataType)&&!o){const l={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(s==null?void 0:s.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:g.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:a,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},p=w(l,i.project);return p.setParent(d==null?void 0:d.dataType,s),p.initChildren(s),s==null||s.add(p,b.Added),p.addSelfToProject(s),{newEntities:[p]}}return{newEntities:[]}}}}),{newEntities:[]}}function xd(i,s,e,t){const r=t||R.UUID.uuid(),a={id:r,version:R.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,name:s,type:n.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[i],x:0,y:0,parent:i.project},d=_d(a,i.project);if(d.length>0)return{errors:d,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const o=bO(i,e),l=w(a,i.project);l.setParent(i.project,e),l.initChildren(e),e==null||e.add(l,b.Added);const p=i.properties.map(v=>{const E=R.UUID.uuid(),O=v.clone(e,l,E);return O.abstract=!1,O.implements=v,e==null||e.add(O,b.Added),O.setParent(l,e),l.addProperty(O),O}),h=i.abstractMethods.map(v=>{const E=R.UUID.uuid(),O=v.asFunctionDeclarationTransfer(E),V={id:E+"-parent-ref-id",type:n.GenericReference,entityId:r,version:R.UUID.uuid(),entityType:n.DefinitionEntity},C={...O,implements:v,parent:V},U=w(C,i.project);return l.addMethod(U),U.setParent(l,e),U.initChildren(e),e==null||e.add(U,b.Added),U.implements=v,U});a.properties=p,a.methods=h;const c=RO(l,e);return{implemented:l,errors:[],entitiesChanges:{new:[l,...o.newEntities,...c.newEntities],updated:[l],deleted:[]}}}function Uc(i,s){return s.entities.find(r=>{const a=r.properties,d=a.map(c=>c.name),o=i.every(c=>d.includes(c)),l=d.filter(c=>!i.includes(c)),p=a.every(c=>!l.includes(c.name)||!c.required);return o&&p})||null}function AO(i,s,e,t=Rt.OrDataTypeGroup){const r=[],a=[],d=[],o=[],p={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:i.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:s.toReference()},h=w(p,i.project);return a.push(h),h.setParent(s,e),h.initChildren(e),e==null||e.add(h,b.Added),h.setEntity(i),h.addSelfToProject(e),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:h}}function $c(i,s,e,t,r){var p,h,c,v,E,O,V,C;const a=[],d=[],o=[],l=[];switch(typeof i){case"string":let U=!1;const F=new Date(i);if(F instanceof Date&&!isNaN(F.valueOf())&&(U=!0),U){const _=s.project.getBuiltIn(S[n.PrimitiveEntity][g.Date].id);s.setEntity(_);break}else{const _=s.project.getBuiltIn(S[n.PrimitiveEntity][g.String].id);s.setEntity(_);break}case"number":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Boolean].id));break;case"object":if(i===null){s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Null].id));break}else if(Array.isArray(i))if(s.metaSync({isList:!0},t),i.length>0){const _=i.slice(0,5).filter(k=>k!==void 0);if(_.every(k=>typeof k==typeof _[0])&&(typeof _[0]!="object"||_[0]===null))switch(typeof _[0]){case"string":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.String].id));break;case"number":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Boolean].id));break;case"object":s.setEntity(s.project.getBuiltIn(S[n.PrimitiveEntity][g.Null].id));break}else{const k=[];let W=!1;_.forEach(pe=>{var Te,K,se,Ht;if(Array.isArray(pe)&&(W=!0),typeof pe=="object"&&!Array.isArray(pe)&&pe!==null){const zr=kd(pe,s.project,{...e,id:R.UUID.uuid()},t,r);zr.hasCreated&&k.push((Te=zr.changeSet)==null?void 0:Te.self),a.push(...(K=zr.changeSet)==null?void 0:K.updated),d.push(...(se=zr.changeSet)==null?void 0:se.added),o.push(...(Ht=zr.changeSet)==null?void 0:Ht.removed)}});const ee=u(k);if(!ee.length&&!W){_.forEach(pe=>{const Te={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:Rt.OrDataTypeGroup,parent:s.toReference()},K=w(Te,s.project);switch(K.setParent(s,t),K.initChildren(t),t==null||t.add(K,b.Added),K.addSelfToProject(t),typeof pe){case"string":K.setEntity(K.project.getBuiltIn(S[n.PrimitiveEntity][g.String].id));break;case"number":K.setEntity(K.project.getBuiltIn(S[n.PrimitiveEntity][g.Number].id));break;case"boolean":K.setEntity(K.project.getBuiltIn(S[n.PrimitiveEntity][g.Boolean].id));break;case"object":K.setEntity(K.project.getBuiltIn(S[n.PrimitiveEntity][g.Null].id));break}});break}else ee.length===1&&!W?s.setEntity(ee[0]):_.forEach(pe=>{if(typeof pe=="object"&&!Array.isArray(pe)&&pe!==null){const Te=Uc(Object.keys(pe),s.project);if(Te){const K=AO(Te||ee[0],s,t,Rt.OrDataTypeGroup);a.push(...K.updated),d.push(...K.added),o.push(...K.removed)}}else{const Te={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:Array.isArray(pe),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:Rt.OrDataTypeGroup,parent:s.toReference()},K=w(Te,s.project);K.setParent(s,t),K.initChildren(t),t==null||t.add(K,b.Added),K.addSelfToProject(t);const se=$c(pe,K,{...e,id:R.UUID.uuid()},t,r);a.push(...se.updated),d.push(...se.added),o.push(...se.removed)}})}}else{const _=kd(i[0],s.project,{...e},t,r);s.setEntity((p=_.changeSet)==null?void 0:p.self),a.push(...(h=_.changeSet)==null?void 0:h.updated),d.push(...(c=_.changeSet)==null?void 0:c.added),o.push(...(v=_.changeSet)==null?void 0:v.removed);break}else{const _=kd(i,s.project,{...e},t,r);s.setEntity((E=_.changeSet)==null?void 0:E.self),a.push(...(O=_.changeSet)==null?void 0:O.updated),d.push(...(V=_.changeSet)==null?void 0:V.added),o.push(...(C=_.changeSet)==null?void 0:C.removed);break}}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:s}}function kd(i,s,e,t,r){const a=[],d=[],o=[],l=[],p=Object.keys(i),h=Uc(p,s);if(h)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:h}};const c=r?e.name+" of "+r.name:e.name,E={id:e.id||R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,name:c,type:n.DefinitionEntity,description:e.description||null,static:e.static||!1,abstract:e.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:s.toReference()},O=w(E,s);return O.setParent(s,t),O.initChildren(t),t==null||t.add(O,b.Added),O.addSelfToProject(t),d.push(O),p.forEach((V,C)=>{const F={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,name:V,type:n.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:C,hidden:!1,private:!1,required:!0,parent:O.toReference()},_=w(F,s);_.setParent(O,t),_.initChildren(t),t==null||t.add(_,b.Added),_.addSelfToProject(t),d.push(_);const j=i[V],W={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:_.toReference()},ee=w(W,s);ee.setParent(_,t),ee.initChildren(t),t==null||t.add(ee,b.Added),ee.addSelfToProject(t),d.push(ee);const pe=$c(j,ee,{...e,name:V,id:R.UUID.uuid()},t,r||O);a.push(...pe.updated),d.push(...pe.added),o.push(...pe.removed)}),{hasCreated:!0,changeSet:{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:O}}}function Zd(i,s){const e=Mn(i);if(e.length===0)return{list:[],last:null};let t=null;return{list:e.flatMap(a=>{if(a===s)return t=a,[a];const d=Zd(a,s);return d.last&&(t=d.last),[a,...d.list]}),last:t}}function DO(i,s,e=new Set){const t=Ji(i),r=Ji(s),a=t.filter(l=>!r.includes(l)),d=t.filter(l=>r.includes(l)),o=a.reduce((l,p)=>e.has(p.id)?l:(e.add(p.id),u([...l,...DO(p,s,e)])),[]);return u([...d,...o])}function Vs(i,s){const e=Zd(i,s);return e.last===s&&e.list.length>0&&e.list[0]!==s}function Lq(i,s){return!!Zd(i,s).last}function Uq(i){if(at.includes(i.type))return i;if([...Cr,n.VariableDeclaration].includes(i.type)){const s=i.parent;return at.includes(s.type)?s:null}return null}function jc(i,s){if(!i||!s)throw new Error("Both entities must be defined to find a common ancestor");if(i===s)return i;const e=i.parent;if(e){if(e===s)return s;if(e.type===n.Project)return null}else return null;const t=s.parent;if(t){if(t===i)return i;if(t.type===n.Project)return null}else return null;return jc(e,t)}function wt(i){if(Gs.includes(i.type)){if(i.type===n.FunctionDeclaration){const s=i.parent;if(s.type===n.DefinitionEntity)return s;if(s.type===n.Loop)return s}return i}else{const s=i.parent;return s?wt(s):null}}function qd(i,s){const e=Cs(i,s);if(!e)return null;if(Gs.includes(e.type)){if(e.type===n.FunctionDeclaration){const t=Cs(e.parent,s);if(t){if(t.type===n.DefinitionEntity)return t;if(t.type===n.Loop)return t}}return e}else{const t=e.parent?Cs(e.parent,s):null;return t?qd(t,s):null}}function OO(i){if(!i)return null;if(Cr.includes(i.type))return i;const s=i.parent;return s?OO(s):null}function PO(i){if(!i)return null;if(nt.includes(i.type))return i;const s=i.parent;return s?PO(s):null}function wO(i){if(!i)return null;if(Br.includes(i.type))return i;const s=i.parent;return s?wO(s):null}function $q(i){return i.type===n.VariableDeclaration?[i]:nt.includes(i.type)?[...i.inputs,...i.outputs||[]]:st.includes(i.type)?i.outputs:$n.includes(i.type)||i.type===n.FunctionDeclaration?i.inputs:[]}function jq(i){const s=Ji(i),e=[],t=[];ef.includes(i.type)&&e.push(...Gc(i));const r=s.filter(a=>{const d=e.includes(a);return d?!1:Cr.includes(a.type)&&!d?(t.push(a),!1):!0});return e.sort((a,d)=>Vs(d,a)?-1:0),t.sort((a,d)=>Vs(d,a)?-1:0),[...e,...t,...r]}function VO(i){return[...i].sort((s,e)=>Vs(e,s)?-1:0)}function Gq(i){const s=VO(i),e=[];return s.forEach(t=>{const r=e[e.length-1];if(r){const a=r[r.length-1];Vs(t,a)?e.push([t]):r.push(t)}else e.push([t])}),e}function Yt(i){const s=i.map(e=>wt(e));return u(s)}function Gc(i){return nt.includes(i.type)?[...Yt(i.successCalls),...Yt(i.errorCalls)]:at.includes(i.type)?Yt(i.calls):[]}function Fq(i,s){return Gc(i).includes(s)}function Fc(i){return i.writesValues||[]}function Sq(i,s){return Fc(i).includes(s)}function CO(i){var s;return Qe.includes((s=i==null?void 0:i.readsValue)==null?void 0:s.type)?i.readsValue:null}function xq(i){return i.writesValues}function BO(i=[]){return i.map(CO).filter(s=>!!s)}function Jd(i=[]){return i.map(s=>s.writesValues).flat().filter(s=>Qe.includes(s.type))}function _O(i=[]){return i.map(s=>s.readsValue).filter(s=>!!s&&Qe.includes(s.type))}function MO(i){return Qe.includes(i.type)?i:null}function gO(i){return i.writesValues.map(MO).filter(s=>!!s)}function NO(i=[]){return i.reduce((s,e)=>e.type===n.OutputMap?[...s,...gO(e)]:s,[])}function it(i){return nt.includes(i.type)?[...Wr(Yt(i.successCalls)),...Wr(Yt(i.errorCalls))]:at.includes(i.type)?Wr(Yt(i.calls)):[]}function kq(i){return nt.includes(i.type)?[...Wr(Yt(i.successCalls)),...Wr(Yt(i.errorCalls))]:at.includes(i.type)?Wr(Yt(i.calls)):[]}function LO(i,s=new Set){return i.writesValues.filter(t=>Qe.includes(t.type)&&!s.has(t.id)).reduce((t,r)=>s.has(r.id)?t:[...t,...We(r,s)],[])}function UO(i,s=new Set){var t;return(((t=i.readsValue)==null?void 0:t.writesValues)||[]).filter(r=>Qe.includes(r.type)&&!s.has(r.id)).reduce((r,a)=>s.has(a.id)?r:[...r,...We(a,s)],[])}function We(i,s=new Set){if(s.has(i.id))return[];if(i.type===n.ReturnStatement)return _O(i.outputs).reduce((t,r)=>[...t,...We(r,s)],[]);if(i.type===n.FunctionCall||i.type===n.Operation||i.type===n.Condition)return[...it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]),...BO(i.inputs),...NO(i.outputs)].reduce((a,d)=>[...a,...We(d,s)],[]);if($n.includes(i.type)){const e=Jd(i.inputs),r=it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d,s)],[])}if(i.type===n.FunctionDeclaration){const e=[...Jd(i.inputs)],r=it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d)],[])}if(Qe.includes(i.type)){s.add(i.id);const t=it(i).reduce((r,a)=>{const d=wt(a);return[...r,...We(d||a,s)]},[]);return[i,...t,...UO(i,s),...LO(i,s)]}return[]}function ir(i,s=new Set){return s.has(i.id)?[]:(s.add(i.id),[...Ji(i).reduce((r,a)=>[...r,a,...ir(a,s)],[])])}function Wr(i){return i.reduce((s,e)=>e.type===n.ReturnStatement||e.type===n.ContinueStatement||e.type===n.BreakStatement?[...s,e]:[...s,e,...it(e)],[])}function $O(i){const s=i.entities||[],e=[...s,...i.functions||[],...i.events||[],...i.projects||[]],t=s.reduce((l,p)=>[...l,...p.properties],[]),r=s.reduce((l,p)=>[...l,...p.methods],[]),a=r.reduce((l,p)=>[...l,...Jd(p.inputs),...Wr(Yt(p.calls)),...p.returnStatements],[]),d=i.functions.reduce((l,p)=>[...l,...Wr(Yt(p.calls)),...p.returnStatements],[]),o=i.events.reduce((l,p)=>[...l,...Wr(Yt(p.calls)),...p.returnStatements],[]);return[...e,...t,...r,...a,...d,...o]}function jO(i,s){return s.filter(t=>{if(!t)return!1;switch(t.type){case n.FunctionCall:return t.inputs.find(r=>r.id===i.id)!==void 0||t.outputs.find(r=>r.id===i.id)!==void 0;case n.Condition:return t.successCalls.find(r=>r.id===i.id)!==void 0||t.errorCalls.find(r=>r.id===i.id)!==void 0||t.inputs.find(r=>r.id===i.id)!==void 0;case n.Operation:return t.outputs.find(r=>r.id===i.id)!==void 0;case n.VariableDeclaration:return nt.includes(i.type)?cP(i).find(a=>{var d;return((d=a.readsValue)==null?void 0:d.id)===t.id})!==void 0:!1;case n.DefinitionEntity:return t.properties.find(r=>r.id===i.id)!==void 0||t.methods.find(r=>r.id===i.id)!==void 0;case n.FunctionDeclaration:return t.inputs.find(r=>r.id===i.id)!==void 0||(t.returnStatements.map(r=>r.outputs).flat()||[]).find(r=>r.id===i.id)!==void 0;default:return!1}})}function Zq(i){const s=$O(i.project);return jO(i,s)}function Cs(i,s){return i?typeof i=="string"?s[i]:i.type===n.GenericReference?s[i.entityId]:s[i.id]?s[i.id]:null:null}function Wd(i,s={},e={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[]}){if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||(e.allBuiltInEntityIds||[]).includes(i.id)))return{upstream:{},downstream:{}};const t=i,r=i,a=i,d=i,o=i,l=i,p=i,h=i,c=i,v=i,E=i,O=i,V=i,C=[...V.readsValue?[V.readsValue]:[],...V.declaration?[V.declaration]:[],...(O.calledByEntry||[]).flatMap(j=>j),...(O.calledBySuccess||[]).flatMap(j=>j),...(O.calledByError||[]).flatMap(j=>j),...(a.extends||[]).flatMap(j=>j),...v.parent?[v.parent]:[]];Array.isArray(a.implements)?C.push(...a.implements.flatMap(j=>j)):c.implements&&C.push(c.implements),o.valueAsTypeList&&Array.isArray(o.valueAsTypeList)&&C.push(...o.valueAsTypeList.flatMap(j=>j)),o.valueAsTypeSingle&&C.push(o.valueAsTypeSingle);const U=[...(t.inputs||[]).flatMap(j=>j),...(E.inputsDeclarations||[]).flatMap(j=>j),...(t.outputs||[]).flatMap(j=>j),...(E.outputsDeclarations||[]).flatMap(j=>j),...(V.internalCalls||[]).flatMap(j=>j),...V.writesValues||[],...O.dataType?[O.dataType]:[],...l.body?[l.body]:[],...O.defaultValue?[O.defaultValue]:[],...(O.successCalls||[]).flatMap(j=>j),...(O.errorCalls||[]).flatMap(j=>j),...(a.properties||[]).flatMap(j=>j),...(a.methods||[]).flatMap(j=>j),...(a.abstractMethods||[]).flatMap(j=>j),...p.error?[p.error]:[],...p.process?[p.process]:[],...v.throws?[v.throws]:[],...(r.andChildrenGroup||[]).flatMap(j=>j),...(r.orChildrenGroup||[]).flatMap(j=>j),...(h.entities||[]).flatMap(j=>j),...(h.functions||[]).flatMap(j=>j),...(h.functionCalls||[]).flatMap(j=>j),...(h.events||[]).flatMap(j=>j),...(h.conditions||[]).flatMap(j=>j),...(h.operations||[]).flatMap(j=>j),...(h.loops||[]).flatMap(j=>j),...(h.variableDeclarations||[]).flatMap(j=>j),...(h.variableInstances||[]).flatMap(j=>j),...(h.searches||[]).flatMap(j=>j),...(h.projects||[]).flatMap(j=>j),...(d.calls||[]).flatMap(j=>j)];i.type===n.DataType&&(r.entity&&s[B(r.entity)]&&s[B(r.entity)].parent&&B(s[B(r.entity)].parent)===i.id?U.push(r.entity):r.entity&&C.push(r.entity));const F={},_={};return C.forEach(j=>{const k=B(j);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes(j.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const W=j.version;k&&(F[k]=W)}),U.forEach(j=>{const k=B(j);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes(j.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const W=j.version;k&&(_[k]=W)}),{upstream:F,downstream:_}}function qq(i,s){const e=[];if(Cr.includes(i.type)){fr(i).forEach(a=>{const d=qd(a,s);d&&e.push(d)});const r=[...i.inputs||[],...i.outputs||[]].map(a=>{const d=Cs(a,s);return d?yP(d,s):null}).filter(a=>a!==null);e.push(...u(r))}if(Qe.includes(i.type)){const t=Yd(i);t&&e.push(t)}return u(e)}function Mn(i){const s=[];if(Cr.includes(i.type)){i.calledBy.forEach(r=>{const a=wt(r);a&&s.push(a)});const t=[...i.inputs||[],...i.outputs||[]].map(r=>Yd(r)).filter(r=>r!==null);s.push(...u(t))}if(Qe.includes(i.type)){const e=Yd(i);e&&s.push(e)}return u(s)}function fr(i){return[...i.calledByEntry||[],...i.calledByError||[],...i.calledBySuccess||[]].filter(s=>s.type!==n.GenericReference)}function GO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[i,...i.inputs.flatMap(t=>N(t,s,e)),...i.outputs.flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.parent?N(i.parent,s,e):[]]}function FO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s):[],...i.writesValues.flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function SO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function xO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...(i.extends||[]).flatMap(t=>N(t,s,e))]}function kO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Condition)throw new Error("Entity must be a condition to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function ZO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function qO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[i,...(i.extends||[]).flatMap(t=>N(t,s,e)),...(i.implements||[]).flatMap(t=>N(t,s,e)),...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function JO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DataType)throw new Error("Entity must be a data type to be flattened");return[i,...(i.andChildrenGroup||[]).flatMap(t=>N(t,s,e)),...(i.orChildrenGroup||[]).flatMap(t=>N(t,s,e)),...i.entity?N(i.entity,s,e):[],...i.parent?N(i.parent,s,e):[]]}function WO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function YO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function zO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function HO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InputMap)throw new Error("Entity must be an input map to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function KO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[i,...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function XO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.parent?N(i.parent,s,e):[]]}function QO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[i,...i.valueAsTypeSingle?N(i.valueAsTypeSingle,s,e):[],...i.valueAsTypeList&&Array.isArray(i.valueAsTypeList)?i.valueAsTypeList.flatMap(t=>N(t,s,e)):[],...i.parent?N(i.parent,s,e):[]]}function eP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Loop)throw new Error("Entity must be a loop to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.body?N(i.body,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function tP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Operation)throw new Error("Entity must be an operation to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function rP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.OutputMap)throw new Error("Entity must be an output map to be flattened");return[i,...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function iP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e))]}function nP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Project)throw new Error("Entity must be a project to be flattened");return[i,...(i.entities||[]).flatMap(t=>N(t,s,e)),...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.variableDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.variableInstances||[]).flatMap(t=>N(t,s,e)),...(i.operations||[]).flatMap(t=>N(t,s,e)),...(i.conditions||[]).flatMap(t=>N(t,s,e)),...(i.functionCalls||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.loops||[]).flatMap(t=>N(t,s,e)),...(i.searches||[]).flatMap(t=>N(t,s,e))]}function aP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Property)throw new Error("Entity must be a property to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function sP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function oP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[i,...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function dP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Search)throw new Error("Entity must be a search to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function lP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function uP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function pP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(fr(i)||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.parent?N(i.parent,s,e):[]]}function Vr(){const i=new Set,s=eI.flatMap(e=>N(e,i)).map(e=>e.id);if(!s.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return s}function N(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(!i)throw new Error("Entity must be defined to be flattened");if(i.type===n.GenericReference)return[];if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||Vr().includes(i.id)))return[];if(s.has(i.id))return[];switch(i.type){case n.FunctionCall:return WO(i,s,e);case n.Operation:return tP(i,s,e);case n.Condition:return kO(i,s,e);case n.Loop:return eP(i,s,e);case n.Search:return dP(i,s,e);case n.GlobalEvent:return zO(i,s,e);case n.ReturnStatement:return oP(i,s,e);case n.ContinueStatement:return ZO(i,s,e);case n.BreakStatement:return SO(i,s,e);case n.VariableDeclaration:return uP(i,s,e);case n.DefinitionEntity:return qO(i,s,e);case n.FunctionDeclaration:return YO(i,s,e);case n.Project:return nP(i,s,e);case n.ActionDescriptor:return GO(i,s,e);case n.ArgumentDeclaration:return FO(i,s,e);case n.ReturnDeclaration:return sP(i,s,e);case n.ValueDescriptor:return lP(i,s,e);case n.InputMap:return HO(i,s,e);case n.OutputMap:return rP(i,s,e);case n.DataType:return JO(i,s,e);case n.InstalledProject:return KO(i,s,e);case n.InternalCall:return XO(i,s,e);case n.LiteralValue:return QO(i,s,e);case n.Property:return aP(i,s,e);case n.VariableInstance:return pP(i,s,e);case n.BuiltInBaseEntity:return e.ignoreBuiltInBaseEntities?[]:xO(i,s,e);case n.PrimitiveEntity:return e.ignoreBuiltInBaseEntities?[]:iP(i,s,e)}return[]}function Sc(i){return i.type===n.FunctionCall||i.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.inputs:i.type===n.FunctionDeclaration||$n.includes(i.type)?i.inputs:i.type===n.Search?i.inputsDeclarations:[]}function Jq(i,s){return s.type===n.Condition?s.inputs.find(e=>e.declaration.id===i.id):s.type===n.FunctionCall||s.type===n.Operation?s.inputs.find(e=>e.declaration.id===i.id):null}function cP(i){return nt.includes(i.type)?i.inputs:[]}function fP(i){var s;return i.type===n.FunctionCall?((s=i.declaration.returnStatements[0])==null?void 0:s.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.outputs:i.type===n.Search?i.outputsDeclarations:st.includes(i.type)?i.outputs:[]}function Wq(i,s){return s.type===n.Condition?null:s.type===n.FunctionCall||s.type===n.Operation?s.outputs.find(e=>e.declaration.id===i.id):null}function Yq(i){return i.type===n.Condition?[]:nt.includes(i.type)?i.outputs:[]}function Yd(i){const s=i.readsValue;return s?wt(s):null}function yP(i,s){const e=i.readsValue;return e?qd(e,s):null}function hP(i){const s=i.internalCalls||[];return u(Yt(u(s.flatMap(e=>[...e.successCalls,...e.errorCalls]))))}function Ra(i){const s=Fc(i),e=[];return s.forEach(t=>{if(Qe.includes(t.type))e.push(t);else if(hi.includes(t.type)){const r=t.parent;e.push(r)}}),e}function u(i){const s=new Set;return i.filter(e=>!e||s.has(e.id)?!1:(s.add(e.id),!0))}function Ji(i,s=!1){const e=[];if(i.type===n.Project&&e.push(...(i==null?void 0:i.entities)||[],...(i==null?void 0:i.functions)||[],...(i==null?void 0:i.variableDeclarations)||[],...(i==null?void 0:i.variableInstances)||[],...(i==null?void 0:i.searches)||[],...(i==null?void 0:i.loops)||[],...(i==null?void 0:i.operations)||[],...(i==null?void 0:i.conditions)||[],...(i==null?void 0:i.functionCalls)||[],...(i==null?void 0:i.events)||[],...(i==null?void 0:i.projects)||[]),mt.includes(i.type)&&e.push(...(i==null?void 0:i.detachedChildren)||[]),i.type===n.DefinitionEntity){const t=[...i.suggestedMethods,...i.methods].flatMap(r=>r.collapsed&&s?[]:Ji(r));e.push(...t)}if(i.type===n.Condition){const t=i.successCalls.map(a=>wt(a)),r=i.errorCalls.map(a=>wt(a));e.push(...t,...r)}if($n.includes(i.type)){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>Ra(a)).flat(),r=i.calls.map(a=>wt(a));e.push(...u(t),...r)}if(nt.includes(i.type)&&i.type!==n.Condition&&i.type!==n.Loop){const t=i==null?void 0:i.outputs.map(d=>Ra(d)).flat(),r=i.successCalls.map(d=>wt(d)),a=i.errorCalls.map(d=>wt(d));e.push(...u(t),...r,...a)}if(Qe.includes(i.type)){const t=Ra(i),r=hP(i);e.push(...t,...r)}if(i.type===n.Loop){const t=i.outputs.map(d=>Ra(d)).flat();if(i.body){const d=Ji(i.body,s);e.push(...d)}const r=i.errorCalls.map(d=>wt(d)),a=i.successCalls.map(d=>wt(d));e.push(...u(t),...a,...r)}if(i.type===n.FunctionDeclaration){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>Ra(a)).flat(),r=i.calls.map(a=>wt(a));e.push(...u(t),...r)}return u(e)}function mP(i,s=!1){const e=Ji(i,s),t=[...e,...e.reduce((r,a)=>[...r,...mP(a,s)],[])];return u(t)}function vP(i){const s=Mn(i),e=[...s,...s.reduce((t,r)=>[...t,...vP(r)],[])];return u(e)}function zd(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...zd(e),...Hd(e)]:[...s,e.name],[])}function Hd(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...Hd(e),...zd(e)]:[...s,e.name],[])}function xc(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...xc(e),...kc(e)]:[...s,e],[])}function kc(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...kc(e),...xc(e)]:[...s,e],[])}function Zc(i){return[...Hd(i),...zd(i)].filter((e,t,r)=>r.indexOf(e)===t)}function TP(i){return i.implements.length===0&&i.extends.length===0?null:i.implements.find(t=>t.type===n.BuiltInBaseEntity&&t.name===z.PERSISTED_ENTITY)?i:[...i.implements,...i.extends].reduce((t,r)=>{if(r.type===n.DefinitionEntity){const a=TP(r);if(a)return a}return t},null)}function zq(i){const s=i.extends.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function Hq(i){const s=i.implements.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function qc(i){const s=i.extends.find(e=>e.type===n.DefinitionEntity);return s&&s.type===n.DefinitionEntity?s:null}function Wi(i){const s=[...i.implements,...i.extends].reduce((e,t)=>t.type===n.BuiltInBaseEntity?[...e,t]:t.type===n.DefinitionEntity?[...e,...Wi(t)]:e,[]);return u(s)}function Jc(i){return i.type===n.PrimitiveEntity?!0:i.type===n.BuiltInBaseEntity?i.interactive:!Wi(i).find(t=>!t.interactive)}function Kq(i){return i.parent===i.project&&i.project.variableDeclarations.includes(i)}function Wc(i){return i.parent!==i.project?!1:n.VariableDeclaration===i.type?i.project.variableDeclarations.includes(i):n.VariableInstance===i.type?i.project.variableInstances.includes(i):n.FunctionCall===i.type?i.project.functionCalls.includes(i):n.Condition===i.type?i.project.conditions.includes(i):n.Operation===i.type?i.project.operations.includes(i):n.Loop===i.type?i.project.loops.includes(i):n.Search===i.type?i.project.searches.includes(i):!1}function EP(i){if([...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||Wc(i))return!1;const s=Mn(i);return s.length===0?!0:s.some(e=>EP(e))}function Yc(i){return[...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||Wc(i)?!1:Mn(i).length===0}function IP(i,s=0){if(Yc(i)){const e=Mn(i);return e.length===0?i:e.map(r=>IP(r,s+1)).reduce((r,a)=>r?a&&a.x<r.x?a:r:a,null)}return null}function bP(i){const s=[];if(Yc(i))s.push(i);else return[];return Mn(i).forEach(t=>{s.push(...bP(t))}),s}function RP(i){return i.type===n.FunctionDeclaration&&i.parent!==i.project&&!![n.DefinitionEntity,n.Loop,n.InstalledProject].includes(i.parent.type)}function Xq(i,s){const e=new Map;return i.forEach(t=>{e.set(t.id,t)}),s.forEach(t=>{e.set(t.id,t)}),Array.from(e.values())}function Bs(i){switch(i){case n.DefinitionEntity:return zi;case n.FunctionDeclaration:return Mi;case n.VariableDeclaration:return $i;case n.VariableInstance:return Ui;case n.FunctionCall:return qi;case n.Operation:return gi;case n.Condition:return Li;case n.ReturnStatement:return _i;case n.Loop:return Ni;case n.Search:return ji;case n.InputMap:return Zr;case n.OutputMap:return qr;case n.ArgumentDeclaration:return Fi;case n.ReturnDeclaration:return rr;case n.Property:return Bi;case n.InstalledProject:return Gi;case n.Project:return R;case n.BuiltInBaseEntity:return Yr;default:return null}}function zt(i,s){if(mt.includes(i.type))return i;if(hr.includes(i.type))return null;const e=i.parent;if(!e)return null;if(e.type===n.GenericReference){const t=B(e);if(!t)return null;const r=s.get(t);return r?zt(r,s):null}else return e===s?s:zt(e,s)}function zc(i,s){if(hr.includes(i.type)||s.getBuiltIn(i.id))return null;const e=nr(i.parent,s);return e?e===s?mt.includes(i.type)?i:null:e.type===n.DefinitionEntity?i:zc(e,s):null}function Kd(i,s,e){if(i===s||s===e||i===e)return!1;const t=zt(s.parent,e);return t===i?!0:Kd(t,s,e)}var Xd=(i=>(i.SameBothLocal="same-both-local",i.AInB="a-in-b",i.BInA="b-in-a",i.ParallelInCommonParent="parallel-in-common-parent",i.ParallelInProject="parallel-in-project",i.AIsGlobalBIsNot="a-is-global-b-is-not",i.BIsGlobalAIsNot="b-is-global-a-is-not",i.SameBothGlobal="same-both-global",i))(Xd||{});function _s(i,s,e){const t=zt(i,e),r=zt(s,e);if(!t)throw new Error("Could not find scope owner for the entity: "+i.id);if(!r)throw new Error("Could not find scope owner for the entity: "+s.id);if(t===r&&t.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:t};if(t===r&&t.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:t};if(t.type===n.Project&&r.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:t};if(t.type!==n.Project&&r.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:r};if(Kd(t,r,e))return{compatible:!0,type:"b-in-a",commonAncestorScope:t};if(Kd(r,t,e))return{compatible:!0,type:"a-in-b",commonAncestorScope:r};const o=jc(t,r);return o===e?{compatible:!1,type:"parallel-in-project",commonAncestorScope:o}:o?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:zt(o,e)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:e}}function AP(i,s,e){const t=_s(i,s,e);if(!t.compatible||t.type!=="same-both-local")return null;if(i===s)return i;let r=zt(i.parent,e);if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;for(;r;){if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;r=zt(r.parent,e)}let a=zt(s.parent,e);if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;for(;a;){if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;a=zt(a.parent,e)}return null}function DP(i){return i.length===0?null:i.length===1?i[0]:i.reduce((e,t)=>{const r=AP(e,t,t.project);return!r||r===t?e:t},i[0])}function nr(i,s){if(!i)return null;let e;return typeof i=="string"?e=i:i.type===n.GenericReference?e=B(i):e=i.id,e===s.id?s:s.get(e)}function Yi(i){if(!i)return null;if(hr.includes(i.type))return i;if(i.type===n.Project)return null;if(i.project.getBuiltIn(i.id))return i;const s=i.parent;return!s||s.type===n.Project?null:Yi(s)}function Qq(i,s){var e;if(i.readsValue){const t=nr(i.readsValue,s.project);s.setValueWriter(t),t.addValueReader(s)}else i.readsValue===null&&((e=s.readsValue)==null||e.removeValueReader(s),s.readsValue=null);return s}function Ms(i){const s=[];function e(a,d){return s.some(o=>o.blockedByCaller===a&&o.blockedByCalling===d)}function t(a,d){e(a,d)||s.push({blockedByCaller:a,blockedByCalling:d})}const r=zc(i,i.project);return i.calledBySuccess.forEach(a=>{[...a.successCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=Ms(o);l.reachable||it(i).find(c=>c===a)||l.blocks.forEach(c=>{t(a,c.blockedByCalling)})}}),i.calledByError.forEach(a=>{[...a.errorCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=Ms(o);l.reachable||it(i).find(c=>c===a)||l.blocks.forEach(c=>{t(a,c.blockedByCalling)})}}),i.calledByEntry.forEach(a=>{if([...a.calls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(c=>c===l)||t(a,l))}),a===r)return;let o;if(a.type===n.FunctionDeclaration){const l=wt(a);if(l.type===n.DefinitionEntity)return;l.type===n.Loop&&(o=l)}if(o){const l=Ms(o);l.reachable||l.blocks.forEach(p=>{t(a,p.blockedByCalling)})}}),{reachable:s.length===0,entryPoint:r,blocks:s}}function eJ(i){return Gs.includes(i.type)?i.type===n.FunctionDeclaration?!RP(i):!0:!1}function tJ(i){if(n.ActionDescriptor===i.type){if(i.project.operationDeclarations.find(a=>a.id===i.id))return n.Operation;if(i.project.globalEventActionDescriptors.find(a=>a.id===i.id))return n.GlobalEvent;if(i.project.loopDeclarations.find(a=>a.id===i.id))return n.Loop;if(i.project.conditionDeclarations.find(a=>a.id===i.id))return n.Condition}return i.type}function Aa(i,s){if(i.type!==n.DefinitionEntity||i.abstract)return!1;const e=qc(i)||i;return!!Zc(e).includes(s)}function rJ(i){const s=[];return i.entities.forEach(e=>{if(Aa(e,z.PERSISTED_ENTITY)){s.push(e);return}}),u(s)}function iJ(i){const s=[];return i.entities.forEach(e=>{if(Aa(e,z.RELATIONAL_DATABASE)){s.push(e);return}}),u(s)}function nJ(i){return i.type!==n.DefinitionEntity||i.abstract||!Aa(i,z.PERSISTED_ENTITY)?null:(i==null?void 0:i.properties.find(e=>{var t;return((t=e.implements)==null?void 0:t.id)===S[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.primaryKey.id&&!e.abstract}))||null}function aJ(i){if(i.type!==n.DefinitionEntity)return[];if(i.abstract)return[];if(!Aa(i,z.PERSISTED_ENTITY))return[];const s=[],e=i.properties.filter(t=>{var r;return((r=t.implements)==null?void 0:r.id)!==S[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id&&!t.abstract});return s.push(...e),s}function sJ(i){var e;if(!i||i.type!==n.DefinitionEntity||!Aa(i,z.PERSISTED_ENTITY))return null;const s=i.properties.find(t=>{var r;return((r=t.implements)==null?void 0:r.id)===S[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id});return(e=s==null?void 0:s.getDefaultValue())==null?void 0:e.valueAsTypeSingle}function ft(i,s){var t;if(!rf.includes(s.type)||!i)return s.project||null;let e=s.project;return i.type===n.Project?e=i:((t=s.project)==null?void 0:t.id)!==i.project.id&&(e=i.project),e}function oJ(i){switch(i){case n.Project:return R;case n.InstalledProject:return Gi;case n.DefinitionEntity:return zi;case n.FunctionDeclaration:return Mi;case n.GlobalEvent:return Vn;case n.VariableInstance:return Ui;case n.VariableDeclaration:return $i;case n.InputMap:return Zr;case n.OutputMap:return qr;case n.Condition:return Li;case n.Operation:return gi;case n.FunctionCall:return qi;case n.ReturnDeclaration:return rr;case n.ArgumentDeclaration:return Fi;case n.PrimitiveEntity:return ar;case n.DataType:return wn;case n.Property:return Bi;case n.ActionDescriptor:return qe;case n.ReturnStatement:return _i;case n.ContinueStatement:return jt;case n.BreakStatement:return Cn;case n.Loop:return Ni;case n.Search:return ji;case n.ValueDescriptor:return Si;case n.InternalCall:return Bn;case n.LiteralValue:return _n}return null}function dJ(i){const s={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:i==null?void 0:i.self};return i==null||i.added.forEach(e=>{s.added[e.id]=e}),i==null||i.updated.forEach(e=>{s.updated[e.id]=e}),i==null||i.removed.forEach(e=>{s.removed[e.id]=e}),s.affected=Array.from(new Set(i==null?void 0:i.affected.map(e=>e.id))),s}function dt(i,s){const e=Bs(i.type);return e?!e.MUTABLE_META_PROPERTIES.every(r=>{const a=i[r],d=s[r];return d===void 0||a===d?!0:Array.isArray(a)&&Array.isArray(d)?a.length!==d.length?!1:a.every((o,l)=>o===d[l]):!1}):!1}function Qd(i,s={}){if(i.type===n.Project)return[];if(!i.parent)return[];const e=B(i.parent);if(!e)return[];const t=s[e];return t?[t.id,...Qd(t,s)]:[]}function lJ(i,s){const e=[];if(i.parent)if(i.id===i.parent)e.push(new P({id:`${i.id}--${i.parent}--${I.SelfReference}`,code:I.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const t=s.get(i.parent);t?[n.Project,n.DataType].includes(t.type)||e.push(new P({id:`${i.id}--${i.parent}--${I.InvalidParentReference}`,code:I.InvalidParentReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):e.push(new P({id:`${i.id}--${i.parent}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return i.implements&&Array.isArray(i.implements)?i.implements.forEach(t=>{if(i.id===t){e.push(new P({id:`${i.id}--${t}--${I.SelfReference}`,code:I.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract||e.push(new P({id:`${i.id}--${t}--${I.InvalidImplementsReference}`,code:I.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${I.InvalidImplementsReference}`,code:I.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):e.push(new P({id:`${i.id}--${$.InvalidObjectStructure}`,code:$.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' property that isn't an array.`,issue:null})),i.extends&&Array.isArray(i.extends)&&i.extends.forEach(t=>{const r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract&&e.push(new P({id:`${i.id}--${t}--${I.InvalidExtendsReference}`,code:I.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):e.push(new P({id:`${i.id}--${t}--${I.InvalidExtendsReference}`,code:I.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${i.id}--${t}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),e}var OP=(i=>(i.Extends="extends",i.Implements="implements",i))(OP||{});const Le=class Le extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"x");f(this,"y");f(this,"static");f(this,"abstract");f(this,"type",n.DefinitionEntity);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"implements",[]);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestedProperties",[]);f(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let r=t;if(e.parent){const p=B(e.parent);r=t.get(p)}const a=[];e.implements&&e.implements.forEach(p=>{a.push(t.get(p)||t.getBuiltIn(p))});const d=[];e.extends&&e.extends.forEach(p=>{d.push(t.get(p)||t.getBuiltIn(p))});const o={id:e.id,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:e.name,type:n.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:d,implements:a,x:0,y:0,parent:r},l=w(o,t);return l.setParent(r,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[],d=lJ(r,t),o=_d(r,t);a.push(...d,...o,...ot(r));const l=r.parent?t.get(r.parent):null;if(l&&l.type===n.DataType){const p=l;p.entity&&a.push(new P({id:`${e.id}--${I.NewEntityWouldOverriteExisting}`,code:I.NewEntityWouldOverriteExisting,severity:D.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${p.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
406
406
  You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
407
407
  ${Jr({describe_entity:p.entity.id})}
408
- Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return u([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])].filter(e=>!!e.abstract))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${I.InvalidParentUpdate}`,code:I.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const p=new Map;for(const[h,c]of this.knownVersions||new Map){if(p.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)p.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const p=await this.APILoadVersion({},e);if(!p)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(p,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:p,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...p),d.push(...h);const{updated:c,added:v,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),r.push(...v),a.push(...E),d.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>w(t,this.project)),this.implements=this.initialData.implements.map(t=>w(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,p=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(c=>!p.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(V=>{var C;return((C=V.implements)==null?void 0:C.id)===c.id}))return;const E=this.properties.find(V=>V.name===c.name&&!!V.abstract&&!V.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,R.UUID.uuid());O.initChildren(e),r.push(O),e==null||e.add(O,b.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,p=l.filter(c=>l.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return p.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const v=c.clone(e,this,R.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{$5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=w(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),j5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.asFunctionDeclarationTransfer(d),l=w(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),l.inputs.forEach(p=>{p.suggestion=!0}),l.returnStatements.length){const p=l.returnStatements[0];p.suggestion=!0,p.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:p,removed:h,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...p),a.push(...h),d.push(...c)}),this.properties.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.methods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:R.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(p=>p.toJSONClone({...e,newId:null})),methods:this.methods.map(p=>p.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(p=>p.toJSONClone({...e,newId:null})),implements:this.implements.map(p=>p.type===n.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),extends:this.extends.map(p=>p.type===n.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toReference(e)),methods:this.methods.map(a=>a.toReference(e)),abstractMethods:this.abstractMethods.map(a=>a.toReference(e)),implements:this.implements.map(a=>a.toReference(e)),extends:this.extends.map(a=>a.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=U5(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var V,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const p=l.split("-id"),h=p[p.length-1||0]||l;o.id=l,o.version=R.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t&&c.setParent(t,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(V=this.properties)==null?void 0:V.map(F=>F.clone(e,c,R.UUID.uuid(),a));c.properties=v;const E=(C=this.methods)==null?void 0:C.map((F,_)=>F.clone(e,c,h+"-method-"+_+"-id",a));c.methods=E;const O=(U=this.abstractMethods)==null?void 0:U.map((F,_)=>F.clone(e,c,h+"-abstract-method-"+_+"-id",a));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return u([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(c=>{l.find(E=>G(E,this.project)===G(c,this.project))||l.push(c)});const p=this.properties.filter(c=>!c.dataType);l.forEach(c=>{var U,F;const v=p.find(_=>G(_,this.project)===G(c,this.project));if(!v)return;const O=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),V=kr(O,t),C=V==null?void 0:V.clone(t,v,R.UUID.uuid(),!0);if(C){const _=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(_==null?void 0:_.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((F=_==null?void 0:_.self)==null?void 0:F.id)&&C.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,b.Added),v.setDataType(_.self),t==null||t.add(v,b.Updated))}c.setDeclaration(v),t==null||t.add(c,b.Updated)});const h=[];return l.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,j,k,W;const v=this.properties.find(ee=>G(ee,this.project)===G(c,this.project));if(v){if(c.setDeclaration(v),!v.getDataType(t)){const pe=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Te=kr(pe),K=Te==null?void 0:Te.clone(t,v,R.UUID.uuid(),!0);if(K){const se=(_=v.dataType)==null?void 0:_.merge(K,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),K.id!==((j=se==null?void 0:se.self)==null?void 0:j.id)&&K.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:R.UUID.uuid(),type:n.Property,version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:G(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=w(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,b.Added);const C=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),U=kr(C),F=U==null?void 0:U.clone(t,O,R.UUID.uuid(),!0);if(F){const ee=(k=O.dataType)==null?void 0:k.merge(F,t);O.dataType&&(ee==null?void 0:ee.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),F.id!==((W=ee==null?void 0:ee.self)==null?void 0:W.id)&&F.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),O.setDataType(ee.self),t==null||t.add(O,b.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,b.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:u(r),updated:u(a),removed:u(d),affected:u(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let zi=Le;function uJ(i){const s=y6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Ls=class Ls extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>w(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await Ls.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=uJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ls&&e.push(...r.getAllInteractiveMethods())})),u(e)}};f(Ls,"repository",{APILoad:async(e,...t)=>null});let Yr=Ls;function pJ(i){const s=a6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const il=class il extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=w(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=w(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await il.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=pJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Yr&&e.push(...r.getAllInteractiveMethods())}),u(e)}};f(il,"repository",{APILoad:async(e,...t)=>null});let ar=il;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new _n(i,s);case n.DefinitionEntity:return e||new zi(i,s);case n.PrimitiveEntity:return e||new ar(i,s);case n.FunctionDeclaration:return e||new Mi(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new Bi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new gi(i,s);case n.VariableDeclaration:return e||new $i(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new qr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Fi(i,s);case n.InputMap:return e||new Zr(i,s);case n.Project:return e||new R(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new _i(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new ji(i,s);case n.ValueDescriptor:return e||new Si(i,s);case n.BuiltInBaseEntity:return e||new Yr(i,s);case n.InternalCall:return e||new Bn(i,s);case n.ContinueStatement:return e||new jt(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function w(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function cJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return _n.fromGenerationTarget(i,s);case n.DefinitionEntity:return zi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return Mi.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return Bi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return gi.fromGenerationTarget(i,s);case n.VariableDeclaration:return $i.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return qr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Fi.fromGenerationTarget(i,s);case n.InputMap:return Zr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return _i.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return ji.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return Si.fromGenerationTarget(i,s);case n.InternalCall:return Bn.fromGenerationTarget(i,s);case n.ContinueStatement:return jt.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class PP{constructor(){f(this,"initialData")}}const L={cascade:!1},wP={APILoad:async(i,...s)=>null},fJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...wP};class yJ{}class hJ extends PP{}class mJ{}class vJ{}class TJ{}class Hc{}class EJ extends Hc{}class IJ extends Hc{}class bJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=w(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=w(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class gs{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=w(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=u([...r,...t]),s.writesValues}}class RJ{}const oe=class oe extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!oe.UUID||oe.UUID.isBackup)&&(oe.UUID=Uo==null?void 0:Uo()),oe.UUID||(oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){oe.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}async closePendingCallbacks(){for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await this.closeChangeSet(t)}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=oe.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new oe(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const p=new Map;for(const[h,c]of this.knownVersions||new Map){if(p.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)p.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const p=await this.APILoadVersion({},e);if(!p)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new oe(p)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await oe.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await oe.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await oe.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await oe.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await oe.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await oe.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,oe.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+oe.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(a=>a.toReference(e)),functions:this.functions.map(a=>a.toReference(e)),events:this.events.map(a=>a.toReference(e)),projects:this.projects.map(a=>a.toReference(e)),variableDeclarations:this.variableDeclarations.map(a=>a.toReference(e)),variableInstances:this.variableInstances.map(a=>a.toReference(e)),conditions:this.conditions.map(a=>a.toReference(e)),operations:this.operations.map(a=>a.toReference(e)),functionCalls:this.functionCalls.map(a=>a.toReference(e)),loops:this.loops.map(a=>a.toReference(e)),searches:this.searches.map(a=>a.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=B5(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntityFromTransfer(e){const t=w(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=w(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=w(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=w(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=w(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=w(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=w(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=w(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=w(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=w(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=w(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return u([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(oe,"sessionAuthor",null),f(oe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(oe,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(oe,"type",n.Project),f(oe,"USER_MANAGED_PARENT_TYPES",[]),f(oe,"PARENT_TYPES",[...oe.USER_MANAGED_PARENT_TYPES]),f(oe,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(oe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(oe,"BASE_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"MUTABLE_META_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,"x","y"]),f(oe,"INMUTABLE_META_PROPERTIES",[...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"META_PROPERTIES",[...oe.MUTABLE_META_PROPERTIES,...oe.INMUTABLE_META_PROPERTIES]),f(oe,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(oe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(oe,"UPSTREAM_PROPERTIES",[...oe.MUTABLE_UPSTREAM_PROPERTIES,...oe.INMUTABLE_UPSTREAM_PROPERTIES]),f(oe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(oe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(oe,"DOWNSTREAM_PROPERTIES",[...oe.MUTABLE_DOWNSTREAM_PROPERTIES,...oe.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(oe,"PROPERTIES",[...oe.META_PROPERTIES,...oe.UPSTREAM_PROPERTIES,...oe.DOWNSTREAM_PROPERTIES]);let R=oe;var VP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(VP||{});class CP extends qe{constructor(e){super(Rr,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",Rr);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Rr.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Rr.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Rr.error?w(Rr.error,this.project):null}}class BP extends qe{constructor(e){super(Ft,e);f(this,"id",Ft.id);f(this,"name",Ft.name);f(this,"description",Ft.description);f(this,"version",Ft.version);f(this,"autoexecutable",!1);f(this,"initialData",Ft);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Ft.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Ft.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Ft.error?w(Ft.error,this.project):null}}class _P extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?w(ti.error,this.project):null}}class AJ extends qe{constructor(s){super(wa,s)}}class DJ extends qe{constructor(s){super(Xi,s)}}class OJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:c,updated:v,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const p=this.getDataToValidateInputMap(e);if(p){const{added:c,updated:v,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(p,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:v,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var p,h,c;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==S.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=w(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==S.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},V=w(O,e.project);V.setParent(e,t),V.initChildren(t),t==null||t.add(V,b.Added),r.push(V),e.setDataType(V)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==S.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},V=w(O,e.project);V.setParent(e,t),V.initChildren(t),t==null||t.add(V,b.Added),r.push(V),e.setDataType(V)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:p}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(p),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===S.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:p}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(p),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:u(d),added:u(a),removed:u(o),affected:u(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class PJ extends qe{constructor(s){super(hl,s)}}class wJ extends qe{constructor(s){super(vl,s)}}class VJ extends qe{constructor(s){super(Tl,s)}}class CJ extends qe{constructor(s){super(Zs,s)}}class BJ extends qe{constructor(s){super(Ss,s)}}class _J extends qe{constructor(s){super(Pa,s)}}function MJ(i){const s=[new _P(i),new CP(i),new BP(i),new AJ(i),new DJ(i),new OJ(i),new CJ(i),new PJ(i),new VJ(i),new wJ(i),new BJ(i),new _J(i),new qe(yl,i),new qe(fl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class MP extends Yr{constructor(e){super(Ot,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",Ot.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Ot.abstract);f(this,"static",Ot.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=w(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=w(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>w(t,this.project))}}function gJ(i){const s=[new MP(i),new Yr(ga,i),new Yr(Nr,i),new Yr(oo,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function NJ(i){const s=[new ar(ne,i),new ar(Kr,i),new ar(me,i),new ar(ol,i),new ar(At,i),new ar(Xr,i),new ar(_r,i),new ar(Qr,i),new ar(jn,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function LJ(i){const s=[new qe(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function UJ(i){const s=[new qe(_a,i),new qe(mi,i),new qe(Ca,i),new qe(Sn,i),new qe(xn,i),new qe(Xs,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(ro,i),new qe(Ba,i),new qe(eo,i),new qe(_l,i),new qe(gl,i),new qe(Qs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function $J(i){const s=[new Si(po,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function jJ(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const gn={},el={},Ns={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null};function gP(i,{enrich:s}={enrich:!0}){const e=i.project,t=i.record,r=new Sd(e),a=new Set;t[e.id]=e,a.add(e.id);const d=T().toISOString();Object.values(t).forEach(p=>{!p||r.allBuiltInEntityIds.includes(p.id)||a.add(p.id)}),r.order=Array.from(a),r.flatRecord=t,r.orderEntities();const o=tl(i.project);o.instances[e.id]=o;const l=s?o.addChangeSet(new A(o,"",d,o)):null;return r.visit(p=>{if(p.id===o.id)return;const h=w(p,o);h.hydrateAncestors(),h.addSelfToProject(null)}),s?(r.visit(p=>{const h=o.get(p.id);h&&h.afterAllChildrenInitialized(l)}),o.afterAllChildrenInitialized(l)):rl(o,d).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(p=>{p.previousVersion=null}),l==null||l.close(),o}async function GJ(i,s=Ns){const e={...Ns,...s};if(e.empty)return{data:{project:{id:i.id,type:n.Project,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const r={...np};return r.id=i.id,{data:{project:r,record:{}}}}return console.log("Fetching project from external API"),new Promise(async r=>{if(e.onFetch){const a=await e.onFetch(i.id);if(a){r({data:a});return}}else r({data:null})})}function tl(i){const s=new R(i);return NJ(s),gJ(s),MJ(s),LJ(s),UJ(s),$J(s),jJ(s),Array.from(new Set([...s.getAllBuiltInIds(),...Vr()])).forEach(t=>{if(!s.builtInInstances[t]&&s.instances[t])s.builtInInstances[t]=s.instances[t],delete s.instances[t];else if(!s.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),s}function rl(i,s){return i.instancesList.filter(t=>T(t.createdAt).isAfter(T(s)||!!t.previousVersion))}function FJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Vr()]));Object.keys(i.instances).forEach(p=>{if(t.includes(p)){e.set(p,p);return}const h=i.get(p);if(!Qd(h,{...i.instances,...i.builtInInstances}).every(E=>!t.includes(E))){e.set(p,p);return}e.set(p,R.UUID.uuid())});const r=T().toISOString(),a=i.toShallowJSON({seenEntityMaps:e});a.previousVersion=null,a.createdAt=r,a.version=R.UUID.uuid();const d=tl(a),o=s?d.addChangeSet(new A(d,"",r,d)):null,l=new Sd(i);return l.visit(p=>{const h=p.toShallowJSON({seenEntityMaps:e});h.previousVersion=null,h.createdAt=r,h.version=R.UUID.uuid();const c=w(h,d);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,b.Added)}),s?(l.visit(p=>{const h=d.get(e.get(p.id));h&&h.afterAllChildrenInitialized(o)}),d.afterAllChildrenInitialized(o)):rl(d,r).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),d.instancesList.forEach(p=>{p.previousVersion=null}),o==null||o.close(),d}function NP(i,{enrich:s}={enrich:!0}){const e=tl(i),t=T().toISOString(),r=s?e.addChangeSet(new A(e,"",t,e)):null;r&&(r.type=bc.Automatic);const a=new Sd(i);return a.visit(d=>{const o=w(d,e);o.hydrateAncestors(),o.addSelfToProject(r)}),s?(a.visit(d=>{const o=e.get(d.id);o&&o.afterAllChildrenInitialized(r)}),e.afterAllChildrenInitialized(r)):rl(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),r==null||r.close(),e}async function SJ(i,s=Ns){const e={...Ns,...s};if(i.id&&gn[i.id]&&!e.ignoreCache)return gn[i.id];if(i.id&&el[i.id]&&!e.ignoreCache)return await el[i.id],gn[i.id];const t=GJ(i,e);i.id&&(el[i.id]=t);const r=await t;if(r.data){let a;return e.mock?a=NP(np,{enrich:!!e.enrich}):a=gP(r.data,{enrich:!!e.enrich}),gn[i.id]=a,i.id&&delete el[i.id],a}return null}function xJ(i){return gn[i.id]&&delete gn[i.id],null}const kJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Mc,y.ALL_BUILT_IN_BASE_ENTITIES=NE,y.ALL_BUILT_IN_CONDITION_ENTITIES=YE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=HE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uT,y.ALL_BUILT_IN_LOOP_ENTITIES=lT,y.ALL_BUILT_IN_OPERATION_ENTITIES=b0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=lf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=eI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=QE,y.ActionDescriptorState=qe,y.ActionInputMapState=yq,y.ActionOutputMapState=vq,y.AppendToListOperationInputIds=vh,y.AppendToListOperationOutputIds=Th,y.ArgumentDeclarationDependencyField=aO,y.ArgumentDeclarationState=Fi,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Vc,y.BUILT_IN_BASE_ENTITY_IDS=S,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=mJ,y.BaseEntityNames=z,y.BaseState=hJ,y.BaseValueDescriptorIds=Fs,y.BreakStatementDependencyField=Ac,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=Yr,y.CACHED_PROJECTS_BY_ID=gn,y.CALLABLE_ENTITIES_EXPLANATION=Oq,y.CALLABLE_TYPES=Cr,y.CALLER_ENTITIES_EXPLANATION=uO,y.CALLER_TYPES=Br,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=JE,y.CONDITIONS=WE,y.CUSTOM_ENTITY_OPERATIONS=Gm,y.CallableEntityClass=TJ,y.CallerEntityClass=Hc,y.ChangeSet=A,y.ChangeSetChangeCaptureType=bc,y.ChangeSetEntityChangeType=b,y.ChildEntityState=vJ,y.ComparisonOperatorTypes=pt,y.ConditionDependencyField=Q1,y.ConditionState=Li,y.ContinueStatementDependencyField=Rc,y.ContinueStatementState=jt,y.CreateNewInputIds=fm,y.CreateNewOutputIds=ym,y.DRAGGABLE_CALLABLE_TYPES=sl,y.DRAGGABLE_CALLER_TYPES=ef,y.DRAGGABLE_ELEMENT_TYPES=Gs,y.DRAGGABLE_EXECUTABLE_TYPES=GP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=al,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=z1,y.DataTypeParentChildRelation=Rt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=OP,y.DefinitionEntityState=zi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=fJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ud,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=FP,y.ENTITY_WITH_DECLARATION_TYPES=$P,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=tf,y.ENTITY_WITH_PARENT_TYPES=LP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Xc,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=UP,y.ENTITY_WITH_VALUE_TYPES=Kc,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=jP,y.EXECUTION_OPERATIONS=cm,y.EntityAction=VP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=I,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=RJ,y.EntityWithValueClass=bJ,y.EntryPointEntityClass=EJ,y.ExecutionOperations=He,y.ExecutionTerminationType=K1,y.FunctionCallDependencyField=IO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=Y1,y.FunctionDeclarationState=Mi,y.GET_PROJECT_OPTIONS_DEFAULTS=Ns,y.GLOBAL_EVENT_DECLARATIONS=zE,y.GetLastInListOperationInputIds=ah,y.GetLastInListOperationOutputIds=sh,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=E0,y.InputMapDependencyField=iO,y.InputMapState=Zr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=rO,y.InternalCallState=Bn,y.JoinListOperationInputIds=Oy,y.JoinListOperationOutputIds=Py,y.LIST_OPERATIONS=_h,y.ListOperations=fe,y.LiteralValueDependencyField=sO,y.LiteralValueState=_n,y.LoopDependencyField=X1,y.LoopState=Ni,y.LoopTypes=X,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Gf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=I0,y.OperationDependencyField=H1,y.OperationState=gi,y.OutputMapDependencyField=nO,y.OutputMapParentChildRelation=Un,y.OutputMapState=qr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=$d,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=xi,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Qc,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_c,y.ParallelExecutionOperation=CP,y.PassThroughCallableEntityClass=IJ,y.PersistedEntity=MP,y.PersistedEntityMethods=or,y.PrimitiveEntityState=ar,y.PrimitiveTypes=g,y.ProjectState=R,y.PropertyDependencyField=J1,y.PropertyState=Bi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=wP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Pq,y.ReturnDeclarationDependencyField=W1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=Md,y.ReturnStatementState=_i,y.STANDALONE_CONDITIONS=$E,y.STRING_OPERATIONS=Dy,y.ScopeCompatibilityType=Xd,y.SearchDependencyField=tO,y.SearchState=ji,y.SequentialExecutionOperation=_P,y.SequentialExecutionOperationInputIds=Qh,y.SequentialExecutionOperationOutputIds=em,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=PP,y.SplitListOperationInputIds=Sy,y.SplitListOperationOutputIds=xy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=Sd,y.USER_MANAGED_ENTITY_TYPES=rf,y.UserManagedEntityStateTemplate=yJ,y.VALUE_READING_ENTITIES_EXPLANATION=Bc,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=pO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Cc,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=oO,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=Si,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=gs,y.VariableDeclarationDependencyField=eO,y.VariableDeclarationState=$i,y.VariableInputMapState=fq,y.VariableInstanceDependencyField=Dc,y.VariableInstanceState=Ui,y.VariableOutputMapState=mq,y.WaitOperation=BP,y.WaitOperationInputIds=Jh,y.WaitOperationOutputIds=Wh,y.appendToListOperation=Zs,y.appendToListOperationElementToAppendArgument=Il,y.appendToListOperationElementToAppendArgumentParentRef=Ph,y.appendToListOperationElementToAppendArgumentRef=bh,y.appendToListOperationError=Bh,y.appendToListOperationErrorParentRef=Ch,y.appendToListOperationListArgument=El,y.appendToListOperationListArgumentParentRef=Oh,y.appendToListOperationListArgumentRef=Eh,y.appendToListOperationListDataType=Ih,y.appendToListOperationResultListDataType=Dh,y.appendToListOperationResultListReturn=Vh,y.appendToListOperationResultListReturnParentRef=wh,y.appendToListOperationResultListReturnRef=Ah,y.appendToListOperationSecondListDataType=Rh,y.asGenerationActionExample=Jr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=Z7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=g1,y.checkArePropertiesCompatibleAsDataType=M1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Lq,y.checkIsCallableEntityReachable=Ms,y.checkIsCanvasEntity=eJ,y.checkIsDetachedBranch=EP,y.checkIsDetachedBranchShallow=Yc,y.checkIsGlobalVariable=Kq,y.checkIsGloballyDeclared=Wc,y.checkIsMethod=RP,y.checkIsNestedScope=Kd,y.checkScopeCompatibility=_s,y.cloneProject=FJ,y.countedLoopActionDescriptor=_a,y.countedLoopActionDescriptorDynamicReturnDeclaration=tT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,y.countedLoopActionDescriptorStringArgumentDeclaration=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=zv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=Yv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Xv,y.countedLoopBodyActionDescriptor=ro,y.countedLoopBodyActionDescriptorAnyDynamicArgument=sT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=aT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=dT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ll,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nT,y.createDefinitionEntityFromJSONObject=kd,y.createEntityError=ye,y.createNestedDataTypeForEntity=AO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=Rm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Em,y.createNewInstanceOperationEntityToInstanciateDataType=Im,y.createNewInstanceOperationError=Pm,y.createNewInstanceOperationErrorParentRef=Om,y.createNewInstanceOperationNewEntityDataArgument=Tm,y.createNewInstanceOperationNewEntityDataArgumentDataType=vm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=hm,y.createNewInstanceOperationOutputEntityDeclaration=Dm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Am,y.createNewInstanceOperationRef=bm,y.createSemanticId=q1,y.createStateFromGenerationTargetType=cJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=w,y.cronJobBuiltInBaseEntity=oo,y.cronJobBuiltInBaseEntityExpressionProperty=ME,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=BE,y.cronJobBuiltInBaseEntityRef=_E,y.cronJobTriggeredFunctionDeclarationBlueprint=zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=VE,y.dataTypeCompatibilityToErrorExplanation=EO,y.datePrototype=_r,y.dateValueAutogenerationSchema=lp,y.definitionEntityToZodSchema=mI,y.deletePersistedEntityMethod=Yl,y.deletePersistedEntityMethodParentRef=fE,y.deleteRootProject=xJ,y.endpointBuiltInBaseEntity=ga,y.endpointBuiltInBaseEntityRef=yT,y.endpointBuiltInBaseEntityRefFour=zT,y.endpointBuiltInBaseEntityRefThree=AT,y.endpointBuiltInBaseEntityRefTwo=ET,y.endpointBuiltInCorsProperty=hT,y.endpointBuiltInCorsPropertyDataType=fT,y.endpointBuiltInCorsPropertyDataTypeRef=pT,y.endpointBuiltInCorsPropertyRef=cT,y.endpointBuiltInMethodProperty=$l,y.endpointBuiltInMethodPropertyDataType=RT,y.endpointBuiltInMethodPropertyDataTypeRef=IT,y.endpointBuiltInMethodPropertyRef=bT,y.endpointBuiltInPathProperty=Ul,y.endpointBuiltInPathPropertyDataType=TT,y.endpointBuiltInPathPropertyDataTypeRef=mT,y.endpointBuiltInPathPropertyRef=vT,y.endpointPathParamsArgumentDeclaration=Gl,y.endpointPathParamsArgumentDeclarationRef=gT,y.endpointPathParamsVariableDataType=NT,y.endpointPathParamsVariableDataTypeRef=MT,y.endpointReachedTriggerActionDescriptor=ql,y.endpointReachedTriggerActionDescriptorRef=LT,y.endpointReachedTriggerActionDescriptorRefFour=jT,y.endpointReachedTriggerActionDescriptorRefThree=$T,y.endpointReachedTriggerActionDescriptorRefTwo=UT,y.endpointRequestBodyArgumentDeclaration=Sl,y.endpointRequestBodyArgumentDeclarationRef=wT,y.endpointRequestBodyVariableDataType=VT,y.endpointRequestHeadersArgumentDeclaration=jl,y.endpointRequestHeadersArgumentDeclarationRef=OT,y.endpointRequestHeadersVariableDataType=PT,y.endpointRequestHeadersVariableDataTypeRef=DT,y.endpointRequestQueryParamsArgumentDeclaration=Fl,y.endpointRequestQueryParamsArgumentDeclarationRef=BT,y.endpointRequestQueryParamsVariableDataType=_T,y.endpointRequestQueryParamsVariableDataTypeRef=CT,y.endpointResponseBodyDataType=WT,y.endpointResponseBodyReturnDeclaration=Zl,y.endpointResponseBodyReturnDeclarationRef=JT,y.endpointResponseCodeDataType=FT,y.endpointResponseCodeReturnDeclaration=xl,y.endpointResponseCodeReturnDeclarationRef=GT,y.endpointResponseHeadersDataType=ZT,y.endpointResponseHeadersDataTypeRef=xT,y.endpointResponseHeadersReturnDeclaration=kl,y.endpointResponseHeadersReturnDeclarationRef=kT,y.endpointReturnStatementRef=ST,y.endpointReturnStatementRefThree=YT,y.endpointReturnStatementRefTwo=qT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=df,y.enumOptionsPropertyDataType=sf,y.enumOptionsPropertyDataTypeRef=nf,y.enumOptionsPropertyRef=af,y.enumPrototype=Xr,y.enumPrototypeRef=of,y.executionBuiltInBaseEntity=lo,y.executionBuiltInEntityAbortMethod=Hl,y.executionBuiltInEntityAbortMethodParentRef=gE,y.filterOutDuplicateEntities=u,y.filterOutDuplicateErrors=H9,y.findEntityFromKeys=Uc,y.findReferenceToSelfInList=jO,y.findReferencesToSelfInProject=Zq,y.flattenActionDescriptor=GO,y.flattenArgumentDeclaration=FO,y.flattenBreakStatement=SO,y.flattenBuiltInBaseEntity=xO,y.flattenCalls=Wr,y.flattenCanvasAncestorsUntil=Zd,y.flattenCondition=kO,y.flattenContinueStatement=ZO,y.flattenDataType=JO,y.flattenDefinitionEntity=qO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Zc,y.flattenDefinitionEntityExtensionTypes=Hd,y.flattenDefinitionEntityExtensions=xc,y.flattenDefinitionEntityImplementations=kc,y.flattenDefinitionEntityImplementionTypes=zd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=bP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=kq,y.flattenEntity=N,y.flattenFunctionCall=WO,y.flattenFunctionDeclaration=YO,y.flattenGlobalEvent=zO,y.flattenInputMap=HO,y.flattenInstalledProject=KO,y.flattenInternalCall=XO,y.flattenLiteralValue=QO,y.flattenLoop=eP,y.flattenOperation=tP,y.flattenOutputMap=rP,y.flattenPrimitiveEntity=iP,y.flattenProject=nP,y.flattenProjectElements=$O,y.flattenProperty=aP,y.flattenRelatedCanvasElementsOnTheLeft=vP,y.flattenRelatedCanvasElementsOnTheRight=mP,y.flattenReturnDeclaration=sP,y.flattenReturnStatement=oP,y.flattenSearch=dP,y.flattenValueDescriptor=lP,y.flattenVariableDeclaration=uP,y.flattenVariableInstance=pP,y.flattenVariableReads=UO,y.flattenVariableWrites=LO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=dJ,y.fromZodParseToEntityGenerationErrors=Oc,y.generate=KV,y.generateActionExample=wq,y.generateExecutionDataType=N7,y.generateIdFromStrategy=ct,y.generateMutablePropertiesExplanation=gd,y.generateRandomBoolean=kI,y.generateRandomDate=II,y.generateRandomDateAfter=vI,y.generateRandomDateBefore=TI,y.generateRandomDateBetweenRange=EI,y.generateRandomNumber=jI,y.generateRandomNumberAfter=LI,y.generateRandomNumberBefore=UI,y.generateRandomNumberBetweenRange=$I,y.generateRandomText=xI,y.generateRandomTextAfter=GI,y.generateRandomTextBefore=FI,y.generateRandomTextBetweenRange=SI,y.generateUniqueUUID=NI,y.getAllActionDescriptorsForConditions=Fd,y.getAllActionDescriptorsForGlobalEvents=jd,y.getAllActionDescriptorsForLoops=Gd,y.getAllActionDescriptorsForOperations=_q,y.getAllBuiltInEntityIds=Vr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=mO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=dO,y.getBuiltInEntityOwner=Yi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=ID,y.getCalledBy=fr,y.getCallerEntityReferenceSchema=e5,y.getCallerEntityTypeSchema=Q3,y.getCalls=Gc,y.getCanvasEntitiesDerivedFromInternalCalls=hP,y.getCanvasEntitiesDerivedFromWrites=Ra,y.getCanvasEntityDerivedFromValueReadingEntity=Yd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=yP,y.getCanvasEntityReferenceSchema=v5,y.getCanvasEntityTypeSchema=m5,y.getChildrenEntityWithValues=$q,y.getColumnProperties=aJ,y.getCommonAncestor=jc,y.getCommonChildren=DO,y.getDatabaseEntities=iJ,y.getDatabaseEntity=sJ,y.getDeclaration=Pn,y.getDeepestScope=DP,y.getDefinitionEntityExtends=Aa,y.getDraggableCallableEntityReferenceSchema=RD,y.getDraggableCallableEntityTypeSchema=bD,y.getDraggableCallerEntityReferenceSchema=r5,y.getDraggableCallerEntityTypeSchema=t5,y.getDraggableExecutableEntityReferenceSchema=s5,y.getDraggableExecutableEntityTypeSchema=a5,y.getDraggablePassThroughCallableEntityReferenceSchema=Td,y.getDraggablePassThroughCallableEntityTypeSchema=vd,y.getDraggablePlayableEntityReferenceSchema=p5,y.getDraggablePlayableEntityTypeSchema=u5,y.getEntitiesCreatedSinceInitialization=rl,y.getEntityArgumentDeclarations=Sc,y.getEntityInputMaps=cP,y.getEntityOutputMaps=Yq,y.getEntityReferenceSchema=h5,y.getEntityReturnDeclarations=fP,y.getEntityTypeSchema=y5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=o5,y.getEntityWithValueReferenceSchema=ED,y.getEntityWithValueTypeSchema=X3,y.getEntryPointEntityReferenceSchema=bt,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=hd,y.getEventEntityTypeSchema=yd,y.getExecutableEntityReferenceSchema=n5,y.getExecutableEntityTypeSchema=i5,y.getExtendedBuiltInEntity=zq,y.getExtendedDefinitionEntity=qc,y.getGenerationTargetSchemaBasedOnType=lO,y.getHeadIfPartOfDetachedBranch=IP,y.getHighestScope=AP,y.getImplementedBuiltInEntity=Hq,y.getIsInteractive=Jc,y.getLastInListOperation=Tl,y.getLastInListOperationError=mh,y.getLastInListOperationErrorParentRef=hh,y.getLastInListOperationInputListArgument=ch,y.getLastInListOperationInputListArgumentParentRef=ph,y.getLastInListOperationInputListArgumentRef=oh,y.getLastInListOperationInputListDataType=dh,y.getLastInListOperationOutputElementDataType=uh,y.getLastInListOperationOutputElementReturn=yh,y.getLastInListOperationOutputElementReturnParentRef=fh,y.getLastInListOperationOutputElementReturnRef=lh,y.getLinkedEntitiesFromArgumentDeclaration=xq,y.getLowestPersistedEntityImplementation=TP,y.getParentCallableEntity=OO,y.getParentCallerEntity=wO,y.getParentCanvasEntities=Yt,y.getParentCanvasEntity=wt,y.getParentCanvasEntityFromTransfer=qd,y.getParentEntryPoint=Uq,y.getParentPassthroughCallableEntity=PO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=md,y.getPeristedEntities=rJ,y.getPlayableEntityReferenceSchema=l5,y.getPlayableEntityTypeSchema=d5,y.getProject=SJ,y.getPrototypeByType=Bs,y.getRecusriveParentsIds=Qd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Ld,y.getReferencedEntityStateOrErrors=Pc,y.getReferencedIds=Wd,y.getRelatedCanvasElementsOnTheLeft=Mn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=qq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=zc,y.getScopeOwner=zt,y.getStateClassFromType=oJ,y.getTerminationReferenceSchema=f5,y.getTerminationTypeSchema=c5,y.getUsedArgFromDeclaration=Jq,y.getUsedReturnFromDeclaration=Wq,y.getValueReadingEntityReferenceSchema=TD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=K3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=CO,y.getVariableFromReturnVariablePointer=MO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=Jd,y.getVariablesFromInputMaps=BO,y.getVariablesFromOutputMapping=gO,y.getVariablesFromOutputMaps=NO,y.getVariablesFromReturnDeclarations=_O,y.getVariablesInSameOrHigherScope=yc,y.getWrites=Fc,y.groupCallsBasedOnParallelizableExecution=Gq,y.handleAfterEntityImplementationSideEffects=RO,y.handleBeforeEntityImplementationSideEffects=bO,y.httpRequestBodyArgument=Ys,y.httpRequestBodyArgumentRef=Xm,y.httpRequestBodyDataType=Qm,y.httpRequestHeadersArgument=Ws,y.httpRequestHeadersArgumentRef=Hm,y.httpRequestHeadersDataType=Km,y.httpRequestMethodArgument=qs,y.httpRequestMethodArgumentRef=Ym,y.httpRequestMethodDataType=zm,y.httpRequestMethodDataTypeRef=Jm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=Pl,y.httpRequestOperationErrorValueDescriptorDatatype=T0,y.httpRequestOperationErrorValueDescriptorRef=v0,y.httpRequestOperationRef=f0,y.httpRequestOperationRefEight=h0,y.httpRequestOperationRefFive=p0,y.httpRequestOperationRefFour=u0,y.httpRequestOperationRefNine=m0,y.httpRequestOperationRefSeven=y0,y.httpRequestOperationRefSix=c0,y.httpRequestOperationRefThree=l0,y.httpRequestOperationRefTwo=d0,y.httpRequestQueryParamsArgument=Ol,y.httpRequestQueryParamsArgumentRef=Zm,y.httpRequestQueryParamsDataType=qm,y.httpRequestVariableURLArgument=Js,y.httpRequestVariableURLArgumentRef=xm,y.httpRequestVariableURLDataType=km,y.httpRequestVariableURLDataTypeRef=Fm,y.httpResponseBodyReturnDataType=o0,y.httpResponseBodyReturnDataTypeRef=a0,y.httpResponseBodyReturnReturn=Ks,y.httpResponseBodyReturnReturnRef=s0,y.httpResponseCodeDataType=t0,y.httpResponseCodeReturn=zs,y.httpResponseCodeReturnRef=e0,y.httpResponseHeadersDataType=n0,y.httpResponseHeadersDataTypeRef=r0,y.httpResponseHeadersReturn=Hs,y.httpResponseHeadersReturnRef=i0,y.implement=xd,y.inferArgumentDeclarationDataType=N1,y.inferDataType=kr,y.inferInputMapDataType=pc,y.inferOutputMapDataType=fc,y.inferPropertyDataType=$1,y.inferReturnDeclarationDataType=cc,y.inferValueDescriptorDataType=j1,y.inferVariableDeclarationDataType=U1,y.inferVariableInstanceDataType=L1,y.initBaseProjectEntity=tl,y.initProject=NP,y.initProjectFromFetchResult=gP,y.isPromise=Lc,y.iterateOverListActionDescriptorListArgumentDeclaration=X0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=H0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=z0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=K0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=ev,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Q0,y.iterateOverListLoopBodyActionDescriptor=Ba,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=lv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=uv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=to,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=yv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopActionDescriptor=Sn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Tv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=vv,y.iterateOverObjectKeysLoopBodyActionDescriptor=_l,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=wv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Bl,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Dv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Nv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Mv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=_v,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=gv,y.iterateOverObjectValuesLoopActionDescriptor=xn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Uv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptor=gl,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ml,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=xv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=$0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=L0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=g0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=M0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=N0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=eo,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=q0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=J0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Vl,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=G0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=j0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=F0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Cl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=x0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=S0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=k0,y.joinListOperation=hl,y.joinListOperationError=Fy,y.joinListOperationErrorParentRef=Gy,y.joinListOperationFirstListArgument=Ny,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=wy,y.joinListOperationFirstListDataType=Vy,y.joinListOperationResultListDataType=My,y.joinListOperationResultListReturn=jy,y.joinListOperationResultListReturnParentRef=$y,y.joinListOperationResultListReturnRef=_y,y.joinListOperationSecondListArgument=Uy,y.joinListOperationSecondListArgumentParentRef=Ly,y.joinListOperationSecondListArgumentRef=Cy,y.joinListOperationSecondListDataType=By,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=sy,y.joinStringsOperationDynamicStringArgumentParentRef=ay,y.joinStringsOperationDynamicStringArgumentRef=iy,y.joinStringsOperationDynamicStringDataType=ny,y.joinStringsOperationError=ry,y.joinStringsOperationErrorParentRef=ty,y.joinStringsOperationFirstStringArgument=xs,y.joinStringsOperationFirstStringArgumentParentRef=Jf,y.joinStringsOperationFirstStringArgumentRef=Ff,y.joinStringsOperationFirstStringDataType=Sf,y.joinStringsOperationResultStringDataType=qf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=ey,y.joinStringsOperationResultStringReturnRef=Zf,y.joinStringsOperationSecondStringArgument=ks,y.joinStringsOperationSecondStringArgumentParentRef=Qf,y.joinStringsOperationSecondStringArgumentRef=xf,y.joinStringsOperationSecondStringDataType=kf,y.joinStringsOperationSeparatorStringArgument=Xf,y.joinStringsOperationSeparatorStringArgumentParentRef=Kf,y.joinStringsOperationSeparatorStringArgumentRef=Wf,y.joinStringsOperationSeparatorStringDataType=Hf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=zf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Yf,y.keyValuePrototype=jn,y.lowercaseFirstLetter=Pd,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=wl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=O0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=D0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=P0,y.manualFlowLoopActionDescriptor=Xs,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=A0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=R0,y.manualFlowLoopBodyActionDescriptor=Qs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=V0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=w0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=C0,y.mapActionDescriptorToTypeItRepresents=tJ,y.mergeEntityErrorsList=K9,y.mergeListOfEntities=Xq,y.methodDefaultValue=Wm,y.mockClientProject=np,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=SE,y.moreThanOrEqualConditionLeftHandArgumentDataType=GE,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=jE,y.moreThanOrEqualConditionLeftHandArgumentParentRef=FE,y.moreThanOrEqualConditionRightHandArgument=qE,y.moreThanOrEqualConditionRightHandArgumentDataType=kE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=xE,y.moreThanOrEqualConditionRightHandArgumentParentRef=ZE,y.notEmptyCondition=an,y.notEmptyConditionArgument=UE,y.notEmptyConditionRef=LE,y.nullPrototype=ol,y.numberAdditionOperation=Ss,y.numberAdditionOperationDynamicSummandArgument=Rf,y.numberAdditionOperationDynamicSummandArgumentType=bf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=If,y.numberAdditionOperationError=Ef,y.numberAdditionOperationErrorParentRef=Tf,y.numberAdditionOperationFirstNumberArgument=dl,y.numberAdditionOperationFirstNumberArgumentRef=uf,y.numberAdditionOperationFirstNumberDataType=pf,y.numberAdditionOperationRef=mf,y.numberAdditionOperationRefThree=ul,y.numberAdditionOperationRefTwo=vf,y.numberAdditionOperationResultNumberDataType=hf,y.numberAdditionOperationResultNumberReturn=pl,y.numberAdditionOperationResultNumberReturnRef=yf,y.numberAdditionOperationSecondNumberArgument=ll,y.numberAdditionOperationSecondNumberArgumentRef=cf,y.numberAdditionOperationSecondNumberDataType=ff,y.numberPrototype=me,y.numberSubtractionOperation=fl,y.numberSubtractionOperationDynamicSubtrahendArgument=jf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=$f,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Uf,y.numberSubtractionOperationError=Lf,y.numberSubtractionOperationErrorParentRef=Nf,y.numberSubtractionOperationFirstNumberArgument=Cf,y.numberSubtractionOperationFirstNumberArgumentRef=Af,y.numberSubtractionOperationFirstNumberDataType=Df,y.numberSubtractionOperationRef=cl,y.numberSubtractionOperationRefThree=Mf,y.numberSubtractionOperationRefTwo=Bf,y.numberSubtractionOperationResultNumberDataType=Vf,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=wf,y.numberSubtractionOperationSecondNumberArgument=_f,y.numberSubtractionOperationSecondNumberArgumentRef=Of,y.numberSubtractionOperationSecondNumberDataType=Pf,y.numberValueAutogenerationSchema=dp,y.parallelExecutionOperation=Rr,y.parallelExecutionOperationError=qh,y.parallelExecutionOperationErrorParentRef=Zh,y.parallelExecutionOperationListOfExecutionResultsDataType=Sh,y.parallelExecutionOperationListOfExecutionResultsReturn=Rl,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Fh,y.parallelExecutionOperationListOfFunctionsArgument=bl,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Gh,y.parallelExecutionOperationListOfFunctionsArgumentRef=jh,y.parallelExecutionOperationListOfFunctionsBlueprint=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Lh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=Nh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Mh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Uh,y.parallelExecutionOperationRef=xh,y.parallelExecutionOperationRefThree=kh,y.persistedBuiltInBaseEntity=Ot,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=mE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=qP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=vE,y.persistedBuiltInBaseEntityDatabasePropertyRef=hE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=OE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=PE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=bE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=AE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=RE,y.processOutputGlobalValueDescriptorDataType=XE,y.processOutputGlobalValueDescriptorReturn=po,y.processOutputGlobalValueDescriptorReturnRef=KE,y.projectPublicationCompletedGlobalEvent=uo,y.propertyToZodSchema=hI,y.relationalDatabaseBuiltInBaseEntity=Nr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Wl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=pE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=uE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=cE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=lE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Jl,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=dE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=sE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=oE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=io,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=XT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=so,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=iE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=nE,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=ao,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=ZP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=no,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=eE,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=QT,y.resolveActionDescriptorName=Z1,y.resolveBaseEntityName=F1,y.resolveBuiltInBaseEntityDataTypeLabel=S1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Bd,y.resolveDataType=wd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=$c,y.resolveDataTypeLabel=Cd,y.resolveDefinitionEntityDataTypeLabel=G7,y.resolveEntityDataTypeLabel=j7,y.resolveEntityName=G,y.resolveFirstCallsSecond=Fq,y.resolveFirstWritesSecond=Sq,y.resolvePrimaryKeyProperty=nJ,y.resolvePrimitiveEntityName=k1,y.resolveSearchName=x1,y.resolveVariableScope=L7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=pm,y.sequentialExecutionOperationErrorParentRef=um,y.sequentialExecutionOperationListOfExecutionResultsDataType=om,y.sequentialExecutionOperationListOfExecutionResultsReturn=Dl,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=lm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=sm,y.sequentialExecutionOperationListOfFunctionsArgument=Al,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=am,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=dm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=nm,y.sequentialExecutionOperationListOfFunctionsBlueprint=im,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tm,y.softDeletePersistedEntityMethod=JP,y.softDeletePersistedEntityMethodParentRef=wE,y.sortCallsBasedOnExecutionDependencies=VO,y.sortChildrenEntitiesBasedOnExecutionDependencies=jq,y.splitListOperation=vl,y.splitListOperationError=nh,y.splitListOperationErrorParentRef=ih,y.splitListOperationFirstOutputListDataType=Wy,y.splitListOperationFirstOutputListReturn=Qy,y.splitListOperationFirstOutputListReturnParentRef=Xy,y.splitListOperationFirstOutputListReturnRef=ml,y.splitListOperationInputListArgument=zy,y.splitListOperationInputListArgumentParentRef=Yy,y.splitListOperationInputListArgumentRef=ky,y.splitListOperationInputListDataType=Zy,y.splitListOperationSecondOutputListDataType=eh,y.splitListOperationSecondOutputListReturn=rh,y.splitListOperationSecondOutputListReturnParentRef=th,y.splitListOperationSplitIndexArgument=Ky,y.splitListOperationSplitIndexArgumentParentRef=Hy,y.splitListOperationSplitIndexArgumentRef=qy,y.splitListOperationSplitIndexDataType=Jy,y.splitStringOperation=yl,y.splitStringOperationError=Ay,y.splitStringOperationErrorParentRef=Ry,y.splitStringOperationFirstPartResultStringDataType=cy,y.splitStringOperationFirstPartResultStringReturn=by,y.splitStringOperationFirstPartResultStringReturnParentRef=Iy,y.splitStringOperationFirstPartResultStringReturnRef=py,y.splitStringOperationIndexArgument=Ty,y.splitStringOperationIndexArgumentParentRef=vy,y.splitStringOperationIndexArgumentRef=ly,y.splitStringOperationIndexDataType=uy,y.splitStringOperationSecondPartResultStringDataType=yy,y.splitStringOperationSecondPartResultStringReturn=SP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ey,y.splitStringOperationSecondPartResultStringReturnRef=fy,y.splitStringOperationStringArgument=my,y.splitStringOperationStringArgumentParentRef=hy,y.splitStringOperationStringArgumentRef=oy,y.splitStringOperationStringDataType=dy,y.stringPrototype=ne,y.stringValueAutogenerationSchema=op,y.suggestNewIdForEntity=Ic,y.test_primitive_entities_export=kJ,y.toCamelCase=U7,y.toEntityState=nr,y.toKebabCase=G1,y.toLowerCaseKebabCase=Vd,y.toPascalCase=$7,y.untypedDataPrototype=At,y.updateErrorsList=Ye,y.updateValueReader=Qq,y.urlDefaultValue=Sm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=Tc,y.validateCalledByErrorIdInAction=Cq,y.validateCalledByIdInAction=Vq,y.validateCallers=hO,y.validateConditionEntityDeclaration=Mq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Bm,y.validateDataOperationDataToValidateArgumentParentRef=Cm,y.validateDataOperationDataToValidateArgumentRef=wm,y.validateDataOperationDataToValidateDataType=Vm,y.validateDataOperationEntityToMatchTypeArgument=Nm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=gm,y.validateDataOperationEntityToMatchTypeArgumentRef=_m,y.validateDataOperationEntityToMatchTypeDataType=Mm,y.validateDataOperationError=jm,y.validateDataOperationErrorParentRef=$m,y.validateDataOperationOutputEntityDeclaration=Um,y.validateDataOperationOutputEntityDeclarationParentRef=Lm,y.validateDefinitionEntityName=_d,y.validateEntryCaller=yO,y.validateErrorCaller=fO,y.validateFunctionCallDeclaration=vO,y.validateFunctionDeclarationName=hc,y.validateGeneratedEntityParentIsNotBuiltInEntity=Dq,y.validateGeneration=Rq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=Aq,y.validateLoopEntityDeclaration=gq,y.validateName=F7,y.validateOperationEntityDeclaration=TO,y.validatePropertyName=vc,y.validateReachability=fi,y.validateReadsValueInActionPayload=Bq,y.validateReferenceObject=Nd,y.validateReferenceToOne=wc,y.validateReferences=Et,y.validateReturnDeclarationName=Ec,y.validateSuccessCaller=cO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=gc,y.validateVariableDeclarationName=mc,y.validateVariableInternalCallUse=Nc,y.valueAutogenerationCurrentDateAndTimeSchema=KA,y.valueAutogenerationGenericSchema=Qo,y.valueAutogenerationOptions=up,y.valueAutogenerationOptionsSchema=HA,y.valueAutogenerationRandomBooleanSchema=sp,y.valueAutogenerationRandomDateBetweenSchema=sD,y.valueAutogenerationRandomDateFromSchema=nD,y.valueAutogenerationRandomDateSchema=rd,y.valueAutogenerationRandomDateUntilSchema=aD,y.valueAutogenerationRandomNumberBetweenSchema=eD,y.valueAutogenerationRandomNumberFromSchema=XA,y.valueAutogenerationRandomNumberSchema=ed,y.valueAutogenerationRandomNumberUntilSchema=QA,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=iD,y.valueAutogenerationRandomTextFromSchema=tD,y.valueAutogenerationRandomTextSchema=td,y.valueAutogenerationRandomTextUntilSchema=rD,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=ap,y.waitOperation=Ft,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=Yh,y.waitOperationMillisecondsNumberDataType=zh,y.waitOperationOperationError=Xh,y.waitOperationOperationErrorParentRef=Kh,y.waitOperationRef=Hh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
408
+ Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return u([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])].filter(e=>!!e.abstract))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${I.InvalidParentUpdate}`,code:I.InvalidParentUpdate,severity:D.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const p=new Map;for(const[h,c]of this.knownVersions||new Map){if(p.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)p.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const p=await this.APILoadVersion({},e);if(!p)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(p,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=B(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=B(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:p,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...p),d.push(...h);const{updated:c,added:v,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),r.push(...v),a.push(...E),d.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>w(t,this.project)),this.implements=this.initialData.implements.map(t=>w(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,p=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(c=>!p.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(V=>{var C;return((C=V.implements)==null?void 0:C.id)===c.id}))return;const E=this.properties.find(V=>V.name===c.name&&!!V.abstract&&!V.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,R.UUID.uuid());O.initChildren(e),r.push(O),e==null||e.add(O,b.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,p=l.filter(c=>l.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return p.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const v=c.clone(e,this,R.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{$5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=w(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),j5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.asFunctionDeclarationTransfer(d),l=w(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),l.inputs.forEach(p=>{p.suggestion=!0}),l.returnStatements.length){const p=l.returnStatements[0];p.suggestion=!0,p.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:p,removed:h,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...p),a.push(...h),d.push(...c)}),this.properties.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.methods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:p,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...p),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ct(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:R.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(p=>p.toJSONClone({...e,newId:null})),methods:this.methods.map(p=>p.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(p=>p.toJSONClone({...e,newId:null})),implements:this.implements.map(p=>p.type===n.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),extends:this.extends.map(p=>p.type===n.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toReference(e)),methods:this.methods.map(a=>a.toReference(e)),abstractMethods:this.abstractMethods.map(a=>a.toReference(e)),implements:this.implements.map(a=>a.toReference(e)),extends:this.extends.map(a=>a.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=U5(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var V,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const p=l.split("-id"),h=p[p.length-1||0]||l;o.id=l,o.version=R.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=lt(o,d);t&&c.setParent(t,null),a&&c.subscribe(),c.initChildren(e),e==null||e.add(c,b.Added);const v=(V=this.properties)==null?void 0:V.map(F=>F.clone(e,c,R.UUID.uuid(),a));c.properties=v;const E=(C=this.methods)==null?void 0:C.map((F,_)=>F.clone(e,c,h+"-method-"+_+"-id",a));c.methods=E;const O=(U=this.abstractMethods)==null?void 0:U.map((F,_)=>F.clone(e,c,h+"-abstract-method-"+_+"-id",a));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return u([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(c=>{l.find(E=>G(E,this.project)===G(c,this.project))||l.push(c)});const p=this.properties.filter(c=>!c.dataType);l.forEach(c=>{var U,F;const v=p.find(_=>G(_,this.project)===G(c,this.project));if(!v)return;const O=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),V=kr(O,t),C=V==null?void 0:V.clone(t,v,R.UUID.uuid(),!0);if(C){const _=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(_==null?void 0:_.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((F=_==null?void 0:_.self)==null?void 0:F.id)&&C.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,b.Added),v.setDataType(_.self),t==null||t.add(v,b.Updated))}c.setDeclaration(v),t==null||t.add(c,b.Updated)});const h=[];return l.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,j,k,W;const v=this.properties.find(ee=>G(ee,this.project)===G(c,this.project));if(v){if(c.setDeclaration(v),!v.getDataType(t)){const pe=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Te=kr(pe),K=Te==null?void 0:Te.clone(t,v,R.UUID.uuid(),!0);if(K){const se=(_=v.dataType)==null?void 0:_.merge(K,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),K.id!==((j=se==null?void 0:se.self)==null?void 0:j.id)&&K.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:R.UUID.uuid(),type:n.Property,version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:G(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=w(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,b.Added);const C=Pn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),U=kr(C),F=U==null?void 0:U.clone(t,O,R.UUID.uuid(),!0);if(F){const ee=(k=O.dataType)==null?void 0:k.merge(F,t);O.dataType&&(ee==null?void 0:ee.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),F.id!==((W=ee==null?void 0:ee.self)==null?void 0:W.id)&&F.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),O.setDataType(ee.self),t==null||t.add(O,b.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,b.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:u(r),updated:u(a),removed:u(d),affected:u(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let zi=Le;function uJ(i){const s=y6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Ls=class Ls extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>w(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await Ls.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=uJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=xd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ls&&e.push(...r.getAllInteractiveMethods())})),u(e)}};f(Ls,"repository",{APILoad:async(e,...t)=>null});let Yr=Ls;function pJ(i){const s=a6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const il=class il extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=w(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=w(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=w(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=L,...t){return await il.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=pJ(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Yr&&e.push(...r.getAllInteractiveMethods())}),u(e)}};f(il,"repository",{APILoad:async(e,...t)=>null});let ar=il;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new _n(i,s);case n.DefinitionEntity:return e||new zi(i,s);case n.PrimitiveEntity:return e||new ar(i,s);case n.FunctionDeclaration:return e||new Mi(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new Bi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new gi(i,s);case n.VariableDeclaration:return e||new $i(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new qr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Fi(i,s);case n.InputMap:return e||new Zr(i,s);case n.Project:return e||new R(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new _i(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new ji(i,s);case n.ValueDescriptor:return e||new Si(i,s);case n.BuiltInBaseEntity:return e||new Yr(i,s);case n.InternalCall:return e||new Bn(i,s);case n.ContinueStatement:return e||new jt(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function w(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function cJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return _n.fromGenerationTarget(i,s);case n.DefinitionEntity:return zi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return Mi.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return Bi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return gi.fromGenerationTarget(i,s);case n.VariableDeclaration:return $i.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return qr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Fi.fromGenerationTarget(i,s);case n.InputMap:return Zr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return _i.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return ji.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return Si.fromGenerationTarget(i,s);case n.InternalCall:return Bn.fromGenerationTarget(i,s);case n.ContinueStatement:return jt.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class PP{constructor(){f(this,"initialData")}}const L={cascade:!1},wP={APILoad:async(i,...s)=>null},fJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...wP};class yJ{}class hJ extends PP{}class mJ{}class vJ{}class TJ{}class Hc{}class EJ extends Hc{}class IJ extends Hc{}class bJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=w(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=w(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class gs{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=w(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=u([...r,...t]),s.writesValues}}class RJ{}const oe=class oe extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!oe.UUID||oe.UUID.isBackup)&&(oe.UUID=Uo==null?void 0:Uo()),oe.UUID||(oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),oe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){oe.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}async closePendingCallbacks(){for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await this.closeChangeSet(t)}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=oe.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new oe(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const p=new Map;for(const[h,c]of this.knownVersions||new Map){if(p.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[v,E]of c.knownVersions)p.set(v,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const p=await this.APILoadVersion({},e);if(!p)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new oe(p)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=w(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await oe.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await oe.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await oe.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await oe.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await oe.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await oe.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,oe.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+oe.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(a=>a.toReference(e)),functions:this.functions.map(a=>a.toReference(e)),events:this.events.map(a=>a.toReference(e)),projects:this.projects.map(a=>a.toReference(e)),variableDeclarations:this.variableDeclarations.map(a=>a.toReference(e)),variableInstances:this.variableInstances.map(a=>a.toReference(e)),conditions:this.conditions.map(a=>a.toReference(e)),operations:this.operations.map(a=>a.toReference(e)),functionCalls:this.functionCalls.map(a=>a.toReference(e)),loops:this.loops.map(a=>a.toReference(e)),searches:this.searches.map(a=>a.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=B5(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntityFromTransfer(e){const t=w(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=w(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=w(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=w(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=w(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=w(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=w(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=w(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=w(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=w(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=w(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return u([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(oe,"sessionAuthor",null),f(oe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(oe,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(oe,"type",n.Project),f(oe,"USER_MANAGED_PARENT_TYPES",[]),f(oe,"PARENT_TYPES",[...oe.USER_MANAGED_PARENT_TYPES]),f(oe,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(oe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(oe,"BASE_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"MUTABLE_META_PROPERTIES",[...oe.MUTABLE_BASE_PROPERTIES,"x","y"]),f(oe,"INMUTABLE_META_PROPERTIES",[...oe.INMUTABLE_BASE_PROPERTIES]),f(oe,"META_PROPERTIES",[...oe.MUTABLE_META_PROPERTIES,...oe.INMUTABLE_META_PROPERTIES]),f(oe,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(oe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(oe,"UPSTREAM_PROPERTIES",[...oe.MUTABLE_UPSTREAM_PROPERTIES,...oe.INMUTABLE_UPSTREAM_PROPERTIES]),f(oe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(oe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(oe,"DOWNSTREAM_PROPERTIES",[...oe.MUTABLE_DOWNSTREAM_PROPERTIES,...oe.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(oe,"PROPERTIES",[...oe.META_PROPERTIES,...oe.UPSTREAM_PROPERTIES,...oe.DOWNSTREAM_PROPERTIES]);let R=oe;var VP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(VP||{});class CP extends qe{constructor(e){super(Rr,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",Rr);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Rr.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Rr.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Rr.error?w(Rr.error,this.project):null}}class BP extends qe{constructor(e){super(Ft,e);f(this,"id",Ft.id);f(this,"name",Ft.name);f(this,"description",Ft.description);f(this,"version",Ft.version);f(this,"autoexecutable",!1);f(this,"initialData",Ft);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Ft.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Ft.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Ft.error?w(Ft.error,this.project):null}}class _P extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?w(ti.error,this.project):null}}class AJ extends qe{constructor(s){super(wa,s)}}class DJ extends qe{constructor(s){super(Xi,s)}}class OJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:c,updated:v,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const p=this.getDataToValidateInputMap(e);if(p){const{added:c,updated:v,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(p,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:v,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...c),d.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var p,h,c;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==S.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=w(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==S.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},V=w(O,e.project);V.setParent(e,t),V.initChildren(t),t==null||t.add(V,b.Added),r.push(V),e.setDataType(V)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,v,E;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==S.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const O={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},V=w(O,e.project);V.setParent(e,t),V.initChildren(t),t==null||t.add(V,b.Added),r.push(V),e.setDataType(V)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:p}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(p),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===S.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:p}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(p),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===S.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:u(d),added:u(a),removed:u(o),affected:u(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class PJ extends qe{constructor(s){super(hl,s)}}class wJ extends qe{constructor(s){super(vl,s)}}class VJ extends qe{constructor(s){super(Tl,s)}}class CJ extends qe{constructor(s){super(Zs,s)}}class BJ extends qe{constructor(s){super(Ss,s)}}class _J extends qe{constructor(s){super(Pa,s)}}function MJ(i){const s=[new _P(i),new CP(i),new BP(i),new AJ(i),new DJ(i),new OJ(i),new CJ(i),new PJ(i),new VJ(i),new wJ(i),new BJ(i),new _J(i),new qe(yl,i),new qe(fl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class MP extends Yr{constructor(e){super(Ot,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",Ot.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Ot.abstract);f(this,"static",Ot.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(t=>{const r=w(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=w(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=w(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>w(t,this.project))}}function gJ(i){const s=[new MP(i),new Yr(ga,i),new Yr(Nr,i),new Yr(oo,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function NJ(i){const s=[new ar(ne,i),new ar(Kr,i),new ar(me,i),new ar(ol,i),new ar(At,i),new ar(Xr,i),new ar(_r,i),new ar(Qr,i),new ar(jn,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function LJ(i){const s=[new qe(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function UJ(i){const s=[new qe(_a,i),new qe(mi,i),new qe(Ca,i),new qe(Sn,i),new qe(xn,i),new qe(Xs,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(ro,i),new qe(Ba,i),new qe(eo,i),new qe(_l,i),new qe(gl,i),new qe(Qs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function $J(i){const s=[new Si(po,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function jJ(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const gn={},el={},Ns={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function gP(i,{enrich:s}={enrich:!0}){const e=i.project,t=i.record,r=new Sd(e),a=new Set;t[e.id]=e,a.add(e.id);const d=T().toISOString();Object.values(t).forEach(p=>{!p||r.allBuiltInEntityIds.includes(p.id)||a.add(p.id)}),r.order=Array.from(a),r.flatRecord=t,r.orderEntities();const o=tl(i.project);o.instances[e.id]=o;const l=s?o.addChangeSet(new A(o,"",d,o)):null;return r.visit(p=>{if(p.id===o.id)return;const h=w(p,o);h.hydrateAncestors(),h.addSelfToProject(null)}),s?(r.visit(p=>{const h=o.get(p.id);h&&h.afterAllChildrenInitialized(l)}),o.afterAllChildrenInitialized(l)):rl(o,d).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(p=>{p.previousVersion=null}),l==null||l.close(),o}async function GJ(i,s=Ns){const e={...Ns,...s};if(e.empty)return{data:{project:{id:i.id,type:n.Project,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const r={...np};return r.id=i.id,{data:{project:r,record:{}}}}return console.log("Fetching project from external API"),new Promise(async r=>{if(e.onFetch){const a=await e.onFetch(i.id);if(a){r({data:a});return}}else r({data:null})})}function tl(i){const s=new R(i);return NJ(s),gJ(s),MJ(s),LJ(s),UJ(s),$J(s),jJ(s),Array.from(new Set([...s.getAllBuiltInIds(),...Vr()])).forEach(t=>{if(!s.builtInInstances[t]&&s.instances[t])s.builtInInstances[t]=s.instances[t],delete s.instances[t];else if(!s.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),s}function rl(i,s){return i.instancesList.filter(t=>T(t.createdAt).isAfter(T(s)||!!t.previousVersion))}function FJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Vr()]));Object.keys(i.instances).forEach(p=>{if(t.includes(p)){e.set(p,p);return}const h=i.get(p);if(!Qd(h,{...i.instances,...i.builtInInstances}).every(E=>!t.includes(E))){e.set(p,p);return}e.set(p,R.UUID.uuid())});const r=T().toISOString(),a=i.toShallowJSON({seenEntityMaps:e});a.previousVersion=null,a.createdAt=r,a.version=R.UUID.uuid();const d=tl(a),o=s?d.addChangeSet(new A(d,"",r,d)):null,l=new Sd(i);return l.visit(p=>{const h=p.toShallowJSON({seenEntityMaps:e});h.previousVersion=null,h.createdAt=r,h.version=R.UUID.uuid();const c=w(h,d);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,b.Added)}),s?(l.visit(p=>{const h=d.get(e.get(p.id));h&&h.afterAllChildrenInitialized(o)}),d.afterAllChildrenInitialized(o)):rl(d,r).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),d.instancesList.forEach(p=>{p.previousVersion=null}),o==null||o.close(),d}function NP(i,{enrich:s}={enrich:!0}){const e=tl(i),t=T().toISOString(),r=s?e.addChangeSet(new A(e,"",t,e)):null;r&&(r.type=bc.Automatic);const a=new Sd(i);return a.visit(d=>{const o=w(d,e);o.hydrateAncestors(),o.addSelfToProject(r)}),s?(a.visit(d=>{const o=e.get(d.id);o&&o.afterAllChildrenInitialized(r)}),e.afterAllChildrenInitialized(r)):rl(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),r==null||r.close(),e}async function SJ(i,s=Ns){const e={...Ns,...s};if(i.id&&gn[i.id]&&!e.ignoreCache)return gn[i.id];if(i.id&&el[i.id]&&!e.ignoreCache)return await el[i.id],gn[i.id];const t=GJ(i,e);i.id&&(el[i.id]=t);const r=await t;if(r.data){let a;return e.mock?a=NP(np,{enrich:!!e.enrich}):r.data instanceof R?a=r.data:a=gP(r.data,{enrich:!!e.enrich}),gn[i.id]=a,i.id&&delete el[i.id],a}return null}function xJ(i){return gn[i.id]&&delete gn[i.id],null}const kJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Mc,y.ALL_BUILT_IN_BASE_ENTITIES=NE,y.ALL_BUILT_IN_CONDITION_ENTITIES=YE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=HE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uT,y.ALL_BUILT_IN_LOOP_ENTITIES=lT,y.ALL_BUILT_IN_OPERATION_ENTITIES=b0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=lf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=eI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=QE,y.ActionDescriptorState=qe,y.ActionInputMapState=yq,y.ActionOutputMapState=vq,y.AppendToListOperationInputIds=vh,y.AppendToListOperationOutputIds=Th,y.ArgumentDeclarationDependencyField=aO,y.ArgumentDeclarationState=Fi,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Vc,y.BUILT_IN_BASE_ENTITY_IDS=S,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=mJ,y.BaseEntityNames=z,y.BaseState=hJ,y.BaseValueDescriptorIds=Fs,y.BreakStatementDependencyField=Ac,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=Yr,y.CACHED_PROJECTS_BY_ID=gn,y.CALLABLE_ENTITIES_EXPLANATION=Oq,y.CALLABLE_TYPES=Cr,y.CALLER_ENTITIES_EXPLANATION=uO,y.CALLER_TYPES=Br,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=JE,y.CONDITIONS=WE,y.CUSTOM_ENTITY_OPERATIONS=Gm,y.CallableEntityClass=TJ,y.CallerEntityClass=Hc,y.ChangeSet=A,y.ChangeSetChangeCaptureType=bc,y.ChangeSetEntityChangeType=b,y.ChildEntityState=vJ,y.ComparisonOperatorTypes=pt,y.ConditionDependencyField=Q1,y.ConditionState=Li,y.ContinueStatementDependencyField=Rc,y.ContinueStatementState=jt,y.CreateNewInputIds=fm,y.CreateNewOutputIds=ym,y.DRAGGABLE_CALLABLE_TYPES=sl,y.DRAGGABLE_CALLER_TYPES=ef,y.DRAGGABLE_ELEMENT_TYPES=Gs,y.DRAGGABLE_EXECUTABLE_TYPES=GP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=al,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=z1,y.DataTypeParentChildRelation=Rt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=OP,y.DefinitionEntityState=zi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=fJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ud,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=FP,y.ENTITY_WITH_DECLARATION_TYPES=$P,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=tf,y.ENTITY_WITH_PARENT_TYPES=LP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Xc,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=UP,y.ENTITY_WITH_VALUE_TYPES=Kc,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=jP,y.EXECUTION_OPERATIONS=cm,y.EntityAction=VP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=I,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=RJ,y.EntityWithValueClass=bJ,y.EntryPointEntityClass=EJ,y.ExecutionOperations=He,y.ExecutionTerminationType=K1,y.FunctionCallDependencyField=IO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=Y1,y.FunctionDeclarationState=Mi,y.GET_PROJECT_OPTIONS_DEFAULTS=Ns,y.GLOBAL_EVENT_DECLARATIONS=zE,y.GetLastInListOperationInputIds=ah,y.GetLastInListOperationOutputIds=sh,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=E0,y.InputMapDependencyField=iO,y.InputMapState=Zr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=rO,y.InternalCallState=Bn,y.JoinListOperationInputIds=Oy,y.JoinListOperationOutputIds=Py,y.LIST_OPERATIONS=_h,y.ListOperations=fe,y.LiteralValueDependencyField=sO,y.LiteralValueState=_n,y.LoopDependencyField=X1,y.LoopState=Ni,y.LoopTypes=X,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Gf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=I0,y.OperationDependencyField=H1,y.OperationState=gi,y.OutputMapDependencyField=nO,y.OutputMapParentChildRelation=Un,y.OutputMapState=qr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=$d,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=xi,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Qc,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=_c,y.ParallelExecutionOperation=CP,y.PassThroughCallableEntityClass=IJ,y.PersistedEntity=MP,y.PersistedEntityMethods=or,y.PrimitiveEntityState=ar,y.PrimitiveTypes=g,y.ProjectState=R,y.PropertyDependencyField=J1,y.PropertyState=Bi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=wP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Pq,y.ReturnDeclarationDependencyField=W1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=Md,y.ReturnStatementState=_i,y.STANDALONE_CONDITIONS=$E,y.STRING_OPERATIONS=Dy,y.ScopeCompatibilityType=Xd,y.SearchDependencyField=tO,y.SearchState=ji,y.SequentialExecutionOperation=_P,y.SequentialExecutionOperationInputIds=Qh,y.SequentialExecutionOperationOutputIds=em,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=PP,y.SplitListOperationInputIds=Sy,y.SplitListOperationOutputIds=xy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=Sd,y.USER_MANAGED_ENTITY_TYPES=rf,y.UserManagedEntityStateTemplate=yJ,y.VALUE_READING_ENTITIES_EXPLANATION=Bc,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=pO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Cc,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=oO,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=Si,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=gs,y.VariableDeclarationDependencyField=eO,y.VariableDeclarationState=$i,y.VariableInputMapState=fq,y.VariableInstanceDependencyField=Dc,y.VariableInstanceState=Ui,y.VariableOutputMapState=mq,y.WaitOperation=BP,y.WaitOperationInputIds=Jh,y.WaitOperationOutputIds=Wh,y.appendToListOperation=Zs,y.appendToListOperationElementToAppendArgument=Il,y.appendToListOperationElementToAppendArgumentParentRef=Ph,y.appendToListOperationElementToAppendArgumentRef=bh,y.appendToListOperationError=Bh,y.appendToListOperationErrorParentRef=Ch,y.appendToListOperationListArgument=El,y.appendToListOperationListArgumentParentRef=Oh,y.appendToListOperationListArgumentRef=Eh,y.appendToListOperationListDataType=Ih,y.appendToListOperationResultListDataType=Dh,y.appendToListOperationResultListReturn=Vh,y.appendToListOperationResultListReturnParentRef=wh,y.appendToListOperationResultListReturnRef=Ah,y.appendToListOperationSecondListDataType=Rh,y.asGenerationActionExample=Jr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=Z7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=g1,y.checkArePropertiesCompatibleAsDataType=M1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Lq,y.checkIsCallableEntityReachable=Ms,y.checkIsCanvasEntity=eJ,y.checkIsDetachedBranch=EP,y.checkIsDetachedBranchShallow=Yc,y.checkIsGlobalVariable=Kq,y.checkIsGloballyDeclared=Wc,y.checkIsMethod=RP,y.checkIsNestedScope=Kd,y.checkScopeCompatibility=_s,y.cloneProject=FJ,y.countedLoopActionDescriptor=_a,y.countedLoopActionDescriptorDynamicReturnDeclaration=tT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,y.countedLoopActionDescriptorStringArgumentDeclaration=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=zv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=Yv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Xv,y.countedLoopBodyActionDescriptor=ro,y.countedLoopBodyActionDescriptorAnyDynamicArgument=sT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=aT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=dT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ll,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=nT,y.createDefinitionEntityFromJSONObject=kd,y.createEntityError=ye,y.createNestedDataTypeForEntity=AO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=Rm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Em,y.createNewInstanceOperationEntityToInstanciateDataType=Im,y.createNewInstanceOperationError=Pm,y.createNewInstanceOperationErrorParentRef=Om,y.createNewInstanceOperationNewEntityDataArgument=Tm,y.createNewInstanceOperationNewEntityDataArgumentDataType=vm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=hm,y.createNewInstanceOperationOutputEntityDeclaration=Dm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Am,y.createNewInstanceOperationRef=bm,y.createSemanticId=q1,y.createStateFromGenerationTargetType=cJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=w,y.cronJobBuiltInBaseEntity=oo,y.cronJobBuiltInBaseEntityExpressionProperty=ME,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=BE,y.cronJobBuiltInBaseEntityRef=_E,y.cronJobTriggeredFunctionDeclarationBlueprint=zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=VE,y.dataTypeCompatibilityToErrorExplanation=EO,y.datePrototype=_r,y.dateValueAutogenerationSchema=lp,y.definitionEntityToZodSchema=mI,y.deletePersistedEntityMethod=Yl,y.deletePersistedEntityMethodParentRef=fE,y.deleteRootProject=xJ,y.endpointBuiltInBaseEntity=ga,y.endpointBuiltInBaseEntityRef=yT,y.endpointBuiltInBaseEntityRefFour=zT,y.endpointBuiltInBaseEntityRefThree=AT,y.endpointBuiltInBaseEntityRefTwo=ET,y.endpointBuiltInCorsProperty=hT,y.endpointBuiltInCorsPropertyDataType=fT,y.endpointBuiltInCorsPropertyDataTypeRef=pT,y.endpointBuiltInCorsPropertyRef=cT,y.endpointBuiltInMethodProperty=$l,y.endpointBuiltInMethodPropertyDataType=RT,y.endpointBuiltInMethodPropertyDataTypeRef=IT,y.endpointBuiltInMethodPropertyRef=bT,y.endpointBuiltInPathProperty=Ul,y.endpointBuiltInPathPropertyDataType=TT,y.endpointBuiltInPathPropertyDataTypeRef=mT,y.endpointBuiltInPathPropertyRef=vT,y.endpointPathParamsArgumentDeclaration=Gl,y.endpointPathParamsArgumentDeclarationRef=gT,y.endpointPathParamsVariableDataType=NT,y.endpointPathParamsVariableDataTypeRef=MT,y.endpointReachedTriggerActionDescriptor=ql,y.endpointReachedTriggerActionDescriptorRef=LT,y.endpointReachedTriggerActionDescriptorRefFour=jT,y.endpointReachedTriggerActionDescriptorRefThree=$T,y.endpointReachedTriggerActionDescriptorRefTwo=UT,y.endpointRequestBodyArgumentDeclaration=Sl,y.endpointRequestBodyArgumentDeclarationRef=wT,y.endpointRequestBodyVariableDataType=VT,y.endpointRequestHeadersArgumentDeclaration=jl,y.endpointRequestHeadersArgumentDeclarationRef=OT,y.endpointRequestHeadersVariableDataType=PT,y.endpointRequestHeadersVariableDataTypeRef=DT,y.endpointRequestQueryParamsArgumentDeclaration=Fl,y.endpointRequestQueryParamsArgumentDeclarationRef=BT,y.endpointRequestQueryParamsVariableDataType=_T,y.endpointRequestQueryParamsVariableDataTypeRef=CT,y.endpointResponseBodyDataType=WT,y.endpointResponseBodyReturnDeclaration=Zl,y.endpointResponseBodyReturnDeclarationRef=JT,y.endpointResponseCodeDataType=FT,y.endpointResponseCodeReturnDeclaration=xl,y.endpointResponseCodeReturnDeclarationRef=GT,y.endpointResponseHeadersDataType=ZT,y.endpointResponseHeadersDataTypeRef=xT,y.endpointResponseHeadersReturnDeclaration=kl,y.endpointResponseHeadersReturnDeclarationRef=kT,y.endpointReturnStatementRef=ST,y.endpointReturnStatementRefThree=YT,y.endpointReturnStatementRefTwo=qT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=df,y.enumOptionsPropertyDataType=sf,y.enumOptionsPropertyDataTypeRef=nf,y.enumOptionsPropertyRef=af,y.enumPrototype=Xr,y.enumPrototypeRef=of,y.executionBuiltInBaseEntity=lo,y.executionBuiltInEntityAbortMethod=Hl,y.executionBuiltInEntityAbortMethodParentRef=gE,y.filterOutDuplicateEntities=u,y.filterOutDuplicateErrors=H9,y.findEntityFromKeys=Uc,y.findReferenceToSelfInList=jO,y.findReferencesToSelfInProject=Zq,y.flattenActionDescriptor=GO,y.flattenArgumentDeclaration=FO,y.flattenBreakStatement=SO,y.flattenBuiltInBaseEntity=xO,y.flattenCalls=Wr,y.flattenCanvasAncestorsUntil=Zd,y.flattenCondition=kO,y.flattenContinueStatement=ZO,y.flattenDataType=JO,y.flattenDefinitionEntity=qO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Zc,y.flattenDefinitionEntityExtensionTypes=Hd,y.flattenDefinitionEntityExtensions=xc,y.flattenDefinitionEntityImplementations=kc,y.flattenDefinitionEntityImplementionTypes=zd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=bP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=kq,y.flattenEntity=N,y.flattenFunctionCall=WO,y.flattenFunctionDeclaration=YO,y.flattenGlobalEvent=zO,y.flattenInputMap=HO,y.flattenInstalledProject=KO,y.flattenInternalCall=XO,y.flattenLiteralValue=QO,y.flattenLoop=eP,y.flattenOperation=tP,y.flattenOutputMap=rP,y.flattenPrimitiveEntity=iP,y.flattenProject=nP,y.flattenProjectElements=$O,y.flattenProperty=aP,y.flattenRelatedCanvasElementsOnTheLeft=vP,y.flattenRelatedCanvasElementsOnTheRight=mP,y.flattenReturnDeclaration=sP,y.flattenReturnStatement=oP,y.flattenSearch=dP,y.flattenValueDescriptor=lP,y.flattenVariableDeclaration=uP,y.flattenVariableInstance=pP,y.flattenVariableReads=UO,y.flattenVariableWrites=LO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=dJ,y.fromZodParseToEntityGenerationErrors=Oc,y.generate=KV,y.generateActionExample=wq,y.generateExecutionDataType=N7,y.generateIdFromStrategy=ct,y.generateMutablePropertiesExplanation=gd,y.generateRandomBoolean=kI,y.generateRandomDate=II,y.generateRandomDateAfter=vI,y.generateRandomDateBefore=TI,y.generateRandomDateBetweenRange=EI,y.generateRandomNumber=jI,y.generateRandomNumberAfter=LI,y.generateRandomNumberBefore=UI,y.generateRandomNumberBetweenRange=$I,y.generateRandomText=xI,y.generateRandomTextAfter=GI,y.generateRandomTextBefore=FI,y.generateRandomTextBetweenRange=SI,y.generateUniqueUUID=NI,y.getAllActionDescriptorsForConditions=Fd,y.getAllActionDescriptorsForGlobalEvents=jd,y.getAllActionDescriptorsForLoops=Gd,y.getAllActionDescriptorsForOperations=_q,y.getAllBuiltInEntityIds=Vr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=mO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=dO,y.getBuiltInEntityOwner=Yi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=ID,y.getCalledBy=fr,y.getCallerEntityReferenceSchema=e5,y.getCallerEntityTypeSchema=Q3,y.getCalls=Gc,y.getCanvasEntitiesDerivedFromInternalCalls=hP,y.getCanvasEntitiesDerivedFromWrites=Ra,y.getCanvasEntityDerivedFromValueReadingEntity=Yd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=yP,y.getCanvasEntityReferenceSchema=v5,y.getCanvasEntityTypeSchema=m5,y.getChildrenEntityWithValues=$q,y.getColumnProperties=aJ,y.getCommonAncestor=jc,y.getCommonChildren=DO,y.getDatabaseEntities=iJ,y.getDatabaseEntity=sJ,y.getDeclaration=Pn,y.getDeepestScope=DP,y.getDefinitionEntityExtends=Aa,y.getDraggableCallableEntityReferenceSchema=RD,y.getDraggableCallableEntityTypeSchema=bD,y.getDraggableCallerEntityReferenceSchema=r5,y.getDraggableCallerEntityTypeSchema=t5,y.getDraggableExecutableEntityReferenceSchema=s5,y.getDraggableExecutableEntityTypeSchema=a5,y.getDraggablePassThroughCallableEntityReferenceSchema=Td,y.getDraggablePassThroughCallableEntityTypeSchema=vd,y.getDraggablePlayableEntityReferenceSchema=p5,y.getDraggablePlayableEntityTypeSchema=u5,y.getEntitiesCreatedSinceInitialization=rl,y.getEntityArgumentDeclarations=Sc,y.getEntityInputMaps=cP,y.getEntityOutputMaps=Yq,y.getEntityReferenceSchema=h5,y.getEntityReturnDeclarations=fP,y.getEntityTypeSchema=y5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=o5,y.getEntityWithValueReferenceSchema=ED,y.getEntityWithValueTypeSchema=X3,y.getEntryPointEntityReferenceSchema=bt,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=hd,y.getEventEntityTypeSchema=yd,y.getExecutableEntityReferenceSchema=n5,y.getExecutableEntityTypeSchema=i5,y.getExtendedBuiltInEntity=zq,y.getExtendedDefinitionEntity=qc,y.getGenerationTargetSchemaBasedOnType=lO,y.getHeadIfPartOfDetachedBranch=IP,y.getHighestScope=AP,y.getImplementedBuiltInEntity=Hq,y.getIsInteractive=Jc,y.getLastInListOperation=Tl,y.getLastInListOperationError=mh,y.getLastInListOperationErrorParentRef=hh,y.getLastInListOperationInputListArgument=ch,y.getLastInListOperationInputListArgumentParentRef=ph,y.getLastInListOperationInputListArgumentRef=oh,y.getLastInListOperationInputListDataType=dh,y.getLastInListOperationOutputElementDataType=uh,y.getLastInListOperationOutputElementReturn=yh,y.getLastInListOperationOutputElementReturnParentRef=fh,y.getLastInListOperationOutputElementReturnRef=lh,y.getLinkedEntitiesFromArgumentDeclaration=xq,y.getLowestPersistedEntityImplementation=TP,y.getParentCallableEntity=OO,y.getParentCallerEntity=wO,y.getParentCanvasEntities=Yt,y.getParentCanvasEntity=wt,y.getParentCanvasEntityFromTransfer=qd,y.getParentEntryPoint=Uq,y.getParentPassthroughCallableEntity=PO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=md,y.getPeristedEntities=rJ,y.getPlayableEntityReferenceSchema=l5,y.getPlayableEntityTypeSchema=d5,y.getProject=SJ,y.getPrototypeByType=Bs,y.getRecusriveParentsIds=Qd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Ld,y.getReferencedEntityStateOrErrors=Pc,y.getReferencedIds=Wd,y.getRelatedCanvasElementsOnTheLeft=Mn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=qq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=zc,y.getScopeOwner=zt,y.getStateClassFromType=oJ,y.getTerminationReferenceSchema=f5,y.getTerminationTypeSchema=c5,y.getUsedArgFromDeclaration=Jq,y.getUsedReturnFromDeclaration=Wq,y.getValueReadingEntityReferenceSchema=TD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=K3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=CO,y.getVariableFromReturnVariablePointer=MO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=Jd,y.getVariablesFromInputMaps=BO,y.getVariablesFromOutputMapping=gO,y.getVariablesFromOutputMaps=NO,y.getVariablesFromReturnDeclarations=_O,y.getVariablesInSameOrHigherScope=yc,y.getWrites=Fc,y.groupCallsBasedOnParallelizableExecution=Gq,y.handleAfterEntityImplementationSideEffects=RO,y.handleBeforeEntityImplementationSideEffects=bO,y.httpRequestBodyArgument=Ys,y.httpRequestBodyArgumentRef=Xm,y.httpRequestBodyDataType=Qm,y.httpRequestHeadersArgument=Ws,y.httpRequestHeadersArgumentRef=Hm,y.httpRequestHeadersDataType=Km,y.httpRequestMethodArgument=qs,y.httpRequestMethodArgumentRef=Ym,y.httpRequestMethodDataType=zm,y.httpRequestMethodDataTypeRef=Jm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=Pl,y.httpRequestOperationErrorValueDescriptorDatatype=T0,y.httpRequestOperationErrorValueDescriptorRef=v0,y.httpRequestOperationRef=f0,y.httpRequestOperationRefEight=h0,y.httpRequestOperationRefFive=p0,y.httpRequestOperationRefFour=u0,y.httpRequestOperationRefNine=m0,y.httpRequestOperationRefSeven=y0,y.httpRequestOperationRefSix=c0,y.httpRequestOperationRefThree=l0,y.httpRequestOperationRefTwo=d0,y.httpRequestQueryParamsArgument=Ol,y.httpRequestQueryParamsArgumentRef=Zm,y.httpRequestQueryParamsDataType=qm,y.httpRequestVariableURLArgument=Js,y.httpRequestVariableURLArgumentRef=xm,y.httpRequestVariableURLDataType=km,y.httpRequestVariableURLDataTypeRef=Fm,y.httpResponseBodyReturnDataType=o0,y.httpResponseBodyReturnDataTypeRef=a0,y.httpResponseBodyReturnReturn=Ks,y.httpResponseBodyReturnReturnRef=s0,y.httpResponseCodeDataType=t0,y.httpResponseCodeReturn=zs,y.httpResponseCodeReturnRef=e0,y.httpResponseHeadersDataType=n0,y.httpResponseHeadersDataTypeRef=r0,y.httpResponseHeadersReturn=Hs,y.httpResponseHeadersReturnRef=i0,y.implement=xd,y.inferArgumentDeclarationDataType=N1,y.inferDataType=kr,y.inferInputMapDataType=pc,y.inferOutputMapDataType=fc,y.inferPropertyDataType=$1,y.inferReturnDeclarationDataType=cc,y.inferValueDescriptorDataType=j1,y.inferVariableDeclarationDataType=U1,y.inferVariableInstanceDataType=L1,y.initBaseProjectEntity=tl,y.initProject=NP,y.initProjectFromFetchResult=gP,y.isPromise=Lc,y.iterateOverListActionDescriptorListArgumentDeclaration=X0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=H0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=z0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=K0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=ev,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Q0,y.iterateOverListLoopBodyActionDescriptor=Ba,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=lv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=uv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=to,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=tv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=yv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopActionDescriptor=Sn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Tv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=vv,y.iterateOverObjectKeysLoopBodyActionDescriptor=_l,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=wv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Bl,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Dv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Nv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Mv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=_v,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=gv,y.iterateOverObjectValuesLoopActionDescriptor=xn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Uv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptor=gl,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ml,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=xv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=$0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=L0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=g0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=M0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=N0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=eo,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=q0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=J0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Vl,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=G0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=j0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=F0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Cl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=x0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=S0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=k0,y.joinListOperation=hl,y.joinListOperationError=Fy,y.joinListOperationErrorParentRef=Gy,y.joinListOperationFirstListArgument=Ny,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=wy,y.joinListOperationFirstListDataType=Vy,y.joinListOperationResultListDataType=My,y.joinListOperationResultListReturn=jy,y.joinListOperationResultListReturnParentRef=$y,y.joinListOperationResultListReturnRef=_y,y.joinListOperationSecondListArgument=Uy,y.joinListOperationSecondListArgumentParentRef=Ly,y.joinListOperationSecondListArgumentRef=Cy,y.joinListOperationSecondListDataType=By,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=sy,y.joinStringsOperationDynamicStringArgumentParentRef=ay,y.joinStringsOperationDynamicStringArgumentRef=iy,y.joinStringsOperationDynamicStringDataType=ny,y.joinStringsOperationError=ry,y.joinStringsOperationErrorParentRef=ty,y.joinStringsOperationFirstStringArgument=xs,y.joinStringsOperationFirstStringArgumentParentRef=Jf,y.joinStringsOperationFirstStringArgumentRef=Ff,y.joinStringsOperationFirstStringDataType=Sf,y.joinStringsOperationResultStringDataType=qf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=ey,y.joinStringsOperationResultStringReturnRef=Zf,y.joinStringsOperationSecondStringArgument=ks,y.joinStringsOperationSecondStringArgumentParentRef=Qf,y.joinStringsOperationSecondStringArgumentRef=xf,y.joinStringsOperationSecondStringDataType=kf,y.joinStringsOperationSeparatorStringArgument=Xf,y.joinStringsOperationSeparatorStringArgumentParentRef=Kf,y.joinStringsOperationSeparatorStringArgumentRef=Wf,y.joinStringsOperationSeparatorStringDataType=Hf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=zf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Yf,y.keyValuePrototype=jn,y.lowercaseFirstLetter=Pd,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=wl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=O0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=D0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=P0,y.manualFlowLoopActionDescriptor=Xs,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=A0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=R0,y.manualFlowLoopBodyActionDescriptor=Qs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=V0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=w0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=C0,y.mapActionDescriptorToTypeItRepresents=tJ,y.mergeEntityErrorsList=K9,y.mergeListOfEntities=Xq,y.methodDefaultValue=Wm,y.mockClientProject=np,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=SE,y.moreThanOrEqualConditionLeftHandArgumentDataType=GE,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=jE,y.moreThanOrEqualConditionLeftHandArgumentParentRef=FE,y.moreThanOrEqualConditionRightHandArgument=qE,y.moreThanOrEqualConditionRightHandArgumentDataType=kE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=xE,y.moreThanOrEqualConditionRightHandArgumentParentRef=ZE,y.notEmptyCondition=an,y.notEmptyConditionArgument=UE,y.notEmptyConditionRef=LE,y.nullPrototype=ol,y.numberAdditionOperation=Ss,y.numberAdditionOperationDynamicSummandArgument=Rf,y.numberAdditionOperationDynamicSummandArgumentType=bf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=If,y.numberAdditionOperationError=Ef,y.numberAdditionOperationErrorParentRef=Tf,y.numberAdditionOperationFirstNumberArgument=dl,y.numberAdditionOperationFirstNumberArgumentRef=uf,y.numberAdditionOperationFirstNumberDataType=pf,y.numberAdditionOperationRef=mf,y.numberAdditionOperationRefThree=ul,y.numberAdditionOperationRefTwo=vf,y.numberAdditionOperationResultNumberDataType=hf,y.numberAdditionOperationResultNumberReturn=pl,y.numberAdditionOperationResultNumberReturnRef=yf,y.numberAdditionOperationSecondNumberArgument=ll,y.numberAdditionOperationSecondNumberArgumentRef=cf,y.numberAdditionOperationSecondNumberDataType=ff,y.numberPrototype=me,y.numberSubtractionOperation=fl,y.numberSubtractionOperationDynamicSubtrahendArgument=jf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=$f,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Uf,y.numberSubtractionOperationError=Lf,y.numberSubtractionOperationErrorParentRef=Nf,y.numberSubtractionOperationFirstNumberArgument=Cf,y.numberSubtractionOperationFirstNumberArgumentRef=Af,y.numberSubtractionOperationFirstNumberDataType=Df,y.numberSubtractionOperationRef=cl,y.numberSubtractionOperationRefThree=Mf,y.numberSubtractionOperationRefTwo=Bf,y.numberSubtractionOperationResultNumberDataType=Vf,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=wf,y.numberSubtractionOperationSecondNumberArgument=_f,y.numberSubtractionOperationSecondNumberArgumentRef=Of,y.numberSubtractionOperationSecondNumberDataType=Pf,y.numberValueAutogenerationSchema=dp,y.parallelExecutionOperation=Rr,y.parallelExecutionOperationError=qh,y.parallelExecutionOperationErrorParentRef=Zh,y.parallelExecutionOperationListOfExecutionResultsDataType=Sh,y.parallelExecutionOperationListOfExecutionResultsReturn=Rl,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Fh,y.parallelExecutionOperationListOfFunctionsArgument=bl,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Gh,y.parallelExecutionOperationListOfFunctionsArgumentRef=jh,y.parallelExecutionOperationListOfFunctionsBlueprint=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Lh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=Nh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Mh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Uh,y.parallelExecutionOperationRef=xh,y.parallelExecutionOperationRefThree=kh,y.persistedBuiltInBaseEntity=Ot,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=mE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=qP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=vE,y.persistedBuiltInBaseEntityDatabasePropertyRef=hE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=OE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=PE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=bE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=AE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=RE,y.processOutputGlobalValueDescriptorDataType=XE,y.processOutputGlobalValueDescriptorReturn=po,y.processOutputGlobalValueDescriptorReturnRef=KE,y.projectPublicationCompletedGlobalEvent=uo,y.propertyToZodSchema=hI,y.relationalDatabaseBuiltInBaseEntity=Nr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Wl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=pE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=uE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=cE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=lE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Jl,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=dE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=sE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=oE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=io,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=XT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=so,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=iE,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=nE,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=ao,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=ZP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=no,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=eE,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=QT,y.resolveActionDescriptorName=Z1,y.resolveBaseEntityName=F1,y.resolveBuiltInBaseEntityDataTypeLabel=S1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Bd,y.resolveDataType=wd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=$c,y.resolveDataTypeLabel=Cd,y.resolveDefinitionEntityDataTypeLabel=G7,y.resolveEntityDataTypeLabel=j7,y.resolveEntityName=G,y.resolveFirstCallsSecond=Fq,y.resolveFirstWritesSecond=Sq,y.resolvePrimaryKeyProperty=nJ,y.resolvePrimitiveEntityName=k1,y.resolveSearchName=x1,y.resolveVariableScope=L7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=pm,y.sequentialExecutionOperationErrorParentRef=um,y.sequentialExecutionOperationListOfExecutionResultsDataType=om,y.sequentialExecutionOperationListOfExecutionResultsReturn=Dl,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=lm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=sm,y.sequentialExecutionOperationListOfFunctionsArgument=Al,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=am,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=dm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=nm,y.sequentialExecutionOperationListOfFunctionsBlueprint=im,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tm,y.softDeletePersistedEntityMethod=JP,y.softDeletePersistedEntityMethodParentRef=wE,y.sortCallsBasedOnExecutionDependencies=VO,y.sortChildrenEntitiesBasedOnExecutionDependencies=jq,y.splitListOperation=vl,y.splitListOperationError=nh,y.splitListOperationErrorParentRef=ih,y.splitListOperationFirstOutputListDataType=Wy,y.splitListOperationFirstOutputListReturn=Qy,y.splitListOperationFirstOutputListReturnParentRef=Xy,y.splitListOperationFirstOutputListReturnRef=ml,y.splitListOperationInputListArgument=zy,y.splitListOperationInputListArgumentParentRef=Yy,y.splitListOperationInputListArgumentRef=ky,y.splitListOperationInputListDataType=Zy,y.splitListOperationSecondOutputListDataType=eh,y.splitListOperationSecondOutputListReturn=rh,y.splitListOperationSecondOutputListReturnParentRef=th,y.splitListOperationSplitIndexArgument=Ky,y.splitListOperationSplitIndexArgumentParentRef=Hy,y.splitListOperationSplitIndexArgumentRef=qy,y.splitListOperationSplitIndexDataType=Jy,y.splitStringOperation=yl,y.splitStringOperationError=Ay,y.splitStringOperationErrorParentRef=Ry,y.splitStringOperationFirstPartResultStringDataType=cy,y.splitStringOperationFirstPartResultStringReturn=by,y.splitStringOperationFirstPartResultStringReturnParentRef=Iy,y.splitStringOperationFirstPartResultStringReturnRef=py,y.splitStringOperationIndexArgument=Ty,y.splitStringOperationIndexArgumentParentRef=vy,y.splitStringOperationIndexArgumentRef=ly,y.splitStringOperationIndexDataType=uy,y.splitStringOperationSecondPartResultStringDataType=yy,y.splitStringOperationSecondPartResultStringReturn=SP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ey,y.splitStringOperationSecondPartResultStringReturnRef=fy,y.splitStringOperationStringArgument=my,y.splitStringOperationStringArgumentParentRef=hy,y.splitStringOperationStringArgumentRef=oy,y.splitStringOperationStringDataType=dy,y.stringPrototype=ne,y.stringValueAutogenerationSchema=op,y.suggestNewIdForEntity=Ic,y.test_primitive_entities_export=kJ,y.toCamelCase=U7,y.toEntityState=nr,y.toKebabCase=G1,y.toLowerCaseKebabCase=Vd,y.toPascalCase=$7,y.untypedDataPrototype=At,y.updateErrorsList=Ye,y.updateValueReader=Qq,y.urlDefaultValue=Sm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=Tc,y.validateCalledByErrorIdInAction=Cq,y.validateCalledByIdInAction=Vq,y.validateCallers=hO,y.validateConditionEntityDeclaration=Mq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Bm,y.validateDataOperationDataToValidateArgumentParentRef=Cm,y.validateDataOperationDataToValidateArgumentRef=wm,y.validateDataOperationDataToValidateDataType=Vm,y.validateDataOperationEntityToMatchTypeArgument=Nm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=gm,y.validateDataOperationEntityToMatchTypeArgumentRef=_m,y.validateDataOperationEntityToMatchTypeDataType=Mm,y.validateDataOperationError=jm,y.validateDataOperationErrorParentRef=$m,y.validateDataOperationOutputEntityDeclaration=Um,y.validateDataOperationOutputEntityDeclarationParentRef=Lm,y.validateDefinitionEntityName=_d,y.validateEntryCaller=yO,y.validateErrorCaller=fO,y.validateFunctionCallDeclaration=vO,y.validateFunctionDeclarationName=hc,y.validateGeneratedEntityParentIsNotBuiltInEntity=Dq,y.validateGeneration=Rq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=Aq,y.validateLoopEntityDeclaration=gq,y.validateName=F7,y.validateOperationEntityDeclaration=TO,y.validatePropertyName=vc,y.validateReachability=fi,y.validateReadsValueInActionPayload=Bq,y.validateReferenceObject=Nd,y.validateReferenceToOne=wc,y.validateReferences=Et,y.validateReturnDeclarationName=Ec,y.validateSuccessCaller=cO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=gc,y.validateVariableDeclarationName=mc,y.validateVariableInternalCallUse=Nc,y.valueAutogenerationCurrentDateAndTimeSchema=KA,y.valueAutogenerationGenericSchema=Qo,y.valueAutogenerationOptions=up,y.valueAutogenerationOptionsSchema=HA,y.valueAutogenerationRandomBooleanSchema=sp,y.valueAutogenerationRandomDateBetweenSchema=sD,y.valueAutogenerationRandomDateFromSchema=nD,y.valueAutogenerationRandomDateSchema=rd,y.valueAutogenerationRandomDateUntilSchema=aD,y.valueAutogenerationRandomNumberBetweenSchema=eD,y.valueAutogenerationRandomNumberFromSchema=XA,y.valueAutogenerationRandomNumberSchema=ed,y.valueAutogenerationRandomNumberUntilSchema=QA,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=iD,y.valueAutogenerationRandomTextFromSchema=tD,y.valueAutogenerationRandomTextSchema=td,y.valueAutogenerationRandomTextUntilSchema=rD,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=ap,y.waitOperation=Ft,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=Yh,y.waitOperationMillisecondsNumberDataType=zh,y.waitOperationOperationError=Xh,y.waitOperationOperationErrorParentRef=Kh,y.waitOperationRef=Hh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
@@ -17,7 +17,8 @@ export interface IGetProjectOptions {
17
17
  mock?: boolean;
18
18
  baseUrl?: string;
19
19
  ignoreCache?: boolean;
20
- onFetch?: (projectId: EntityId) => Promise<ProjectFetchResult>;
20
+ onFetch?: (projectId: EntityId) => Promise<ProjectFetchResult | ProjectState>;
21
+ manuallyInit?: boolean;
21
22
  }
22
23
  export declare const GET_PROJECT_OPTIONS_DEFAULTS: IGetProjectOptions;
23
24
  export declare function initProjectFromFetchResult(result: IProjectFetchResult, { enrich }?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6180",
3
+ "version": "0.0.6181",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",