@elyx-code/project-logic-tree 0.0.6874 → 0.0.6875

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
46
46
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
47
47
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writers of its inputs, or the value readers of its outputs.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="loop-parent-field"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="loop-parent-field"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){var i,r,a,c,e,f,h,m,E,b,A,_,N;return(i=this.parent)==null||i.unsubscribeDependents([{entity:this,field:"loop-parent-field"}]),(c=(a=(r=this.dataType)==null?void 0:r.entity)==null?void 0:a.unsubscribeDependents)==null||c.call(a,[{entity:this,field:"loop-data-type-entity-field"}]),(f=(e=this.dataType)==null?void 0:e.unsubscribeDependents)==null||f.call(e,[{entity:this,field:"loop-data-type-field"}]),(b=(E=(m=(h=this.body)==null?void 0:h.dataType)==null?void 0:m.entity)==null?void 0:E.unsubscribeDependents)==null||b.call(E,[{entity:this,field:"loop-body-data-type-entity-field"}]),(N=(_=(A=this.body)==null?void 0:A.dataType)==null?void 0:_.unsubscribeDependents)==null||N.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}subscribeToDependencies(){var i,r,a,c,e,f,h,m,E,b,A,_,N;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"loop-parent-field"}]),(c=(a=(r=this.dataType)==null?void 0:r.entity)==null?void 0:a.subscribeDependents)==null||c.call(a,[{entity:this,field:"loop-data-type-entity-field"}]),(f=(e=this.dataType)==null?void 0:e.subscribeDependents)==null||f.call(e,[{entity:this,field:"loop-data-type-field"}]),(b=(E=(m=(h=this.body)==null?void 0:h.dataType)==null?void 0:m.entity)==null?void 0:E.subscribeDependents)==null||b.call(E,[{entity:this,field:"loop-body-data-type-entity-field"}]),(N=(_=(A=this.body)==null?void 0:A.dataType)==null?void 0:_.subscribeDependents)==null||N.call(_,[{entity:this,field:"loop-body-data-type-field"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new Xt(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Xt(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.error=this.error,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.declaration=this.declaration,i.body=this.body,i.calledByEntry=[...this.calledByEntry],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.writesValues=[...this.writesValues],i.dataType=this.dataType,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,N]of A.knownVersions)E.set(_,N);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Xt(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.inputs=[...h.inputs],this.outputs=[...h.outputs],this.error=h.error,this.successCalls=[...h.successCalls],this.errorCalls=[...h.errorCalls],this.declaration=h.declaration,this.body=h.body,this.calledBySuccess=[...h.calledBySuccess],this.calledByError=[...h.calledByError],this.calledByEntry=[...h.calledByEntry],this.writesValues=[...h.writesValues],this.dataType=h.dataType,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const a=te(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const a=te(i.declaration),c=this.project.get(a);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addEntryCaller(e,r),e.addCall(this,r))}),[...this.calledByEntry].forEach(a=>{i.calledByEntry.find(e=>te(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledBySuccess.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addSuccessCaller(e,r),e.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(a=>{i.calledBySuccess.find(e=>te(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.calledByError.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addErrorCaller(e,r),e.addErrorCall(this,r))}),[...this.calledByError].forEach(a=>{i.calledByError.find(e=>te(e)===a.id)||(this.removeCaller(a,r),a.removeCall(this,r))}),i.dataType){const a=te(i.dataType),c=this.project.get(a);c&&this.setDataType(c,r)}else this.setDataType(null,r);return i.outputs.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addOutput(e,r),e.setParent(this,r))}),[...this.outputs].forEach(a=>{i.outputs.find(e=>te(e)===a.id)||(this.removeOutput(a,r),a.removeFromParent(r))}),i.inputs.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addInput(e,r),e.setParent(this,r))}),[...this.inputs].forEach(a=>{i.inputs.find(e=>te(e)===a.id)||(this.removeInput(a,r),a.removeFromParent(r))}),i.writesValues.forEach(a=>{const c=te(a),e=this.project.get(c);e&&(this.addValueReader(e,r),e.setValueWriter(this,r))}),[...this.writesValues].forEach(a=>{i.writesValues.find(e=>te(e)===a.id)||(this.removeValueReader(a,r),a.setValueWriter(null,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const f=te(i.parent),h=this.project.get(f),m=this.parent;if(m&&m.id!==(h==null?void 0:h.id)&&this.removeFromParent(r),h)this.setParent(h,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(i.declaration){const f=te(i.declaration),h=this.project.get(f);if(h)this.setDeclaration(h);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(a=i.calledByEntry)==null||a.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addEntryCaller(m,r),m.addCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${h}' that isn't found in the project`)}),i.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=i.calledByEntry)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addSuccessCaller(m,r),m.addSuccessCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${h}' that isn't found in the project`)}),i.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=i.calledBySuccess)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addErrorCaller(m,r),m.addErrorCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${h}' that isn't found in the project`)}),i.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=i.calledByError)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=te(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null),i.push(f);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const e=te(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addErrorCaller(h,null)}),{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.initialized=!0,this.checkIsSynced())return i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};const{updated:f,added:h,removed:m}=this.syncChildren(i);return r.push(...f),a.push(...h),c.push(...m),this.inputs.sort((E,b)=>{var A,_;return(E.index??((A=E.declaration)==null?void 0:A.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),this.outputs.sort((E,b)=>{var A,_;return(E.index??((A=E.declaration)==null?void 0:A.index))-(b.index??((_=b.declaration)==null?void 0:_.index))}),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(f=>{f.addSuccessCaller(this,i),r.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,i),r.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,i),r.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,i),r.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,i),r.push(f)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this;const a=this.inputs.findIndex(c=>c.id===i.id);return a>-1&&(this.inputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){return this.checkCanEdit(this,r)?this.inputs.includes(i)?(r==null||r.attemptAutoclose(w.AddInput,this.id),this):(this.inputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(Y.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}addOutput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,r)?this.outputs.includes(i)?(r==null||r.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose("add-output",this.id),this):(Y.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("add-output",this.id),this)}removeOutput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose("remove-output",this.id),this;const a=this.outputs.findIndex(c=>c.id===i.id);return a>-1&&(this.outputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose("remove-output",this.id),this}setBody(i){return this.body=i,this}detachBody(){return this.body=null,this}addSuccessCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}--${Be.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddEntryCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddEntryCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddEntryCaller}-${this.id}--${Be.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Be.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),this.catchesError&&this.metaSync({catchesError:!1},r),a&&Et(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&&Et(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveCall)),a=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCall,r))return this;const c=this.successCalls.findIndex(f=>f.id===i.id);c>-1&&(this.successCalls.splice(c,1),r==null||r.add(this,W.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,W.Affected)),a&&Et(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"remove-caller")),a=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCaller,r)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),a&&Et(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}replaceDetachedChild(i,r){const a=this.detachedChildren.indexOf(i);return a!==-1&&(this.detachedChildren[a]=r),this}subscribeDetachedChild(i){return this.detachedChildren.includes(i)||this.detachedChildren.push(i),this}unsubscribeDetachedChild(i){const r=this.detachedChildren.indexOf(i);return r!==-1&&this.detachedChildren.splice(r,1),this}setError(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetErrorEntity))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this;const a=this.error;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.error=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetErrorEntity,this.id),this}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.declaration=Ae(this.initialData.declaration,this.project),this.initialData.dataType){const r=Ae(this.initialData.dataType,this.project);this.setDataType(r,null),this.dataType.setParent(this,null),this.dataType.initChildren(i)}return this.successCalls=this.initialData.successCalls.map(r=>{const a=Ae(r,this.project);if(a.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=mn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.errorCalls=this.initialData.errorCalls.map(r=>{const a=Ae(r,this.project);if(a.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=mn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.outputs=this.initialData.outputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.initialData.body&&(this.body=Ae(this.initialData.body,this.project),this.body.setParent(this,null),this.body.initChildren(i)),this.initialData.error&&(this.error=Ae(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Yr(this,i,r),c=zr(this,a),e=this.toMeta();return this.x=a.x||e.x,this.y=a.y||e.y,this.catchesError=a.catchesError!==void 0?a.catchesError:this.catchesError,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ke,...r){return await Xt.repository.APILoad(this.id,...r),this}async APICreate(i=Ke,...r){return await Xt.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ke,...r){return await Xt.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ke,...r){return await Xt.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ke,...r){return await Xt.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ke,r,...a){return await Xt.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeLoop(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return Y.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),this.inputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.outputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.body.remove({ignoreUpstream:!0},r),this.error){const{updated:m,removed:E}=this.error.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.dataType){const{updated:m,removed:E}=this.dataType.remove({ignoreUpstream:!0},r);a.push(...m),c.push(...E)}if(this.successCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),this.errorCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(E=>{a.push(E),E.removeCall(this,r)})}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),this.inputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.outputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.body.restore({},i),this.successCalls.forEach(f=>{a.push(f),f.addSuccessCaller(this,i)}),this.errorCalls.forEach(f=>{a.push(f),f.addErrorCaller(this,i)}),this.error){const{updated:f}=this.error.restore({},i);a.push(...f)}if(this.dataType){const{updated:f}=this.dataType.restore({},i);a.push(...f)}return this.calledBySuccess.forEach(f=>{a.push(f),f.addSuccessCall(this,i)}),this.calledByError.forEach(f=>{a.push(f),f.addErrorCall(this,i)}),this.calledByEntry.forEach(f=>{a.push(f),f.addCall(this,i)}),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.inputs.flatMap(a=>a.toFlat(i)),...this.outputs.flatMap(a=>a.toFlat(i)),...this.successCalls.flatMap(a=>a.toFlat(i)),...this.errorCalls.flatMap(a=>a.toFlat(i)),...this.error?this.error.toFlat(i):[],...this.body?this.body.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[],...this.continueStatements.flatMap(a=>a.toFlat(i)),...this.breakStatements.flatMap(a=>a.toFlat(i))])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.inputs.flatMap(a=>a.toFlatIds(i)),...this.outputs.flatMap(a=>a.toFlatIds(i)),...this.successCalls.flatMap(a=>a.toFlatIds(i)),...this.errorCalls.flatMap(a=>a.toFlatIds(i)),...this.error?this.error.toFlatIds(i):[],...this.body?this.body.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[],...this.continueStatements.flatMap(a=>a.toFlatIds(i)),...this.breakStatements.flatMap(a=>a.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable,catchesError:this.catchesError}}toJSON(i=new Set){var r,a;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,catchesError:this.catchesError,x:this.x,y:this.y,dataType:((r=this.dataType)==null?void 0:r.toJSON(i))||null,calledBySuccess:this.calledBySuccess.map(c=>c.toReference()),calledByError:this.calledByError.map(c=>c.toReference()),calledByEntry:this.calledByEntry.map(c=>c.toReference()),writesValues:this.writesValues.map(c=>c.toJSON(i)),declaration:this.declaration.toJSON(i),inputs:this.inputs.map(c=>c.toJSON(i)),outputs:this.outputs.map(c=>c.toJSON(i)),successCalls:this.successCalls.map(c=>c.toJSON(i)),errorCalls:this.errorCalls.map(c=>c.toJSON(i)),error:((a=this.error)==null?void 0:a.toJSON(i))||null,body:this.body.toJSON(i),parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||rn(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,catchesError:this.catchesError,dataType:((m=this.dataType)==null?void 0:m.toJSONClone({...i,newId:null}))||null,calledBySuccess:this.calledBySuccess.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),declaration:this.declaration.toJSON(),inputs:this.inputs.map(b=>b.toJSONClone({...i,newId:null})),outputs:this.outputs.map(b=>b.toJSONClone({...i,newId:null})),writesValues:this.writesValues.map(b=>b.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(b=>b.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(b=>b.toJSONClone({...i,newId:null})),error:((E=this.error)==null?void 0:E.toJSONClone({...i,newId:null}))||null,body:this.body.toJSONClone({...i,newId:null}),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f,h;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,catchesError:this.catchesError,x:this.x,y:this.y,dataType:((c=this.dataType)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,body:((f=this.body)==null?void 0:f.toReference(i))||null,inputs:this.inputs.map(m=>m.toReference(i)),outputs:this.outputs.map(m=>m.toReference(i)),writesValues:this.writesValues.map(m=>m.toReference(i)),successCalls:this.successCalls.map(m=>m.toReference(i)),errorCalls:this.errorCalls.map(m=>m.toReference(i)),calledBySuccess:this.calledBySuccess.map(m=>m.toReference(i)),calledByError:this.calledByError.map(m=>m.toReference(i)),calledByEntry:this.calledByEntry.map(m=>m.toReference(i)),error:((h=this.error)==null?void 0:h.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.body)==null?void 0:a.toFlatJSON(i))||[],...this.successCalls.flatMap(c=>c.toFlatJSON(i)),...this.errorCalls.flatMap(c=>c.toFlatJSON(i)),...this.inputs.flatMap(c=>c.toFlatJSON(i)),...this.outputs.flatMap(c=>c.toFlatJSON(i)),...this.continueStatements.flatMap(c=>c.toFlatJSON(i)),...this.breakStatements.flatMap(c=>c.toFlatJSON(i)),...this.error?this.error.toFlatJSON(i):[],...this.dataType?this.dataType.toFlatJSON(i):[]])}toGenerationTarget(i=at){var c,e;const r=this.parent.type===d.Project?void 0:(c=i.seenEntityMaps)!=null&&c.has(this.parent.id)?i.seenEntityMaps.get(this.parent.id):this.parent.id;let a=this.id;return(e=i.seenEntityMaps)!=null&&e.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,type:this.type,calledByEntry:this.calledByEntry.map(f=>f.id),calledBySuccess:this.calledBySuccess.map(f=>f.id),calledByError:this.calledByError.map(f=>f.id),declaration:this.declaration.id,parent:r}}toFlatGenerationTarget(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.body)==null?void 0:a.toFlatGenerationTarget(i))||[],...this.successCalls.flatMap(c=>c.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(c=>c.toFlatGenerationTarget(i)),...this.inputs.flatMap(c=>c.toFlatGenerationTarget(i)),...this.outputs.flatMap(c=>c.toFlatGenerationTarget(i)),...this.continueStatements.flatMap(c=>c.toFlatGenerationTarget(i)),...this.breakStatements.flatMap(c=>c.toFlatGenerationTarget(i)),...this.error?this.error.toFlatGenerationTarget(i):[],...this.dataType?this.dataType.toFlatGenerationTarget(i):[]])}clearErrors(){var i,r;return this.errors=[],this.inputs.forEach(a=>a.clearErrors()),this.outputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this.continueStatements.forEach(a=>a.clearErrors()),this.breakStatements.forEach(a=>a.clearErrors()),(i=this.error)==null||i.clearErrors(),(r=this.dataType)==null||r.clearErrors(),this}validate(){return this.errors=gx(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await o_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(r=>r.getErrors()),...this.outputs.flatMap(r=>r.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.dataType?this.dataType.getErrors():[]]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.inputs)a.push(...await c.getErrorsAsync({tracker:r}));for(const c of this.outputs)a.push(...await c.getErrorsAsync({tracker:r}));return this.body&&a.push(...await this.body.getErrorsAsync({tracker:r})),this.error&&a.push(...await this.error.getErrorsAsync({tracker:r})),this.dataType&&a.push(...await this.dataType.getErrorsAsync({tracker:r})),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var N,P;const e=Mr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=tr(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const A=(N=this.inputs)==null?void 0:N.map((j,M)=>j.clone(i,b,E+"-input-map-"+M+"-id",c));b.inputs=A;const _=(P=this.outputs)==null?void 0:P.map((j,M)=>j.clone(i,b,E+"-output-map-"+M+"-id",c));return b.outputs=_,this.body&&(b.body=this.body.clone(i,b,E+"-body-id",c,!0)),this.error&&(b.error=this.error.clone(i,b,E+"-error-map-id",c)),this.dataType&&(b.dataType=this.dataType.clone(i,b,E+"-data-type-id",c)),i||b.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}getVariableInstances(){return this.body?lr(this.body).filter(a=>a.type===d.VariableInstance):[]}addReturnStatement(i){return Bt.includes(this.parent.type)&&this.parent.addReturnStatement(i),this}removeReturnStatement(i){return Bt.includes(this.parent.type)&&this.parent.removeReturnStatement(i),this}addBreakStatement(i){return this.breakStatements.includes(i)||this.breakStatements.push(i),this}removeBreakStatement(i){const r=this.breakStatements.indexOf(i);return r!==-1&&this.breakStatements.splice(r,1),this}addContinueStatement(i){return this.continueStatements.includes(i)||this.continueStatements.push(i),this}removeContinueStatement(i){const r=this.continueStatements.indexOf(i);return r!==-1&&this.continueStatements.splice(r,1),this}getUniqueInputMaps(){const i=[];return[...this.breakStatements,...this.continueStatements].forEach(a=>{a.outputs.filter(e=>{var f;return!e.deleted&&!((f=e.declaration)!=null&&f.deleted)}).forEach(e=>{i.find(h=>h===e||le(h,this.project)===le(e,this.project)&&oi(h.dataType,e.dataType))||i.push(e)})}),C(i)}syncTerminationStatements(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-termination-statements"))){const r=[],a=[],c=[],e=[],f=this.getUniqueInputMaps();return[...this.breakStatements,...this.continueStatements].forEach(m=>{const E=m.outputs.filter(A=>{var _;return!A.deleted&&!((_=A.declaration)!=null&&_.deleted)}),b=f.filter(A=>!E.find(_=>le(A,this.project)===le(_,this.project)&&oi(A.dataType,_.dataType)));b.length&&(r.push(m),i==null||i.add(m,W.Updated)),b.forEach(A=>{const _=A.clone(i,m);i==null||i.add(_,W.Added),_.addSelfToProject(i),a.push(_)})}),i==null||i.attemptAutoclose("sync-termination-statements",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncBodyInputIndexes(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-body-input-indexes"))){const r=[],a=[],c=[],e=[];return this.body.inputs.sort((f,h)=>f.index-h.index),i==null||i.attemptAutoclose("sync-body-input-indexes",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncBodyArgumentsDeclarations(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-body-arguments-declarations"))){var P,j,M,G,q,re;const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncFixedBodyArgumentDeclarations(i);r.push(...f),a.push(...h),c.push(...m);const E=this.getUniqueInputMaps(),b=this.body.inputs;if(E.sort((ee,de)=>ee.index-de.index),((M=(j=(P=this.body)==null?void 0:P.dataType)==null?void 0:j.entity)==null?void 0:M.id)!==ne["primitive-entity"].void.id&&!b.find(de=>{var ie,se,ue,z,X,ce,oe;return de.id!==((ie=this.currentIterationNumberArgumentDeclaration)==null?void 0:ie.id)&&de.id!==((se=this.currentValueArgumentDeclaration)==null?void 0:se.id)&&((z=(ue=de.dataType)==null?void 0:ue.entity)==null?void 0:z.id)===((oe=(ce=(X=this.body)==null?void 0:X.dataType)==null?void 0:ce.entity)==null?void 0:oe.id)})){let de=0;this.currentIterationNumberArgumentDeclaration&&de++,this.currentValueArgumentDeclaration&&de++;const ie=ja.new(i);ie.name="Aggregate result",ie.description="Aggretated list of all previously outputted values from each iteration",ie.constant=!0,ie.index=de,ie.required=!1,ie.parent=this.body.toReference();const se=Ae(ie,this.project);if(se.hydrateAncestors(),se.addSelfToProject(i),i==null||i.add(se,W.Added),a.push(se),se.setParent(this.body,i),se.initChildren(i),!se.dataType&&((G=this.body)!=null&&G.dataType)){const ue=yr.new(i);ue.parent=se.toReference();const z=Ae(ue,this.project);z.hydrateAncestors(),z.addSelfToProject(i),a.push(z),z.setParent(se,i),z.initChildren(i),z.merge((q=this.body)==null?void 0:q.dataType,i),z.setEntity((re=this.body)==null?void 0:re.dataType.entity,i),i==null||i.add(z,W.Added),i||z.captureVersion()}i||se.captureVersion()}const{updated:A,added:_,removed:N}=this.removeExtraBodyArgumentDeclarations(i);return r.push(...A),a.push(..._),c.push(...N),i==null||i.attemptAutoclose("sync-body-arguments-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}reAttachAllTerminationInputMapsToDeclarations(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"reattach-termination-input-maps-to-declarations"))){var h,m,E;const r=[],a=[],c=[],e=[];return!((h=this.body)!=null&&h.dataType)||!((m=this.body)!=null&&m.dataType.entity)||((E=this.body)==null?void 0:E.dataType.entity.type)!==d.DefinitionEntity?(i==null||i.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}):([...this.breakStatements,...this.continueStatements].forEach(b=>{var j,M,G;const A=b.outputs.filter(q=>{var re;return!q.deleted&&!((re=q.declaration)!=null&&re.deleted)}),_=A.filter(q=>!q.declaration&&!!q.readsValue),N=A.filter(q=>!q.declaration&&!q.readsValue);let P=(((G=(M=(j=this.body)==null?void 0:j.dataType)==null?void 0:M.entity)==null?void 0:G.properties)||[]).filter(q=>!A.find(re=>{var ee,de;return!re.deleted&&!((ee=re.declaration)!=null&&ee.deleted)&&((de=re.declaration)==null?void 0:de.id)===q.id}));_.forEach(q=>{const re=q.getDataType(i);if(q.readsValue){const ee=le(q.readsValue,this.project),de=P.find(ie=>le(ie,this.project)===ee&&oi(ie.dataType,re));if(de){q.setDeclaration(de,i),r.push(q),P=P.filter(ie=>ie!==de);return}}}),N.forEach(q=>{const re=q.getDataType(i),ee=P.find(de=>oi(de.dataType,re));if(ee){q.setDeclaration(ee,i),r.push(q),P=P.filter(de=>de!==ee);return}}),A.forEach(q=>{const re=P.find(ee=>le(ee,this.project)===le(q,this.project));q.declaration&&!P.includes(q.declaration)&&re&&(q.setDeclaration(re,i),r.push(q),P=P.filter(ee=>ee!==re))})}),i==null||i.attemptAutoclose("reattach-termination-input-maps-to-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this})}syncOutputDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-outputs-properties"))){var P,j,M,G,q,re,ee,de,ie,se,ue,z,X,ce,oe,me,ve,we,Re,xe,je,Se,et;const r=[],a=[],c=[],e=[],f=[...this.breakStatements,...this.continueStatements];if(!f.every(Ze=>Ze.initialized))return i==null||i.attemptAutoclose("sync-outputs-properties",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this};let h=!1;if(!((P=this.body)!=null&&P.dataType)){const Ze=yr.new(i);Ze.parent=this.body.toReference(),Ze.inferred=!0;const Xe=Ae(Ze,this.project);Xe.hydrateAncestors(),Xe.addSelfToProject(i),i==null||i.add(Xe,W.Added),Xe.initChildren(i),a.push(Xe),h=!0}const m=f.find(Ze=>!!Ze.readsValue);if(m){const Ze=(j=m.readsValue)==null?void 0:j.getDataType(i);Ze&&((G=(M=this.body)==null?void 0:M.dataType)==null||G.merge(Ze,i))}h&&(i||(re=(q=this.body)==null?void 0:q.dataType)==null||re.captureVersion());const E=this.getUniqueInputMaps();let b=(de=(ee=this.body)==null?void 0:ee.dataType)==null?void 0:de.entity;if(E.length&&(!b||b.id===ne["primitive-entity"].void.id)){const Ze=Ls.new(i);Ze.parent=((ie=this.body)==null?void 0:ie.dataType).toReference(),Ze.name=`${le(this,this.project)} output definition`,Ze.description=`The definition of the output data type of the loop '${le(this,this.project)}'`;const Xe=Ae(Ze,this.project);Xe.setParent((se=this.body)==null?void 0:se.dataType,i),Xe.hydrateAncestors(),i==null||i.add(Xe,W.Added),Xe.addSelfToProject(i),Xe.initChildren(i),a.push(Xe),b=Xe,(z=(ue=this.body)==null?void 0:ue.dataType)==null||z.metaSync({inferred:!0},i),i||Xe.captureVersion()}const A=(b==null?void 0:b.properties)||[];(ce=(X=this.body)==null?void 0:X.dataType)!=null&&ce.inferred&&((me=(oe=this.body)==null?void 0:oe.dataType.entity)==null?void 0:me.type)===d.DefinitionEntity&&(E.forEach(Ze=>{var Jr,cr,ar,an,Is;const Xe=Ze.getDataType(i);let Mt=A.find(Vr=>le(Vr,this.project)===le(Ze,this.project)&&oi(Vr.dataType,Ze.dataType));if(!Mt){const Vr=ps.new(i);Vr.name=le(Ze,this.project),Vr.description=`Aggretated list of all previously outputted values from each iteration by the output '${le(Ze,this.project)}'`,Vr.index=Ze.index,Vr.required=((Jr=Ze.declaration)==null?void 0:Jr.required)||!1,Vr.parent=((ar=(cr=this.body)==null?void 0:cr.dataType)==null?void 0:ar.entity).toReference();const Pn=Ae(Vr,this.project);Pn.hydrateAncestors(),Pn.setParent((Is=(an=this.body)==null?void 0:an.dataType)==null?void 0:Is.entity,i),Pn.addSelfToProject(i),i==null||i.add(Pn,W.Added),Pn.initChildren(i),a.push(Pn),Mt=Pn,i||Pn.captureVersion()}Mt.index!==Ze.index&&(Mt.metaSync({index:Ze.index},i),r.push(Mt));let hi=Mt.getDataType(i);if(Xe)if(!hi||!oi(hi,Xe)){if(!hi){const Vr=Xe.clone(i,Mt);i==null||i.add(Vr,W.Added),Vr.addSelfToProject(i),hi=Vr,a.push(Vr),r.push(Mt)}hi.merge(Xe,i),hi.metaSync({isList:!0},i)}else hi.isList||(hi.metaSync({isList:!0},i),r.push(hi));if(!Xe&&!hi){const Vr={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,parentRelationType:null,isList:!0,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:Mt.toReference()},Pn=Ae(Vr,this.project);Pn.metaSync({isList:!0},i),Pn.hydrateAncestors(),Pn.setParent(Mt,i),Pn.addSelfToProject(i),i==null||i.add(Pn,W.Added),Pn.initChildren(i),a.push(Pn),i||Pn.captureVersion()}}),this.reAttachAllTerminationInputMapsToDeclarations(i)),(we=(ve=this.body)==null?void 0:ve.dataType)!=null&&we.inferred&&((xe=(Re=this.body)==null?void 0:Re.dataType.entity)==null?void 0:xe.type)===d.DefinitionEntity&&A.filter(Xe=>!E.find(Mt=>le(Xe,this.project)===le(Mt,this.project))).forEach(Xe=>{if(!(i!=null&&i.hasRemoved(Xe.id))&&!Xe.deleted){const{updated:Dt,removed:Mt}=Xe.remove({ignoreUpstream:!1},i);r.push(...Dt),c.push(...Mt)}}),f.forEach(Ze=>{Ze.outputs.filter(Dt=>{var Mt;return!Dt.deleted&&!((Mt=Dt.declaration)!=null&&Mt.deleted)}).forEach(Dt=>{var xi,hi,Jr;if(!(((Jr=(hi=(xi=this.body)==null?void 0:xi.dataType)==null?void 0:hi.entity)==null?void 0:Jr.properties)||[]).find(cr=>{var ar;return((ar=Dt.declaration)==null?void 0:ar.id)===cr.id})&&!(i!=null&&i.hasRemoved(Dt.id))&&!Dt.deleted){const{updated:cr,removed:ar}=Dt.remove({ignoreUpstream:!1},i);r.push(...cr),c.push(...ar)}})});const _=this.getUniqueInputMaps();if(f.every(Ze=>!Ze.readsValue)&&!_.length){const Ze=this.project.getBuiltIn(ne["primitive-entity"].void.id);(Se=(je=this.body)==null?void 0:je.dataType)==null||Se.setEntity(Ze,i),r.push((et=this.body)==null?void 0:et.dataType)}return i==null||i.attemptAutoclose("sync-outputs-properties",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncOutputMaps(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SyncOutputs))){var E,b,A;const r=[],a=[],c=[],e=[],f=((A=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:A.properties)||[],h=this.outputs;return f.forEach(_=>{var j;let P=h.find(M=>{var G,q;return((G=M.declaration)==null?void 0:G.id)===_.id&&oi((q=M.declaration)==null?void 0:q.dataType,_.dataType)});if(P)((j=P.declaration)==null?void 0:j.id)!==_.id&&(P.setDeclaration(_,i),r.push(P));else{const M={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.OutputMap,index:_.index,declaration:_.toJSON(),writesValues:[],parent:this.toReference()},G=Ae(M,this.project);G.hydrateAncestors(),G.setParent(this,i),G.addSelfToProject(i),i==null||i.add(G,W.Added),G.initChildren(i),a.push(G),i||G.captureVersion(),P=G}P.index!==_.index&&(P.metaSync({index:_.index},i),r.push(P))}),h.filter(_=>!f.find(P=>{var j;return((j=_.declaration)==null?void 0:j.id)===P.id})).forEach(_=>{const{updated:N,removed:P}=_.remove({ignoreUpstream:!1},i);r.push(...N),c.push(...P)}),this.outputs.forEach(_=>{const{updated:N,added:P,removed:j}=_.afterAllChildrenInitialized(i);r.push(...N),a.push(...P),c.push(...j)}),this.outputs.sort((_,N)=>_.index-N.index),i==null||i.attemptAutoclose(w.SyncOutputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}createCurrentIterationNumberArgumentDeclaration(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"create-current-iteration-number-argument-declaration"))){const r=[],a=[],c=[],e=[];let h=this.body.inputs.find(A=>{var _;return A.name===Xt.CURRENT_ITERATION_NUMBER_ARG_NAME||A.id===((_=this.currentIterationNumberArgumentDeclaration)==null?void 0:_.id)});const m=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!h){const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Xt.CURRENT_ITERATION_NUMBER_ARG_NAME,codeName:null,description:"The number of the current iteration",defaultValue:null,constant:!0,dataType:null,implements:[m==null?void 0:m.toJSON()],index:this.body.inputs.length,required:!0,parent:this.body.toReference(),writesValues:[]},_=Ae(A,this.project);_.hydrateAncestors(),_.setParent(this.body,i),_.addSelfToProject(i),i==null||i.add(_,W.Added),_.initChildren(i),a.push(_),i||_.captureVersion(),h=_}!h.index&&h.index!==0&&(h.metaSync({index:0},i),r.push(h)),(!h.implements||!h.implements.find(A=>A.id===m.id))&&(h.addImplementation(m,i),r.push(h));let b=h.getDataType(i);if(!b){const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,parentRelationType:null,isList:!1,index:null,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:h.toReference()},_=Ae(A,this.project);_.hydrateAncestors(),_.setParent(h,i),_.addSelfToProject(i),i==null||i.add(_,W.Added),_.initChildren(i),a.push(_),i||_.captureVersion(),b=_}if(!b.entity||b.entity.type!==d.PrimitiveEntity||b.entity.name!==ye.Number||b.entity.id!==ne["primitive-entity"].number.id){const A=this.project.getBuiltIn(ne["primitive-entity"].number.id);b.setEntity(A,i),r.push(b)}return i==null||i.attemptAutoclose("create-current-iteration-number-argument-declaration",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}removeExtraBodyArgumentDeclarations(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"remove-extra-body-argument-declarations"))){const r=[],a=[],c=[],e=[];return this.body.inputs.filter(m=>{var E,b,A,_,N,P,j,M;return m===this.currentIterationNumberArgumentDeclaration||m===this.currentValueArgumentDeclaration?!1:((A=(b=(E=this.body)==null?void 0:E.dataType)==null?void 0:b.entity)==null?void 0:A.id)===ne["primitive-entity"].void.id?!0:((N=(_=m.dataType)==null?void 0:_.entity)==null?void 0:N.id)!==((M=(j=(P=this.body)==null?void 0:P.dataType)==null?void 0:j.entity)==null?void 0:M.id)}).forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!1},i);r.push(...E),c.push(...b)}),i==null||i.attemptAutoclose("remove-extra-body-argument-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}createCurrentValueInputBasedOnInputMap(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"create-current-value-input-based-on-input-map"))){var E,b,A,_,N,P,j,M,G;const r=[],a=[],c=[],e=[];switch(this.declaration.id){case ft.List:{const q=this.body.inputs.find(de=>!!de.implements.find(ie=>ie.id===ne[d.Loop][ft.List].body.inputs.currentValue.id)),re=this.inputs.find(de=>{var ie;return((ie=de.declaration)==null?void 0:ie.id)===ne[d.Loop][ft.List].inputs.list.id});if(!re)break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(q){ee&&!q.implements.find(ue=>ue.id===ee.id)&&(q.addImplementation(ee,i),r.push(q));let ie=q.getDataType(i);if(!ie){const ue={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(E=this.currentValueArgumentDeclaration)==null?void 0:E.toReference()},z=Ae(ue,this.project);z.hydrateAncestors(),z.setParent(this.currentValueArgumentDeclaration,i),z.addSelfToProject(i),i==null||i.add(z,W.Added),z.initChildren(i),a.push(z),i||z.captureVersion(),ie=z}const se=re.getDataType(i);ie.merge(se,i),ie.metaSync({isList:!1},i)}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Xt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ie=Ae(de,this.project);ie.hydrateAncestors(),ie.setParent(this.body,i),ie.addSelfToProject(i),i==null||i.add(ie,W.Added),ie.initChildren(i),ee&&!ie.implements.find(se=>se.id===ee.id)&&(ie.addImplementation(ee,i),r.push(ie)),a.push(ie),i||ie.captureVersion()}break}case ft.ManualFlow:break;case ft.Counted:break;case ft.ObjectKeys:{const q=this.body.inputs.find(de=>!!de.implements.find(ie=>ie.id===ne[d.Loop][ft.ObjectKeys].body.inputs.currentValue.id));if(!this.inputs.find(de=>{var ie;return((ie=de.declaration)==null?void 0:ie.id)===ne[d.Loop][ft.ObjectKeys].inputs.object.id}))break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(q){ee&&!q.implements.find(se=>se.id===ee.id)&&(q.addImplementation(ee),r.push(q));let ie=q.getDataType(i);if(ie){const se=this.project.getBuiltIn(ne["primitive-entity"].string.id);((A=ie.entity)==null?void 0:A.id)!==se.id&&(ie.setEntity(se,i),r.push(ie))}else{const se={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(b=this.currentValueArgumentDeclaration)==null?void 0:b.toReference()},ue=Ae(se,this.project);ue.hydrateAncestors(),ue.setParent(this.currentValueArgumentDeclaration,i),ue.addSelfToProject(i),i==null||i.add(ue,W.Added),ue.initChildren(i),i||ue.captureVersion(),ie=ue}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Xt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,defaultValue:null,index:this.body.inputs.length,constant:!0,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ie=Ae(de,this.project);ie.hydrateAncestors(),ie.setParent(this.body,i),ie.addSelfToProject(i),i==null||i.add(ie,W.Added),ie.initChildren(i),ee&&!ie.implements.find(se=>se.id===ee.id)&&(ie.addImplementation(ee,i),r.push(ie)),a.push(ie),i||ie.captureVersion()}break}case ft.ObjectValues:{const q=this.body.inputs.find(de=>!!de.implements.find(ie=>ie.id===ne[d.Loop][ft.ObjectValues].body.inputs.currentValue.id)),re=this.inputs.find(de=>{var ie;return((ie=de.declaration)==null?void 0:ie.id)===ne[d.Loop][ft.ObjectValues].inputs.object.id});if(!re)break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(q){ee&&!q.implements.find(se=>se.id===ee.id)&&(q.addImplementation(ee,i),r.push(q));let ie=q.getDataType(i);if(ie){const se=re.getDataType(i),ue=((P=se==null?void 0:se.entity)==null?void 0:P.properties)||[];(j=ie.orChildrenGroup)==null||j.forEach(z=>{const{updated:X,removed:ce}=z.remove({ignoreUpstream:!1},i);r.push(...X),c.push(...ce)}),ue.forEach(z=>{if(!z.getDataType(i)){const ce={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:ze.OrDataTypeGroup,parent:ie.toReference()},oe=Ae(ce,this.project);oe.hydrateAncestors(),oe.setParent(ie,i),oe.addSelfToProject(i),i==null||i.add(oe,W.Added),oe.initChildren(i),i||oe.captureVersion(),a.push(oe)}})}else{const se={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(_=this.currentValueArgumentDeclaration)==null?void 0:_.toReference()},ue=Ae(se,this.project);ue.hydrateAncestors(),ue.setParent(this.currentValueArgumentDeclaration,i),ue.addSelfToProject(i),i==null||i.add(ue,W.Added),ue.initChildren(i),i||ue.captureVersion(),ie=ue;const z=re.getDataType(i);(((N=z==null?void 0:z.entity)==null?void 0:N.properties)||[]).forEach(ce=>{if(!ce.getDataType(i)){const me={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,index:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:ze.OrDataTypeGroup,parent:ue.toReference()},ve=Ae(me,this.project);ve.hydrateAncestors(),ve.setParent(ue,i),ve.addSelfToProject(i),i==null||i.add(ve,W.Added),ve.initChildren(i),i||ve.captureVersion(),a.push(ve)}})}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Xt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,constant:!0,defaultValue:null,index:this.body.inputs.length,required:!0,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ie=Ae(de,this.project);ie.hydrateAncestors(),ie.setParent(this.body,i),ie.addSelfToProject(i),i==null||i.add(ie,W.Added),ie.initChildren(i),ee&&!ie.implements.find(se=>se.id===ee.id)&&(ie.addImplementation(ee,i),r.push(ie)),a.push(ie),i||ie.captureVersion()}break}case ft.String:{const q=this.body.inputs.find(de=>!!de.implements.find(ie=>ie.id===ne[d.Loop][ft.String].body.inputs.currentValue.id));if(!this.inputs.find(de=>{var ie;return((ie=de.declaration)==null?void 0:ie.id)===ne[d.Loop][ft.String].inputs.string.id}))break;const ee=this.getCurrentValueBuiltInValueDescriptor();if(q){ee&&!q.implements.find(se=>se.id===ee.id)&&(q.addImplementation(ee,i),r.push(q));let ie=q.getDataType(i);if(ie){const se=this.project.getBuiltIn(ne["primitive-entity"].string.id);((G=ie.entity)==null?void 0:G.id)!==se.id&&(ie.setEntity(se,i),r.push(ie))}else{const se={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.DataType,foreignKeyRef:null,foreignKeyAllowed:null,options:[],implementationChooseOne:!1,parentRelationType:null,staticEntities:null,interactiveEntities:null,index:null,actionEntities:null,isList:!1,entity:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:null,orChildrenGroup:null,parent:(M=this.currentValueArgumentDeclaration)==null?void 0:M.toReference()},ue=Ae(se,this.project);ue.hydrateAncestors(),ue.setParent(this.currentValueArgumentDeclaration,i),ue.addSelfToProject(i),i==null||i.add(ue,W.Added),ue.initChildren(i),i||ue.captureVersion(),a.push(ue),ie=ue}}else{const de={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:Xt.CURRENT_VALUE_ARG_NAME,codeName:null,description:null,index:this.body.inputs.length,required:!0,constant:!0,defaultValue:null,implements:[ee],writesValues:[],dataType:null,parent:this.body.toReference()},ie=Ae(de,this.project);ie.hydrateAncestors(),ie.setParent(this.body,i),ie.addSelfToProject(i),i==null||i.add(ie,W.Added),ie.initChildren(i),ee&&!ie.implements.find(se=>se.id===ee.id)&&(ie.addImplementation(ee,i),r.push(ie)),a.push(ie),i||ie.captureVersion()}break}}const{updated:f,added:h,removed:m}=this.removeExtraBodyArgumentDeclarations(i);return r.push(...f),a.push(...h),c.push(...m),i==null||i.attemptAutoclose("create-current-value-input-based-on-input-map",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncFixedBodyArgumentDeclarations(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-fixed-body-argument-declarations"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.createCurrentIterationNumberArgumentDeclaration(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:A}=this.createCurrentValueInputBasedOnInputMap(i);return r.push(...E),a.push(...b),c.push(...A),i==null||i.attemptAutoclose("sync-fixed-body-argument-declarations",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncInputMaps(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-input-maps"))){const r=[],a=[],c=[],e=[];switch(this.declaration.id){case ft.List:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===ne[d.Loop]["list-loop"].inputs.list.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==ne[d.Loop]["list-loop"].inputs.list.id){const m=this.project.get(ne[d.Loop]["list-loop"].inputs.list.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(ne[d.Loop]["list-loop"].inputs.list.id),E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==ne[d.Loop]["list-loop"].inputs.list.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case ft.ManualFlow:{this.inputs.forEach(f=>{f.remove({ignoreUpstream:!1},i),c.push(f)});break}case ft.Counted:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===ne[d.Loop]["counted-loop"].inputs.number.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==ne[d.Loop]["counted-loop"].inputs.number.id){const m=this.project.get(ne[d.Loop]["counted-loop"].inputs.number.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(ne[d.Loop]["counted-loop"].inputs.number.id),E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==ne[d.Loop]["counted-loop"].inputs.number.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case ft.ObjectKeys:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===ne[d.Loop]["object-keys-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==ne[d.Loop]["object-keys-loop"].inputs.object.id){const m=this.project.get(ne[d.Loop]["object-keys-loop"].inputs.object.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(ne[d.Loop]["object-keys-loop"].inputs.object.id),E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==ne[d.Loop]["object-keys-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case ft.ObjectValues:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===ne[d.Loop]["object-values-loop"].inputs.object.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==ne[d.Loop]["object-values-loop"].inputs.object.id){const m=this.project.get(ne[d.Loop]["object-values-loop"].inputs.object.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(ne[d.Loop]["object-values-loop"].inputs.object.id),E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==ne[d.Loop]["object-values-loop"].inputs.object.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}case ft.String:{let f=null;if(this.inputs.forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)===ne[d.Loop]["string-loop"].inputs.string.id?f=m:(m.remove({ignoreUpstream:!1},i),c.push(m))}),f){if(f.declaration.id!==ne[d.Loop]["string-loop"].inputs.string.id){const m=this.project.get(ne[d.Loop]["string-loop"].inputs.string.id);f.setDeclaration(m,i),r.push(f)}}else{const m=this.project.get(ne[d.Loop]["string-loop"].inputs.string.id),E={dataType:null,id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,parentRelationType:null,name:null,codeName:null,description:null,index:0,declaration:m.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}[...this.inputs].forEach(m=>{var E;((E=m.declaration)==null?void 0:E.id)!==ne[d.Loop]["string-loop"].inputs.string.id&&(m.remove({ignoreUpstream:!1},i),c.push(m))}),this.inputs.sort((m,E)=>B(m.createdAt).isBefore(B(E.createdAt))?-1:1).forEach((m,E)=>{E!==0&&(m.remove({ignoreUpstream:!1},i),c.push(m))});break}}return this.inputs.forEach(f=>{const{updated:h,added:m,removed:E}=f.afterAllChildrenInitialized(i);r.push(...h),a.push(...m),c.push(...E)}),this.inputs.sort((f,h)=>f.index-h.index),i==null||i.attemptAutoclose("sync-input-maps",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}getValueInputMapDeclarationId(){switch(this.declaration.id){case ft.List:return ne[d.Loop]["list-loop"].inputs.list.id;case ft.ObjectKeys:return ne[d.Loop]["object-keys-loop"].inputs.object.id;case ft.ObjectValues:return ne[d.Loop]["object-values-loop"].inputs.object.id;case ft.String:return ne[d.Loop]["string-loop"].inputs.string.id;case ft.Counted:return ne[d.Loop]["counted-loop"].inputs.number.id;default:return null}}getCurrentValueBuiltInValueDescriptor(){var r;if(this.declaration.id===ft.ManualFlow||this.declaration.id===ft.Counted)return null;const i=(r=ne[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:r.id;return i?this.project.get(i):null}getCurrentIterationNumberBuiltInValueDescriptor(){const i=ne[d.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(i)}syncBody(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-body"))){var m;const r=[],a=[],c=[],e=[],f=ne[d.Loop][this.declaration.id].body.id,h=this.project.getBuiltIn(f);if(this.body)((m=this.body.implements)==null?void 0:m.id)!==h.id&&(this.body.setImplements(h,i),this.body.setParent(this,i),r.push(this.body));else{const E=ld.new(i);E.implements=h.toJSON(),E.name=h.name,E.parent=this.toReference();const b=Ae(E,this.project);b.hydrateAncestors(),b.setParent(this,i),b.addSelfToProject(i),i==null||i.add(b,W.Added),b.initChildren(i),i||b.captureVersion(),a.push(b)}return i==null||i.attemptAutoclose("sync-body",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}checkIsSynced(){var b,A,_,N,P,j,M,G,q,re,ee,de,ie,se,ue,z,X,ce,oe,me,ve,we,Re,xe,je;if((!this.body||!((b=this.body)!=null&&b.dataType)||!((A=this.body)!=null&&A.dataType.entity))&&this.id)return!1;const i=[ft.List,ft.ObjectKeys,ft.ObjectValues,ft.String],r=this.body.inputs.find(Se=>Se.implements.find(et=>et.id===ne[d.Loop][this.declaration.id].body.inputs.iterationNumber.id))||null,a=this.body.inputs.find(Se=>Se.implements.find(et=>{var Ze;return et.id===((Ze=ne[d.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:Ze.id)}))||null;if(!r||i.includes(this.declaration.id)&&!a)return!1;const c=[...this.breakStatements,...this.continueStatements];if(((P=(N=(_=this.body)==null?void 0:_.dataType)==null?void 0:N.entity)==null?void 0:P.id)!==ne["primitive-entity"].void.id){if(!this.body.inputs.find(et=>{var Ze,Xe,Dt,Mt,xi;return((Xe=(Ze=et.dataType)==null?void 0:Ze.entity)==null?void 0:Xe.id)===((xi=(Mt=(Dt=this.body)==null?void 0:Dt.dataType)==null?void 0:Mt.entity)==null?void 0:xi.id)})||((G=(M=(j=this.body)==null?void 0:j.dataType)==null?void 0:M.entity)==null?void 0:G.type)===d.DefinitionEntity&&(!((re=(q=this.body)==null?void 0:q.dataType)==null?void 0:re.entity).properties.every(Xe=>this.outputs.find(Dt=>{var Mt;return((Mt=Dt.declaration)==null?void 0:Mt.id)===Xe.id}))||!c.every(Xe=>{var hi,Jr;const Dt=Xe.outputs.filter(cr=>!cr.deleted),Mt=((Jr=(hi=this.body)==null?void 0:hi.dataType)==null?void 0:Jr.entity).properties.every(cr=>Dt.find(ar=>{var an;return((an=ar.declaration)==null?void 0:an.id)===cr.id})),xi=Dt.every(cr=>{var ar,an;return((an=(ar=this.body)==null?void 0:ar.dataType)==null?void 0:an.entity).properties.find(Is=>{var Vr;return Is.id===((Vr=cr.declaration)==null?void 0:Vr.id)})});return Mt&&xi})))return!1}else if(this.body.inputs.find(Ze=>{var Xe,Dt,Mt,xi,hi;return((Dt=(Xe=Ze.dataType)==null?void 0:Xe.entity)==null?void 0:Dt.id)===((hi=(xi=(Mt=this.body)==null?void 0:Mt.dataType)==null?void 0:xi.entity)==null?void 0:hi.id)})||this.outputs.length>0||![...this.breakStatements,...this.continueStatements].every(Ze=>Ze.outputs.filter(Xe=>!Xe.deleted).length===0))return!1;if([ft.List,ft.Counted,ft.ObjectKeys,ft.ObjectValues,ft.String].includes(this.declaration.id)){if(this.inputs.length!==1)return!1;const Se=this.inputs[0],et=this.getValueInputMapDeclarationId();if(((ee=Se.declaration)==null?void 0:ee.id)!==et)return!1}else if(this.inputs.length>0)return!1;if((ie=(de=this.body)==null?void 0:de.dataType)!=null&&ie.inferred){const Se=this.getUniqueInputMaps();if(c.every(Dt=>!Dt.readsValue)&&!Se.length&&((z=(ue=(se=this.body)==null?void 0:se.dataType)==null?void 0:ue.entity)==null?void 0:z.id)!==ne["primitive-entity"].void.id)return!1;const Ze=c.find(Dt=>Dt.readsValue),Xe=(oe=(ce=(X=Ze==null?void 0:Ze.readsValue)==null?void 0:X.getDataType(null))==null?void 0:ce.entity)==null?void 0:oe.id;if(Xe&&Xe!==((we=(ve=(me=this.body)==null?void 0:me.dataType)==null?void 0:ve.entity)==null?void 0:we.id))return!1}const f=((je=(xe=(Re=this.body)==null?void 0:Re.dataType)==null?void 0:xe.entity)==null?void 0:je.properties)||[],h=this.outputs,m=f.every(Se=>h.find(et=>{var Ze;return((Ze=et.declaration)==null?void 0:Ze.id)===Se.id})),E=h.every(Se=>f.find(et=>{var Ze;return et.id===((Ze=Se.declaration)==null?void 0:Ze.id)}));return!(!m||!E)}syncFromDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-from-data-type"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncOutputDataType(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:A}=this.syncBodyArgumentsDeclarations(i);r.push(...E),a.push(...b),c.push(...A);const{updated:_,added:N,removed:P}=this.syncBodyInputIndexes(i);r.push(..._),a.push(...N),c.push(...P);const{updated:j,added:M,removed:G}=this.syncOutputMaps(i);return r.push(...j),a.push(...M),c.push(...G),i==null||i.attemptAutoclose("sync-from-data-type",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}syncChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-children"))){const r=[],a=[],c=[],e=[],{updated:f,added:h,removed:m}=this.syncBody(i);r.push(...f),a.push(...h),c.push(...m);const{updated:E,added:b,removed:A}=this.syncInputMaps(i);r.push(...E),a.push(...b),c.push(...A);const{updated:_,added:N,removed:P}=this.syncTerminationStatements(i);r.push(..._),a.push(...N),c.push(...P);const{updated:j,added:M,removed:G}=this.syncFromDataType(i);return r.push(...j),a.push(...M),c.push(...G),i==null||i.attemptAutoclose("sync-children",this.id),{self:this,updated:C(r),added:C(a),removed:C(c),affected:C(e)}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}addValueReader(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddValueReader))){var e,f,h,m;if(!this.checkCanEditFromScopeOwnerWithSideEffects(this,w.AddValueReader,r))return this;(i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.SetValueWriter}-${this.id}`,action:w.SetValueWriter,owner:this,errorReason:Be.CannotValueWriteItself,rootAction:((e=r==null?void 0:r.self)==null?void 0:e.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.SetValueWriter}));const a=i.type===d.InputMap&&i.parent.type===d.VariableInstance&&((f=i.declaration)==null?void 0:f.type)===d.Property&&((h=i.declaration)==null?void 0:h.constant),c=i.type===d.VariableInstance&&((m=i.declaration)==null?void 0:m.constant);return(a||c)&&i?(r==null||r.event({id:`${w.SetValueWriter}-${this.id}--${i.id}`,action:w.SetValueWriter,owner:i,counterpart:this,errorReason:Be.ValueReadingOverridesConstantVariable,rootAction:!1}),r==null||r.attemptAutoclose(w.AddValueReader,this.id),this):this.writesValues.includes(i)?(r==null||r.attemptAutoclose(w.AddValueReader,this.id),this):(this.writesValues.push(i),r==null||r.add(this,W.Affected),this)}setDataType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetDataType))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetDataType,this.id),this;const a=this.dataType;return(a==null?void 0:a.id)!==(i==null?void 0:i.id)&&(a==null||a.remove({ignoreUpstream:!0},r),this.dataType=i,this.subscribeToDependencies(),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.SetDataType,this.id),this}removeValueReader(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,w.RemoveValueReader,r)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(a=>a.id!==i.id),r==null||r.add(this,W.Affected),this):(r==null||r.attemptAutoclose(w.RemoveValueReader,this.id),this):this}removeDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,W.Affected),this.dataType=null),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this):(Y.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveDataType,this.id),this)}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var r;return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType||((r=this.body)==null?void 0:r.dataType)||null}};R(Xt,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(Xt,"type",d.Loop),R(Xt,"USER_MANAGED_PARENT_TYPES",[...br,d.Project]),R(Xt,"PARENT_TYPES",[...Hi.USER_MANAGED_PARENT_TYPES]),R(Xt,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),R(Xt,"CURRENT_VALUE_ARG_NAME","Current value"),R(Xt,"MUTABLE_BASE_PROPERTIES",["catchesError"]),R(Xt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(Xt,"BASE_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,...Xt.INMUTABLE_BASE_PROPERTIES]),R(Xt,"MUTABLE_META_PROPERTIES",[...Xt.MUTABLE_BASE_PROPERTIES,"x","y"]),R(Xt,"INMUTABLE_META_PROPERTIES",[...Xt.INMUTABLE_BASE_PROPERTIES]),R(Xt,"META_PROPERTIES",[...Xt.MUTABLE_META_PROPERTIES,...Xt.INMUTABLE_META_PROPERTIES]),R(Xt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),R(Xt,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration","dataType"]),R(Xt,"UPSTREAM_PROPERTIES",[...Xt.MUTABLE_UPSTREAM_PROPERTIES,...Xt.INMUTABLE_UPSTREAM_PROPERTIES]),R(Xt,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","successCalls","errorCalls","error","breakStatements","continueStatements"]),R(Xt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Xt,"DOWNSTREAM_PROPERTIES",[...Xt.MUTABLE_DOWNSTREAM_PROPERTIES,...Xt.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Xt,"PROPERTIES",[...Xt.META_PROPERTIES,...Xt.UPSTREAM_PROPERTIES,...Xt.DOWNSTREAM_PROPERTIES]);let vp=Xt;async function c_e(l,p={}){const i=Y.YieldTracker.from(p),r=ya(l),a=ha(l),c=[...r,...a],e=qt(l.errors,c);await i.tick();for(const f of l.inputs)await f.validateAsync({tracker:i});return e}function f_e(l){l.inputs.forEach(a=>a.validate());const p=ya(l),i=ha(l),r=[...p,...i];return qt(l.errors,r)}const TAi=Object.freeze(Object.defineProperty({__proto__:null,validate:f_e,validateAsync:c_e},Symbol.toStringTag,{value:"Module"}));var y_e=(l=>(l.Parent="parent",l))(y_e||{});const Bi=class Bi extends nn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"x");R(this,"y");R(this,"type",d.Condition);R(this,"index",null);R(this,"successCalls",[]);R(this,"errorCalls",[]);R(this,"declaration");R(this,"inputs",[]);R(this,"calledBySuccess",[]);R(this,"calledByError",[]);R(this,"calledByEntry",[]);R(this,"andChildrenGroup",null);R(this,"orChildrenGroup",null);R(this,"project");R(this,"errors",[]);R(this,"parent");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);this.initialData=i,this.project=r,this.id=i.id,this.x=i.x,this.y=i.y,this.index=i.index??null}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,declaration:null,index:null,inputs:[],parent:null,andChildrenGroup:null,orChildrenGroup:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,r,a){var N,P;const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a;let e=r;if(i.parent){const j=te(i.parent);e=r.get(j)}const f=(i.calledByEntry||[]).map(j=>{const M=te(j);return r.get(M)}),h=(i.calledBySuccess||[]).map(j=>{const M=te(j);return r.get(M)}),m=(i.calledByError||[]).map(j=>{const M=te(j);return r.get(M)});let E;if(i.declaration){const j=te(i.declaration);E=r.get(j)}let b=null;e&&e.type===d.Condition&&(((N=e.declaration)==null?void 0:N.id)===Dr.Or?b=(e.orChildrenGroup||[]).length:((P=e.declaration)==null?void 0:P.id)===Dr.And&&(b=(e.andChildrenGroup||[]).length));const A={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.Condition,index:b,declaration:E.toJSON(),andChildrenGroup:[],orChildrenGroup:[],calledByEntry:f.map(j=>j.toReference()),calledBySuccess:h.map(j=>j.toReference()),calledByError:m.map(j=>j.toReference()),errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:e.toReference()},_=Ae(A,r);return _.hydrateAncestors(),_.setParent(e,c),_.addSelfToProject(c),c==null||c.add(_,W.Added),_.initChildren(c),c||_.captureVersion(),_}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Vn(a,{parent:{list:!1,types:[...br,d.Project],optional:!0}},r);c.push(...f.explanations),a=f.modifiedData;const h=Wr(a);if(e.push(...f.errors,...h.errors),c.push(...h.explanations),!i.declaration)e.push(new De({id:`${i.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:Te.Error,message:`Entity of type '${i.type}' with id '${i.id}' is missing the 'declaration' property. This property is required for a '${i.type}' entity and must point to one of the built-in action descriptors reserved for '${d.Condition}' entities.`})),c.push({id:Zi.AllConditionActionDescriptors,message:GI(r)});else if(!r.get(i.declaration))e.push(new De({id:`${i.id}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:Te.Error,message:`Entity of type '${i.type}' with id '${i.id}' has an 'declaration' property that isn't found in the project. The 'declaration' property must point to one of the built-in action descriptors reserved for '${d.Condition}' entities.`})),c.push({id:Zi.AllConditionActionDescriptors,message:GI(r)});else{const E=Gje(i.declaration,r);e.push(...E.errors),c.push(...E.explanations)}return{errors:e,explanations:c,modifiedData:a}}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new De({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:Te.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
48
48
  If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.remove({ignoreUpstream:!1},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];if(r==="parent"){const{updated:m,added:E,removed:b}=this.restore({},a);c.push(...m),e.push(...E),f.push(...b)}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new Bi(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new Bi(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.inputs=[...this.inputs],i.declaration=this.declaration,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,N]of A.knownVersions)E.set(_,N);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new Bi(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.inputs=[...h.inputs],this.declaration=h.declaration,this.andChildrenGroup=h.andChildrenGroup?[...h.andChildrenGroup]:null,this.orChildrenGroup=h.orChildrenGroup?[...h.orChildrenGroup]:null,this.successCalls=[...h.successCalls],this.errorCalls=[...h.errorCalls],this.calledBySuccess=[...h.calledBySuccess],this.calledByError=[...h.calledByError],this.calledByEntry=[...h.calledByEntry],this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){var a,c;if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const e=te(i.parent),f=this.project.get(e),h=this.parent;if(h&&h.id!==(f==null?void 0:f.id)&&this.removeFromParent(r),f)this.setParent(f,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const e=te(i.declaration),f=this.project.get(e);f&&this.setDeclaration(f)}return(a=i.andChildrenGroup)==null||a.forEach(e=>{const f=te(e),h=this.project.get(f);h&&(this.addToAndGroup(h,r),h.setParent(this,r))}),[...this.andChildrenGroup||[]].forEach(e=>{var h;((h=i.andChildrenGroup)==null?void 0:h.find(m=>te(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const f=te(e),h=this.project.get(f);h&&(this.addToOrGroup(h,r),h.setParent(this,r))}),[...this.orChildrenGroup||[]].forEach(e=>{var h;((h=i.orChildrenGroup)==null?void 0:h.find(m=>te(m)===e.id))||(this.removeChildGroup(e,r),e.removeFromParent(r))}),i.calledByEntry.forEach(e=>{const f=te(e),h=this.project.get(f);h&&(this.addEntryCaller(h,r),h.addCall(this,r))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(h=>te(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledBySuccess.forEach(e=>{const f=te(e),h=this.project.get(f);h&&(this.addSuccessCaller(h,r),h.addSuccessCall(this,r))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(h=>te(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),i.calledByError.forEach(e=>{const f=te(e),h=this.project.get(f);h&&(this.addErrorCaller(h,r),h.addErrorCall(this,r))}),[...this.calledByError].forEach(e=>{i.calledByError.find(h=>te(h)===e.id)||(this.removeCaller(e,r),e.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){var a,c,e;if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent){const f=te(i.parent),h=this.project.get(f),m=this.parent;if(m&&m.id!==(h==null?void 0:h.id)&&this.removeFromParent(r),h)this.setParent(h,r),this.addSelfToProject(r);else throw r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${f}' that isn't found in the project`)}if(i.declaration){const f=te(i.declaration),h=this.project.get(f);if(h)this.setDeclaration(h);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${f}' that isn't found in the project`)}return(a=i.calledByEntry)==null||a.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addEntryCaller(m,r),m.addCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByEntry' reference '${h}' that isn't found in the project`)}),i.calledByEntry&&[...this.calledByEntry].forEach(f=>{var m;((m=i.calledByEntry)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(c=i.calledBySuccess)==null||c.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addSuccessCaller(m,r),m.addSuccessCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledBySuccess' reference '${h}' that isn't found in the project`)}),i.calledBySuccess&&[...this.calledBySuccess].forEach(f=>{var m;((m=i.calledBySuccess)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),(e=i.calledByError)==null||e.forEach(f=>{const h=te(f),m=this.project.get(h);if(m)this.addErrorCaller(m,r),m.addErrorCall(this,r);else throw new Error(`${this.type} with id '${this.id}' has a 'calledByError' reference '${h}' that isn't found in the project`)}),i.calledByError&&[...this.calledByError].forEach(f=>{var m;((m=i.calledByError)==null?void 0:m.find(E=>te(E)===f.id))||(this.removeCaller(f,r),f.removeCall(this,r))}),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent){const e=te(this.initialData.parent),f=this.project.get(e);if(f)this.setParent(f,null);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const e=te(this.initialData.declaration),f=this.project.get(e);f&&(this.setDeclaration(f),i.push(f))}return this.initialData.calledByEntry.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addEntryCaller(h,null)}),this.initialData.calledBySuccess.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addSuccessCaller(h,null)}),this.initialData.calledByError.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.addErrorCaller(h,null)}),{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];if(this.initialized=!0,this.parent.type===d.Condition){let A=this.index||0;const _=(this.parent.declaration.id===Dr.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(P=>!P.deleted&&P.id!==this.id);_.length&&(A>_.length+1?A=_.length:A<0&&(A=0)),_.find(P=>(P.index||0)===A&&!P.deleted)&&_.filter(P=>(P.index||0)>=A&&!P.deleted).forEach(P=>{P.metaSync({index:(P.index||0)+1},i),i==null||i.add(P,W.Updated),r.push(P)}),this.metaSync({index:A},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((A,_)=>(A.index||0)-(_.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((A,_)=>(A.index||0)-(_.index||0)),this.inputs.sort((A,_)=>{var N,P;return(A.index??((N=A.declaration)==null?void 0:N.index))-(_.index??((P=_.declaration)==null?void 0:P.index))});const{updated:f,added:h,removed:m}=this.syncInputs(i);return r.push(...f),a.push(...h),c.push(...m),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){const r=[this],a=[],c=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===d.Condition&&(this.parent.declaration.id===Dr.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===Dr.Or&&this.parent.addToOrGroup(this,i)),this.successCalls.forEach(f=>{f.addSuccessCaller(this,i),r.push(f)}),this.errorCalls.forEach(f=>{f.addErrorCaller(this,i),r.push(f)}),this.calledByEntry.forEach(f=>{f.addCall(this,i),r.push(f)}),this.calledBySuccess.forEach(f=>{f.addSuccessCall(this,i),r.push(f)}),this.calledByError.forEach(f=>{f.addErrorCall(this,i),r.push(f)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveInput))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this;const a=this.inputs.findIndex(c=>c.id===i.id);return a>-1&&(this.inputs.splice(a,1),r&&(r==null||r.add(this,W.Affected))),r==null||r.attemptAutoclose(w.RemoveInput,this.id),this}addInput(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddInput))){return this.checkCanEdit(this,r)?this.inputs.includes(i)?(r==null||r.attemptAutoclose(w.AddInput,this.id),this):(this.inputs.push(i),r==null||r.add(this,W.Affected),r==null||r.attemptAutoclose(w.AddInput,this.id),this):(Y.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddInput,this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}--${Be.CannotSuccessCallItself}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.calledBySuccess.find(e=>e.id===i.id)||(this.calledBySuccess.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddSuccessCaller,this.id),this):this}addErrorCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.calledByError.find(e=>e.id===i.id)||(this.calledByError.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddErrorCaller,this.id),this):this}addEntryCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddEntryCaller)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddEntryCaller,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddEntryCaller}-${this.id}--${Be.CannotEntryCallItself}`,action:w.AddEntryCaller,owner:this,errorReason:Be.CannotEntryCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddEntryCaller})),this.calledByEntry.find(e=>e.id===i.id)||(this.calledByEntry.push(i),r==null||r.add(this,W.Updated),a&&Et(this,r)),r==null||r.attemptAutoclose(w.AddEntryCaller,this.id),this):this}addErrorCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddErrorCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddErrorCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddErrorCaller}-${this.id}--${Be.CannotErrorCallItself}`,action:w.AddErrorCaller,owner:this,errorReason:Be.CannotErrorCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddErrorCaller})),this.errorCalls.find(e=>e.id===i.id)||(this.errorCalls.push(i),a&&Et(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddErrorCall,this.id),this):this}addSuccessCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddSuccessCall)),a=!1){var c;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.AddSuccessCall,r)?((i==null?void 0:i.id)===this.id&&(r==null||r.event({id:`${w.AddSuccessCaller}-${this.id}`,action:w.AddSuccessCaller,owner:this,errorReason:Be.CannotSuccessCallItself,rootAction:((c=r==null?void 0:r.self)==null?void 0:c.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.AddSuccessCaller})),this.successCalls.find(e=>e.id===i.id)||(this.successCalls.push(i),a&&Et(this,r),r==null||r.add(this,W.Affected)),r==null||r.attemptAutoclose(w.AddSuccessCall,this.id),this):this}removeCall(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveCall)),a=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCall,r))return this;const c=this.successCalls.findIndex(f=>f.id===i.id);c>-1&&(this.successCalls.splice(c,1),r==null||r.add(this,W.Affected));const e=this.errorCalls.findIndex(f=>f.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),r==null||r.add(this,W.Affected)),a&&Et(this,r),r==null||r.attemptAutoclose(w.RemoveCall,this.id),this}removeCaller(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveCaller)),a=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.RemoveCaller,r)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(r==null||r.add(this,W.Updated),r==null||r.add(c,W.Affected),!1)),a&&Et(this,r),r==null||r.attemptAutoclose(w.RemoveCaller,this.id),this):this}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}removeChildGroup(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveChildGroup))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const a=this.andChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.andChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}if(this.orChildrenGroup){const a=this.orChildrenGroup.findIndex(c=>c.id===i.id);a!==-1&&(this.orChildrenGroup.splice(a,1),r==null||r.add(this,W.Updated))}return r==null||r.attemptAutoclose(w.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=Ae(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a})),this.successCalls=this.initialData.successCalls.map(r=>{const a=Ae(r,this.project);if(a.addSuccessCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=mn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.errorCalls=this.initialData.errorCalls.map(r=>{const a=Ae(r,this.project);if(a.addErrorCaller(this,null),[d.BreakStatement,d.ContinueStatement].includes(a.type))a.setParent(this.parent.parent,null),a.initChildren(i);else if(a.type===d.ReturnStatement){const c=mn(this,this.project);a.setParent(c,null),a.initChildren(i)}else a.type!==d.InternalCall&&(a.setParent(this.parent,null),a.initChildren(i));return a}),this.inputs=this.initialData.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(i),a}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Yr(this,i,r),c=zr(this,a),e=this.toMeta();return this.x=a.x!==void 0?a.x:e.x,this.y=a.y!==void 0?a.y:e.y,this.index=a.index!==void 0?a.index:e.index,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ke,...r){return await Bi.repository.APILoad(this.id,...r),this}async APICreate(i=Ke,...r){return await Bi.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ke,...r){return await Bi.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ke,...r){return await Bi.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ke,...r){return await Bi.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ke,r,...a){return await Bi.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){var f;if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent.type===d.Project?(this.parent.removeCondition(this),e.push(this.parent)):((f=this.parent)==null?void 0:f.type)===d.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return Y.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(m=>{const{removed:E,updated:b}=m.remove({ignoreUpstream:!0},r);c.push(...E),a.push(...b)}),this.inputs.forEach(m=>{const{updated:E,removed:b}=m.remove({ignoreUpstream:!0},r);a.push(...E),c.push(...b)}),this.successCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),this.errorCalls.forEach(m=>{a.push(m),m.removeCaller(this,r)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected),this.calledBy.forEach(E=>{a.push(E),E.removeCall(this,r)})}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(f=>{const{updated:h,added:m}=f.restore({},i);a.push(...h),r.push(...m)}),this.inputs.forEach(f=>{const{updated:h}=f.restore({},i);a.push(...h)}),this.successCalls.forEach(f=>{a.push(f),f.addSuccessCaller(this,i)}),this.errorCalls.forEach(f=>{a.push(f),f.addErrorCaller(this,i)}),this.calledBySuccess.forEach(f=>{a.push(f),f.addSuccessCall(this,i)}),this.calledByError.forEach(f=>{a.push(f),f.addErrorCall(this,i)}),this.calledByEntry.forEach(f=>{a.push(f),f.addCall(this,i)}),this.parent.type===d.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this})}toFlat(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((a=this.andChildrenGroup)==null?void 0:a.flatMap(e=>e.toFlat(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlat(i)))||[],...this.inputs.flatMap(e=>e.toFlat(i)),...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.calledBy.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((a=this.andChildrenGroup)==null?void 0:a.flatMap(e=>e.toFlatIds(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatIds(i)))||[],...this.inputs.flatMap(e=>e.toFlatIds(i)),...this.successCalls.flatMap(e=>e.toFlatIds(i)),...this.errorCalls.flatMap(e=>e.toFlatIds(i)),...this.calledBy.flatMap(e=>e.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var r,a;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(i),andChildrenGroup:((r=this.andChildrenGroup)==null?void 0:r.map(c=>c.toJSON(i)))||null,orChildrenGroup:((a=this.orChildrenGroup)==null?void 0:a.map(c=>c.toJSON(i)))||null,successCalls:this.successCalls.map(c=>c.toJSON(i)),errorCalls:this.errorCalls.map(c=>c.toJSON(i)),calledBySuccess:this.calledBySuccess.map(c=>c.toReference()),calledByError:this.calledByError.map(c=>c.toReference()),calledByEntry:this.calledByEntry.map(c=>c.toReference()),inputs:this.inputs.map(c=>c.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||rn(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(),andChildrenGroup:((m=this.andChildrenGroup)==null?void 0:m.map(b=>b.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((E=this.orChildrenGroup)==null?void 0:E.map(b=>b.toJSONClone({...i,newId:null})))||null,successCalls:this.successCalls.map(b=>b.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(b=>b.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),inputs:this.inputs.map(b=>b.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(i),andChildrenGroup:((c=this.andChildrenGroup)==null?void 0:c.map(f=>f.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(f=>f.toReference(i)))||null,inputs:this.inputs.map(f=>f.toReference(i)),successCalls:this.successCalls.map(f=>f.toReference(i)),errorCalls:this.errorCalls.map(f=>f.toReference(i)),calledBySuccess:this.calledBySuccess.map(f=>f.toReference(i)),calledByError:this.calledByError.map(f=>f.toReference(i)),calledByEntry:this.calledByEntry.map(f=>f.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((a=this.andChildrenGroup)==null?void 0:a.flatMap(e=>e.toFlatJSON(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatJSON(i)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(i=at){var c,e;const r=this.parent.type===d.Project?void 0:(c=i.seenEntityMaps)!=null&&c.has(this.parent.id)?i.seenEntityMaps.get(this.parent.id):this.parent.id;let a=this.id;return(e=i.seenEntityMaps)!=null&&e.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(f=>f.id),calledBySuccess:this.calledBySuccess.map(f=>f.id),calledByError:this.calledByError.map(f=>f.id),parent:r}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((a=this.andChildrenGroup)==null?void 0:a.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(i))])}clearErrors(){var i,r;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(a=>a.clearErrors()),(r=this.orChildrenGroup)==null||r.forEach(a=>a.clearErrors()),this.inputs.forEach(a=>a.clearErrors()),this.successCalls.forEach(a=>a.clearErrors()),this.errorCalls.forEach(a=>a.clearErrors()),this}validate(){return this.errors=f_e(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await c_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(r=>r.getErrors()),...this.andChildrenGroup?this.andChildrenGroup.flatMap(r=>r.getErrors()):[],...this.orChildrenGroup?this.orChildrenGroup.flatMap(r=>r.getErrors()):[]]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.inputs){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(await r.tick(),this.andChildrenGroup)for(const c of this.andChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.orChildrenGroup)for(const c of this.orChildrenGroup){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}return a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){var P,j,M;const e=Mr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.inputs=[];const m=h.split("-id"),E=m[m.length-1||0]||h;f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.deletable=!0,f.editable=!0;const b=tr(f,e);r?b.setParent(r,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,W.Added);const A=(P=this.andChildrenGroup)==null?void 0:P.map(G=>G.clone(i,b,x.UUID.uuid(),c)),_=(j=this.orChildrenGroup)==null?void 0:j.map(G=>G.clone(i,b,x.UUID.uuid(),c));b.andChildrenGroup=A||null,b.orChildrenGroup=_||null;const N=(M=this.inputs)==null?void 0:M.map((G,q)=>G.clone(i,b,E+"-input-map-"+q+"-id",c));return b.inputs=N,i||b.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),b}addToAndGroup(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddToAndGroup))){return this.checkCanEdit(this,r)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||(this.andChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this):(Y.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToAndGroup,this.id),this)}addToOrGroup(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddToOrGroup))){return this.checkCanEdit(this,r)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||(this.orChildrenGroup.push(i),r==null||r.add(i,W.Affected)),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this):(Y.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.inputs.forEach(h=>{if(!this.declaration.inputs.find(E=>{var b;return E.id===((b=h.declaration)==null?void 0:b.id)})){const E=h.remove({ignoreUpstream:!1},i);c.push(...E.removed),r.push(...E.updated)}}),this.inputs.filter((h,m)=>{const E=this.inputs.findIndex(A=>A.declaration===h.declaration&&A!==h);if(E===-1)return!1;const b=this.inputs[E];return B(b==null?void 0:b.createdAt).isSame(B(h.createdAt))?m>E:!!B(b==null?void 0:b.createdAt).isAfter(h.createdAt)}).forEach(h=>{const m=h.remove({ignoreUpstream:!1},i);c.push(...m.removed),r.push(...m.updated)}),i==null||i.attemptAutoclose(w.RemoveUnrecognizedInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}syncInputs(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SyncInputs))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[],f=this.declaration.inputs.filter(b=>b.parentRelationType===k.FixedArguments&&!this.inputs.find(A=>A.declaration.id===b.id));this.inputs.sort((b,A)=>b.index-A.index),f.forEach(b=>{this.inputs.forEach(N=>{N.index>=b.index&&N.metaSync({index:N.index+1},i)});const A={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.InputMap,dataType:null,parentRelationType:null,declaration:b.toJSON(),readsValue:null,defaultValue:null,index:b.index,name:null,codeName:null,description:null,parent:this.toReference()},_=Ae(A,this.project);_.setParent(this,i),_.addSelfToProject(i),i==null||i.add(_,W.Added),_.initChildren(i),i||_.captureVersion()}),this.inputs.sort((b,A)=>b.index-A.index);const{updated:h,added:m,removed:E}=this.removeUnrecognizedInputs(i);return r.push(...h),a.push(...m),c.push(...E),this.inputs.forEach(b=>{const{updated:A,added:_,removed:N}=b.afterAllChildrenInitialized(i);r.push(...A),a.push(..._),c.push(...N)}),this.inputs.sort((b,A)=>b.index-A.index),i==null||i.attemptAutoclose(w.SyncInputs,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return[]}getDataType(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"get-data-type"))){var a;const r=((a=this.declaration)==null?void 0:a.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),r}};R(Bi,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(Bi,"type",d.Condition),R(Bi,"USER_MANAGED_PARENT_TYPES",[...br,d.Project,d.Condition]),R(Bi,"PARENT_TYPES",[...Bi.USER_MANAGED_PARENT_TYPES]),R(Bi,"MUTABLE_BASE_PROPERTIES",["operator"]),R(Bi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),R(Bi,"BASE_PROPERTIES",[...Bi.MUTABLE_BASE_PROPERTIES,...Bi.INMUTABLE_BASE_PROPERTIES]),R(Bi,"MUTABLE_META_PROPERTIES",["x","y"]),R(Bi,"INMUTABLE_META_PROPERTIES",[...Bi.INMUTABLE_BASE_PROPERTIES]),R(Bi,"META_PROPERTIES",[...Bi.MUTABLE_META_PROPERTIES,...Bi.INMUTABLE_META_PROPERTIES]),R(Bi,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),R(Bi,"INMUTABLE_UPSTREAM_PROPERTIES",[]),R(Bi,"UPSTREAM_PROPERTIES",[...Bi.MUTABLE_UPSTREAM_PROPERTIES,...Bi.INMUTABLE_UPSTREAM_PROPERTIES]),R(Bi,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),R(Bi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(Bi,"DOWNSTREAM_PROPERTIES",[...Bi.MUTABLE_DOWNSTREAM_PROPERTIES,...Bi.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(Bi,"PROPERTIES",[...Bi.META_PROPERTIES,...Bi.UPSTREAM_PROPERTIES,...Bi.DOWNSTREAM_PROPERTIES]);let Ep=Bi;async function vAi(l,p={}){const i=Y.YieldTracker.from(p),r=[],a=qt(l.errors,r);return await i.tick(),a}function EAi(l){const p=[];return qt(l.errors,p)}async function h_e(l,p={}){const i=Y.YieldTracker.from(p),r=[],a=qt(l.errors,r);return await i.tick(),a}function m_e(l){const p=[];return qt(l.errors,p)}const bAi=Object.freeze(Object.defineProperty({__proto__:null,validate:m_e,validateAsync:h_e},Symbol.toStringTag,{value:"Module"}));function AAi(l,p){const i=[],r=[];if(l.parent)if(l.parent){const a=p.get(l.parent);a?xr.USER_MANAGED_PARENT_TYPES.includes(a.type)||r.push(new De({id:`${l.id}--${l.parent}--${he.InvalidParentReference}`,code:he.InvalidParentReference,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}", has a parent reference which is of type ${a.type}, and therefore that isn't pointing to the following valid types for this reference: '${vt(xr.USER_MANAGED_PARENT_TYPES,"', '","' or '")}'.`})):r.push(new De({id:`${l.id}--${l.parent}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${l.parent}" at 'parent' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else r.push(new De({id:`${l.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(xr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`}));else return r.push(new De({id:`${l.id}--${Ce.InvalidObjectStructure}`,code:Ce.InvalidObjectStructure,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type '${vt(xr.USER_MANAGED_PARENT_TYPES,"', '","', or '")}'.`})),{errors:r,explanations:i};if(l.valueAsTypeSingle){const a=[],c=[],e=l.valueAsTypeSingle;Array.isArray(e)?e.forEach(f=>{typeof f=="string"?c.push(f):a.push(f)}):typeof e=="string"?c.push(e):a.push(e),a.forEach(f=>{const h=F1(f);r.push(...h),h.length===0&&c.push(f.entityId)}),c.forEach(f=>{const h=p.get(f);h?[d.DefinitionEntity,d.BuiltInBaseEntity].includes(h.type)||r.push(new De({id:`${l.id}--${f}--${he.InvalidImplementsReference}`,code:he.InvalidImplementsReference,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}", has an 'valueAsTypeSingle' reference which is of type ${h.type}, and therefore that isn't pointing to the following valid types for this reference: 'definition-entity', 'function-declaration' or 'operation'.`})):r.push(new De({id:`${l.id}--${f}--${he.ReferencedEntityNotFound}`,code:he.ReferencedEntityNotFound,severity:Te.Error,message:`Entity of type "${l.type}" with id "${l.id}", is referencing an entity with id "${f}" at 'valueAsTypeSingle' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))})}return{errors:r,explanations:i}}var T_e=(l=>(l.ValueAsTypeSingle="value-as-type-single",l.ValueAsTypeList="value-as-type-list",l))(T_e||{});const ui=class ui extends nn{constructor(i,r){super(i);R(this,"initialData");R(this,"type",d.LiteralValue);R(this,"id");R(this,"name");R(this,"autogeneration",null);R(this,"value",null);R(this,"valueAsTypeSingle",null);R(this,"valueAsTypeList",null);R(this,"errors",[]);R(this,"parent");R(this,"standaloneParent");R(this,"project");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"standalone",!1);if(this.initialData=i,this.project=r,this.id=i.id,this.name=i.name,this.autogeneration=i.autogeneration,this.value=i.value,!this.name)throw new Error("[LiteralValueState.constructor] Must have a name in the initial data passed to the constructor")}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:"",autogeneration:null,value:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=te(i.parent),f=r.get(e);let h=null,m=null;i.valueAsTypeList?Array.isArray(i.valueAsTypeList)&&(m=i.valueAsTypeList.map(A=>r.get(A)||r.getBuiltIn(A))):i.valueAsTypeSingle&&(h=r.get(i.valueAsTypeSingle)||r.getBuiltIn(i.valueAsTypeSingle));const E={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:i.name,autogeneration:i.autogeneration,valueAsTypeSingle:h,valueAsTypeList:m,value:i.value||null,parent:f.toReference()},b=Ae(E,r);return b.hydrateAncestors(),b.setParent(f,c),b.addSelfToProject(c),c==null||c.add(b,W.Added),b.initChildren(c),c||b.captureVersion(),b}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));(a.valueAsTypeList||a.valueAsTypeSingle)&&(a.name=ye.EntityTemplate);const c=[],e=[],f=AAi(a,r),h=Wr(a);return e.push(...f.errors,...h.errors),c.push(...f.explanations,...h.explanations),{errors:e,explanations:c,modifiedData:a}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){return!!(this.parent.type===d.Property&&(this.parent.constant||this.parent.implements.some(i=>i.constant))||this.parent.type===d.Property&&this.parent.parent.type===d.DefinitionEntity&&!cl(this.parent.parent))}validateGeneratedUpdate(i){const r=[],a=[];return i.parent&&r.push(new De({id:`${this.id}--${he.InvalidParentUpdate}`,code:he.InvalidParentUpdate,severity:Te.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
49
- This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=null,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==i.id),a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=i,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(i=>{i.type!==d.BuiltInBaseEntity&&i.unsubscribeDependents([{entity:this,field:"value-as-type-list"}])}),this}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(i=>{i.type!==d.BuiltInBaseEntity&&i.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new ui(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new ui(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,N]of A.knownVersions)E.set(_,N);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new ui(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.valueAsTypeSingle=h.valueAsTypeSingle,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=te(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=te(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(a=>{const c=te(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>te(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=te(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}else this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=te(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=te(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' that isn't found in the project`)}if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(a=>{const c=te(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>te(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=te(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}return(i.valueAsTypeSingle===null||i.valueAsTypeList||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeSingle(null,r),(i.valueAsTypeList===null||i.valueAsTypeSingle||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeList(null,r),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const e=te(this.initialData.parent),f=this.project.get(e);if(Y.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)Y.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),i.push(f);else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const e=te(this.initialData.standaloneParent),f=this.project.get(e);if(Y.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)Y.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Standalone parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${e}' that isn't found in the project`)}else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Entity with id '${this.id}' must have a 'parent'`),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.valueAsTypeList.push(h)});else if(this.initialData.valueAsTypeSingle){const e=te(this.initialData.valueAsTypeSingle),f=this.project.get(e);f&&(this.valueAsTypeSingle=f)}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.initialized=!0,i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f,h;const r=[this],a=[],c=[],e=[];return((f=this.parent)==null?void 0:f.type)===d.DataType?this.parent.setEntity(this,i):(h=this.parent)==null||h.setDefaultValue(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setStandaloneParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetStandaloneParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetStandaloneParent,r)?(((a=this.standaloneParent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.standaloneParent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetStandaloneParent,this.id),this):this}addValueAsTypeToList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddValueAsTypeToList))){return this.checkCanEdit(this,r)?((this.valueAsTypeList||[]).includes(i)||(this.valueAsTypeList=this.valueAsTypeList||[],this.valueAsTypeList.push(i),this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated)),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this):(Y.Logger.warn(`[addValueAsTypeToList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this)}removeValueAsTypeFromList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueAsTypeFromList))){return this.checkCanEdit(this,r)?(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&(this.valueAsTypeList||[]).includes(i)&&(this.valueAsTypeList=this.valueAsTypeList.filter(a=>a.id!==i.id),this.valueAsTypeList.length===0?this.valueAsTypeList=null:(this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated))),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this):(Y.Logger.warn(`[removeValueAsTypeFromList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this)}setValueAsTypeSingle(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeSingle))){return this.checkCanEdit(this,r)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this):(Y.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeList))){var a,c;return this.checkCanEdit(this,r)?(!i&&this.valueAsTypeList?(this.valueAsTypeList=null,r==null||r.add(this,W.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((a=this.valueAsTypeList)==null?void 0:a.length)!==i.length?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,f)=>e!==i[f]))&&(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this):(Y.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this)}setValueAsType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsType))){return this.checkCanEdit(this,r)?i?(Array.isArray(i)?this.setValueAsTypeList(i,r):this.setValueAsTypeSingle(i,r),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r),this):(Y.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this)}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=a,this}const r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=r}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=te(this.initialData.valueAsTypeSingle),c=a?this.project.get(a):null;if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=c,this}const r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=r}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Yr(this,i,r),c=zr(this,a),e=this.toMeta();return this.name=a.name!==void 0?a.name:e.name,this.autogeneration=a.autogeneration!==void 0?a.autogeneration:e.autogeneration,this.value=a.value!==void 0?a.value:e.value,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ke,...r){return await ui.repository.APILoad(this.id,...r),this}async APICreate(i=Ke,...r){return await ui.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ke,...r){return await ui.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ke,...r){return await ui.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ke,...r){return await ui.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ke,r,...a){return await ui.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent&&(this.parent.type===d.DataType?this.parent.setEntity(null,i):ig.includes(this.parent.type)&&this.parent.setDefaultValue(null,i),e.push(this.parent)),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return Y.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlat(i)):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatIds(i)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((r=this.valueAsTypeSingle)==null?void 0:r.toJSON(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(e=>e.toJSON(i)):null,parent:(a=this.parent)==null?void 0:a.toReference(),standaloneParent:(c=this.standaloneParent)==null?void 0:c.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||rn(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...i,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(b=>this.project.getBuiltIn(b.id)?b.toJSON(i.seenEntities):b.toJSONClone({...i,newId:null})):null,parent:(m=this.parent)==null?void 0:m.toReference({seenEntityMaps:i.seenEntityMaps}),standaloneParent:(E=this.standaloneParent)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.toReference(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(h=>h.toReference(i)):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.toReference(i),standaloneParent:(f=this.standaloneParent)==null?void 0:f.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatJSON(i)):[]])}toGenerationTarget(i=at){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,type:this.type,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(h=>h.id):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.id,standaloneParent:(f=this.standaloneParent)==null?void 0:f.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatGenerationTarget(i)):[]])}clearErrors(){return this.errors=[],this}validate(){return this.errors=m_e(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await h_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];return await r.tick(),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){const e=Mr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.editable=!0,f.deletable=!0;const m=tr(f,e);return m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),i==null||i.add(m,W.Added),m.initChildren(i),i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}merge(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"merge-literal-value"))){const a=[],c=[],e=[],f=[];return this.valueAsTypeSingle!==(i==null?void 0:i.valueAsTypeSingle)&&(this.setValueAsType(i.valueAsTypeSingle,r),a.push(this)),this.valueAsTypeList!==i.valueAsTypeList&&(this.setValueAsTypeList(i.valueAsTypeList,r),a.push(this)),this.value!==i.value&&(this.metaSync({value:i.value},r),a.push(this)),this.autogeneration!==i.autogeneration&&(this.metaSync({autogeneration:i.autogeneration},r),a.push(this)),this.name!==i.name&&(this.metaSync({name:i.name},r),a.push(this)),r==null||r.attemptAutoclose("merge-literal-value",this.id),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}};R(ui,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(ui,"type",d.LiteralValue),R(ui,"USER_MANAGED_PARENT_TYPES",[d.DataType,d.InputMap,d.Property,d.ArgumentDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement,d.VariableDeclaration,d.VariableInstance,d.ValueDescriptor]),R(ui,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...tg]),R(ui,"PARENT_TYPES",[...ui.USER_MANAGED_PARENT_TYPES]),R(ui,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),R(ui,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(ui,"BASE_PROPERTIES",[...ui.MUTABLE_BASE_PROPERTIES,...ui.INMUTABLE_BASE_PROPERTIES]),R(ui,"MUTABLE_META_PROPERTIES",[...ui.MUTABLE_BASE_PROPERTIES]),R(ui,"INMUTABLE_META_PROPERTIES",[...ui.INMUTABLE_BASE_PROPERTIES]),R(ui,"META_PROPERTIES",[...ui.MUTABLE_META_PROPERTIES,...ui.INMUTABLE_META_PROPERTIES]),R(ui,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),R(ui,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(ui,"UPSTREAM_PROPERTIES",[...ui.MUTABLE_UPSTREAM_PROPERTIES,...ui.INMUTABLE_UPSTREAM_PROPERTIES]),R(ui,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ui,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ui,"DOWNSTREAM_PROPERTIES",[...ui.MUTABLE_DOWNSTREAM_PROPERTIES,...ui.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(ui,"PROPERTIES",[...ui.META_PROPERTIES,...ui.UPSTREAM_PROPERTIES,...ui.DOWNSTREAM_PROPERTIES]);let xr=ui;function qf(l){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(l);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(l)}function v_e(l,p){const i=p-l+1,a=n1()*i;return Math.floor(a)+l}function E_e(){const l=qf(4);return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0}function n1(){return E_e()/2**32}function Rx(l){const p=qf(l);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const g_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Dx(l){let p="";const i=qf(l);for(let r=0;r<l;r++)p+=g_[i[r]%g_.length];return p}function b_e(l){const p=qf(l);let i;if(typeof Buffer<"u")i=Buffer.from(p).toString("base64");else{const r=String.fromCharCode(...p);i=btoa(r)}return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function wx(l){return Dx(l)}function Cx(l,p=g_){let i="";const r=qf(l);for(let a=0;a<l;a++)i+=p[r[a]%p.length];return i}function op(){const l=qf(16);l[6]=l[6]&15|64,l[8]=l[8]&63|128;const p=Array.from(l).map(i=>i.toString(16).padStart(2,"0")).join("");return[p.slice(0,8),p.slice(8,12),p.slice(12,16),p.slice(16,20),p.slice(20,32)].join("-")}function A_e(){return Cx(6)}function I_e(){return Rx(32)}const IAi=63,gAi=/^[a-z][a-z0-9-]*[a-z0-9]$/;function RAi(l){return l.length>=1&&l.length<=IAi&&gAi.test(l)&&!l.includes("--")}function*DAi(){yield"";const l="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const i=new Array(p).fill(0);let r=!1;for(;!r;){yield i.map(a=>l[a]).join("");for(let a=p-1;a>=0&&(i[a]++,!(i[a]<l.length));a--)i[a]=0,a===0&&(r=!0)}}}function wAi(l,p){const i=new Set(l.map(a=>a.toLowerCase())),r=p>0?"secondary-db":"main";for(const a of DAi()){const c=a?`${r}-${a}`:r;if(RAi(c)&&!i.has(c))return c}throw new Error("Unable to generate identifier")}function g_e(l,p){switch(l.id){case ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=l.project.entities.filter(h=>!!h.implements.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),r=i.find(h=>{const m=h.properties.find(A=>A.implements.find(_=>_.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.getDefaultValue();return(E==null?void 0:E.value)===!0});if(!r&&i.length){const m=i[0].properties.find(b=>b.implements.find(A=>A.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.defaultValue;if(E)E.metaSync({value:!0},p);else if(m!=null&&m.dataType){const b={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},A=Ae(b,l.project);return A.hydrateAncestors(),A.setParent(m,p),A.addSelfToProject(p),p==null||p.add(A,W.Added),A.initChildren(p),p||A.captureVersion(),{newEntities:[A]}}return{newEntities:[]}}else if(r)return{newEntities:[]};const a=l.project.get(ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),c=a1(a,"Main database",p);if(c.errors.length>0)return{newEntities:[]};const e=c.properties.find(h=>h.implements.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),f=e==null?void 0:e.defaultValue;if(f)f.metaSync({value:!0},p);else if(e!=null&&e.dataType){const h={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Ae(h,l.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,W.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[c]}}}return{newEntities:[]}}function R_e(l,p){const i=[],r=[],a=[],c=[];return l.implements.filter(f=>f.type===d.BuiltInBaseEntity).forEach(f=>{var h,m,E,b,A,_,N,P,j;switch(f.id){case ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const M=l.project.entities.filter(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let G=M.find(ie=>!!ie.properties.find(se=>{var ue;return se.implements.find(z=>z.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ue=se.getDefaultValue())==null?void 0:ue.value)===!0}));if(!G&&M.length)G=M[0];else if(!G&&!M.length){G=l.project.getBuiltIn(ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const se=G.properties.find(ue=>ue.implements.find(z=>z.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(h=se==null?void 0:se.defaultValue)==null||h.metaSync({value:!0},p),r.push(G)}const q=l.properties.find(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if(q&&!(q!=null&&q.defaultValue)){const ie={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(G==null?void 0:G.toJSON())||null,valueAsTypeList:null,parent:q==null?void 0:q.toReference()},se=Ae(ie,l.project);se.hydrateAncestors(),se.setParent(q,p),se.addSelfToProject(p),p==null||p.add(se,W.Added),se.initChildren(p),(q==null?void 0:q.defaultValue).setValueAsTypeSingle(G||null,p),r.push(se),p||se.captureVersion();return}else q!=null&&q.defaultValue&&!(q!=null&&q.defaultValue.valueAsTypeSingle)&&(q==null||q.defaultValue.setValueAsTypeSingle(G||null,p));const re=l.properties.find(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!re)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${ne["built-in-base-entity"]}`);let ee=!1;if(!re.dataType){const ie=yr.new(p);ie.parent=re.toReference();const se=Ae(ie,l.project);se.hydrateAncestors(),se.setParent(re,p),se.addSelfToProject(p),p==null||p.add(se,W.Added),se.initChildren(p),ee=!0}const de=l.project.getBuiltIn(ne["primitive-entity"].number.id);(m=re.dataType)==null||m.setEntity(de,p),ee&&(p||(E=re.dataType)==null||E.captureVersion());return}case ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const M=l.project.entities.filter(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&z.id!==l.id),G=M.map(z=>{var oe;const X=z.properties.find(me=>me.implements.find(ve=>ve.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(oe=X==null?void 0:X.getDefaultValue())==null?void 0:oe.value}).filter(z=>!!z),q=l.properties.find(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!M.find(z=>!!z.properties.find(X=>{var ce;return X.implements.find(oe=>oe.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ce=X.getDefaultValue())==null?void 0:ce.value)===!0}))){const z=l.properties.find(ce=>ce.implements.find(oe=>oe.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!z)throw new Error("Default boolean property not found for relational database entity with id: "+l.id);let X=!1;if(!(z!=null&&z.defaultValue)){const ce=xr.new(p);ce.parent=z.toReference();const oe=Ae(ce,l.project);oe.hydrateAncestors(),oe.setParent(z,p),oe.addSelfToProject(p),p==null||p.add(oe,W.Added),oe.initChildren(p),X=!0}(b=z==null?void 0:z.defaultValue)==null||b.metaSync({value:!0},p),X&&(p||(A=z==null?void 0:z.defaultValue)==null||A.captureVersion())}if(!q)throw new Error("Identifier property not found for relational database entity with id: "+l.id);let ee=!1;if(!(q!=null&&q.defaultValue)){const z=xr.new(p);z.parent=q.toReference();const X=Ae(z,l.project);X.hydrateAncestors(),X.setParent(q,p),X.addSelfToProject(p),p==null||p.add(X,W.Added),X.initChildren(p),ee=!0}const de=wAi(G,M.length);(_=q.defaultValue)==null||_.metaSync({value:de},p),ee&&(p||(N=q.defaultValue)==null||N.captureVersion());const ie=l.properties.find(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!ie)throw new Error(`[handleAfterEntityImplementationSideEffects] Password property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id} with id ${l.id}`);let se=!1;if(!ie.defaultValue){const z=xr.new(p);z.parent=ie.toReference();const X=Ae(z,l.project);X.hydrateAncestors(),X.setParent(ie,p),X.addSelfToProject(p),p==null||p.add(X,W.Added),X.initChildren(p),r.push(X),se=!0}const ue=wx(24);(P=ie.defaultValue)==null||P.metaSync({value:ue},p),se&&(p||(j=ie.defaultValue)==null||j.captureVersion());return}case ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const M=l.properties.find(ee=>ee.implements.find(de=>de.id===ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!M)throw new Error(`[handleAfterEntityImplementationSideEffects] Time property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let G=M.defaultValue||null;if(!G){const ee=xr.new(p);ee.parent=M.toReference(),ee.name=ye.Date,ee.id=x.UUID.uuid(),G=Ae(ee,l.project),G.hydrateAncestors(),G.setParent(M,p),G.addSelfToProject(p),G.initChildren(p),p==null||p.add(G,W.Added)}G.metaSync({value:new Date().toISOString()},p),G.metaSync({editable:!1,deletable:!1},p),M.metaSync({editable:!1,deletable:!1},p);const q=l.properties.find(ee=>ee.implements.find(de=>de.id===ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!q)throw new Error(`[handleAfterEntityImplementationSideEffects] Definition property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let re=q.defaultValue||null;if(!re){const ee=xr.new(p);ee.name=ye.EntityTemplate,ee.parent=q.toReference(),ee.id=x.UUID.uuid(),re=Ae(ee,l.project),re.hydrateAncestors(),re.setParent(q,p),re.addSelfToProject(p),re.initChildren(p),p==null||p.add(re,W.Added)}}}}),{self:l,updated:C(i),added:C(r),removed:C(a),affected:C(c)}}function a1(l,p,i,r){const a=r||x.UUID.uuid(),c=Ls.new(i);c.id=a,c.name=p,c.static=l.static,c.implements=[l.toJSON()],c.parent=l.project.toReference(),c.static=l.static,g_e(l,i);const e=Ae(c,l.project);return e.hydrateAncestors(),i==null||i.add(e,W.Added),e.addSelfToProject(i),e.initChildren(i),i||e.captureVersion(),R_e(e,i),e.afterAllChildrenInitialized(i),e}function Ox(l,p){return p.entities.find(a=>{const c=a.properties,e=c.map(b=>b.name),f=l.every(b=>e.includes(b)),h=e.filter(b=>!l.includes(b)),m=c.every(b=>!h.includes(b.name)||!b.required);return f&&m})||null}function D_e(l,p,i,r=ze.OrDataTypeGroup){const a=[],c=[],e=[],f=[],h=x.UUID.uuid(),m=yr.new(i);m.id=h,m.parent=p.toReference(),m.like=!0,m.parentRelationType=r;const E=Ae(m,l.project);return c.push(E),E.setParent(p,i),E.addSelfToProject(i),i==null||i.add(E,W.Added),E.setEntity(l,i),E.initChildren(i),i||E.captureVersion(),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:E}}function _x(l,p,i,r,a){var m,E,b,A,_,N,P,j;const c=[],e=[],f=[],h=[];switch(typeof l){case"string":let M=!1;const G=new Date(l);if(G instanceof Date&&!isNaN(G.valueOf())&&(M=!0),M){const q=p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Date].id);p.setEntity(q,r);break}else{const q=p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id);p.setEntity(q,r);break}case"number":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":if(l===null){p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}else if(Array.isArray(l))if(p.metaSync({isList:!0},r),l.length>0){const q=l.slice(0,5).filter(ee=>ee!==void 0);if(q.every(ee=>typeof ee==typeof q[0])&&(typeof q[0]!="object"||q[0]===null))switch(typeof q[0]){case"string":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id),r);break;case"number":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}else{const ee=[];let de=!1;q.forEach(se=>{var ue,z,X,ce;if(Array.isArray(se)&&(de=!0),typeof se=="object"&&!Array.isArray(se)&&se!==null){const oe=JA(se,p.project,{...i,id:x.UUID.uuid()},r,a);oe.hasCreated&&ee.push((ue=oe.changeSet)==null?void 0:ue.self),c.push(...(z=oe.changeSet)==null?void 0:z.updated),e.push(...(X=oe.changeSet)==null?void 0:X.added),f.push(...(ce=oe.changeSet)==null?void 0:ce.removed)}});const ie=C(ee);if(!ie.length&&!de){q.forEach(se=>{const ue=yr.new(r);ue.parentRelationType=ze.OrDataTypeGroup,ue.parent=p.toReference();const z=Ae(ue,p.project);switch(z.hydrateAncestors(),z.setParent(p,r),z.addSelfToProject(r),r==null||r.add(z,W.Added),z.initChildren(r),typeof se){case"string":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id),r);break;case"number":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}r||z.captureVersion()});break}else ie.length===1&&!de?p.setEntity(ie[0],r):q.forEach(se=>{if(typeof se=="object"&&!Array.isArray(se)&&se!==null){const ue=Ox(Object.keys(se),p.project);if(ue){const z=D_e(ue||ie[0],p,r,ze.OrDataTypeGroup);c.push(...z.updated),e.push(...z.added),f.push(...z.removed)}}else{const ue=yr.new(r);ue.parentRelationType=ze.OrDataTypeGroup,ue.parent=p.toReference();const z=Ae(ue,p.project);z.hydrateAncestors(),z.setParent(p,r),z.addSelfToProject(r),r==null||r.add(z,W.Added),z.initChildren(r);const X=_x(se,z,{...i,id:x.UUID.uuid()},r,a);c.push(...X.updated),e.push(...X.added),f.push(...X.removed),r||z.captureVersion()}})}}else{const q=JA(l[0],p.project,{...i},r,a);p.setEntity((m=q.changeSet)==null?void 0:m.self,r),c.push(...(E=q.changeSet)==null?void 0:E.updated),e.push(...(b=q.changeSet)==null?void 0:b.added),f.push(...(A=q.changeSet)==null?void 0:A.removed);break}else{const q=JA(l,p.project,{...i},r,a);p.setEntity((_=q.changeSet)==null?void 0:_.self,r),c.push(...(N=q.changeSet)==null?void 0:N.updated),e.push(...(P=q.changeSet)==null?void 0:P.added),f.push(...(j=q.changeSet)==null?void 0:j.removed);break}}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:p}}function JA(l,p,i,r,a){const c=[],e=[],f=[],h=[],m=Object.keys(l),E=Ox(m,p);if(E)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:E}};const b=a?i.name+" of "+a.name:i.name,_={id:i.id||x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,name:b,codeName:null,deletable:!0,editable:!0,type:d.DefinitionEntity,additionalProperties:!1,additionalPropertiesDataType:null,allPropertiesImplement:null,description:i.description||null,static:i.static||!1,abstract:i.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:null,implements:[],x:0,y:0,parent:p.toReference()},N=Ae(_,p);return N.hydrateAncestors(),N.setParent(p,r),N.addSelfToProject(r),r==null||r.add(N,W.Added),N.initChildren(r),e.push(N),m.forEach((P,j)=>{const M=x.UUID.uuid(),G=ps.new(r);G.id=M,G.name=P,G.codeName=P,G.parent=N.toReference(),G.index=j,G.required=!0,G.interactive=!0;const q=Ae(G,p);q.hydrateAncestors(),q.setParent(N,r),q.addSelfToProject(r),r==null||r.add(q,W.Added),q.initChildren(r),e.push(q);const re=l[P],ee=x.UUID.uuid(),de=yr.new(r);de.id=ee,de.parent=q.toReference(),de.like=!0,de.isList=!1;const ie=Ae(de,p);ie.hydrateAncestors(),ie.setParent(q,r),ie.addSelfToProject(r),r==null||r.add(ie,W.Added),ie.initChildren(r),e.push(ie);const se=_x(re,ie,{...i,name:P,id:x.UUID.uuid()},r,a||N);c.push(...se.updated),e.push(...se.added),f.push(...se.removed),r||(q.captureVersion(),ie.captureVersion())}),r||N.captureVersion(),{hasCreated:!0,changeSet:{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:N}}}function Ud(l,p,i,r){const a=[];return!l.length||!p.length?{errors:a,overlap:!1}:(l.length>p.length?l.forEach(c=>{const e=p.find(h=>h.name===c.name),f=p.find(h=>{var m,E;return Array.isArray(h.implements)?h.implements.some(b=>!!c.implements.find(A=>A.id===b.id)):((m=h.implements)==null?void 0:m.id)===((E=c.implements)==null?void 0:E.id)});if(e){const h=new ki({id:c.id+"--"+e.id+"--"+r,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${e.type} ${e.name} with id "${e.id}" that has the same name`,severity:Te.Error,code:r,entity:c,firstRelationship:e});a.push(h)}if(f){const h=new ki({id:c.id+"--"+f.id+"--"+i,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${f.type} ${f.name} with id "${f.id}" that implements the same base descriptor`,severity:Te.Error,code:i,entity:c,firstRelationship:f});a.push(h)}}):p.forEach(c=>{var h;const e=l.find(m=>m.name===c.name),f=l.find(m=>{var E,b;return m.implements&&Array.isArray(m.implements)?m.implements.some(A=>!!c.implements.find(_=>_.id===A.id)):((E=m.implements)==null?void 0:E.id)===((b=c.implements)==null?void 0:b.id)});if(e){const m=new ki({id:e.id+"--"+c.id+"--"+r,message:`Entity of type ${e.type} named "${e.name}" with id "${e.id}" overrides a base entity ${c.name} with id "${c.id}" that has the same name`,severity:Te.Error,code:r,entity:e,firstRelationship:c});a.push(m)}if(f){const m=new ki({id:f.id+"--"+c.id+"--"+i,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base entity ${c.name} with id "${c.id}" that implements the same base ${Array.isArray(f==null?void 0:f.implements)?vt(f==null?void 0:f.implements.map(E=>E.type),"', '","' and '"):(h=f.implements)==null?void 0:h.id}`,severity:Te.Error,code:i,entity:f,firstRelationship:c});a.push(m)}}),{errors:a,overlap:!!a.length})}function CAi(l,p){return l.abstract||(l.properties.forEach(r=>{r.abstract||r.metaSync({abstract:!0},p)}),Object.values(l.detachedDependents).forEach(r=>{r.field===tL.EntityField&&r.entity.remove({ignoreUpstream:!1},p)}),l.metaSync({abstract:!0},p)),l}function OAi(l,p){return l.abstract&&(l.properties.forEach(r=>{r.abstract&&r.metaSync({abstract:!1},p)}),Object.values(l.detachedDependents).forEach(r=>{(r.field===jI.Implements||r.field===jI.Extends)&&r.entity.onDetachedDependencyRemoved(l,r.field,p)}),l.metaSync({abstract:!1},p)),l}function _Ai(l,p){return l.static||(l.properties.forEach(r=>{r.static||r.metaSync({static:!0},p)}),l.metaSync({static:!0},p)),l}function VAi(l,p){return l.static&&l.metaSync({static:!1},p),l}const kT=class kT extends Ex{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"version");R(this,"name");R(this,"description",null);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",!1);R(this,"static");R(this,"additionalProperties",!1);R(this,"properties",[]);R(this,"allPropertiesImplement",null);R(this,"additionalPropertiesDataType",null);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"interactive",!1);R(this,"errors",[]);R(this,"project");if(this.initialData=this.initialData||i,this.project=this.project||r,this.id=this.id||i.id,this.version=this.version||i.version,this.name=this.name||i.name,this.static=this.static||i.static,this.interactive=this.interactive||i.interactive,this.abstract=i.abstract,this.additionalProperties=i.additionalProperties,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.initialData.allPropertiesImplement){const a=Ae(this.initialData.allPropertiesImplement,this.project);a.setParent(this,null),a.initChildren(null),this.allPropertiesImplement=a}if(this.initialData.additionalPropertiesDataType){const a=Ae(this.initialData.additionalPropertiesDataType,this.project);a.setParent(this,null),a.initChildren(null),this.additionalPropertiesDataType=a}this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}get allMethods(){return C([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return C([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allMethods)||[],r=[...i].filter(c=>!i.some(e=>e.id!==c.id));return C(r)}get allBasePropertiesFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allProperties)||[],r=[...i].filter(c=>!i.some(e=>{var f;return e.id!==c.id&&(!!e.implements.find(h=>h.id===c.id)||((f=e.extends)==null?void 0:f.id)===c.id)}));return C(r)}get allBasePropertiesFromExtendedAndImplementedEntities(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.allBasePropertiesFromExtendedAndImplementedEntities)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C([...r])}get allBaseMethodsFromExtendedAndImplementedEntities(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>r.type===d.PrimitiveEntity?i:[...[...r.ownDeclaredMethods,...r.allBaseMethodsFromExtendedAndImplementedEntities].filter(c=>c.type!==d.ActionDescriptor),...i],[])])}get extendedPropertiesFromOriginalParents(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.extendedPropertiesFromOriginalParents)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C(r)}get implementedPropertiesFromOriginalParents(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>{const a=r.implementedPropertiesFromOriginalParents,c=[...r.ownDeclaredProperties].filter(h=>!!h.abstract),e=[...a,...c,...i];return[...e].filter(h=>!!!e.find(E=>{var b;return((b=E.extends)==null?void 0:b.id)===h.id||!!E.implements.find(A=>A.id===h.id)}))},[])].filter(i=>!!i.abstract))}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredMethods(){return[...this.methods,...this.abstractMethods]}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}subscribe(){return this.project.subscribeBuiltInInstance(this),this}unsubscribe(){return this.project.unsubscribeBuiltInInstance(this),this}async APILoad(i=Ke,...r){return await kT.repository.APILoad(this.id,...r),this}toFlat(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(c=>c.toFlat(i)),...this.methods.flatMap(c=>c.toFlat(i)),...this.abstractMethods.flatMap(c=>c.toFlat(i)),...((a=this.extends)==null?void 0:a.toFlat(i))||[]])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(c=>c.toFlatIds(i)),...this.methods.flatMap(c=>c.toFlatIds(i)),...this.abstractMethods.flatMap(c=>c.toFlatIds(i)),...((a=this.extends)==null?void 0:a.toFlatIds(i))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,additionalProperties:this.additionalProperties,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(i=new Set){var r,a,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,additionalProperties:this.additionalProperties,interactive:this.interactive,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toJSON(i))||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toJSON(i))||null,properties:this.properties.map(e=>e.toJSON(i)),methods:this.methods.map(e=>e.toJSON(i)),abstractMethods:this.abstractMethods.map(e=>e.toJSON(i)),extends:((c=this.extends)==null?void 0:c.toJSON(i))||null})}toReference(i=at){return{id:this.id+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=at){var r,a,c;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,additionalProperties:this.additionalProperties,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toReference())||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toReference())||null,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:((c=this.extends)==null?void 0:c.toReference())||null}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(e=>e.toFlatJSON(i)),...this.methods.flatMap(e=>e.toFlatJSON(i)),...this.abstractMethods.flatMap(e=>e.toFlatJSON(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatJSON(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatJSON(i))||[]])}toGenerationTarget(i=at){var r;return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,additionalProperties:this.additionalProperties,extends:(r=this.extends)==null?void 0:r.id}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(e=>e.toFlatGenerationTarget(i)),...this.methods.flatMap(e=>e.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(e=>e.toFlatGenerationTarget(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatGenerationTarget(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatGenerationTarget(i))||[]])}clearErrors(){var i,r;return this.errors=[],this.properties.forEach(a=>a.clearErrors()),this.methods.forEach(a=>a.clearErrors()),this.abstractMethods.forEach(a=>a.clearErrors()),(i=this.additionalPropertiesDataType)==null||i.clearErrors(),(r=this.allPropertiesImplement)==null||r.clearErrors(),this}validate(){return this.errors=EAi(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await vAi(this,{tracker:r}),{success:!0}}getErrors(){var r,a;return[...this.errors,...this.properties.flatMap(c=>c.getErrors()),...this.methods.flatMap(c=>c.getErrors()),...this.abstractMethods.flatMap(c=>c.getErrors()),...((r=this.additionalPropertiesDataType)==null?void 0:r.getErrors())||[],...((a=this.allPropertiesImplement)==null?void 0:a.getErrors())||[]]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.properties){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.methods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.abstractMethods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.additionalPropertiesDataType){const c=await this.additionalPropertiesDataType.getErrorsAsync({tracker:r});a.push(...c)}if(this.allPropertiesImplement){const c=await this.allPropertiesImplement.getErrorsAsync({tracker:r});a.push(...c)}return a}getShallowErrors(){return this.errors}implement(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),null,!0,"implement-built-in-base-entity")),a){const c=a1(this,i,r,a);return r==null||r.attemptAutoclose("implement-built-in-base-entity",this.id),c}getAllPropertiesImplements(){var r;const i=[];return this.allPropertiesImplement&&i.push(this.allPropertiesImplement),((r=this.extends)==null?void 0:r.type)===d.BuiltInBaseEntity&&i.push(...this.extends.getAllPropertiesImplements()||[]),i}getAllInteractiveMethods(){const i=[];if(this.interactive){if(i.push(...this.methods,...this.abstractMethods),!this.extends||this.extends.type===d.BuiltInBaseEntity&&this.extends.interactive||this.extends.type===d.PrimitiveEntity)return i;this.extends instanceof kT&&i.push(...this.extends.getAllInteractiveMethods())}return C(i)}};R(kT,"repository",{APILoad:async(i,...r)=>null});let od=kT;class w_e extends od{constructor(i){super(gn,i);R(this,"initialData");R(this,"id",Ie.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",Ie.PERSISTED_ENTITY);R(this,"description",gn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",gn.abstract);R(this,"static",gn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=gn,this.project=i,this.id=gn.id,this.version=gn.version,this.name=gn.name,this.static=gn.static,this.abstract=gn.abstract,this.properties=this.initialData.properties.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}}var wn=(l=>(l.ValueMustBeString="value-must-be-string",l.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",l.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",l.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",l))(wn||{});function Vx(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new ki({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:Te.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s/g,"-")}}function C_e(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new ki({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Te.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}if(r.includes("-")){const a=new ki({id:l.id+"--string-value-must-not-have-dashes",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Te.Error,code:"string-value-must-not-have-dashes",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s|-/g,"_")}}var dd=(l=>(l.StatusCodeMustBeNumber="status-code-must-be-number",l.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",l))(dd||{});function O_e(l,p){const i=[];if(typeof p!="number"){const r=new ki({id:l.id+"--status-code-must-be-number",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number.`,severity:Te.Error,code:"status-code-must-be-number",entity:l});return i.push(r),{errors:i,override:p}}if(p<100||p>599){const r=new ki({id:l.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:Te.Error,code:"status-code-must-be-between-100-and-599",entity:l});i.push(r)}return{errors:i,override:p}}class __e extends od{constructor(i){var f,h;super(ts,i);R(this,"initialData");R(this,"id",Ie.HTTP_ENDPOINT);R(this,"version","1");R(this,"name",Ie.HTTP_ENDPOINT);R(this,"description",ts.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",ts.abstract);R(this,"static",ts.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=ts,this.project=i,this.id=ts.id,this.version=ts.version,this.name=ts.name,this.static=ts.static,this.abstract=ts.abstract,this.properties=this.initialData.properties.map(m=>{const E=Ae(m,this.project);return E.setParent(this,null),E.initChildren(null),E}),this.methods=this.initialData.methods.map(m=>{const E=Ae(m,this.project);return E.parent=this,E}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const E=Ae(m,this.project);return E.parent=this,E}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(m,E)=>{var j;const b=Vx(m,E),A=m.parent,_=A.properties.find(M=>M.implements.find(G=>G.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),N=(j=_==null?void 0:_.getDefaultValue())==null?void 0:j.value;if(m.project.entities.filter(M=>ai(M,Ie.HTTP_ENDPOINT)&&M.id!==A.id).some(M=>{var re,ee;const G=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((re=G==null?void 0:G.getDefaultValue())==null?void 0:re.value)!==N)return!1;const q=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!q)throw new Error(`"Path" property not found in endpoint entity "${M.name}" (${M.id})`);return((ee=q.getDefaultValue())==null?void 0:ee.value)===E})){const M=new ki({id:m.id+"--"+wn.MustBeUniqueAmongSameEntities,message:`Path "${E}" is already in use by another endpoint with the ${N} method.`,severity:Te.Error,code:wn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(M)}return b};const a=this.properties.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);a&&(a._codeNativeValueValidation=(m,E)=>{var j;const b={errors:[],override:E},A=m.parent,_=A.properties.find(M=>M.implements.find(G=>G.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),N=(j=_==null?void 0:_.getDefaultValue())==null?void 0:j.value;if(m.project.entities.filter(M=>ai(M,Ie.HTTP_ENDPOINT)&&M.id!==A.id).some(M=>{var re,ee;const G=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(((re=G==null?void 0:G.getDefaultValue())==null?void 0:re.value)!==N)return!1;const q=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((ee=q==null?void 0:q.getDefaultValue())==null?void 0:ee.value)===E})){const M=new ki({id:m.id+"--"+wn.MustBeUniqueAmongSameEntities,message:`Method "${E}" cannot be used because another endpoint is already using the ${E} method on path "${N}".`,severity:Te.Error,code:wn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(M)}return b});const c=this.abstractMethods.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!c)throw new Error("Handler method not found in endpoint entity");const e=(((h=(f=c.dataType)==null?void 0:f.entity)==null?void 0:h.properties)||[]).find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.dataType.entity.properties.statusCode.id);if(!e)throw new Error("Status code output not found in handler method");e._codeNativeValueValidation=(m,E)=>O_e(m,E)}}var NT=(l=>(l.InvalidCharacters="cron-invalid-characters",l.MustHaveSixFields="cron-must-have-six-fields",l.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",l))(NT||{});function V_e(l,p){const i=[];let r=p;if(typeof p!="string"){const e=new ki({id:l.id+"--"+wn.ValueMustBeString,message:`Entity of type ${l.type} with id "${l.id}" has an invalid value. The cron expression must be a string.`,severity:Te.Error,code:wn.ValueMustBeString,entity:l});return i.push(e),{errors:i,override:""}}r=p.trimStart().replace(/\s{2,}/g," ");const a=/[^0-9A-Z *?\-/,LW#]/g;if(a.test(r)){const e=Array.from(new Set(r.match(a)));i.push(new ki({id:l.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:Te.Error,code:"cron-invalid-characters",entity:l})),r=r.replace(a,"")}const c=r.split(" ").filter(Boolean);if(c.length!==6&&r.endsWith(" ")===!1)i.push(new ki({id:l.id+"--cron-must-have-six-fields",message:`AWS Cron expressions must have exactly 6 fields separated by spaces (Minutes, Hours, Day-of-month, Month, Day-of-week, Year). Currently has ${c.length}.`,severity:Te.Error,code:"cron-must-have-six-fields",entity:l}));else if(c.length===6){const e=c[2],f=c[4];e!=="?"&&f!=="?"&&(i.push(new ki({id:l.id+"--cron-day-of-month-and-week-conflict",message:"AWS restricts defining both Day-of-month and Day-of-week simultaneously. If you specify one, the other must be '?'",severity:Te.Error,code:"cron-day-of-month-and-week-conflict",entity:l})),e==="*"&&f==="*"&&(c[4]="?",r=c.join(" ")))}return{errors:i,override:r}}class P_e extends od{constructor(i){super(Vs,i);R(this,"initialData");R(this,"id",Ie.CRON_JOB);R(this,"version","1");R(this,"name",Ie.CRON_JOB);R(this,"description",Vs.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Vs.abstract);R(this,"static",Vs.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Vs,this.project=i,this.id=Vs.id,this.version=Vs.version,this.name=Vs.name,this.static=Vs.static,this.abstract=Vs.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===ne["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!r)throw new Error("Expression property not found in cron job entity");r._codeNativeValueValidation=(a,c)=>(console.log("Called cron expression validation for value:",c),V_e(a,c))}}class N_e extends od{constructor(i){super(jn,i);R(this,"initialData");R(this,"id",Ie.RELATIONAL_DATABASE);R(this,"version","1");R(this,"name",Ie.RELATIONAL_DATABASE);R(this,"description",jn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",jn.abstract);R(this,"static",jn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=jn,this.project=i,this.id=jn.id,this.version=jn.version,this.name=jn.name,this.static=jn.static,this.abstract=jn.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(a,c)=>C_e(a,c)}}class x_e extends Hi{constructor(i){super(la,i);R(this,"id",la.id);R(this,"name",la.name);R(this,"description",la.description);R(this,"version",la.version);R(this,"autoexecutable",!1);R(this,"type",d.ActionDescriptor);R(this,"inputs",[]);R(this,"dataType",null);R(this,"error",null);R(this,"project");this.project=i,this.inputs=la.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ae(la.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=la.error?Ae(la.error,this.project):null}}var as=(l=>(l.UUIDMustBeString="uuid-must-be-string",l.UUIDMustBeValidFormat="uuid-must-be-valid-format",l.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",l))(as||{});function PAi(l,p){const i=[];if(typeof p!="string"){const a=new ki({id:l.id+"--uuid-must-be-string",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be text.`,severity:Te.Error,code:"uuid-must-be-string",entity:l});return i.push(a),{errors:i,override:p}}const r=Vx(l,p);if(r.errors.length>0)return i.push(...r.errors),{errors:i,override:p};if(!vx(p)){const a=new ki({id:l.id+"--uuid-must-be-valid-format",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:Te.Error,code:"uuid-must-be-valid-format",entity:l});i.push(a)}return{errors:i,override:p}}var Me=(l=>(l.Inherited="inherited",l.DefaultValue="default-value",l.Missing="missing",l.Empty="empty",l.AutoCalculated="auto-calculated",l.QueuedAutocalculation="queued-autocalculation",l.External="external",l.Testing="testing",l.ExecutionResult="execution-result",l))(Me||{});const $_e={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function IT(l,p){return{...$_e,id:l,project:p}}class gT{constructor(p,i){R(this,"initialized",!1);R(this,"id");R(this,"project");R(this,"values",{});R(this,"onWriteCallback",()=>{});R(this,"onRemoveCallback",()=>{});this.id=p,this.project=i,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var r;if(!((r=this.project)!=null&&r.id)||this.initialized)return;const p={},i={};Object.keys(p).forEach(a=>{const c=p[a],e=new xr(c,this.project);try{if(c.parent){const m=this.project.findSubscribedInstanceFromReference(c.parent);if(!m)return;e.setParent(m,null),e.hydrateAncestors(),e.initChildren(null)}else if(c.standaloneParent){const m=this.project.findSubscribedInstanceFromReference(c.standaloneParent);if(!m)return;e.standalone=!0,e.setStandaloneParent(m,null),e.hydrateAncestors(),e.initChildren(null)}i[a]=e;const f=e.parent||e.standaloneParent,h=J_e(e,f,this.project);h?i[a]=h:delete p[a]}catch(f){Y.Logger.error("Error hydrating ancestors: ",f),delete p[a]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(i=>{p[i]=this.values[i].toJSON()}),p}writeValue(p,i){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let a=this.values[p.id];if(!a)if(i instanceof xr)a=i;else if(i)a=tr(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:rf(p.getDataType(null))};a=tr(c,this.project)}a.standalone=!0,a.initialData.standaloneParent||Y.Logger.warn("instance.initialData: ",a.initialData),a.setStandaloneParent(p,null),a.hydrateAncestors(),a.initChildren(null),i&&(a.metaSync({...i},null),a.setValueAsType(i.valueAsType,null)),this.values[p.id]=a,this.onWriteCallback(p,a)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const i=this.project.get(p);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function Rr(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}function Px(l){if(Array.isArray(l))return l.map(h=>typeof h=="number"?h:e(h)?Number(h):String(h));const p=[];let i=0,r="",a=!1,c=null;for(;i<l.length;){const h=l[i];if(h==="."&&!a){r.length&&(p.push(f(r)),r=""),i++;continue}if(h==="["&&!a){r.length&&(p.push(f(r)),r=""),a=!0,i++;continue}if(a){if(!c&&(h==='"'||h==="'")){c=h,i++;continue}if(c){if(h==="\\"&&i+1<l.length){r+=l[i+1],i+=2;continue}if(h===c){c=null,i++;continue}r+=h,i++;continue}if(h==="]"){p.push(f(r)),r="",a=!1,i++;continue}if(/\s/.test(h)&&!c){i++;continue}r+=h,i++;continue}r+=h,i++}return r.length&&p.push(f(r)),p;function e(h){return/^[0-9]+$/.test(h)}function f(h){const m=h.trim();return e(m)?Number(m):m}}function s1(l,p,i){if(l==null)return i;const r=Px(p);let a=l;for(let c=0;c<r.length;c++){const e=r[c];if(a==null)return i;if(Array.isArray(a)&&typeof e=="number"){if(!(e in a))return i;a=a[e]}else{if(!Object.prototype.hasOwnProperty.call(a,e))return i;a=a[e]}}return a}const NAi=new Set(["__proto__","prototype","constructor"]);function L_e(l){return typeof l=="string"&&NAi.has(l)}function xAi(l,p,i,r){const{createMissing:a=!0,coerce:c=!0}=r??{};if(l==null||typeof l!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=Px(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=l;for(let h=0;h<e.length;h++){const m=e[h];if(L_e(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const E=h===e.length-1,A=typeof e[h+1]=="number",_=Array.isArray(f)&&typeof m=="number";if(E){if(_&&f[m]==null&&!a)throw new Error(`set(...) missing array index "${String(m)}" (createMissing=false).`);return f[m]=i,l}else{if(!Object.prototype.hasOwnProperty.call(f,m)||f[m]==null){if(!a)throw new Error(`set(...) missing parent at segment "${String(m)}" (createMissing=false).`);f[m]=A?[]:{}}else{const N=f[m],P=N!==null&&typeof N=="object",j=Array.isArray(N);if(A){if(!j){if(!c)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!P||j){if(!c)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return l}function Nx(l,p,i,r){const a=Px(p);if(a.length===0)return l;function c(e,f){const h=a[f],m=f===a.length-1;if(r==="strict-set"||r==="strict-delete"){if(L_e(h))throw new Error(`Unsafe key "${String(h)}"`);if(e==null||typeof e!="object"&&!Array.isArray(e))throw new Error(`Missing parent or invalid container at segment "${String(h)}".`);if(r==="strict-delete"&&m&&!(h in e))return e}let E;if(Array.isArray(e))E=[...e];else if(e&&typeof e=="object")E={...e};else if(r==="safe-set")E=typeof h=="number"?[]:{};else throw new Error(`Cannot traverse path at "${String(h)}"`);if(m)return r==="strict-delete"?delete E[h]:E[h]=i,E;const b=e?e[h]:void 0;if(r==="safe-set"&&b==null){const A=typeof a[f+1]=="number",_=c(A?[]:{},f+1);return E[h]=_,E}return E[h]=c(b,f+1),E}if(l==null&&r==="safe-set"){const e=typeof a[0]=="number";return c(e?[]:{},0)}return c(l,0)}const Ck=Symbol("missing"),$Ai=l=>l!=null&&typeof l=="object";function l1(l,p){if(typeof l!="string")throw new TypeError(`${p} expects the key to be a string.`);return l}function wm(l,p){if(typeof l!="string"&&!Array.isArray(l))throw new TypeError(`${p} expects the path to be string or array.`);return l}function Sf(l,p){if(!Rr(l))throw new TypeError(`${p} expects the first argument to be an object.`);return l??{}}function B_e(l,p){const i=l1(p,"ReadKey");return(l??{})[i]}function M_e(l,p,i){const r=l1(p,"WriteKey");if(l&&typeof l=="object"){const a=Array.isArray(l)?[...l]:{...l};return a[r]=i,a}return{[r]:i}}function G_e(l,p){if(!l||typeof l!="object")return{};const i=String(p),{[i]:r,...a}=l;return a}function j_e(l,p,i){const r=Sf(l,"ReadNestedKey"),a=wm(p,"ReadNestedKey");return s1(r,a,i)}function k_e(l,p,i){const r=Sf(l,"WriteNestedKey"),a=wm(p,"WriteNestedKey");return Nx(r,a,i,"strict-set")}function U_e(l,p,i){const r=Sf(l,"WriteSafeNestedKeyRecursively"),a=wm(p,"WriteSafeNestedKeyRecursively");return Nx(r,a,i,"safe-set")}function F_e(l,p){const i=Sf(l,"DeleteNestedKey"),r=wm(p,"DeleteNestedKey");return Nx(i,r,null,"strict-delete")}function K_e(l,p){const i=l1(p,"HasKey"),r=l;return r!=null&&$Ai(r)&&Object.prototype.hasOwnProperty.call(r,i)}function q_e(l,p,i){const r=l1(p,"KeyValueEquals");return l==null||typeof l!="object"?!1:l[r]===i}function S_e(l,p){const i=l,r=wm(p,"HasNestedKey");return s1(i,r,Ck)!==Ck}function Z_e(l,p,i){const r=wm(p,"NestedKeyValueEquals");return s1(l,r)===i}function H_e(...l){const p={};for(let i=0;i<l.length;i++){const r=l[i];if(r!=null){if(!Rr(r))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,r)}}return p}function W_e(l){const p=Sf(l,"ObjectKeys");return Object.keys(p)}function z_e(l){const p=Sf(l,"ObjectValues");return Object.values(p)}function Y_e(l){const p=Sf(l,"ObjectEntries");return Object.entries(p)}function LAi(l){return{execution:null,project:l,localTestValues:IT("local-test-values",l),resolvedValues:IT("resolved-values",l),persistedExecutionResults:IT("persisted-execution-results",l),lastExecutionResults:IT("last-execution-results",l),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function Vu(l,p,i,r){var f;let a;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:a=ye.EntityTemplate;break;case ye.String:a=ye.String;break;case ye.Number:a=ye.Number;break;case ye.Boolean:a=ye.Boolean;break;case ye.Null:a=ye.Null;break;case ye.Enum:a=ye.Enum;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Untyped:a=ye.Untyped;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Date:a=ye.Date;break;case ye.UUID:a=ye.UUID;break;case ye.File:a=ye.File;break;case ye.Void:a=ye.Void;break;case ye.ActionDescriptor:a=ye.ActionDescriptor;break;case ye.Bytes:a=ye.Bytes;break;default:throw new Error(`Primitive type ${le(l.entity,i)} is not supported`)}else a=ye.Untyped;const c=xr.new(r);c.name=a,c.parent=p.toReference();const e=Ae(c,i);return e.hydrateAncestors(),r==null||r.add(e,W.Added),e.addSelfToProject(r),e.initChildren(r),e}function id(l,p,i=new Set){var r,a,c;if(i.has(l.id))return[];if(i.add(l.id),xt.includes(l.type)){const e=Tr(l);return C([e,...[e].flatMap(f=>id(f,p,i))])}else if(l.type===d.OutputMap){if(xt.includes(l.parent.type)&&((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static)return C([l,l.declaration,...[l,l.declaration].flatMap(e=>id(e,p,i))])}else if(l.type===d.InputMap&&xt.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&&(c=l.declaration)!=null&&c.static)return C([l.declaration,...[l.declaration].flatMap(e=>id(e,p,i))]);return[l]}function J_e(l,p,i){return l}function Cm(l,p,i=!1){const r=l.readsValue;let a=null;const c=mf(r,p,i);if(c){const e={sources:[c],target:l};a={value:c.value,valueOwner:l,type:Me.Inherited,inheritanceLink:e}}return a}function Nt(l,p,i){var f;if(!p)return null;let r;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:r=ye.EntityTemplate;break;case ye.String:r=ye.String;break;case ye.Number:r=ye.Number;break;case ye.Boolean:r=ye.Boolean;break;case ye.Null:r=ye.Null;break;case ye.Enum:r=ye.Enum;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Untyped:r=ye.Untyped;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Date:r=ye.Date;break;case ye.UUID:r=ye.UUID;break;case ye.File:r=ye.File;break;case ye.Void:r=ye.Void;break;case ye.ActionDescriptor:r=ye.ActionDescriptor;break;case ye.Bytes:r=ye.Bytes;break;default:throw new Error(`Primitive type ${le(l.entity,i)} is not supported`)}else r=ye.Untyped;if(!i.get(p.id))return null;const c=xr.new(null);c.name=r,c.standaloneParent=p.toReference();let e=new xr(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function Q_e(l,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(l)&&!i){const f=(c=p.lastExecutionResults)==null?void 0:c.readValue(l.id);if(f)return{value:f,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(e=p.localTestValues)==null?void 0:e.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}function QA(l,p,i,r=!1){var e,f;const a={...l},c=p.type===d.VariableDeclaration?p.inputs:At.includes(p.type)?p.outputs:[];if(!c||c.length===0)return a;for(const h of c){if(!qE(h))continue;const m=KT(h,i,r);if(m&&m.value){const E=le(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||Qi(E);a[b]=Ln((m==null?void 0:m.value)||null)?a[b]:(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function RT(l,p,i,r=!1){var e,f;const a={...l},c=p.inputs;if(!c)return a;for(const h of c){if(!qE(h))continue;const m=pE(h,i,r);if(m&&m.value){const E=le(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||Qi(E);a[b]=(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function X_e(l,p,i=!1){var E,b,A,_,N,P,j,M;let r={};if(((b=(E=l.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.DefinitionEntity&&(r={...r,...((A=l.getDataType(null))==null?void 0:A.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const G=(_=p.lastExecutionResults)==null?void 0:_.readValue(l.id);if(G){if(Rr(G.value)){const re={...r,...G.value},ee={...RT(re,l,p,i)};G.metaSync({value:ee},null)}return{value:G,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=!!((N=p.execution)!=null&&N.entities.length),c=(P=p.execution)==null?void 0:P.hasEntity(l),e=l.readsValue;let f=null;if(e){const G=(j=p.execution)==null?void 0:j.hasEntity(e);if((!a||a&&G&&c||a&&!G&&!c)&&(f=Cm(l,p,i),f&&f.value&&Rr(f.value.value))){const re={...r,...f.value.value},ee={...RT(re,l,p,i)};f.value.metaSync({value:ee},null)}}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const G=h;if(G&&G.value===null&&G.autogeneration){const q=sD(G);if(G.metaSync({value:q},null),Rr(q)){const re={...RT(q,l,p,i)};G.metaSync({value:re},null)}}(i||m===null||m!==Me.Testing)&&(f={value:G,valueOwner:l,type:Ln(G)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const G=(M=p.localTestValues)==null?void 0:M.readValue(l.id);if(G){if(Rr(G.value)){const q={...r,...G.value},re={...RT(q,l,p,i)};G.metaSync({value:re},null)}return{value:G,valueOwner:l,type:Me.Testing,inheritanceLink:null}}}return Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function xx(l,p,i=!1){var e,f,h,m,E,b,A,_,N;let r={};if(((f=(e=l.getDataType(null))==null?void 0:e.entity)==null?void 0:f.type)===d.DefinitionEntity&&(r={...r,...((h=l.getDataType(null))==null?void 0:h.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const P=(m=p.lastExecutionResults)==null?void 0:m.readValue(l.id);if(P){if(Rr(P.value)){const M={...r,...P.value},G=QA(M,l,p,i);P==null||P.metaSync({value:G},null)}return{value:P,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=(E=p.localTestValues)==null?void 0:E.readValue(l.id),c=p.getValueTypePreference(l.id);if(a&&!i&&(c===null||c!==Me.DefaultValue)){if(Rr(a.value)){const j={...r,...a.value},M=QA(j,l,p,i);a.metaSync({value:M},null)}return{value:a,valueOwner:l,type:Me.Testing,inheritanceLink:null}}if((b=l.getDataType(null))!=null&&b.entity&&((_=(A=l.getDataType(null))==null?void 0:A.entity)==null?void 0:_.type)===d.DefinitionEntity&&((N=l.getDataType(null))!=null&&N.isObject())){const P=Nt(l.dataType,l,p.project),j=QA(r,l,p,i);return P==null||P.metaSync({value:j},null),{value:P,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null}}return null}function uE(l,p,i=!1){var E,b,A,_,N;if((E=l.dataType)!=null&&E.isObject())return X_e(l,p,i);const r=yt(l),a=!!((b=p.execution)!=null&&b.entities.length),c=(A=p.execution)==null?void 0:A.hasEntity(r),e=l.readsValue;let f=null;if(e){const P=(_=p.execution)==null?void 0:_.hasEntity(e);(!a||a&&P&&c||a&&!P&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const P=h;if(P&&P.value===null&&P.autogeneration){const j=sD(P);P.metaSync({value:j},null)}(i||m===null||m!==Me.Testing)&&(f={value:P,valueOwner:l,type:Ln(P)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const P=(N=p.localTestValues)==null?void 0:N.readValue(l.id);if(P)return{value:P,valueOwner:l,type:Me.Testing,inheritanceLink:null}}return Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function $x(l,p,i=!1){var e,f,h;if((e=l.dataType)!=null&&e.isObject())return xx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const m=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(m)return{value:m,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(h=p.localTestValues)==null?void 0:h.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:uE(l,p,i)}function Lx(l,p,i=!1){var A,_,N,P;const r=!!((A=p.execution)!=null&&A.entities.length),a=(_=p.execution)==null?void 0:_.hasEntity(l);let c=null;const e=l.readsValue;if(e){const j=(N=p.execution)==null?void 0:N.hasEntity(e);(!r||r&&j&&a||r&&!j&&!a)&&(c=Cm(l,p,i))}const f=l.declaration;if(!c&&f){const j=uE(f,p);j&&j.value&&(c=j)}const h=p.getValueTypePreference(l.id);if(!c||(c.type===Me.DefaultValue||c.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(P=p.localTestValues)==null?void 0:P.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=cd(l),E=l.getDataType(null);return m&&a&&(!(c!=null&&c.value)||!La(E)&&pd(c==null?void 0:c.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:a&&!m&&Ln((c==null?void 0:c.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:c||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function eVe(l,p,i=!1){return $x(l.declaration,p,i)}function tVe(l,p,i=!1){var A,_,N,P;if(!i&&p.execution&&p.execution.hasEntity(l)){const j=(A=p.lastExecutionResults)==null?void 0:A.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=yt(l),a=l.parent.type===d.FunctionDeclaration&&l.parent.parent.type===d.Loop?l.parent:null,c=!!((_=p.execution)!=null&&_.hasEntity(r))||!!a&&!!((N=p.execution)!=null&&N.hasEntity(a));let e=null;const f=l.defaultValue,h=p.getValueTypePreference(l.id);if(f){const j=f||null;if(j&&j.value===null&&j.autogeneration){const M=sD(j);j.metaSync({value:M},null)}(i||h===null||h!==Me.Testing)&&(e={value:j,valueOwner:l,type:Ln(j)?Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!e||(e.type===Me.DefaultValue||e.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(P=p.localTestValues)==null?void 0:P.readValue(l.id),M=p.getValueTypePreference(l.id);if(j&&!i&&(M===null||M!==Me.DefaultValue))return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=cd(l),E=l.getDataType(null);let b=m&&c&&(!(e!=null&&e.value)||!La(E)&&pd(e==null?void 0:e.value));return r.type===d.Loop&&c&&(b=!1),b?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:c&&!m&&Ln((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function Bx(l,p,i=!1){var _,N,P,j,M,G;if((_=l.getDataType(null))!=null&&_.isObject())return xx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const q=(N=p.lastExecutionResults)==null?void 0:N.readValue(l.id);if(q)return{value:q,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=yt(l),a=!!((P=p.execution)!=null&&P.entities.length),c=(j=p.execution)==null?void 0:j.hasEntity(r),e=l.readsValue;let f=null;if(e){const q=(M=p.execution)==null?void 0:M.hasEntity(e);(!a||a&&q&&c||a&&!q&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const q=h;(i||m===null||m!==Me.Testing)&&(f={value:q,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const q=(G=p.localTestValues)==null?void 0:G.readValue(l.id);if(q)return{value:q,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=cd(l),b=l.getDataType(null);return E&&(!(f!=null&&f.value)||!La(b)&&pd(f==null?void 0:f.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:!E&&Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function iVe(l,p,i=!1){var f,h,m,E,b,A,_,N,P,j,M,G,q;if(p.execution&&p.execution.hasEntity(l)&&!i){const re=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(re)return{value:re,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=Op(l);if(cp.includes(r.type)){const re=mf(r,p,i),ee=l.codeName||((h=l.declaration)==null?void 0:h.codeName)||Qi(le(l,p.project));if(re!=null&&re.value&&Rr(re.value.value)){const de=re.value.value[ee],ie=Nt(l.getDataType(null),l,p.project);return ie==null||ie.metaSync({value:de},null),{value:ie,valueOwner:l,type:!xt.includes(r.type)&&re.type===Me.Empty?Me.QueuedAutocalculation:re.type,inheritanceLink:{sources:[re],target:l}}}return{value:null,valueOwner:l,type:xt.includes(r.type)?Me.Empty:Me.QueuedAutocalculation,inheritanceLink:null}}const a=(m=p.execution)==null?void 0:m.hasEntity(r),c=((E=p.execution)==null?void 0:E.state)===Qx.Running;if((b=p.persistedExecutionResults)!=null&&b.values[l.id]&&!a&&!c&&!i){const re=(A=p.persistedExecutionResults)==null?void 0:A.readValue(l.id);if((re==null?void 0:re.value)!==null||(re==null?void 0:re.valueAsType)!==null)return{value:re,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const e=l.parent;if(!e)throw new Error(`Couldn't find the parent that generates the output ${l.id}`);switch(e.type){case d.VariableInstance:{const ee=Lx(e,p,i);if(ee&&ee.value){const ie=l.declaration;if(Rr(ee.value.value)){const se=ee.value.value[ie.name],ue=Nt(((_=l.declaration)==null?void 0:_.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:se},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const de=Nt(((N=l.declaration)==null?void 0:N.dataType)||null,l,p.project);return de==null||de.metaSync({value:null},null),{value:de,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.VariableDeclaration:{const ee=uE(e,p,i);if(ee&&ee.value){const ie=l.declaration;if(Rr(ee.value.value)){const se=ee.value.value[ie.name],ue=Nt(((P=l.declaration)==null?void 0:P.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:se},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const de=Nt(((j=l.declaration)==null?void 0:j.dataType)||null,l,p.project);return de==null||de.metaSync({value:null},null),{value:de,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.Operation:{const re=e.outputs.map(de=>{var ie,se;if((ie=p.persistedExecutionResults)!=null&&ie.values[de.id]){const ue=(se=p.persistedExecutionResults)==null?void 0:se.values[de.id];if(ue.value!==null||ue.valueAsType!==null)return{value:ue,valueOwner:de,type:Me.ExecutionResult,inheritanceLink:null}}}).filter(de=>!!de),ee=Nt(((M=l.declaration)==null?void 0:M.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.FunctionCall:{const re=e.inputs.map(de=>AI(de,p,i)).filter(de=>!!de),ee=Nt(((G=l.declaration)==null?void 0:G.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.Loop:{const re=e.inputs.map(de=>AI(de,p,i)).filter(de=>!!de),ee=Nt(((q=l.declaration)==null?void 0:q.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.Search:return{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}return null}function R_(l,p,i=!1){var b,A,_;if(![...At,...xt].includes(l.parent.type)||!qE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return mf(l.declaration,p);const r=pE(l,p,i);if(r&&r.type!==Me.Empty&&r.type!==Me.Missing)return r;const a=Tr(l.parent),c=Yo(a,p,i),e=l.codeName||((A=l.declaration)==null?void 0:A.codeName)||Qi(le(l,p.project)),f=Nt(l.getDataType(null),l,p.project),h=cd(l),m=(_=c==null?void 0:c.value)==null?void 0:_.value;if(m&&Rr(m)){let N=m[e];m[e]===void 0&&(N=null),f==null||f.metaSync({value:N},null);const P=cd(l),j=l.getDataType(null);return P&&(!f||!La(j)&&pd(f))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:f,valueOwner:l,type:c.type,inheritanceLink:{sources:c?[c]:[],target:l}}}return h?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}}function D_(l,p,i=!1){var b,A,_,N,P,j,M,G;if(![...At,...xt].includes(l.parent.type)||!qE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return mf(l.declaration,p,i);const r=At.includes(l.parent.type)?l.parent:Tr(l.parent),a=mf(r,p,i);let c=l;r.type===d.VariableDeclaration&&(c=(l.parent===r?l:r.inputs.find(re=>{var ee,de;return((ee=re.declaration)==null?void 0:ee.id)===((de=l.declaration)==null?void 0:de.id)}))||l);const e=KT(c,p,i),f=l.codeName||((A=l.declaration)==null?void 0:A.codeName)||Qi(le(l,p.project)),h=(r.type===d.VariableDeclaration,l.defaultValue||Nt(l.getDataType(null),l,p.project)),m=(_=a==null?void 0:a.value)==null?void 0:_.value;if(((a==null?void 0:a.type)===Me.ExecutionResult||(a==null?void 0:a.type)===Me.Testing)&&!i&&m&&Rr(m)){let q=m[f];return m[f]===void 0&&(q=null),h==null||h.metaSync({value:q},null),{value:h,valueOwner:l,type:a.type,inheritanceLink:{sources:a?[a]:[],target:l}}}if(e&&e.type!==Me.Empty&&e.type!==Me.Missing)return e;if(m&&Rr(m)){let q=m[f];m[f]===void 0&&(q=null),h!=null&&h.standaloneParent&&(h==null||h.metaSync({value:q},null));const re=cd(l),ee=l.getDataType(null),de=re&&(!h||!La(ee)&&pd(h)),ie=!!((N=p.execution)!=null&&N.entities.length),se=(P=p.execution)==null?void 0:P.hasEntity(r),ue=r.readsValue;if(ue){const z=(j=p.execution)==null?void 0:j.hasEntity(ue);if(de&&(!ie||ie&&z&&se||ie&&!z&&!se))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}if(l.readsValue){const z=(M=p.execution)==null?void 0:M.hasEntity(l.readsValue);if(de&&(!ie||ie&&z&&se||ie&&!z&&!se))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return de?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:h,valueOwner:l,type:((G=h==null?void 0:h.parent)==null?void 0:G.id)===(l==null?void 0:l.id)?a.type:Me.Inherited,inheritanceLink:{sources:a?[a]:[],target:l}}}return KT(l,p,i)}function pE(l,p,i=!1){var _,N,P,j,M,G;const r=yt(l),a=!!((_=p.execution)!=null&&_.entities.length),c=(N=p.execution)==null?void 0:N.hasEntity(r),e=l.readsValue;let f=null;if(e){const q=(P=p.execution)==null?void 0:P.hasEntity(e);(!a||a&&q&&c||a&&!q&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h&&(i||m===null||m!==Me.Testing)&&(f={value:h,valueOwner:l,type:pd(h)?Me.Empty:Me.DefaultValue,inheritanceLink:null}),!f||f.type===Me.DefaultValue||(f==null?void 0:f.type)===Me.Empty){const q=(j=p.persistedExecutionResults)==null?void 0:j.readValue(l.id);if(q&&!i)return{value:q,valueOwner:l,type:Me.Testing,inheritanceLink:null};const re=(M=p.localTestValues)==null?void 0:M.readValue(l.id);if(re&&!i&&(m===null||m!==Me.DefaultValue))return{value:re,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=cd(l),b=l.getDataType(null),A=E&&(!(f!=null&&f.value)||!La(b)&&pd(f==null?void 0:f.value));if(l.readsValue){const q=(G=p.execution)==null?void 0:G.hasEntity(l.readsValue);if(A&&(!a||a&&q&&c||a&&!q&&!c))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return A?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!E&&(!f||f.type===Me.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:l,type:l.readsValue||!(f!=null&&f.value)?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function KT(l,p,i=!1){var e,f;if(p.execution&&p.execution.hasEntity(l)&&!i){const h=(e=p.lastExecutionResults)==null?void 0:e.readValue(l.id);if(h)return{value:h,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(f=p.localTestValues)==null?void 0:f.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:pE(l,p,i)}function AI(l,p,i=!1){var r,a;return xt.includes(l.parent.type)&&(r=Tr(l.parent).dataType)!=null&&r.isObject()||At.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?R_(l,p,i):pE(l,p,i)}function rVe(l,p,i=!1){var r,a;return xt.includes(l.parent.type)&&(r=Tr(l.parent).dataType)!=null&&r.isObject()||At.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?D_(l,p,i):KT(l,p,i)}function nVe(l,p,i=!1){var E,b;if(!l.static)return null;if(p.execution){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(A&&!i)return{value:A,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=cd(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!La(h)&&pd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Ln(e==null?void 0:e.value)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function aVe(l,p,i=!1){var E,b;if(p.execution&&p.execution.hasEntity(l)&&!i){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(A)return{value:A,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=cd(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!La(h)&&pd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Ln((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function mf(l,p,i=!1){switch(l.type){case d.ArgumentDeclaration:return tVe(l,p,i);case d.InputMap:return rVe(l,p,i);case d.VariableDeclaration:return $x(l,p,i);case d.VariableInstance:return eVe(l,p,i);case d.OutputMap:return iVe(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return Bx(l,p,i);case d.Property:return nVe(l,p,i);case d.ValueDescriptor:return aVe(l,p,i);case d.Operation:case d.FunctionCall:case d.InternalCall:case d.Search:return Q_e(l,p,i);default:return null}}function Yo(l,p,i=!1){switch(l.type){case d.InputMap:return AI(l,p,i);case d.VariableDeclaration:return uE(l,p,i);case d.VariableInstance:return Lx(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return Bx(l,p,i);default:return null}}function BAi(l){var p;if(l&&l.type===Me.DefaultValue&&l.value&&l.valueOwner&&(!ig.includes(l.valueOwner.type)||((p=l.valueOwner.defaultValue)==null?void 0:p.id)===l.value.id)){const i=Nt(l.valueOwner.getDataType(null),l.valueOwner,l.valueOwner.project);return{type:Me.DefaultValue,value:i,valueOwner:l.valueOwner,inheritanceLink:null}}return l}function cf(l,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,N,P,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let M=a?m.defaultValue:e==null?void 0:e.readValue(m.id);M?!a&&M&&M.id===((A=m.defaultValue)==null?void 0:A.id)&&(M=Nt(m.getDataType(null),m,p)):a?M=Vu(m.getDataType(null),m,p,c):M=Nt(m.getDataType(null),m,p);const G=le(l,p),q=l.codeName||((_=l.extends)==null?void 0:_.codeName)||((N=l.implements[0])==null?void 0:N.codeName)||Qi(G);let re={};((j=(P=m.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(re={...re,...m.dataType.entity.getActiveRawDefaultValue()}),Rr(M==null?void 0:M.value)&&(re={...re,...M.value}),re[q]=i,M==null||M.metaSync({value:re},c),a||e==null||e.writeValue(m,M);return}}),c}function qT(l,p,i,r){var _,N,P,j;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Tr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=Nt(f.getDataType(null),f,p)):a?m=Vu(f.getDataType(null),f,p,c):m=Nt(f.getDataType(null),f,p);const E=le(l,p),b=l.codeName||((N=l.declaration)==null?void 0:N.codeName)||Qi(E);let A={};if(((j=(P=f.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),Rr(m==null?void 0:m.value)&&(A={...A,...m.value}),A[b]=i,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),(i===""||i===null||i===void 0)&&l.type===d.OutputMap){const M=f.inputs.find(G=>{var q,re;return((q=G.declaration)==null?void 0:q.id)===((re=l.declaration)==null?void 0:re.id)||le(G,p)===E});if(M){let G=a?M.defaultValue:e==null?void 0:e.readValue(M.id);G&&G.metaSync({value:null},c),a||e==null||e.removeValue(M.id)}}return c}function sVe(l,p,i){var e,f,h,m,E;let r=!1,a=null,c=null;if(i instanceof S?(r=!0,a=i,c=null):(a=null,c=i),xt.includes(l.type)){const b=Tr(l);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(A=>{var _,N,P,j,M,G;if(((_=A.declaration)==null?void 0:_.type)===d.Property&&A.declaration.static){let q=r?((N=A.getDefaultValue)==null?void 0:N.call(A))||null:c==null?void 0:c.readValue(A.declaration.id);q?!r&&q&&q.id===((P=A.declaration.defaultValue)==null?void 0:P.id)&&(q=Nt(A.declaration.getDataType(null),A.declaration,p)):r?q=Vu(A.declaration.getDataType(null),A.declaration,p,a):q=Nt(A.declaration.getDataType(null),A.declaration,p),q==null||q.metaSync({value:null},a),r||c==null||c.removeValue((j=A.declaration)==null?void 0:j.id)}else if(((M=A.declaration)==null?void 0:M.type)===d.Property){let q=r?((G=A.getDefaultValue)==null?void 0:G.call(A))||null:c==null?void 0:c.readValue(A.id);q&&q.metaSync({value:null},a),r||c==null||c.removeValue(A.id)}})}else l.type===d.InputMap?((f=l.declaration)==null?void 0:f.type)===d.Property&&l.declaration.static?cf(l.declaration,p,null,i):xt.includes(l.parent.type)&&((h=l.declaration)==null?void 0:h.type)===d.Property&&qT(l,p,null,i):l.type===d.OutputMap?((m=l.declaration)==null?void 0:m.type)===d.Property&&l.declaration.static?cf(l.declaration,p,null,i):xt.includes(l.parent.type)&&((E=l.declaration)==null?void 0:E.type)===d.Property&&qT(l,p,null,i):l.type===d.Property&&l.static&&cf(l,p,null,i);return a}function lVe(l,p,i,r){var f,h,m,E,b,A,_;let a=!1,c=null,e=null;if(r instanceof S?(a=!0,c=r,e=null):(c=null,e=r),xt.includes(p.type)){const N=Tr(p);if((f=N.dataType)!=null&&f.isObject()){let P={};((m=(h=N.dataType)==null?void 0:h.entity)==null?void 0:m.type)===d.DefinitionEntity&&(P={...P,...N.dataType.entity.getActiveRawDefaultValue()});const j=Rr(l)?l:P;N.inputs.forEach(M=>{var G,q,re,ee,de,ie;if(((G=M.declaration)==null?void 0:G.type)===d.Property&&M.declaration.static){let se=a?((q=p.getDefaultValue)==null?void 0:q.call(p))||null:e==null?void 0:e.readValue(M.declaration.id);se?!a&&se&&se.id===((re=M.declaration.defaultValue)==null?void 0:re.id)&&(se=Nt(M.declaration.getDataType(null),M.declaration,i)):a?se=Vu(M.declaration.getDataType(null),M.declaration,i,c):se=Nt(M.declaration.getDataType(null),M.declaration,i);const ue=le(M,i),z=M.codeName||((ee=M.declaration)==null?void 0:ee.codeName)||Qi(ue),X=j[z];se==null||se.metaSync({value:X},c),a||e==null||e.writeValue(M.declaration,se)}else if(((de=M.declaration)==null?void 0:de.type)===d.Property){let se=a?((ie=p.getDefaultValue)==null?void 0:ie.call(p))||null:e==null?void 0:e.readValue(M.id);se&&se.metaSync({value:null},c),a||e==null||e.removeValue(M.id)}})}}else p.type===d.InputMap?((E=p.declaration)==null?void 0:E.type)===d.Property&&p.declaration.static?cf(p.declaration,i,l,r):xt.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===d.Property&&qT(p,i,l,r):p.type===d.OutputMap?((A=p.declaration)==null?void 0:A.type)===d.Property&&p.declaration.static?cf(p.declaration,i,null,r):xt.includes(p.parent.type)&&((_=p.declaration)==null?void 0:_.type)===d.Property&&qT(p,i,null,r):p.type===d.Property&&p.static&&cf(p,i,l,r);return c}function MAi(l,p,i){const r=id(l,p);let a=!1,c=null,e=null;return i instanceof S?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?((m=f.getDefaultValue)==null?void 0:m.call(f))||null:e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),sVe(f,p,i)}),c}function GAi(l,p,i,r){const a=id(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),i.diggestedBuiltInBaseEntitiesIds.has(p.id)||a.forEach(h=>{var E,b,A,_;if(i.diggestedBuiltInBaseEntitiesIds.has(h.id))return;let m=null;if(c){const N=((E=h.getDefaultValue)==null?void 0:E.call(h))||null;N&&(i.diggestedBuiltInBaseEntitiesIds.has(N.id)||((b=N.parent)==null?void 0:b.id)!==h.id?m=N.clone(e,h):m=N)}else m=f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((_=(A=h.getDefaultValue)==null?void 0:A.call(h))==null?void 0:_.id)&&(m=Nt(h.getDataType(null),h,i)):c?(m=Vu(h.getDataType(null),h,i,e),e==null||e.add(m,W.Added)):m=Nt(h.getDataType(null),h,i),m==null||m.setValueAsType(null,e),m==null||m.metaSync({value:l},e),c||f==null||f.writeValue(h,m),lVe(l,h,i,r)}),e}function ff(l,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,N,P,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let M=a?m.defaultValue:e==null?void 0:e.readValue(m.id);M?!a&&M&&M.id===((A=m.defaultValue)==null?void 0:A.id)&&(M=Nt(m.getDataType(null),m,p)):a?M=Vu(m.getDataType(null),m,p,c):M=Nt(m.getDataType(null),m,p);const G=le(l,p),q=l.codeName||((_=l.extends)==null?void 0:_.codeName)||((N=l.implements[0])==null?void 0:N.codeName)||Qi(G);let re={};((j=(P=m.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(re={...re,...m.dataType.entity.getActiveRawDefaultValue()}),Rr(M==null?void 0:M.value)&&(re={...re,...M.value}),Array.isArray(i)?re[q]=(i==null?void 0:i.map(ee=>ee.toShallowJSON()))||null:re[q]=(i==null?void 0:i.toShallowJSON())||null,M==null||M.metaSync({value:re},c),a||e==null||e.writeValue(m,M);return}}),c}function ST(l,p,i,r){var _,N,P,j;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Tr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=Nt(f.getDataType(null),f,p)):a?m=Vu(f.getDataType(null),f,p,c):m=Nt(f.getDataType(null),f,p);const E=le(l,p),b=l.codeName||((N=l.declaration)==null?void 0:N.codeName)||Qi(E);let A={};if(((j=(P=f.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),Rr(m==null?void 0:m.value)&&(A={...A,...m.value}),Array.isArray(i)?A[b]=(i==null?void 0:i.map(M=>M.toShallowJSON()))||null:A[b]=(i==null?void 0:i.toShallowJSON())||null,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),i==null&&l.type===d.OutputMap){const M=f.inputs.find(G=>{var q,re;return((q=G.declaration)==null?void 0:q.id)===((re=l.declaration)==null?void 0:re.id)||le(G,p)===E});if(M){let G=a?M.defaultValue:e==null?void 0:e.readValue(M.id);G&&(Array.isArray(i)?G==null||G.setValueAsTypeList(i,c):G==null||G.setValueAsTypeSingle(i,c)),a||e==null||e.removeValue(M.id)}}return c}function oVe(l,p,i){var r,a,c,e;return l.type===d.InputMap?((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static?ff(l.declaration,p,null,i):xt.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&&ST(l,p,null,i):l.type===d.OutputMap?((c=l.declaration)==null?void 0:c.type)===d.Property&&l.declaration.static?ff(l.declaration,p,null,i):xt.includes(l.parent.type)&&((e=l.declaration)==null?void 0:e.type)===d.Property&&ST(l,p,null,i):l.type===d.Property&&l.static&&ff(l,p,null,i),i}function dVe(l,p,i,r){var a,c,e,f;return p.type===d.InputMap?((a=p.declaration)==null?void 0:a.type)===d.Property&&p.declaration.static?ff(p.declaration,i,l,r):xt.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===d.Property&&ST(p,i,l,r):p.type===d.OutputMap?((e=p.declaration)==null?void 0:e.type)===d.Property&&p.declaration.static?ff(p.declaration,i,null,r):xt.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===d.Property&&ST(p,i,null,r):p.type===d.Property&&p.static&&ff(p,i,l,r),r}function jAi(l,p,i){const r=id(l,p);let a=!1,c=null,e=null;return i instanceof S?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?(m=f.getDefaultValue)==null?void 0:m.call(f):e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),oVe(f,p,i)}),c}function kAi(l,p,i,r){const a=id(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),a.forEach(h=>{var E,b,A;let m=c?(E=h.getDefaultValue)==null?void 0:E.call(h):f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((A=(b=h.getDefaultValue)==null?void 0:b.call(h))==null?void 0:A.id)&&(m=Nt(h.getDataType(null),h,h.project)):c?m=Vu(h.getDataType(null),h,i,e):m=Nt(h.getDataType(null),h,i),Array.isArray(l)?m==null||m.setValueAsTypeList(l,e):m==null||m.setValueAsTypeSingle(l,e),m==null||m.metaSync({value:null},e),c||f==null||f.writeValue(h,m),dVe(l,h,i,r)}),e}class o1{constructor(p,i){this.extensionsRegistry=p,this.contextType=i,this.off=this.extensionsRegistry.off.bind(this.extensionsRegistry),this.on=this.extensionsRegistry.on.bind(this.extensionsRegistry),this.emit=this.extensionsRegistry.emit.bind(this.extensionsRegistry),this.emitAsync=this.extensionsRegistry.emitAsync.bind(this.extensionsRegistry),this.emitAsyncAll=this.extensionsRegistry.emitAsyncAll.bind(this.extensionsRegistry),this.emitAsyncAllSettled=this.extensionsRegistry.emitAsyncAllSettled.bind(this.extensionsRegistry),this.emitAsyncSequentially=this.extensionsRegistry.emitAsyncSequentially.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAll=this.extensionsRegistry.emitAsyncSequentiallyAll.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAllSettled=this.extensionsRegistry.emitAsyncSequentiallyAllSettled.bind(this.extensionsRegistry)}on(p,i){this.extensionsRegistry.on(p,i)}emit(p,...i){this.extensionsRegistry.emit(p,...i)}off(p,i){this.extensionsRegistry.off(p,i)}emitAsync(p,...i){return this.extensionsRegistry.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.extensionsRegistry.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.extensionsRegistry.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.extensionsRegistry.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...i)}}var Oe=(l=>(l[l.High=1]="High",l[l.Normal=5]="Normal",l[l.Low=10]="Low",l))(Oe||{}),ae=(l=>(l.Logic="logic",l.EditorGUI="editor-gui",l.GUI="gui",l.Editor="editor",l.Compile="compile",l.PublicationRun="publication-run",l))(ae||{}),_e=(l=>(l.All="*",l.OnAll="on:*",l.EmitAll="emit:*",l.ReadAll="read:*",l.WriteAll="write:*",l.UpdateAll="update:*",l.DoAll="do:*",l.OnLogicAll="on:logic:*",l.EmitLogicAll="emit:logic:*",l.ReadLogicAll="read:logic:*",l.WriteLogicAll="write:logic:*",l.UpdateLogicAll="update:logic:*",l.DoLogicAll="do:logic:*",l.OnGUIAll="on:gui:*",l.EmitGUIAll="emit:gui:*",l.ReadGUIAll="read:gui:*",l.WriteGUIAll="write:gui:*",l.UpdateGUIAll="update:gui:*",l.DoGUIAll="do:gui:*",l.OnEditorAll="on:editor:*",l.EmitEditorAll="emit:editor:*",l.ReadEditorAll="read:editor:*",l.WriteEditorAll="write:editor:*",l.UpdateEditorAll="update:editor:*",l.DoEditorAll="do:editor:*",l.OnCompileBefore="on:compile:before:DefinitionEntity",l.OnCompileDefault="on:compile:default:DefinitionEntity",l.OnCompileAfter="on:compile:after:DefinitionEntity",l.EmitCompile="emit:compile:DefinitionEntity",l.DoEditorPublish="do:editor:publish",l.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",l.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",l.UpdateGUIGlobalTheme="update:gui:global:theme",l))(_e||{});class uVe{constructor(p){R(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,i){this.state.set(p,i)}delete(p){this.state.delete(p)}}class pVe extends uVe{constructor(p,i){super(i),this.parentExtension=p}}class Pe{constructor(p,i){R(this,"manifest");R(this,"module");R(this,"state");this.extensionsRegistry=p,this.state=new pVe(this,i)}}class w_ extends o1{constructor(i,r){super(i,ae.Logic);R(this,"id");this._project=r,this.id=r.id}get type(){return this._project.type}get name(){return this._project.name}get description(){return this._project.description}get version(){return this._project.version}get createdAt(){return this._project.createdAt}get previousVersion(){return this._project.previousVersion}get author(){return this._project.author}get deleted(){return this._project.deleted}get editable(){return this._project.editable}get deletable(){return this._project.deletable}get entities(){return[...this._project.entities]}get projects(){return[...this._project.projects]}get functions(){return[...this._project.functions]}get events(){return[...this._project.events]}get variableDeclarations(){return[...this._project.variableDeclarations]}get variableInstances(){return[...this._project.variableInstances]}get conditions(){return[...this._project.conditions]}get operations(){return[...this._project.operations]}get functionCalls(){return[...this._project.functionCalls]}get loops(){return[...this._project.loops]}get searches(){return[...this._project.searches]}get primitives(){return[...this._project.primitives]}get builtInBaseEntities(){return[...this._project.builtInBaseEntities]}get operationDeclarations(){return[...this._project.operationDeclarations]}get globalEventActionDescriptors(){return[...this._project.globalEventActionDescriptors]}get loopDeclarations(){return[...this._project.loopDeclarations]}get loopDeclarationsBodies(){return[...this._project.loopDeclarationsBodies]}get conditionDeclarations(){return[...this._project.conditionDeclarations]}get valueDescriptors(){return[...this._project.valueDescriptors]}get dataTypes(){return[...this._project.dataTypes]}get errors(){return[...this._project.errors]}get history(){return[...this._project.history]}get undoableStackValueIndex(){return this._project.undoableStackValueIndex}get knownVersions(){return this._project.knownVersions}get activeVersion(){return this._project.activeVersion}get initialized(){return this._project.initialized}get startedInitialization(){return this._project.startedInitialization}closePersistChangeSetsSequentially(){return this._project.closePersistChangeSetsSequentially()}persistChangeSetSequentially(i){return this._project.persistChangeSetSequentially(i)}toLatestChangeSet(i,r,a,c=!1,e="here-this"){return this._project.toLatestChangeSet(i,r,a,c,e)}addChangeSet(i){return this._project.addChangeSet(i)}discardChangeSet(i){return this._project.discardChangeSet(i)}subscribeDependents(i){return this._project.subscribeDependents(i)}unsubscribeDependents(i){return this._project.unsubscribeDependents(i)}syncDependents(i){return this._project.syncDependents(i)}onDetachedDependencyRemoved(i,r,a){return this._project.onDetachedDependencyRemoved(i,r,a)}onDetachedDependencyRestored(i,r,a){return this._project.onDetachedDependencyRestored(i,r,a)}increaseVersion(i){return this._project.increaseVersion(i)}captureVersion(){return this._project.captureVersion()}restoreVersion(i){return this._project.restoreVersion(i)}updateWithShallowTransfer(i,r){return this._project.updateWithShallowTransfer(i,r)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(i=null){return this._project.afterAllChildrenInitialized(i)}addSelfToProject(i){return this._project.addSelfToProject(i)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(i){return this._project.isOperationDeclaration(i)}isGlobalEventActionDescriptor(i){return this._project.isGlobalEventActionDescriptor(i)}isLoopDeclaration(i){return this._project.isLoopDeclaration(i)}isConditionDeclaration(i){return this._project.isConditionDeclaration(i)}findSubscribedBuiltInInstance(i){return this._project.findSubscribedBuiltInInstance(i)}get(i){return this._project.get(i)}getDeleted(i){return this._project.getDeleted(i)}getManaged(i){return this._project.getManaged(i)}getBuiltIn(i){return this._project.getBuiltIn(i)}findSubscribedInstanceFromReference(i){return this._project.findSubscribedInstanceFromReference(i)}findSubscribedBuiltInInstanceFromReference(i){return this._project.findSubscribedBuiltInInstanceFromReference(i)}metaSync(i,r){return this._project.metaSync(i,r)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(i){return this._project.toFlat(i)}toFlatIds(i){return this._project.toFlatIds(i)}toMeta(){return this._project.toMeta()}toJSON(i){return this._project.toJSON(i)}toJSONClone(i){return this._project.toJSONClone(i)}toReference(i){return this._project.toReference(i)}toShallowJSON(i){return this._project.toShallowJSON(i)}toFlatJSON(i){return this._project.toFlatJSON(i)}toGenerationTarget(i){return this._project.toGenerationTarget(i)}toFlatGenerationTarget(i){return this._project.toFlatGenerationTarget(i)}clearErrors(){return this._project.clearErrors()}validate(){return this._project.validate()}validateChildren(){return this._project.validateChildren()}getErrors(){return this._project.getErrors()}getShallowErrors(){return this._project.getShallowErrors()}addDefinitionEntity(i){return this._project.addDefinitionEntity(i)}addFunctionDeclaration(i){return this._project.addFunctionDeclaration(i)}addFunctionCall(i){return this._project.addFunctionCall(i)}addVariableDeclaration(i){return this._project.addVariableDeclaration(i)}addVariableInstance(i){return this._project.addVariableInstance(i)}addInstalledProject(i){return this._project.addInstalledProject(i)}addGlobalEvent(i){return this._project.addGlobalEvent(i)}addCondition(i){return this._project.addCondition(i)}addOperation(i){return this._project.addOperation(i)}addLoop(i){return this._project.addLoop(i)}addSearch(i){return this._project.addSearch(i)}removeDefinitionEntity(i){return this._project.removeDefinitionEntity(i)}removeCondition(i){return this._project.removeCondition(i)}removeOperation(i){return this._project.removeOperation(i)}removeLoop(i){return this._project.removeLoop(i)}removeSearch(i){return this._project.removeSearch(i)}removeFunctionCall(i){return this._project.removeFunctionCall(i)}removeVariableInstance(i){return this._project.removeVariableInstance(i)}removeVariableDeclaration(i){return this._project.removeVariableDeclaration(i)}removeFunctionDeclaration(i){return this._project.removeFunctionDeclaration(i)}removeInstalledProject(i){return this._project.removeInstalledProject(i)}removeGlobalEvent(i){return this._project.removeGlobalEvent(i)}removeTopLevelVariableDeclaration(i){return this._project.removeTopLevelVariableDeclaration(i)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(i){return this._project.getFunctionDeclaration(i)}getConditions(){return this._project.getConditions()}getOperations(){return this._project.getOperations()}getVariables(){return this._project.getVariables()}getVariableInstances(){return this._project.getVariableInstances()}getVariableDeclarations(){return this._project.getVariableDeclarations()}getLoops(){return this._project.getLoops()}getSearches(){return this._project.getSearches()}getBuiltInPersistedEntity(){return this._project.getBuiltInPersistedEntity()}requestActiveDynamicValue(i,r=!1){return this._project.requestActiveDynamicValue(i,r)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(i){return this._project.applyExternalChangeSet(i)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function UAi(l,p){return p instanceof w_?p:new w_(l,p)}const eh="built-in-function-implementations__",$e="operations-implementations__",es="conditions-implementations__",Ve={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:eh+Nr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:eh+Nr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:eh+Nr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:eh+Nr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:$e+Ut.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:$e+Ut.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:$e+Ut.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:$e+Ut.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:$e+da.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:$e+Le.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:$e+ls.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:$e+fe.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:$e+fe.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:$e+fe.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:$e+fe.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:$e+fe.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:$e+fe.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:$e+fe.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:$e+fe.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:$e+fe.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:$e+fe.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:$e+fe.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:$e+fe.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:$e+fe.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:$e+fe.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:$e+fe.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:$e+fe.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:$e+fe.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:$e+fe.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:$e+fe.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:$e+fe.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:$e+fe.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:$e+fe.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:$e+fe.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:$e+fe.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:$e+fe.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:$e+fe.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:$e+fe.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:$e+fe.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:$e+fe.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:$e+fe.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:$e+fe.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:$e+H.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:$e+H.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:$e+H.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:$e+H.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:$e+fe.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:$e+fe.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:$e+fe.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:$e+H.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:$e+H.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:$e+H.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:$e+H.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:$e+H.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:$e+H.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:$e+H.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:$e+H.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:$e+H.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:$e+H.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:$e+H.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:$e+H.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:$e+H.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:$e+H.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:$e+H.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:$e+H.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:$e+H.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:$e+H.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:$e+H.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:$e+H.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:$e+H.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:$e+H.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:$e+H.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:$e+H.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:$e+H.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:$e+H.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:$e+H.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:$e+H.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:$e+H.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:$e+H.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:$e+H.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:$e+H.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:$e+H.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:$e+H.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:$e+H.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:$e+H.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:$e+H.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:$e+H.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:$e+H.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:$e+H.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:$e+H.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:$e+pe.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:$e+pe.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:$e+pe.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:$e+pe.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:$e+pe.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:$e+pe.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:$e+pe.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:$e+pe.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:$e+pe.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:$e+pe.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:$e+pe.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:$e+pe.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:$e+pe.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:$e+pe.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:$e+pe.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:$e+pe.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:$e+pe.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:$e+pe.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:$e+pe.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:$e+pe.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:$e+pe.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:$e+pe.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:$e+pe.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:$e+pe.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:$e+pe.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:$e+pe.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:$e+pe.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:$e+pe.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:$e+pe.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:$e+pe.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:$e+pe.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:$e+pe.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:$e+pe.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:$e+pe.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:$e+pe.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:$e+pe.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:$e+pe.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:$e+pe.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:$e+pe.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:$e+pe.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:$e+pe.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:$e+pe.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:$e+nt.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:$e+nt.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:$e+nt.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:$e+nt.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:$e+nt.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:$e+nt.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:$e+nt.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:$e+nt.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:$e+nt.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:$e+nt.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:$e+H.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:$e+H.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:$e+H.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:$e+H.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:$e+K.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:$e+K.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:$e+K.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:$e+K.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:$e+K.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:$e+K.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:$e+K.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:$e+K.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:$e+K.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:$e+K.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:$e+K.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:$e+K.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:$e+K.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:$e+K.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:$e+K.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:$e+K.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:$e+K.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:$e+K.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:$e+K.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:$e+K.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:$e+K.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:$e+K.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:$e+K.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:$e+K.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:$e+K.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:$e+K.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:$e+K.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:$e+K.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:$e+K.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:$e+K.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:$e+K.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:$e+K.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:$e+K.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:$e+K.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:$e+K.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:es+K.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:es+K.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:es+K.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:es+K.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:es+K.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:es+K.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:es+K.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:es+K.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:$e+K.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:$e+K.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:$e+K.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:$e+K.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:$e+K.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:$e+K.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:$e+K.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:$e+K.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:$e+K.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:$e+K.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:$e+K.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:$e+K.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:$e+K.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:$e+Le.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:$e+Le.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:$e+Le.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:$e+Le.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:$e+Le.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:$e+Le.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:$e+Le.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:es+Le.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:es+Le.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:es+Le.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:es+Le.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:es+Le.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:$e+Le.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:$e+Le.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:$e+Le.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:$e+Le.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:$e+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:$e+Pi.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:$e+Pi.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:$e+nt.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:$e+Pi.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:$e+Pi.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:$e+yn.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:$e+yn.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:$e+ur.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:$e+ur.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:$e+ur.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:$e+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:$e+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:$e+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:$e+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:$e+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:$e+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:$e+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:$e+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:$e+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:$e+Qe.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:$e+fn.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:$e+fn.Stringify};class cVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION,version:"1.0.0",description:'Implementation for the built-in function "Abort Execution". It terminates the execution of the current entity being run.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class fVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete Persisted Entity". It deletes the current entity as an entry in the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class yVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class hVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class mVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({error:"Search module not implemented",data:null})})}}class TVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:Oe.High,permissions:[_e.All],contexts:[]});R(this,"module",uV)}}const vVe=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class EVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.Empty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=vVe(r),c=!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.NotEmpty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=vVe(r),c=!!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}const zI=class zI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.PrimitiveEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&zI.primitiveSet.has(E)?_=b===A:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)===JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(zI,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let II=zI;const YI=class YI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.PrimitiveNotEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&YI.primitiveSet.has(E)?_=b!==A:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)!==JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(YI,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let gI=YI;var AVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(c,e,f){var h=e.prototype;f.utc=function(P){var j={date:P,utc:!0,args:arguments};return new e(j)},h.utc=function(P){var j=f(this.toDate(),{locale:this.$L,utc:!0});return P?j.add(this.utcOffset(),i):j},h.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=h.parse;h.parse=function(P){P.utc&&(this.$u=!0),this.$utils().u(P.$offset)||(this.$offset=P.$offset),m.call(this,P)};var E=h.init;h.init=function(){if(this.$u){var P=this.$d;this.$y=P.getUTCFullYear(),this.$M=P.getUTCMonth(),this.$D=P.getUTCDate(),this.$W=P.getUTCDay(),this.$H=P.getUTCHours(),this.$m=P.getUTCMinutes(),this.$s=P.getUTCSeconds(),this.$ms=P.getUTCMilliseconds()}else E.call(this)};var b=h.utcOffset;h.utcOffset=function(P,j){var M=this.$utils().u;if(M(P))return this.$u?0:M(this.$offset)?b.call(this):this.$offset;if(typeof P=="string"&&(P=function(ee){ee===void 0&&(ee="");var de=ee.match(r);if(!de)return null;var ie=(""+de[0]).match(a)||["-",0,0],se=ie[0],ue=60*+ie[1]+ +ie[2];return ue===0?0:se==="+"?ue:-ue}(P),P===null))return this;var G=Math.abs(P)<=16?60*P:P;if(G===0)return this.utc(j);var q=this.clone();if(j)return q.$offset=G,q.$u=!1,q;var re=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(q=this.local().add(G+re,i)).$offset=G,q.$x.$localOffset=re,q};var A=h.format;h.format=function(P){var j=P||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return A.call(this,j)},h.valueOf=function(){var P=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*P},h.isUTC=function(){return!!this.$u},h.toISOString=function(){return this.toDate().toISOString()},h.toString=function(){return this.toDate().toUTCString()};var _=h.toDate;h.toDate=function(P){return P==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var N=h.diff;h.diff=function(P,j,M){if(P&&this.$u===P.$u)return N.call(this,P,j,M);var G=this.local(),q=f(P).local();return N.call(G,q,j,M)}}})})(AVe);var FAi=AVe.exports;const KAi=Es(FAi);var IVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,c,e){var f,h=function(A,_,N){N===void 0&&(N={});var P=new Date(A),j=function(M,G){G===void 0&&(G={});var q=G.timeZoneName||"short",re=M+"|"+q,ee=r[re];return ee||(ee=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:M,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:q}),r[re]=ee),ee}(_,N);return j.formatToParts(P)},m=function(A,_){for(var N=h(A,_),P=[],j=0;j<N.length;j+=1){var M=N[j],G=M.type,q=M.value,re=i[G];re>=0&&(P[re]=parseInt(q,10))}var ee=P[3],de=ee===24?0:ee,ie=P[0]+"-"+P[1]+"-"+P[2]+" "+de+":"+P[4]+":"+P[5]+":000",se=+A;return(e.utc(ie).valueOf()-(se-=se%1e3))/6e4},E=c.prototype;E.tz=function(A,_){A===void 0&&(A=f);var N,P=this.utcOffset(),j=this.toDate(),M=j.toLocaleString("en-US",{timeZone:A}),G=Math.round((j-new Date(M))/1e3/60),q=15*-Math.round(j.getTimezoneOffset()/15)-G;if(!Number(q))N=this.utcOffset(0,_);else if(N=e(M,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(q,!0),_){var re=N.utcOffset();N=N.add(P-re,"minute")}return N.$x.$timezone=A,N},E.offsetName=function(A){var _=this.$x.$timezone||e.tz.guess(),N=h(this.valueOf(),_,{timeZoneName:A}).find(function(P){return P.type.toLowerCase()==="timezonename"});return N&&N.value};var b=E.startOf;E.startOf=function(A,_){if(!this.$x||!this.$x.$timezone)return b.call(this,A,_);var N=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call(N,A,_).tz(this.$x.$timezone,!0)},e.tz=function(A,_,N){var P=N&&_,j=N||_||f,M=m(+e(),j);if(typeof A!="string")return e(A).tz(j);var G=function(de,ie,se){var ue=de-60*ie*1e3,z=m(ue,se);if(ie===z)return[ue,ie];var X=m(ue-=60*(z-ie)*1e3,se);return z===X?[ue,z]:[de-60*Math.min(z,X)*1e3,Math.max(z,X)]}(e.utc(A,P).valueOf(),M,j),q=G[0],re=G[1],ee=e(q).utcOffset(re);return ee.$x.$timezone=j,ee},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(A){f=A}}})})(IVe);var qAi=IVe.exports;const SAi=Es(qAi);var gVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){r.prototype.isBetween=function(c,e,f,h){var m=a(c),E=a(e),b=(h=h||"()")[0]==="(",A=h[1]===")";return(b?this.isAfter(m,f):!this.isBefore(m,f))&&(A?this.isBefore(E,f):!this.isAfter(E,f))||(b?this.isBefore(m,f):!this.isAfter(m,f))&&(A?this.isAfter(E,f):!this.isBefore(E,f))}}})})(gVe);var ZAi=gVe.exports;const HAi=Es(ZAi);var RVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isSameOrAfter=function(a,c){return this.isSame(a,c)||this.isAfter(a,c)}}})})(RVe);var WAi=RVe.exports;const zAi=Es(WAi);var DVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isSameOrBefore=function(a,c){return this.isSame(a,c)||this.isBefore(a,c)}}})})(DVe);var YAi=DVe.exports;const JAi=Es(YAi);var wVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="week",r="year";return function(a,c,e){var f=c.prototype;f.week=function(h){if(h===void 0&&(h=null),h!==null)return this.add(7*(h-this.week()),"day");var m=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=e(this).startOf(r).add(1,r).date(m),b=e(this).endOf(i);if(E.isBefore(b))return 1}var A=e(this).startOf(r).date(m).startOf(i).subtract(1,"millisecond"),_=this.diff(A,i,!0);return _<0?e(this).startOf("week").week():Math.ceil(_)},f.weeks=function(h){return h===void 0&&(h=null),this.week(h)}}})})(wVe);var QAi=wVe.exports;const XAi=Es(QAi);var CVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="day";return function(r,a,c){var e=function(m){return m.add(4-m.isoWeekday(),i)},f=a.prototype;f.isoWeekYear=function(){return e(this).year()},f.isoWeek=function(m){if(!this.$utils().u(m))return this.add(7*(m-this.isoWeek()),i);var E,b,A,_,N=e(this),P=(E=this.isoWeekYear(),b=this.$u,A=(b?c.utc:c)().year(E).startOf("year"),_=4-A.isoWeekday(),A.isoWeekday()>4&&(_+=7),A.add(_,i));return N.diff(P,"week")+1},f.isoWeekday=function(m){return this.$utils().u(m)?this.day()||7:this.day(this.day()%7?m:m-7)};var h=f.startOf;f.startOf=function(m,E){var b=this.$utils(),A=!!b.u(E)||E;return b.p(m)==="isoweek"?A?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):h.bind(this)(m,E)}}})})(CVe);var eIi=CVe.exports;const tIi=Es(eIi);var OVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="month",r="quarter";return function(a,c){var e=c.prototype;e.quarter=function(m){return this.$utils().u(m)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(m-1))};var f=e.add;e.add=function(m,E){return m=Number(m),this.$utils().p(E)===r?this.add(3*m,i):f.bind(this)(m,E)};var h=e.startOf;e.startOf=function(m,E){var b=this.$utils(),A=!!b.u(E)||E;if(b.p(m)===r){var _=this.quarter()-1;return A?this.month(3*_).startOf(i).startOf("day"):this.month(3*_+2).endOf(i).endOf("day")}return h.bind(this)(m,E)}}})})(OVe);var iIi=OVe.exports;const rIi=Es(iIi);var _Ve={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){r.prototype.dayOfYear=function(c){var e=Math.round((a(this).startOf("day")-a(this).startOf("year"))/864e5)+1;return c==null?e:this.add(c-e,"day")}}})})(_Ve);var nIi=_Ve.exports;const aIi=Es(nIi);var VVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){i=i||{};var c=r.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function f(m,E,b,A){return c.fromToBase(m,E,b,A)}a.en.relativeTime=e,c.fromToBase=function(m,E,b,A,_){for(var N,P,j,M=b.$locale().relativeTime||e,G=i.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],q=G.length,re=0;re<q;re+=1){var ee=G[re];ee.d&&(N=A?a(m).diff(b,ee.d,!0):b.diff(m,ee.d,!0));var de=(i.rounding||Math.round)(Math.abs(N));if(j=N>0,de<=ee.r||!ee.r){de<=1&&re>0&&(ee=G[re-1]);var ie=M[ee.l];_&&(de=_(""+de)),P=typeof ie=="string"?ie.replace("%d",de):ie(de,E,ee.l,j);break}}if(E)return P;var se=j?M.future:M.past;return typeof se=="function"?se(P):se.replace("%s",P)},c.to=function(m,E){return f(m,E,this,!0)},c.from=function(m,E){return f(m,E,this)};var h=function(m){return m.$u?a.utc():a()};c.toNow=function(m){return this.to(h(this),m)},c.fromNow=function(m){return this.from(h(this),m)}}})})(VVe);var sIi=VVe.exports;const lIi=Es(sIi);var PVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i,r,a=1e3,c=6e4,e=36e5,f=864e5,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m=31536e6,E=2628e6,b=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,A={years:m,months:E,days:f,hours:e,minutes:c,seconds:a,milliseconds:1,weeks:6048e5},_=function(de){return de instanceof re},N=function(de,ie,se){return new re(de,se,ie.$l)},P=function(de){return r.p(de)+"s"},j=function(de){return de<0},M=function(de){return j(de)?Math.ceil(de):Math.floor(de)},G=function(de){return Math.abs(de)},q=function(de,ie){return de?j(de)?{negative:!0,format:""+G(de)+ie}:{negative:!1,format:""+de+ie}:{negative:!1,format:""}},re=function(){function de(se,ue,z){var X=this;if(this.$d={},this.$l=z,se===void 0&&(this.$ms=0,this.parseFromMilliseconds()),ue)return N(se*A[P(ue)],this);if(typeof se=="number")return this.$ms=se,this.parseFromMilliseconds(),this;if(typeof se=="object")return Object.keys(se).forEach(function(me){X.$d[P(me)]=se[me]}),this.calMilliseconds(),this;if(typeof se=="string"){var ce=se.match(b);if(ce){var oe=ce.slice(2).map(function(me){return me!=null?Number(me):0});return this.$d.years=oe[0],this.$d.months=oe[1],this.$d.weeks=oe[2],this.$d.days=oe[3],this.$d.hours=oe[4],this.$d.minutes=oe[5],this.$d.seconds=oe[6],this.calMilliseconds(),this}}return this}var ie=de.prototype;return ie.calMilliseconds=function(){var se=this;this.$ms=Object.keys(this.$d).reduce(function(ue,z){return ue+(se.$d[z]||0)*A[z]},0)},ie.parseFromMilliseconds=function(){var se=this.$ms;this.$d.years=M(se/m),se%=m,this.$d.months=M(se/E),se%=E,this.$d.days=M(se/f),se%=f,this.$d.hours=M(se/e),se%=e,this.$d.minutes=M(se/c),se%=c,this.$d.seconds=M(se/a),se%=a,this.$d.milliseconds=se},ie.toISOString=function(){var se=q(this.$d.years,"Y"),ue=q(this.$d.months,"M"),z=+this.$d.days||0;this.$d.weeks&&(z+=7*this.$d.weeks);var X=q(z,"D"),ce=q(this.$d.hours,"H"),oe=q(this.$d.minutes,"M"),me=this.$d.seconds||0;this.$d.milliseconds&&(me+=this.$d.milliseconds/1e3,me=Math.round(1e3*me)/1e3);var ve=q(me,"S"),we=se.negative||ue.negative||X.negative||ce.negative||oe.negative||ve.negative,Re=ce.format||oe.format||ve.format?"T":"",xe=(we?"-":"")+"P"+se.format+ue.format+X.format+Re+ce.format+oe.format+ve.format;return xe==="P"||xe==="-P"?"P0D":xe},ie.toJSON=function(){return this.toISOString()},ie.format=function(se){var ue=se||"YYYY-MM-DDTHH:mm:ss",z={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return ue.replace(h,function(X,ce){return ce||String(z[X])})},ie.as=function(se){return this.$ms/A[P(se)]},ie.get=function(se){var ue=this.$ms,z=P(se);return z==="milliseconds"?ue%=1e3:ue=z==="weeks"?M(ue/A[z]):this.$d[z],ue||0},ie.add=function(se,ue,z){var X;return X=ue?se*A[P(ue)]:_(se)?se.$ms:N(se,this).$ms,N(this.$ms+X*(z?-1:1),this)},ie.subtract=function(se,ue){return this.add(se,ue,!0)},ie.locale=function(se){var ue=this.clone();return ue.$l=se,ue},ie.clone=function(){return N(this.$ms,this)},ie.humanize=function(se){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!se)},ie.valueOf=function(){return this.asMilliseconds()},ie.milliseconds=function(){return this.get("milliseconds")},ie.asMilliseconds=function(){return this.as("milliseconds")},ie.seconds=function(){return this.get("seconds")},ie.asSeconds=function(){return this.as("seconds")},ie.minutes=function(){return this.get("minutes")},ie.asMinutes=function(){return this.as("minutes")},ie.hours=function(){return this.get("hours")},ie.asHours=function(){return this.as("hours")},ie.days=function(){return this.get("days")},ie.asDays=function(){return this.as("days")},ie.weeks=function(){return this.get("weeks")},ie.asWeeks=function(){return this.as("weeks")},ie.months=function(){return this.get("months")},ie.asMonths=function(){return this.as("months")},ie.years=function(){return this.get("years")},ie.asYears=function(){return this.as("years")},de}(),ee=function(de,ie,se){return de.add(ie.years()*se,"y").add(ie.months()*se,"M").add(ie.days()*se,"d").add(ie.hours()*se,"h").add(ie.minutes()*se,"m").add(ie.seconds()*se,"s").add(ie.milliseconds()*se,"ms")};return function(de,ie,se){i=se,r=se().$utils(),se.duration=function(X,ce){var oe=se.locale();return N(X,{$l:oe},ce)},se.isDuration=_;var ue=ie.prototype.add,z=ie.prototype.subtract;ie.prototype.add=function(X,ce){return _(X)?ee(this,X,1):ue.bind(this)(X,ce)},ie.prototype.subtract=function(X,ce){return _(X)?ee(this,X,-1):z.bind(this)(X,ce)}}})})(PVe);var oIi=PVe.exports;const dIi=Es(oIi);var NVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(NVe);var uIi=NVe.exports;const pIi=Es(uIi);B.extend(KAi);B.extend(SAi);B.extend(HAi);B.extend(zAi);B.extend(JAi);B.extend(XAi);B.extend(tIi);B.extend(rIi);B.extend(aIi);B.extend(lIi);B.extend(dIi);B.extend(pIi);const Vt=l=>B(l),hr=l=>l.toISOString();function xVe(){return hr(B())}function $Ve(l,p){return Vt(l).format(p)}function LVe(l){return hr(B(l))}function BVe(l){if(l==null)throw new TypeError("ToDate expects a non-null value.");if(typeof l=="string"){const p=B(l);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof l=="number"&&Number.isFinite(l)){const p=Math.abs(l)<1e12?B.unix(l):B(l);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(l instanceof Date){const p=B(l);if(!p.isValid())throw new TypeError("Invalid Date object.");return p.toISOString()}throw new TypeError("Unsupported value type for ToDate. Provide a string, number, or Date.")}function MVe(l,p,i){return hr(Vt(l).add(p,i))}function GVe(l,p,i){return hr(Vt(l).subtract(p,i))}function jVe(l,p,i,r=!1){return Vt(l).diff(Vt(p),i,r)}function kVe(l){return Vt(l).unix()}function UVe(l){return hr(B.unix(l))}function FVe(l){return hr(Vt(l))}function KVe(l){return Vt(l).year()}function qVe(l){return Vt(l).month()}function SVe(l){return Vt(l).date()}function ZVe(l){return Vt(l).hour()}function HVe(l){return Vt(l).minute()}function WVe(l){return Vt(l).second()}function zVe(l){return Vt(l).millisecond()}function YVe(l){return Vt(l).isoWeekday()}function JVe(l){return Vt(l).week()}function QVe(l){return Vt(l).quarter()}function XVe(l){return Vt(l).dayOfYear()}function ePe(l){return Vt(l).daysInMonth()}function tPe(l,p){return hr(Vt(l).year(p))}function iPe(l,p){return hr(Vt(l).month(p))}function rPe(l,p){return hr(Vt(l).date(p))}function nPe(l,p){return hr(Vt(l).hour(p))}function aPe(l,p){return hr(Vt(l).minute(p))}function sPe(l,p){return hr(Vt(l).second(p))}function lPe(l,p){return hr(Vt(l).millisecond(p))}function oPe(l,p){return hr(Vt(l).isoWeekday(p))}function dPe(l,p){return hr(Vt(l).quarter(p))}function uPe(l,p){return hr(Vt(l).startOf(p))}function pPe(l,p){return hr(Vt(l).endOf(p))}function cPe(l,p){const i=Vt(l),r=i.startOf(p),a=i.endOf(p),c=r.valueOf()+(a.valueOf()-r.valueOf())/2;return hr(i.valueOf()<c?r:a)}function fPe(l,p,i){return Vt(l).isBefore(Vt(p),i)}function yPe(l,p,i){return Vt(l).isAfter(Vt(p),i)}function hPe(l,p,i){return Vt(l).isSame(Vt(p),i)}function mPe(l,p,i){return Vt(l).isSameOrBefore(Vt(p),i)}function TPe(l,p,i){return Vt(l).isSameOrAfter(Vt(p),i)}function vPe(l,p,i,r,a="()"){return Vt(l).isBetween(Vt(p),Vt(i),r,a)}function EPe(l){return B(l).isValid()}function bPe(l){return Vt(l).isLeapYear()}function APe(l,p,i){const r=Vt(l);return r.isBefore(p)?hr(Vt(p)):r.isAfter(i)?hr(Vt(i)):hr(r)}function IPe(l){if(l.length===0)throw new Error("minOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isBefore(p)&&(p=r)}return hr(p)}function gPe(l){if(l.length===0)throw new Error("maxOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isAfter(p)&&(p=r)}return hr(p)}function RPe(l,p=!1){return Vt(l).fromNow(p)}function DPe(l,p=!1){return Vt(l).toNow(p)}function wPe(l,p,i=!0){const r=Vt(l).diff(Vt(p),"millisecond",!0),a=Math.abs(r),e=B.duration(a,"milliseconds").humanize();return i?r>=0?`in ${e}`:`${e} ago`:e}function CPe(l,p,i=["6","7"],r=[]){const a=m=>r.some(E=>Vt(E).isSame(m,"day")),c=m=>((m.day()+6)%7+1).toString();let e=Vt(l);const f=p>=0?1:-1;let h=Math.abs(p);for(;h>0;){e=e.add(f,"day");const m=c(e);!i.includes(m)&&!a(e)&&h--}return hr(e)}function OPe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.add(1,"day"),i.isoWeekday()===r)return hr(i);return hr(i)}function _Pe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.subtract(1,"day"),i.isoWeekday()===r)return hr(i);return hr(i)}const VPe="Local";function Mx(){try{const l=Intl.DateTimeFormat().resolvedOptions().timeZone;if(l&&typeof l=="string")return l}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function Gx(){const l=Mx();if(l)return l;throw new Error("Unable to detect current IANA timezone from host environment.")}function PPe(l,p,i=!1){let r=p;if(r===VPe){const e=Mx();if(!e)throw new Error("Unable to detect current timezone from host environment.");r=e}const a=r?B.tz(l,r):Vt(l),c=i?a.utc(!0):a.utc();return hr(c)}function NPe(l,p,i=!1){const r=Vt(l);return hr(i?r.tz(p,!0):r.tz(p))}function xPe(l,p){const i=l===VPe?Gx():l;return Vt(p).tz(i).utcOffset()}function $Pe(l,p,i=!1){return hr(Vt(l).utcOffset(p,i))}class LPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetCurrentTimestamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=xVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FormatDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=$Ve(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class MPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ParseDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=LVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class GPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.AddToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=MVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SubtractFromDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=GVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.DifferenceBetweenDates);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2],h=a[3]??!1,m=jVe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cIi extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=BVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class UPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FromUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=UVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToISOString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=FVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=KVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=qVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ZPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=SVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class HPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=ZVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class WPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=HVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=WVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class YPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=zVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class JPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=YVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class QPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetWeekOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=JVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class XPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=QVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDayOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=XVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDaysInMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=ePe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetCurrentIanaTimeZone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=Gx();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=tPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=iPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=rPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=nPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=aPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=sPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class dNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=lPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=oPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=dPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.StartOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=uPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.EndOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=pPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.RoundTo);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=cPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=fPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class mNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=yPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSame);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=hPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSameOrBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=mPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ENe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSameOrAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=TPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsBetween);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)||((_=b.value)==null?void 0:_.value)}),c=a[0],e=a[1],f=a[2],h=a[3],m=a[4],E=vPe(c,e,f,h,m??void 0);return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ANe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsValid);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=EPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class INe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsLeapYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=bPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ClampToRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=APe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class RNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=IPe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class DNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=gPe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FromNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=RPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class CNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=DPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ONe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.HumanizeDiff);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=wPe(a,c,e??!0);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _Ne extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.AddBusinessDays);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??void 0,h=a[3]??[],m=CPe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class VNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.NextWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=OPe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class PNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.PreviousWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=_Pe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class NNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToUTC);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]||void 0,f=a[2]??!1,h=PPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ConvertTimezone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=NPe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $Ne extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetTimezoneOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=xPe(a,c);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class LNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetUTCOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=$Pe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ls.Wait);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:U.Success,error:null,result:null})}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const fIi=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,jx=l=>l===null||["string","number","boolean"].includes(typeof l);function Kn(l,p="Input must be an array"){if(!Array.isArray(l))throw new TypeError(p);return l}function _o(l){const p=Kn(l,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function kx(l){return Array.isArray(l)?l:[]}function $s(l){return Number(l)}function MNe(l){if(!l||l.length===0)throw new TypeError("No input lists provided");if(!l.every(r=>Array.isArray(r)))throw new TypeError("All inputs must be arrays");const[p,...i]=l;return i.reduce((r,a)=>r.concat(a),p)}function GNe(l,...p){if(!Array.isArray(l))throw new TypeError("First input must be an array");if(!p.every(i=>Array.isArray(i)))throw new TypeError("All subsequent inputs must be arrays");return l.concat(...p)}function jNe(l,p){const i=_o(l),r=$s(p);return[i.slice(0,r),i.slice(r)]}function kNe(l){return _o(l).slice().reverse()}function UNe(l){return _o(l).slice(0,-1)}function FNe(l){return _o(l).slice(1)}function KNe(l,p,i){const r=Kn(l),a=$s(p);if(a<0||a>r.length)throw new TypeError("Index out of bounds");return[...r.slice(0,a),i,...r.slice(a)]}function qNe(l,p,i){const r=_o(l),a=$s(p);if(a<0||a>=r.length)throw new TypeError("Index out of bounds");const c=[...r];return c[a]=i,c}function SNe(l,p,i){const r=_o(l),a=r.indexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function ZNe(l,p,i){const r=_o(l),a=r.lastIndexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function HNe(l,p,i){return _o(l).map(a=>a===p?i:a)}function WNe(l,p){const i=_o(l),r=$s(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i[r]}function zNe(l){return _o(l)[0]}function YNe(l){const p=_o(l);return p[p.length-1]}function JNe(l,p,...i){return[...Kn(l),p,...i]}function QNe(l,p){const i=Kn(l);return[p,...i]}function XNe(l){return Kn(l).length}function exe(l,p){const i=Kn(l),r=$s(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i.slice(0,r).concat(i.slice(r+1))}function txe(l,p){const i=Kn(l),r=Math.max(0,$s(p)??0);return i.slice(0,r)}function ixe(l,p){const i=Kn(l),r=Math.max(0,$s(p)??0);return r===0?[]:i.slice(-r)}function rxe(l,p,i){const r=Kn(l),a=p==null?void 0:$s(p),c=i==null?void 0:$s(i);return r.slice(a,c)}function nxe(l,p){return Kn(l).indexOf(p)}function axe(l,p){return Kn(l).lastIndexOf(p)}function sxe(l){const p=Kn(l),i=[],r=new Set;for(const a of p)r.has(a)||(r.add(a),i.push(a));return i}function lxe(l){return Kn(l).reduce((i,r)=>i.concat(r),[])}function oxe(l){const p=Kn(l);if(p.length<=1)return[...p];const i=p[0],r=typeof i=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),a=typeof i=="string"&&p.every(e=>typeof e=="string");let c=null;if(r?c="number":a&&(c=p.every(f=>fIi.test(f)&&B(f).isValid())?"date":"string"),!c)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return c==="number"?[...p].sort((e,f)=>e-f):c==="string"?[...p].sort((e,f)=>e.localeCompare(f)):[...p].sort((e,f)=>B(e).valueOf()-B(f).valueOf())}function dxe(l){const i=[...Kn(l)];for(let r=i.length-1;r>0;r--){const a=Math.floor(n1()*(r+1));[i[r],i[a]]=[i[a],i[r]]}return i}function uxe(l,p){const i=Kn(l),r=Math.max(1,$s(p)||1),a=[];for(let c=0;c<i.length;c+=r)a.push(i.slice(c,c+r));return a}function pxe(l,p,i){const r=Kn(l),a=Math.max(0,$s(p)||0);if(r.length>=a)return[...r];const c=a-r.length;return Array(c).fill(i).concat(r)}function cxe(l,p,i){const r=Kn(l),a=Math.max(0,$s(p)||0);if(r.length>=a)return[...r];const c=a-r.length,e=Array(c).fill(i);return r.concat(e)}function fxe(l,p){const i=Kn(l),r=Math.max(0,$s(p)||0),a=[];for(let c=0;c<r;c++)a.push(...i);return a}function yxe(l,p){if(!jx(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return kx(l).some(r=>r===p)}function hxe(l,p){const i=kx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(jx))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return r.every(a=>i.includes(a))}function mxe(l,p){const i=kx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(jx))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return r.some(a=>i.includes(a))}class Txe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=MNe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Split);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],[f,h]=jNe(c,e);return{value:U.Success,error:null,result:[f,h]}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Exe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.DeleteLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=UNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Axe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.DeleteFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=FNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Ixe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=KNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=qNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Rxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=SNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Dxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=ZNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=HNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Cxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=WNe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Oxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetFirst);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=zNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _xe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetLast);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=YNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Vxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a.slice(2),h=JNe(c,e,...f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Pxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=QNe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Nxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(c=>{var e,f;return((e=c.value)==null?void 0:e.valueAsType)??((f=c.value)==null?void 0:f.value)});return{value:U.Success,error:null,result:XNe(a)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=exe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $xe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=txe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Lxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=ixe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Bxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=rxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Mxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Concat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),[c,...e]=a,f=GNe(c,...e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Gxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=nxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=axe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Unique);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=sxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Uxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Flatten);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=lxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Fxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT,version:"1.0.0",description:"List sort (non-mutating). Supports lists of strings (alphabetic), numbers (numeric), or ISO date strings (chronological).",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Sort);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=oxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Kxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Shuffle);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=dxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Chunk);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=uxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Sxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=pxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Zxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=cxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Hxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=fxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Wxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=yxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.ContainsAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=hxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Yxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.ContainsAny);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=mxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yIi extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.length;return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Jxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.separator.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.first.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.second.id}),A=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",N=r.filter(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.dynamicString.id}).map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)||((G=j.value)==null?void 0:G.value)||""}),P=[E,A,...N].join(h);return{value:U.Success,error:null,result:P}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class Qxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f={firstPart:c.slice(0,e),secondPart:c.slice(e)};return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Xxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS,version:"1.0.0",description:"String split at all the occurrences of separators operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtAllSeparators);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=c.split(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class e$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR,version:"1.0.0",description:"String split at the first occurrence of a separator operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtFirstSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.indexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class t$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR,version:"1.0.0",description:"String split at the last occurrence of a separator operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtLastSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.lastIndexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class i$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class r$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class n$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.split("").reverse().join("");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class a$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ToLowerCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toLowerCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class s$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ToUpperCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toUpperCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class l$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=Math.min(f,c.length-e),m=c.slice(0,e)+c.slice(e+h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class o$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,e)+f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class d$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class u$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,-e)+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class p$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??1,h=a[3];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const m=(c.slice(0,e)||"")+h+(c.slice(e+f)||"");return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class c$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceFirstMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.replace(e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class f$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceLastMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.lastIndexOf(e),m=h===-1?c:c.substring(0,h)+f+c.substring(h+e.length);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class y$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceAllMatches);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.split(e).join(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class h$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.charAt(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class m$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class T$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class v$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No search value provided",result:null};const f=c.indexOf(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class E$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No value to append provided",result:null};const f=a.slice(2);if(!f.every(m=>typeof m=="string"))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"All values to append must be strings",result:null};const h=[c,e,...f].join("");return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class b$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=e+c;return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class A$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Trim);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trim();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class I$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.TrimStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimStart();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class g$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.TrimEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimEnd();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class R$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Substring);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.substring(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class D$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.slice(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class w$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.lastIndexOf(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class C$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padStart(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class O$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padEnd(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.repeat(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class V$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),f=new RegExp(String(c??""),e?String(e):void 0),h=String(a??"").match(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class P$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchAllRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)??((_=b.value)==null?void 0:_.value)}),f=e?String(e):"",h=f.includes("g")?f:f+"g",m=new RegExp(String(c??""),h),E=Array.from(String(a??"").matchAll(m),b=>Array.from(b));return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class N$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.SearchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});let f=-1;try{const h=new RegExp(String(c??""),e?String(e):void 0);f=String(a??"").search(h)}catch{f=-1}return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class x$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.ReplaceRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});let h=String(a??"");const m=new RegExp(String(c??""),f?String(f):void 0);return h=h.replace(m,String(e??"")),{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.NormalizeUnicode);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.normalize(c||"NFC");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const JI=class JI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemoveDiacritics);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a??"").normalize("NFD").replace(JI.COMBINING_MARKS,"");return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}};R(JI,"COMBINING_MARKS",/[\u0300-\u036f]/g);let RI=JI;class L$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.CountOccurrences);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=f===""?0:e.split(f).length-1;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class B$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EnsurePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e:f+e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class M$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EnsureSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e:e+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class G$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemovePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e.slice(f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class j$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemoveSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e.slice(0,-f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class k$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.StartsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("StartsWith expects two strings.");const e=a.startsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class U$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EndsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("EndsWith expects two strings.");const e=a.endsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class F$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("Contains expects two strings.");const e=a.includes(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class K$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchesRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("MatchesRegex expects source and pattern to be strings.");if(!(e===void 0||typeof e=="string"))throw new TypeError("MatchesRegex flags must be a string if provided.");let f=!1;return f=new RegExp(c,e).test(a),{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function q$e(l,p){const i=Number(l),a=10**Math.max(0,Number(p)||0);return Math.round(i*a)/a}function S$e(l,p){const i=Number(l),r=Math.abs(Number(p)||0);return r===0?i:Math.round(i/r)*r}function Z$e(l,p,i){const r=Number(l),a=Number(p),c=Number(i);return Math.min(Math.max(r,a),c)}function H$e(l,p,i,r,a){const c=Number(l),e=Number(p),f=Number(i),h=Number(r),m=Number(a);if(e===f)throw new Error("Input range cannot be zero");const E=(c-e)/(f-e);return h+E*(m-h)}function W$e(...l){const p=l.map(r=>Number(r));return p.length===0?0:p.reduce((r,a)=>r+a,0)/p.length}function z$e(...l){const p=l.map(r=>Number(r)).sort((r,a)=>r-a);if(p.length===0)return 0;const i=Math.floor(p.length/2);return p.length%2?p[i]:(p[i-1]+p[i])/2}function Y$e(l,p){const i=Number(l),r=Number(p);return r===0?NaN:i<0&&r%2===1?-Math.pow(-i,1/r):Math.pow(i,1/r)}function J$e(l,p){const i=Number(l),r=Number(p);return i===0?1/0:(r-i)/i*100}const Ni=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class Q$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Addition);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e+f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class X$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Subtraction);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e-f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Multiplication);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e*f,1);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Division);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a/c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Remainder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a%c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Exponentiation);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Math.pow(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Negate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:-a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Absolute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.abs(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Sign);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sign(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Round);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.round(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class oLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Floor);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.floor(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class dLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Ceil);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.ceil(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class uLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Trunc);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.trunc(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.RoundToDecimals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=q$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP,version:"1.0.0",description:"Snap a number to the nearest multiple of step (>=0 step)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.SnapToStep);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=S$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class fLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Clamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ni(r),f=Z$e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MapRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h]=Ni(r),m=H$e(a,c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Average);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r),c=W$e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Median);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r),c=z$e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class TLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r).map(Number),c=a.length?Math.min(...a):1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class vLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r).map(Number),c=a.length?Math.max(...a):-1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ELe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.SquareRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sqrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.CubeRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.cbrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ALe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.NthRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Y$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ILe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Exp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.exp(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class gLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LogNatural);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.log(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class RLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Log10);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r),c=Number(a),e=Math.log10?Math.log10(c):Math.log(c)/Math.LN10;return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class DLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Sin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Cos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.cos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class CLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Tan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.tan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class OLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Asin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.asin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _Le extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Acos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.acos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class VLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Atan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.atan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class PLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Atan2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:Math.atan2(Number(a),Number(c))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class NLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.ToRadians);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Number(a)*Math.PI/180}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class xLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.ToDegrees);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Number(a)*180/Math.PI}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class $Le extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.PercentOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Number(a)/100*Number(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class C_ extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.PercentageChange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=J$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class LLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LessThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a<c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class BLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MoreThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a>c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class MLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LessThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a<=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class GLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MoreThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a>=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}function jLe(l,p){return function(){return l.apply(p,arguments)}}const{toString:hIi}=Object.prototype,{getPrototypeOf:Ux}=Object,{iterator:d1,toStringTag:kLe}=Symbol,u1=(l=>p=>{const i=hIi.call(p);return l[i]||(l[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Vo=l=>(l=l.toLowerCase(),p=>u1(p)===l),p1=l=>p=>typeof p===l,{isArray:Om}=Array,mh=p1("undefined");function cE(l){return l!==null&&!mh(l)&&l.constructor!==null&&!mh(l.constructor)&&ss(l.constructor.isBuffer)&&l.constructor.isBuffer(l)}const ULe=Vo("ArrayBuffer");function mIi(l){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(l):p=l&&l.buffer&&ULe(l.buffer),p}const TIi=p1("string"),ss=p1("function"),FLe=p1("number"),fE=l=>l!==null&&typeof l=="object",vIi=l=>l===!0||l===!1,XA=l=>{if(u1(l)!=="object")return!1;const p=Ux(l);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(kLe in l)&&!(d1 in l)},EIi=l=>{if(!fE(l)||cE(l))return!1;try{return Object.keys(l).length===0&&Object.getPrototypeOf(l)===Object.prototype}catch{return!1}},bIi=Vo("Date"),AIi=Vo("File"),IIi=l=>!!(l&&typeof l.uri<"u"),gIi=l=>l&&typeof l.getParts<"u",RIi=Vo("Blob"),DIi=Vo("FileList"),wIi=l=>fE(l)&&ss(l.pipe);function CIi(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ok=CIi(),_k=typeof Ok.FormData<"u"?Ok.FormData:void 0,OIi=l=>{let p;return l&&(_k&&l instanceof _k||ss(l.append)&&((p=u1(l))==="formdata"||p==="object"&&ss(l.toString)&&l.toString()==="[object FormData]"))},_Ii=Vo("URLSearchParams"),[VIi,PIi,NIi,xIi]=["ReadableStream","Request","Response","Headers"].map(Vo),$Ii=l=>l.trim?l.trim():l.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yE(l,p,{allOwnKeys:i=!1}={}){if(l===null||typeof l>"u")return;let r,a;if(typeof l!="object"&&(l=[l]),Om(l))for(r=0,a=l.length;r<a;r++)p.call(null,l[r],r,l);else{if(cE(l))return;const c=i?Object.getOwnPropertyNames(l):Object.keys(l),e=c.length;let f;for(r=0;r<e;r++)f=c[r],p.call(null,l[f],f,l)}}function KLe(l,p){if(cE(l))return null;p=p.toLowerCase();const i=Object.keys(l);let r=i.length,a;for(;r-- >0;)if(a=i[r],p===a.toLowerCase())return a;return null}const lf=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),qLe=l=>!mh(l)&&l!==lf;function O_(){const{caseless:l,skipUndefined:p}=qLe(this)&&this||{},i={},r=(a,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const e=l&&KLe(i,c)||c;XA(i[e])&&XA(a)?i[e]=O_(i[e],a):XA(a)?i[e]=O_({},a):Om(a)?i[e]=a.slice():(!p||!mh(a))&&(i[e]=a)};for(let a=0,c=arguments.length;a<c;a++)arguments[a]&&yE(arguments[a],r);return i}const LIi=(l,p,i,{allOwnKeys:r}={})=>(yE(p,(a,c)=>{i&&ss(a)?Object.defineProperty(l,c,{value:jLe(a,i),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(l,c,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),l),BIi=l=>(l.charCodeAt(0)===65279&&(l=l.slice(1)),l),MIi=(l,p,i,r)=>{l.prototype=Object.create(p.prototype,r),Object.defineProperty(l.prototype,"constructor",{value:l,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(l,"super",{value:p.prototype}),i&&Object.assign(l.prototype,i)},GIi=(l,p,i,r)=>{let a,c,e;const f={};if(p=p||{},l==null)return p;do{for(a=Object.getOwnPropertyNames(l),c=a.length;c-- >0;)e=a[c],(!r||r(e,l,p))&&!f[e]&&(p[e]=l[e],f[e]=!0);l=i!==!1&&Ux(l)}while(l&&(!i||i(l,p))&&l!==Object.prototype);return p},jIi=(l,p,i)=>{l=String(l),(i===void 0||i>l.length)&&(i=l.length),i-=p.length;const r=l.indexOf(p,i);return r!==-1&&r===i},kIi=l=>{if(!l)return null;if(Om(l))return l;let p=l.length;if(!FLe(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=l[p];return i},UIi=(l=>p=>l&&p instanceof l)(typeof Uint8Array<"u"&&Ux(Uint8Array)),FIi=(l,p)=>{const r=(l&&l[d1]).call(l);let a;for(;(a=r.next())&&!a.done;){const c=a.value;p.call(l,c[0],c[1])}},KIi=(l,p)=>{let i;const r=[];for(;(i=l.exec(p))!==null;)r.push(i);return r},qIi=Vo("HTMLFormElement"),SIi=l=>l.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,a){return r.toUpperCase()+a}),Vk=(({hasOwnProperty:l})=>(p,i)=>l.call(p,i))(Object.prototype),ZIi=Vo("RegExp"),SLe=(l,p)=>{const i=Object.getOwnPropertyDescriptors(l),r={};yE(i,(a,c)=>{let e;(e=p(a,c,l))!==!1&&(r[c]=e||a)}),Object.defineProperties(l,r)},HIi=l=>{SLe(l,(p,i)=>{if(ss(l)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const r=l[i];if(ss(r)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},WIi=(l,p)=>{const i={},r=a=>{a.forEach(c=>{i[c]=!0})};return Om(l)?r(l):r(String(l).split(p)),i},zIi=()=>{},YIi=(l,p)=>l!=null&&Number.isFinite(l=+l)?l:p;function JIi(l){return!!(l&&ss(l.append)&&l[kLe]==="FormData"&&l[d1])}const QIi=l=>{const p=new Array(10),i=(r,a)=>{if(fE(r)){if(p.indexOf(r)>=0)return;if(cE(r))return r;if(!("toJSON"in r)){p[a]=r;const c=Om(r)?[]:{};return yE(r,(e,f)=>{const h=i(e,a+1);!mh(h)&&(c[f]=h)}),p[a]=void 0,c}}return r};return i(l,0)},XIi=Vo("AsyncFunction"),egi=l=>l&&(fE(l)||ss(l))&&ss(l.then)&&ss(l.catch),ZLe=((l,p)=>l?setImmediate:p?((i,r)=>(lf.addEventListener("message",({source:a,data:c})=>{a===lf&&c===i&&r.length&&r.shift()()},!1),a=>{r.push(a),lf.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",ss(lf.postMessage)),tgi=typeof queueMicrotask<"u"?queueMicrotask.bind(lf):typeof process<"u"&&process.nextTick||ZLe,igi=l=>l!=null&&ss(l[d1]),qe={isArray:Om,isArrayBuffer:ULe,isBuffer:cE,isFormData:OIi,isArrayBufferView:mIi,isString:TIi,isNumber:FLe,isBoolean:vIi,isObject:fE,isPlainObject:XA,isEmptyObject:EIi,isReadableStream:VIi,isRequest:PIi,isResponse:NIi,isHeaders:xIi,isUndefined:mh,isDate:bIi,isFile:AIi,isReactNativeBlob:IIi,isReactNative:gIi,isBlob:RIi,isRegExp:ZIi,isFunction:ss,isStream:wIi,isURLSearchParams:_Ii,isTypedArray:UIi,isFileList:DIi,forEach:yE,merge:O_,extend:LIi,trim:$Ii,stripBOM:BIi,inherits:MIi,toFlatObject:GIi,kindOf:u1,kindOfTest:Vo,endsWith:jIi,toArray:kIi,forEachEntry:FIi,matchAll:KIi,isHTMLForm:qIi,hasOwnProperty:Vk,hasOwnProp:Vk,reduceDescriptors:SLe,freezeMethods:HIi,toObjectSet:WIi,toCamelCase:SIi,noop:zIi,toFiniteNumber:YIi,findKey:KLe,global:lf,isContextDefined:qLe,isSpecCompliantForm:JIi,toJSONObject:QIi,isAsyncFn:XIi,isThenable:egi,setImmediate:ZLe,asap:tgi,isIterable:igi};class Ka extends Error{static from(p,i,r,a,c,e){const f=new Ka(p.message,i||p.code,r,a,c);return f.cause=p,f.name=p.name,p.status!=null&&f.status==null&&(f.status=p.status),e&&Object.assign(f,e),f}constructor(p,i,r,a,c){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,i&&(this.code=i),r&&(this.config=r),a&&(this.request=a),c&&(this.response=c,this.status=c.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qe.toJSONObject(this.config),code:this.code,status:this.status}}}Ka.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ka.ERR_BAD_OPTION="ERR_BAD_OPTION";Ka.ECONNABORTED="ECONNABORTED";Ka.ETIMEDOUT="ETIMEDOUT";Ka.ERR_NETWORK="ERR_NETWORK";Ka.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ka.ERR_DEPRECATED="ERR_DEPRECATED";Ka.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ka.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ka.ERR_CANCELED="ERR_CANCELED";Ka.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ka.ERR_INVALID_URL="ERR_INVALID_URL";const Ji=Ka,rgi=null;function __(l){return qe.isPlainObject(l)||qe.isArray(l)}function HLe(l){return qe.endsWith(l,"[]")?l.slice(0,-2):l}function FO(l,p,i){return l?l.concat(p).map(function(a,c){return a=HLe(a),!i&&c?"["+a+"]":a}).join(i?".":""):p}function ngi(l){return qe.isArray(l)&&!l.some(__)}const agi=qe.toFlatObject(qe,{},null,function(p){return/^is[A-Z]/.test(p)});function c1(l,p,i){if(!qe.isObject(l))throw new TypeError("target must be an object");p=p||new FormData,i=qe.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(P,j){return!qe.isUndefined(j[P])});const r=i.metaTokens,a=i.visitor||E,c=i.dots,e=i.indexes,h=(i.Blob||typeof Blob<"u"&&Blob)&&qe.isSpecCompliantForm(p);if(!qe.isFunction(a))throw new TypeError("visitor must be a function");function m(N){if(N===null)return"";if(qe.isDate(N))return N.toISOString();if(qe.isBoolean(N))return N.toString();if(!h&&qe.isBlob(N))throw new Ji("Blob is not supported. Use a Buffer instead.");return qe.isArrayBuffer(N)||qe.isTypedArray(N)?h&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function E(N,P,j){let M=N;if(qe.isReactNative(p)&&qe.isReactNativeBlob(N))return p.append(FO(j,P,c),m(N)),!1;if(N&&!j&&typeof N=="object"){if(qe.endsWith(P,"{}"))P=r?P:P.slice(0,-2),N=JSON.stringify(N);else if(qe.isArray(N)&&ngi(N)||(qe.isFileList(N)||qe.endsWith(P,"[]"))&&(M=qe.toArray(N)))return P=HLe(P),M.forEach(function(q,re){!(qe.isUndefined(q)||q===null)&&p.append(e===!0?FO([P],re,c):e===null?P:P+"[]",m(q))}),!1}return __(N)?!0:(p.append(FO(j,P,c),m(N)),!1)}const b=[],A=Object.assign(agi,{defaultVisitor:E,convertValue:m,isVisitable:__});function _(N,P){if(!qe.isUndefined(N)){if(b.indexOf(N)!==-1)throw Error("Circular reference detected in "+P.join("."));b.push(N),qe.forEach(N,function(M,G){(!(qe.isUndefined(M)||M===null)&&a.call(p,M,qe.isString(G)?G.trim():G,P,A))===!0&&_(M,P?P.concat(G):[G])}),b.pop()}}if(!qe.isObject(l))throw new TypeError("data must be an object");return _(l),p}function Pk(l){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(l).replace(/[!'()~]|%20|%00/g,function(r){return p[r]})}function Fx(l,p){this._pairs=[],l&&c1(l,this,p)}const WLe=Fx.prototype;WLe.append=function(p,i){this._pairs.push([p,i])};WLe.toString=function(p){const i=p?function(r){return p.call(this,r,Pk)}:Pk;return this._pairs.map(function(a){return i(a[0])+"="+i(a[1])},"").join("&")};function sgi(l){return encodeURIComponent(l).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zLe(l,p,i){if(!p)return l;const r=i&&i.encode||sgi,a=qe.isFunction(i)?{serialize:i}:i,c=a&&a.serialize;let e;if(c?e=c(p,a):e=qe.isURLSearchParams(p)?p.toString():new Fx(p,a).toString(r),e){const f=l.indexOf("#");f!==-1&&(l=l.slice(0,f)),l+=(l.indexOf("?")===-1?"?":"&")+e}return l}class lgi{constructor(){this.handlers=[]}use(p,i,r){return this.handlers.push({fulfilled:p,rejected:i,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){qe.forEach(this.handlers,function(r){r!==null&&p(r)})}}const Nk=lgi,Kx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ogi=typeof URLSearchParams<"u"?URLSearchParams:Fx,dgi=typeof FormData<"u"?FormData:null,ugi=typeof Blob<"u"?Blob:null,pgi={isBrowser:!0,classes:{URLSearchParams:ogi,FormData:dgi,Blob:ugi},protocols:["http","https","file","blob","url","data"]},qx=typeof window<"u"&&typeof document<"u",V_=typeof navigator=="object"&&navigator||void 0,cgi=qx&&(!V_||["ReactNative","NativeScript","NS"].indexOf(V_.product)<0),fgi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),ygi=qx&&window.location.href||"http://localhost",hgi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qx,hasStandardBrowserEnv:cgi,hasStandardBrowserWebWorkerEnv:fgi,navigator:V_,origin:ygi},Symbol.toStringTag,{value:"Module"})),Ta={...hgi,...pgi};function mgi(l,p){return c1(l,new Ta.classes.URLSearchParams,{visitor:function(i,r,a,c){return Ta.isNode&&qe.isBuffer(i)?(this.append(r,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function Tgi(l){return qe.matchAll(/\w+|\[(\w*)]/g,l).map(p=>p[0]==="[]"?"":p[1]||p[0])}function vgi(l){const p={},i=Object.keys(l);let r;const a=i.length;let c;for(r=0;r<a;r++)c=i[r],p[c]=l[c];return p}function YLe(l){function p(i,r,a,c){let e=i[c++];if(e==="__proto__")return!0;const f=Number.isFinite(+e),h=c>=i.length;return e=!e&&qe.isArray(a)?a.length:e,h?(qe.hasOwnProp(a,e)?a[e]=[a[e],r]:a[e]=r,!f):((!a[e]||!qe.isObject(a[e]))&&(a[e]=[]),p(i,r,a[e],c)&&qe.isArray(a[e])&&(a[e]=vgi(a[e])),!f)}if(qe.isFormData(l)&&qe.isFunction(l.entries)){const i={};return qe.forEachEntry(l,(r,a)=>{p(Tgi(r),a,i,0)}),i}return null}function Egi(l,p,i){if(qe.isString(l))try{return(p||JSON.parse)(l),qe.trim(l)}catch(r){if(r.name!=="SyntaxError")throw r}return(i||JSON.stringify)(l)}const Sx={transitional:Kx,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const r=i.getContentType()||"",a=r.indexOf("application/json")>-1,c=qe.isObject(p);if(c&&qe.isHTMLForm(p)&&(p=new FormData(p)),qe.isFormData(p))return a?JSON.stringify(YLe(p)):p;if(qe.isArrayBuffer(p)||qe.isBuffer(p)||qe.isStream(p)||qe.isFile(p)||qe.isBlob(p)||qe.isReadableStream(p))return p;if(qe.isArrayBufferView(p))return p.buffer;if(qe.isURLSearchParams(p))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let f;if(c){if(r.indexOf("application/x-www-form-urlencoded")>-1)return mgi(p,this.formSerializer).toString();if((f=qe.isFileList(p))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return c1(f?{"files[]":p}:p,h&&new h,this.formSerializer)}}return c||a?(i.setContentType("application/json",!1),Egi(p)):p}],transformResponse:[function(p){const i=this.transitional||Sx.transitional,r=i&&i.forcedJSONParsing,a=this.responseType==="json";if(qe.isResponse(p)||qe.isReadableStream(p))return p;if(p&&qe.isString(p)&&(r&&!this.responseType||a)){const e=!(i&&i.silentJSONParsing)&&a;try{return JSON.parse(p,this.parseReviver)}catch(f){if(e)throw f.name==="SyntaxError"?Ji.from(f,Ji.ERR_BAD_RESPONSE,this,null,this.response):f}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ta.classes.FormData,Blob:Ta.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qe.forEach(["delete","get","head","post","put","patch"],l=>{Sx.headers[l]={}});const Zx=Sx,bgi=qe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Agi=l=>{const p={};let i,r,a;return l&&l.split(`
49
+ This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:r,explanations:a,modifiedData:i}}subscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]||(this.detachedDependents[r.entity.id]=r)}),this}unsubscribeDependents(i){return i.forEach(r=>{this.detachedDependents[r.entity.id]&&delete this.detachedDependents[r.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"sync-dependents"))){const r=[],a=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(f=>{const h=f.entity.afterAllChildrenInitialized(i);r.push(...h.updated),a.push(...h.added),c.push(...h.removed),e.push(...h.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}onDetachedDependencyRemoved(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=null,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(m=>m.id!==i.id),a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}onDetachedDependencyRestored(i,r,a){const c=[],e=[],f=[],h=[];return r==="value-as-type-single"&&(this.valueAsTypeSingle=i,a==null||a.add(this,W.Updated)),r==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],a==null||a.add(this,W.Updated)),{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(i=>{i.type!==d.BuiltInBaseEntity&&i.unsubscribeDependents([{entity:this,field:"value-as-type-list"}])}),this}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(i=>{i.type!==d.BuiltInBaseEntity&&i.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==d.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(i){var r;if(this.project.diggestedBuiltInBaseEntitiesIds.has(this.id))return this;if(i&&!B(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);if(i&&B(i).isSame(B(this.createdAt)))return this;if(!((r=this.knownVersions)!=null&&r.has(this.version))&&this.project.initialized)throw new Error(`The current ${this.type} ${this.id} version '${this.version}' is not captured in the 'knownVersions' map. Capture the current version before increasing it to avoid losing data.`);if(!this.activeVersion)throw new Error(`Only active versions can be increased. Entity with id '${this.id}' and version '${this.version}' is not active.`);return this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=B(i).toISOString()||B().toISOString(),this}captureVersion(){var r;const i=((r=this.knownVersions)==null?void 0:r.get(this.version))||new ui(this,this.project);if(!this.activeVersion)throw new Error(`Only active versions can be captured. Entity of type ${this.type} with id '${this.id}' and version '${this.version}' is not active.`);if(this.version!==i.version)throw new Error(`Captured ${this.type} with id '${this.id}', version '${i.version}' does not match current entity version '${this.version}'.`);return this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map().set(this.version,i),this.apply(i),this}snapshot(){const i=new ui(this,this.project);return this.apply(i)}apply(i){const r=this.toMeta();return i.metaSync(r,null),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,i}recursiveCaptureUpstreamVersions(i){const r=[],a=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const f=this.parent.recursiveCaptureUpstreamVersions(i);r.push(this.parent,...f.updated),a.push(...f.added),c.push(...f.removed)}return{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}async restoreVersion(i,r){var m;const a=[],c=[],e=[],f=[];if(this.version===i&&(r!=null&&r.skipIfSameVersion))return{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this};if(!this.knownVersions){const E=new Map;for(const[b,A]of this.knownVersions||new Map){if(E.set(b,A),A.activeVersion=!1,A.knownVersions)for(const[_,N]of A.knownVersions)E.set(_,N);A.knownVersions=null}}let h=(m=this.knownVersions)==null?void 0:m.get(i);if(!h){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);h=new ui(E,this.project)}return this.metaSync(h.toShallowJSON(),null),this.previousVersion=h.previousVersion,this.version=h.version,this.createdAt=h.createdAt,this.author=h.author,this.deleted=h.deleted,this.valueAsTypeSingle=h.valueAsTypeSingle,this.parent=h.parent,{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}updateWithShallowTransfer(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,r),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=te(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=te(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(a=>{const c=te(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>te(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=te(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}else this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r);return this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithShallowTransfer,this.id),this}updateWithGenerationTarget(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.UpdateWithGenerationTarget))){if(!this.checkCanEdit(this,r))return Y.Logger.warn(`[updateWithGenerationTarget] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this;if(this.metaSync(i,r),i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const a=te(i.parent),c=this.project.get(a),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(r),c)this.setParent(c,r),this.addSelfToProject(r);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${a}' that isn't found in the project`)}else if(i.standaloneParent){const a=te(i.standaloneParent),c=this.project.get(a);if(c)this.setStandaloneParent(c,r);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${a}' that isn't found in the project`)}if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(a=>{const c=te(a),e=this.project.get(c);e&&this.addValueAsTypeToList(e,r)}),[...this.valueAsTypeList].forEach(a=>{(i.valueAsTypeList||[]).find(e=>te(e)===a.id)||this.removeValueAsTypeFromList(a,r)}),this.setValueAsTypeSingle(null,r),this.metaSync({value:null},r);else if(i.valueAsTypeSingle){const a=te(i.valueAsTypeSingle),c=this.project.get(a);c&&(this.setValueAsTypeSingle(c,r),this.setValueAsTypeList(null,r),this.metaSync({value:null},r))}return(i.valueAsTypeSingle===null||i.valueAsTypeList||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeSingle(null,r),(i.valueAsTypeList===null||i.valueAsTypeSingle||i.value!==null&&i.value!==void 0)&&this.setValueAsTypeList(null,r),this.captureVersion(),this.subscribeToDependencies(),r==null||r.attemptAutoclose(w.UpdateWithGenerationTarget,this.id),this}hydrateAncestors(){const i=[],r=[],a=[],c=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const e=te(this.initialData.parent),f=this.project.get(e);if(Y.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),f)Y.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${f.id}' for entity with id '${this.id}'`),this.setParent(f,null),i.push(f);else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const e=te(this.initialData.standaloneParent),f=this.project.get(e);if(Y.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),f)Y.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${f.id}' for entity with id '${this.id}'`),this.setStandaloneParent(f,null);else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Standalone parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${e}' that isn't found in the project`)}else throw Y.Logger.error(`[LiteralValueState.hydrateAncestors] Entity with id '${this.id}' must have a 'parent'`),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(e=>{const f=te(e),h=this.project.get(f);h&&this.valueAsTypeList.push(h)});else if(this.initialData.valueAsTypeSingle){const e=te(this.initialData.valueAsTypeSingle),f=this.project.get(e);f&&(this.valueAsTypeSingle=f)}return{updated:C(i),added:C(r),removed:C(a),affected:C(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.initialized=!0,i==null||i.attemptAutoclose(w.AfterAllChildrenInitialized,this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"add-self-to-project"))){var f,h;const r=[this],a=[],c=[],e=[];return((f=this.parent)==null?void 0:f.type)===d.DataType?this.parent.setEntity(this,i):(h=this.parent)==null||h.setDefaultValue(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:C(r),added:C(a),removed:C(c),affected:C(e),self:this}}setParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetParent,r)?(((a=this.parent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.parent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetParent,this.id),this):this}setStandaloneParent(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetStandaloneParent))){var a;return this.checkCanEditWithCounterpartAndSideEffects(this,i,w.SetStandaloneParent,r)?(((a=this.standaloneParent)==null?void 0:a.id)!==(i==null?void 0:i.id)&&(this.standaloneParent=i,r&&(r==null||r.add(this,W.Updated))),r==null||r.attemptAutoclose(w.SetStandaloneParent,this.id),this):this}addValueAsTypeToList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.AddValueAsTypeToList))){return this.checkCanEdit(this,r)?((this.valueAsTypeList||[]).includes(i)||(this.valueAsTypeList=this.valueAsTypeList||[],this.valueAsTypeList.push(i),this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated)),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this):(Y.Logger.warn(`[addValueAsTypeToList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.AddValueAsTypeToList,this.id),this)}removeValueAsTypeFromList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveValueAsTypeFromList))){return this.checkCanEdit(this,r)?(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&(this.valueAsTypeList||[]).includes(i)&&(this.valueAsTypeList=this.valueAsTypeList.filter(a=>a.id!==i.id),this.valueAsTypeList.length===0?this.valueAsTypeList=null:(this.value!==null&&this.metaSync({value:null},r),this.valueAsTypeSingle!==null&&(this.valueAsTypeSingle=null,r==null||r.add(this,W.Updated))),r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this):(Y.Logger.warn(`[removeValueAsTypeFromList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.RemoveValueAsTypeFromList,this.id),this)}setValueAsTypeSingle(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeSingle))){return this.checkCanEdit(this,r)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this):(Y.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsTypeList))){var a,c;return this.checkCanEdit(this,r)?(!i&&this.valueAsTypeList?(this.valueAsTypeList=null,r==null||r.add(this,W.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((a=this.valueAsTypeList)==null?void 0:a.length)!==i.length?(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,f)=>e!==i[f]))&&(this.valueAsTypeList=i,r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this):(Y.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsTypeList,this.id),this)}setValueAsType(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.SetValueAsType))){return this.checkCanEdit(this,r)?i?(Array.isArray(i)?this.setValueAsTypeList(i,r):this.setValueAsTypeSingle(i,r),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,r),this.setValueAsTypeList(null,r),this):(Y.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),r==null||r.attemptAutoclose(w.SetValueAsType,this.id),this)}initChildren(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=a,this}const r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=r}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(r=>{if(r.type===d.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(r);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.entityType}' with id '${r.entityId}' that is not part of the project state.`);return c}const a=this.project.get(r.id);if(!a)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${r.type}' with id '${r.id}' that is not part of the project state.`);return a});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===d.GenericReference){const a=te(this.initialData.valueAsTypeSingle),c=a?this.project.get(a):null;if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=c,this}const r=this.project.get(this.initialData.valueAsTypeSingle.id);if(!r)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=r}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){var i;return this.activeVersion=!0,(i=this.knownVersions)==null||i.forEach(r=>{r.version!==this.version&&(r.activeVersion=!1)}),this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"meta-sync"))){const a=Yr(this,i,r),c=zr(this,a),e=this.toMeta();return this.name=a.name!==void 0?a.name:e.name,this.autogeneration=a.autogeneration!==void 0?a.autogeneration:e.autogeneration,this.value=a.value!==void 0?a.value:e.value,super.baseMetaSync(a,this,r),a.deleted===!0&&!e.deleted?r==null||r.add(this,W.Removed):a.deleted===!1&&e.deleted?r==null||r.add(this,W.Added):c&&(r==null||r.add(this,W.Updated)),r==null||r.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ke,...r){return await ui.repository.APILoad(this.id,...r),this}async APICreate(i=Ke,...r){return await ui.repository.APICreate(this.toShallowJSON(),...r),this}async APIUpdate(i=Ke,...r){return await ui.repository.APIUpdate(this.toShallowJSON(),...r),this}async APIDelete(i=Ke,...r){return await ui.repository.APIDelete(this.toShallowJSON(),...r),this}async APIClone(i=Ke,...r){return await ui.repository.APIClone(this.id,...r),this}async APILoadVersion(i=Ke,r,...a){return await ui.repository.APILoadVersion(this.id,r,...a)}removeFromParent(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveFromParent))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return this.parent&&(this.parent.type===d.DataType?this.parent.setEntity(null,i):ig.includes(this.parent.type)&&this.parent.setDefaultValue(null,i),e.push(this.parent)),i==null||i.attemptAutoclose(w.RemoveFromParent,this.id),{added:C(c),updated:C(r),removed:C(a),affected:C(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RemoveEntity))){var h;if(!this.checkCanDelete(this,r))return Y.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),r==null||r.event({id:`${w.RemoveEntity}-${this.id}--${Be.ActionOwnerEntityNonDeletable}`,action:w.RemoveEntity,owner:this,errorReason:Be.ActionOwnerEntityNonDeletable,rootAction:((h=r==null?void 0:r.self)==null?void 0:h.id)===this.id&&(r==null?void 0:r.autoCloseActionName)===w.RemoveEntity}),r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const a=[],c=[],e=[],f=[];if(r!=null&&r.hasRemoved(this.id))return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},r),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:b,added:A}=m.entity.onDetachedDependencyRemoved(this,m.field,r);a.push(...E),c.push(...b),e.push(...A)}),!i){const m=this.removeFromParent(r);e.push(...m.added),a.push(...m.updated),c.push(...m.removed),f.push(...m.affected)}return r==null||r.attemptAutoclose(w.RemoveEntity,this.id),{added:C(e),updated:C(a),removed:C(c),affected:C(f),self:this}}restore({}={},i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.RestoreEntity))){if(!this.checkCanEdit(this,i))return Y.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const r=[],a=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(f=>{const{updated:h,removed:m,added:E}=f.entity.onDetachedDependencyRestored(this,f.field,i);a.push(...h),c.push(...m),r.push(...E)}),i==null||i.attemptAutoclose(w.RestoreEntity,this.id),{added:C(r),updated:C(a),removed:C(c),affected:C(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlat(i)):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatIds(i)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var r,a,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((r=this.valueAsTypeSingle)==null?void 0:r.toJSON(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(e=>e.toJSON(i)):null,parent:(a=this.parent)==null?void 0:a.toReference(),standaloneParent:(c=this.standaloneParent)==null?void 0:c.toReference()})}toJSONClone(i=at){var a,c,e,f,h,m,E;let r;return(a=i.seenEntityMaps)!=null&&a.has(this.id)?r=i.seenEntityMaps.get(this.id):(r=i.newId||rn(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,r)),(c=i.seenEntities)!=null&&c.has(r)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((f=i.seenEntities)==null||f.add(r),(h=i.seenEntities)==null||h.add(this.id),{id:r,version:x.UUID.uuid(),createdAt:i.timestamp||B().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...i,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(b=>this.project.getBuiltIn(b.id)?b.toJSON(i.seenEntities):b.toJSONClone({...i,newId:null})):null,parent:(m=this.parent)==null?void 0:m.toReference({seenEntityMaps:i.seenEntityMaps}),standaloneParent:(E=this.standaloneParent)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=at){var a;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:r,version:this.version,entityType:this.type}}toShallowJSON(i=at){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.toReference(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(h=>h.toReference(i)):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.toReference(i),standaloneParent:(f=this.standaloneParent)==null?void 0:f.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatJSON(i)):[]])}toGenerationTarget(i=at){var a,c,e,f;let r=this.id;return(a=i.seenEntityMaps)!=null&&a.has(this.id)&&(r=i.seenEntityMaps.get(this.id)),{id:r,type:this.type,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(h=>h.id):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.id,standaloneParent:(f=this.standaloneParent)==null?void 0:f.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(a=>a.toFlatGenerationTarget(i)):[]])}clearErrors(){return this.errors=[],this}validate(){return this.errors=m_e(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await h_e(this,{tracker:r}),{success:!0}}getErrors(){return[...this.errors]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];return await r.tick(),a}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,w.CloneEntity)),r=null,a=null,c=!0){const e=Mr(r,this),f=this.toJSON(),h=a||x.UUID.uuid();f.id=h,f.version=x.UUID.uuid(),f.createdAt=(i==null?void 0:i.timestamp)||B().toISOString(),f.author=(i==null?void 0:i.author)||"1",f.previousVersion=null,f.deleted=!1,f.editable=!0,f.deletable=!0;const m=tr(f,e);return m.hydrateAncestors(),r&&m.setParent(r,i),c&&(m.subscribe(),m.addSelfToProject(i)),i==null||i.add(m,W.Added),m.initChildren(i),i||m.captureVersion(),i==null||i.attemptAutoclose(w.CloneEntity,this.id),m}merge(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),this,!0,"merge-literal-value"))){const a=[],c=[],e=[],f=[];return this.valueAsTypeSingle!==(i==null?void 0:i.valueAsTypeSingle)&&(this.setValueAsType(i.valueAsTypeSingle,r),a.push(this)),this.valueAsTypeList!==i.valueAsTypeList&&(this.setValueAsTypeList(i.valueAsTypeList,r),a.push(this)),this.value!==i.value&&(this.metaSync({value:i.value},r),a.push(this)),this.autogeneration!==i.autogeneration&&(this.metaSync({autogeneration:i.autogeneration},r),a.push(this)),this.name!==i.name&&(this.metaSync({name:i.name},r),a.push(this)),r==null||r.attemptAutoclose("merge-literal-value",this.id),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:this}}};R(ui,"repository",{APICreate:async(i,...r)=>i,APIUpdate:async(i,...r)=>i,APIDelete:async(i,...r)=>i,APIClone:async(i,...r)=>{},APILoad:async(i,...r)=>null,APILoadVersion:async(i,r,...a)=>null}),R(ui,"type",d.LiteralValue),R(ui,"USER_MANAGED_PARENT_TYPES",[d.DataType,d.InputMap,d.Property,d.ArgumentDeclaration,d.ReturnStatement,d.BreakStatement,d.ContinueStatement,d.VariableDeclaration,d.VariableInstance,d.ValueDescriptor]),R(ui,"USER_MANAGED_STANDALONE_PARENT_TYPES",[...tg]),R(ui,"PARENT_TYPES",[...ui.USER_MANAGED_PARENT_TYPES]),R(ui,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),R(ui,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),R(ui,"BASE_PROPERTIES",[...ui.MUTABLE_BASE_PROPERTIES,...ui.INMUTABLE_BASE_PROPERTIES]),R(ui,"MUTABLE_META_PROPERTIES",[...ui.MUTABLE_BASE_PROPERTIES]),R(ui,"INMUTABLE_META_PROPERTIES",[...ui.INMUTABLE_BASE_PROPERTIES]),R(ui,"META_PROPERTIES",[...ui.MUTABLE_META_PROPERTIES,...ui.INMUTABLE_META_PROPERTIES]),R(ui,"MUTABLE_UPSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),R(ui,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),R(ui,"UPSTREAM_PROPERTIES",[...ui.MUTABLE_UPSTREAM_PROPERTIES,...ui.INMUTABLE_UPSTREAM_PROPERTIES]),R(ui,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ui,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),R(ui,"DOWNSTREAM_PROPERTIES",[...ui.MUTABLE_DOWNSTREAM_PROPERTIES,...ui.INMUTABLE_DOWNSTREAM_PROPERTIES]),R(ui,"PROPERTIES",[...ui.META_PROPERTIES,...ui.UPSTREAM_PROPERTIES,...ui.DOWNSTREAM_PROPERTIES]);let xr=ui;function qf(l){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(l);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(l)}function v_e(l,p){const i=p-l+1,a=n1()*i;return Math.floor(a)+l}function E_e(){const l=qf(4);return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0}function n1(){return E_e()/2**32}function Rx(l){const p=qf(l);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const g_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Dx(l){let p="";const i=qf(l);for(let r=0;r<l;r++)p+=g_[i[r]%g_.length];return p}function b_e(l){const p=qf(l);let i;if(typeof Buffer<"u")i=Buffer.from(p).toString("base64");else{const r=String.fromCharCode(...p);i=btoa(r)}return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function wx(l){return Dx(l)}function Cx(l,p=g_){let i="";const r=qf(l);for(let a=0;a<l;a++)i+=p[r[a]%p.length];return i}function op(){const l=qf(16);l[6]=l[6]&15|64,l[8]=l[8]&63|128;const p=Array.from(l).map(i=>i.toString(16).padStart(2,"0")).join("");return[p.slice(0,8),p.slice(8,12),p.slice(12,16),p.slice(16,20),p.slice(20,32)].join("-")}function A_e(){return Cx(6)}function I_e(){return Rx(32)}const IAi=63,gAi=/^[a-z][a-z0-9-]*[a-z0-9]$/;function RAi(l){return l.length>=1&&l.length<=IAi&&gAi.test(l)&&!l.includes("--")}function*DAi(){yield"";const l="abcdefghijklmnopqrstuvwxyz";for(let p=1;;p++){const i=new Array(p).fill(0);let r=!1;for(;!r;){yield i.map(a=>l[a]).join("");for(let a=p-1;a>=0&&(i[a]++,!(i[a]<l.length));a--)i[a]=0,a===0&&(r=!0)}}}function wAi(l,p){const i=new Set(l.map(a=>a.toLowerCase())),r=p>0?"secondary-db":"main";for(const a of DAi()){const c=a?`${r}-${a}`:r;if(RAi(c)&&!i.has(c))return c}throw new Error("Unable to generate identifier")}function g_e(l,p){switch(l.id){case ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const i=l.project.entities.filter(h=>!!h.implements.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),r=i.find(h=>{const m=h.properties.find(A=>A.implements.find(_=>_.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.getDefaultValue();return(E==null?void 0:E.value)===!0});if(!r&&i.length){const m=i[0].properties.find(b=>b.implements.find(A=>A.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),E=m==null?void 0:m.defaultValue;if(E)E.metaSync({value:!0},p);else if(m!=null&&m.dataType){const b={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:m==null?void 0:m.toReference()},A=Ae(b,l.project);return A.hydrateAncestors(),A.setParent(m,p),A.addSelfToProject(p),p==null||p.add(A,W.Added),A.initChildren(p),p||A.captureVersion(),{newEntities:[A]}}return{newEntities:[]}}else if(r)return{newEntities:[]};const a=l.project.get(ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),c=a1(a,"Main database",p);if(c.errors.length>0)return{newEntities:[]};const e=c.properties.find(h=>h.implements.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)),f=e==null?void 0:e.defaultValue;if(f)f.metaSync({value:!0},p);else if(e!=null&&e.dataType){const h={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:e==null?void 0:e.toReference()},m=Ae(h,l.project);m.hydrateAncestors(),m.setParent(e,p),m.addSelfToProject(p),p==null||p.add(m,W.Added),m.initChildren(p),p||m.captureVersion()}return{newEntities:[c]}}}return{newEntities:[]}}function R_e(l,p){const i=[],r=[],a=[],c=[];return l.implements.filter(f=>f.type===d.BuiltInBaseEntity).forEach(f=>{var h,m,E,b,A,_,N,P,j;switch(f.id){case ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const M=l.project.entities.filter(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let G=M.find(ie=>!!ie.properties.find(se=>{var ue;return se.implements.find(z=>z.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ue=se.getDefaultValue())==null?void 0:ue.value)===!0}));if(!G&&M.length)G=M[0];else if(!G&&!M.length){G=l.project.getBuiltIn(ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",p);const se=G.properties.find(ue=>ue.implements.find(z=>z.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));(h=se==null?void 0:se.defaultValue)==null||h.metaSync({value:!0},p),r.push(G)}const q=l.properties.find(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id));if(q&&!(q!=null&&q.defaultValue)){const ie={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(p==null?void 0:p.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:null,name:ye.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(G==null?void 0:G.toJSON())||null,valueAsTypeList:null,parent:q==null?void 0:q.toReference()},se=Ae(ie,l.project);se.hydrateAncestors(),se.setParent(q,p),se.addSelfToProject(p),p==null||p.add(se,W.Added),se.initChildren(p),(q==null?void 0:q.defaultValue).setValueAsTypeSingle(G||null,p),r.push(se),p||se.captureVersion();return}else q!=null&&q.defaultValue&&!(q!=null&&q.defaultValue.valueAsTypeSingle)&&(q==null||q.defaultValue.setValueAsTypeSingle(G||null,p));const re=l.properties.find(ie=>ie.implements.find(se=>se.id===ne["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.primaryKey.id));if(!re)throw new Error(`[handleAfterEntityImplementationSideEffects] Primary key property not found for implemented base entity ${ne["built-in-base-entity"]}`);let ee=!1;if(!re.dataType){const ie=yr.new(p);ie.parent=re.toReference();const se=Ae(ie,l.project);se.hydrateAncestors(),se.setParent(re,p),se.addSelfToProject(p),p==null||p.add(se,W.Added),se.initChildren(p),ee=!0}const de=l.project.getBuiltIn(ne["primitive-entity"].number.id);(m=re.dataType)==null||m.setEntity(de,p),ee&&(p||(E=re.dataType)==null||E.captureVersion());return}case ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id:{const M=l.project.entities.filter(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)&&z.id!==l.id),G=M.map(z=>{var oe;const X=z.properties.find(me=>me.implements.find(ve=>ve.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));return(oe=X==null?void 0:X.getDefaultValue())==null?void 0:oe.value}).filter(z=>!!z),q=l.properties.find(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id));if(!M.find(z=>!!z.properties.find(X=>{var ce;return X.implements.find(oe=>oe.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id)&&((ce=X.getDefaultValue())==null?void 0:ce.value)===!0}))){const z=l.properties.find(ce=>ce.implements.find(oe=>oe.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id));if(!z)throw new Error("Default boolean property not found for relational database entity with id: "+l.id);let X=!1;if(!(z!=null&&z.defaultValue)){const ce=xr.new(p);ce.parent=z.toReference();const oe=Ae(ce,l.project);oe.hydrateAncestors(),oe.setParent(z,p),oe.addSelfToProject(p),p==null||p.add(oe,W.Added),oe.initChildren(p),X=!0}(b=z==null?void 0:z.defaultValue)==null||b.metaSync({value:!0},p),X&&(p||(A=z==null?void 0:z.defaultValue)==null||A.captureVersion())}if(!q)throw new Error("Identifier property not found for relational database entity with id: "+l.id);let ee=!1;if(!(q!=null&&q.defaultValue)){const z=xr.new(p);z.parent=q.toReference();const X=Ae(z,l.project);X.hydrateAncestors(),X.setParent(q,p),X.addSelfToProject(p),p==null||p.add(X,W.Added),X.initChildren(p),ee=!0}const de=wAi(G,M.length);(_=q.defaultValue)==null||_.metaSync({value:de},p),ee&&(p||(N=q.defaultValue)==null||N.captureVersion());const ie=l.properties.find(z=>z.implements.find(X=>X.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.password.id));if(!ie)throw new Error(`[handleAfterEntityImplementationSideEffects] Password property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id} with id ${l.id}`);let se=!1;if(!ie.defaultValue){const z=xr.new(p);z.parent=ie.toReference();const X=Ae(z,l.project);X.hydrateAncestors(),X.setParent(ie,p),X.addSelfToProject(p),p==null||p.add(X,W.Added),X.initChildren(p),r.push(X),se=!0}const ue=wx(24);(P=ie.defaultValue)==null||P.metaSync({value:ue},p),se&&(p||(j=ie.defaultValue)==null||j.captureVersion());return}case ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id:{const M=l.properties.find(ee=>ee.implements.find(de=>de.id===ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.time.id));if(!M)throw new Error(`[handleAfterEntityImplementationSideEffects] Time property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let G=M.defaultValue||null;if(!G){const ee=xr.new(p);ee.parent=M.toReference(),ee.name=ye.Date,ee.id=x.UUID.uuid(),G=Ae(ee,l.project),G.hydrateAncestors(),G.setParent(M,p),G.addSelfToProject(p),G.initChildren(p),p==null||p.add(G,W.Added)}G.metaSync({value:new Date().toISOString()},p),G.metaSync({editable:!1,deletable:!1},p),M.metaSync({editable:!1,deletable:!1},p);const q=l.properties.find(ee=>ee.implements.find(de=>de.id===ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.properties.definition.id));if(!q)throw new Error(`[handleAfterEntityImplementationSideEffects] Definition property not found for implemented base entity ${ne["built-in-base-entity"].BUILT_IN_SQL_ROW_TRANSFORMER_ENTITY.id} with id ${l.id}`);let re=q.defaultValue||null;if(!re){const ee=xr.new(p);ee.name=ye.EntityTemplate,ee.parent=q.toReference(),ee.id=x.UUID.uuid(),re=Ae(ee,l.project),re.hydrateAncestors(),re.setParent(q,p),re.addSelfToProject(p),re.initChildren(p),p==null||p.add(re,W.Added)}}}}),{self:l,updated:C(i),added:C(r),removed:C(a),affected:C(c)}}function a1(l,p,i,r){const a=r||x.UUID.uuid(),c=Ls.new(i);c.id=a,c.name=p,c.static=l.static,c.implements=[l.toJSON()],c.parent=l.project.toReference(),c.static=l.static,g_e(l,i);const e=Ae(c,l.project);return e.hydrateAncestors(),i==null||i.add(e,W.Added),e.addSelfToProject(i),e.initChildren(i),i||e.captureVersion(),R_e(e,i),e.afterAllChildrenInitialized(i),e}function Ox(l,p){return p.entities.find(a=>{const c=a.properties,e=c.map(b=>b.name),f=l.every(b=>e.includes(b)),h=e.filter(b=>!l.includes(b)),m=c.every(b=>!h.includes(b.name)||!b.required);return f&&m})||null}function D_e(l,p,i,r=ze.OrDataTypeGroup){const a=[],c=[],e=[],f=[],h=x.UUID.uuid(),m=yr.new(i);m.id=h,m.parent=p.toReference(),m.like=!0,m.parentRelationType=r;const E=Ae(m,l.project);return c.push(E),E.setParent(p,i),E.addSelfToProject(i),i==null||i.add(E,W.Added),E.setEntity(l,i),E.initChildren(i),i||E.captureVersion(),{updated:C(a),added:C(c),removed:C(e),affected:C(f),self:E}}function _x(l,p,i,r,a){var m,E,b,A,_,N,P,j;const c=[],e=[],f=[],h=[];switch(typeof l){case"string":let M=!1;const G=new Date(l);if(G instanceof Date&&!isNaN(G.valueOf())&&(M=!0),M){const q=p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Date].id);p.setEntity(q,r);break}else{const q=p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id);p.setEntity(q,r);break}case"number":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":if(l===null){p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}else if(Array.isArray(l))if(p.metaSync({isList:!0},r),l.length>0){const q=l.slice(0,5).filter(ee=>ee!==void 0);if(q.every(ee=>typeof ee==typeof q[0])&&(typeof q[0]!="object"||q[0]===null))switch(typeof q[0]){case"string":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id),r);break;case"number":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":p.setEntity(p.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}else{const ee=[];let de=!1;q.forEach(se=>{var ue,z,X,ce;if(Array.isArray(se)&&(de=!0),typeof se=="object"&&!Array.isArray(se)&&se!==null){const oe=JA(se,p.project,{...i,id:x.UUID.uuid()},r,a);oe.hasCreated&&ee.push((ue=oe.changeSet)==null?void 0:ue.self),c.push(...(z=oe.changeSet)==null?void 0:z.updated),e.push(...(X=oe.changeSet)==null?void 0:X.added),f.push(...(ce=oe.changeSet)==null?void 0:ce.removed)}});const ie=C(ee);if(!ie.length&&!de){q.forEach(se=>{const ue=yr.new(r);ue.parentRelationType=ze.OrDataTypeGroup,ue.parent=p.toReference();const z=Ae(ue,p.project);switch(z.hydrateAncestors(),z.setParent(p,r),z.addSelfToProject(r),r==null||r.add(z,W.Added),z.initChildren(r),typeof se){case"string":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.String].id),r);break;case"number":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Number].id),r);break;case"boolean":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Boolean].id),r);break;case"object":z.setEntity(z.project.getBuiltIn(ne[d.PrimitiveEntity][ye.Null].id),r);break}r||z.captureVersion()});break}else ie.length===1&&!de?p.setEntity(ie[0],r):q.forEach(se=>{if(typeof se=="object"&&!Array.isArray(se)&&se!==null){const ue=Ox(Object.keys(se),p.project);if(ue){const z=D_e(ue||ie[0],p,r,ze.OrDataTypeGroup);c.push(...z.updated),e.push(...z.added),f.push(...z.removed)}}else{const ue=yr.new(r);ue.parentRelationType=ze.OrDataTypeGroup,ue.parent=p.toReference();const z=Ae(ue,p.project);z.hydrateAncestors(),z.setParent(p,r),z.addSelfToProject(r),r==null||r.add(z,W.Added),z.initChildren(r);const X=_x(se,z,{...i,id:x.UUID.uuid()},r,a);c.push(...X.updated),e.push(...X.added),f.push(...X.removed),r||z.captureVersion()}})}}else{const q=JA(l[0],p.project,{...i},r,a);p.setEntity((m=q.changeSet)==null?void 0:m.self,r),c.push(...(E=q.changeSet)==null?void 0:E.updated),e.push(...(b=q.changeSet)==null?void 0:b.added),f.push(...(A=q.changeSet)==null?void 0:A.removed);break}else{const q=JA(l,p.project,{...i},r,a);p.setEntity((_=q.changeSet)==null?void 0:_.self,r),c.push(...(N=q.changeSet)==null?void 0:N.updated),e.push(...(P=q.changeSet)==null?void 0:P.added),f.push(...(j=q.changeSet)==null?void 0:j.removed);break}}return{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:p}}function JA(l,p,i,r,a){const c=[],e=[],f=[],h=[],m=Object.keys(l),E=Ox(m,p);if(E)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:E}};const b=a?i.name+" of "+a.name:i.name,_={id:i.id||x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(r==null?void 0:r.timestamp)||new Date().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,name:b,codeName:null,deletable:!0,editable:!0,type:d.DefinitionEntity,additionalProperties:!1,additionalPropertiesDataType:null,allPropertiesImplement:null,description:i.description||null,static:i.static||!1,abstract:i.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:null,implements:[],x:0,y:0,parent:p.toReference()},N=Ae(_,p);return N.hydrateAncestors(),N.setParent(p,r),N.addSelfToProject(r),r==null||r.add(N,W.Added),N.initChildren(r),e.push(N),m.forEach((P,j)=>{const M=x.UUID.uuid(),G=ps.new(r);G.id=M,G.name=P,G.codeName=P,G.parent=N.toReference(),G.index=j,G.required=!0,G.interactive=!0;const q=Ae(G,p);q.hydrateAncestors(),q.setParent(N,r),q.addSelfToProject(r),r==null||r.add(q,W.Added),q.initChildren(r),e.push(q);const re=l[P],ee=x.UUID.uuid(),de=yr.new(r);de.id=ee,de.parent=q.toReference(),de.like=!0,de.isList=!1;const ie=Ae(de,p);ie.hydrateAncestors(),ie.setParent(q,r),ie.addSelfToProject(r),r==null||r.add(ie,W.Added),ie.initChildren(r),e.push(ie);const se=_x(re,ie,{...i,name:P,id:x.UUID.uuid()},r,a||N);c.push(...se.updated),e.push(...se.added),f.push(...se.removed),r||(q.captureVersion(),ie.captureVersion())}),r||N.captureVersion(),{hasCreated:!0,changeSet:{updated:C(c),added:C(e),removed:C(f),affected:C(h),self:N}}}function Ud(l,p,i,r){const a=[];return!l.length||!p.length?{errors:a,overlap:!1}:(l.length>p.length?l.forEach(c=>{const e=p.find(h=>h.name===c.name),f=p.find(h=>{var m,E;return Array.isArray(h.implements)?h.implements.some(b=>!!c.implements.find(A=>A.id===b.id)):((m=h.implements)==null?void 0:m.id)===((E=c.implements)==null?void 0:E.id)});if(e){const h=new ki({id:c.id+"--"+e.id+"--"+r,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${e.type} ${e.name} with id "${e.id}" that has the same name`,severity:Te.Error,code:r,entity:c,firstRelationship:e});a.push(h)}if(f){const h=new ki({id:c.id+"--"+f.id+"--"+i,message:`Entity of type ${c.type} named "${c.name}" with id "${c.id}" overrides a base ${f.type} ${f.name} with id "${f.id}" that implements the same base descriptor`,severity:Te.Error,code:i,entity:c,firstRelationship:f});a.push(h)}}):p.forEach(c=>{var h;const e=l.find(m=>m.name===c.name),f=l.find(m=>{var E,b;return m.implements&&Array.isArray(m.implements)?m.implements.some(A=>!!c.implements.find(_=>_.id===A.id)):((E=m.implements)==null?void 0:E.id)===((b=c.implements)==null?void 0:b.id)});if(e){const m=new ki({id:e.id+"--"+c.id+"--"+r,message:`Entity of type ${e.type} named "${e.name}" with id "${e.id}" overrides a base entity ${c.name} with id "${c.id}" that has the same name`,severity:Te.Error,code:r,entity:e,firstRelationship:c});a.push(m)}if(f){const m=new ki({id:f.id+"--"+c.id+"--"+i,message:`Entity of type ${f.type} named "${f.name}" with id "${f.id}" overrides a base entity ${c.name} with id "${c.id}" that implements the same base ${Array.isArray(f==null?void 0:f.implements)?vt(f==null?void 0:f.implements.map(E=>E.type),"', '","' and '"):(h=f.implements)==null?void 0:h.id}`,severity:Te.Error,code:i,entity:f,firstRelationship:c});a.push(m)}}),{errors:a,overlap:!!a.length})}function CAi(l,p){return l.abstract||(l.properties.forEach(r=>{r.abstract||r.metaSync({abstract:!0},p)}),Object.values(l.detachedDependents).forEach(r=>{r.field===tL.EntityField&&r.entity.remove({ignoreUpstream:!1},p)}),l.metaSync({abstract:!0},p)),l}function OAi(l,p){return l.abstract&&(l.properties.forEach(r=>{r.abstract&&r.metaSync({abstract:!1},p)}),Object.values(l.detachedDependents).forEach(r=>{(r.field===jI.Implements||r.field===jI.Extends)&&r.entity.onDetachedDependencyRemoved(l,r.field,p)}),l.metaSync({abstract:!1},p)),l}function _Ai(l,p){return l.static||(l.properties.forEach(r=>{r.static||r.metaSync({static:!0},p)}),l.metaSync({static:!0},p)),l}function VAi(l,p){return l.static&&l.metaSync({static:!1},p),l}const kT=class kT extends Ex{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"version");R(this,"name");R(this,"description",null);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",!1);R(this,"static");R(this,"additionalProperties",!1);R(this,"properties",[]);R(this,"allPropertiesImplement",null);R(this,"additionalPropertiesDataType",null);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"interactive",!1);R(this,"errors",[]);R(this,"project");if(this.initialData=this.initialData||i,this.project=this.project||r,this.id=this.id||i.id,this.version=this.version||i.version,this.name=this.name||i.name,this.static=this.static||i.static,this.interactive=this.interactive||i.interactive,this.abstract=i.abstract,this.additionalProperties=i.additionalProperties,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.initialData.allPropertiesImplement){const a=Ae(this.initialData.allPropertiesImplement,this.project);a.setParent(this,null),a.initChildren(null),this.allPropertiesImplement=a}if(this.initialData.additionalPropertiesDataType){const a=Ae(this.initialData.additionalPropertiesDataType,this.project);a.setParent(this,null),a.initChildren(null),this.additionalPropertiesDataType=a}this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}get allMethods(){return C([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return C([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allMethods)||[],r=[...i].filter(c=>!i.some(e=>e.id!==c.id));return C(r)}get allBasePropertiesFromOriginalParents(){var a;const i=((a=this.extends)==null?void 0:a.allProperties)||[],r=[...i].filter(c=>!i.some(e=>{var f;return e.id!==c.id&&(!!e.implements.find(h=>h.id===c.id)||((f=e.extends)==null?void 0:f.id)===c.id)}));return C(r)}get allBasePropertiesFromExtendedAndImplementedEntities(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.allBasePropertiesFromExtendedAndImplementedEntities)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C([...r])}get allBaseMethodsFromExtendedAndImplementedEntities(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>r.type===d.PrimitiveEntity?i:[...[...r.ownDeclaredMethods,...r.allBaseMethodsFromExtendedAndImplementedEntities].filter(c=>c.type!==d.ActionDescriptor),...i],[])])}get extendedPropertiesFromOriginalParents(){var a,c;const i=[...((a=this.extends)==null?void 0:a.ownDeclaredProperties)||[],...((c=this.extends)==null?void 0:c.extendedPropertiesFromOriginalParents)||[]].filter(e=>!e.abstract),r=[...i].filter(e=>!i.some(f=>{var h;return f.id!==e.id&&(!!f.implements.find(m=>m.id===e.id)||((h=f.extends)==null?void 0:h.id)===e.id)}));return C(r)}get implementedPropertiesFromOriginalParents(){return C([...(this.extends?[this.extends]:[]).reduce((i,r)=>{const a=r.implementedPropertiesFromOriginalParents,c=[...r.ownDeclaredProperties].filter(h=>!!h.abstract),e=[...a,...c,...i];return[...e].filter(h=>!!!e.find(E=>{var b;return((b=E.extends)==null?void 0:b.id)===h.id||!!E.implements.find(A=>A.id===h.id)}))},[])].filter(i=>!!i.abstract))}get extendedProperties(){return this.properties.filter(i=>i.isExtendedProperty)}get ownDeclaredMethods(){return[...this.methods,...this.abstractMethods]}get ownDeclaredProperties(){return this.properties.filter(i=>!i.isExtendedProperty)}subscribe(){return this.project.subscribeBuiltInInstance(this),this}unsubscribe(){return this.project.unsubscribeBuiltInInstance(this),this}async APILoad(i=Ke,...r){return await kT.repository.APILoad(this.id,...r),this}toFlat(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this,...this.properties.flatMap(c=>c.toFlat(i)),...this.methods.flatMap(c=>c.toFlat(i)),...this.abstractMethods.flatMap(c=>c.toFlat(i)),...((a=this.extends)==null?void 0:a.toFlat(i))||[]])}toFlatIds(i=new Set){var a;return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.properties.flatMap(c=>c.toFlatIds(i)),...this.methods.flatMap(c=>c.toFlatIds(i)),...this.abstractMethods.flatMap(c=>c.toFlatIds(i)),...((a=this.extends)==null?void 0:a.toFlatIds(i))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,additionalProperties:this.additionalProperties,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(i=new Set){var r,a,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,additionalProperties:this.additionalProperties,interactive:this.interactive,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toJSON(i))||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toJSON(i))||null,properties:this.properties.map(e=>e.toJSON(i)),methods:this.methods.map(e=>e.toJSON(i)),abstractMethods:this.abstractMethods.map(e=>e.toJSON(i)),extends:((c=this.extends)==null?void 0:c.toJSON(i))||null})}toReference(i=at){return{id:this.id+"--"+x.UUID.uuid()+"--ref",type:d.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(i=at){var r,a,c;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,additionalProperties:this.additionalProperties,additionalPropertiesDataType:((r=this.additionalPropertiesDataType)==null?void 0:r.toReference())||null,allPropertiesImplement:((a=this.allPropertiesImplement)==null?void 0:a.toReference())||null,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:((c=this.extends)==null?void 0:c.toReference())||null}}toFlatJSON(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(e=>e.toFlatJSON(i)),...this.methods.flatMap(e=>e.toFlatJSON(i)),...this.abstractMethods.flatMap(e=>e.toFlatJSON(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatJSON(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatJSON(i))||[]])}toGenerationTarget(i=at){var r;return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,additionalProperties:this.additionalProperties,extends:(r=this.extends)==null?void 0:r.id}}toFlatGenerationTarget(i=new Set){var a,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(e=>e.toFlatGenerationTarget(i)),...this.methods.flatMap(e=>e.toFlatGenerationTarget(i)),...this.abstractMethods.flatMap(e=>e.toFlatGenerationTarget(i)),...((a=this.additionalPropertiesDataType)==null?void 0:a.toFlatGenerationTarget(i))||[],...((c=this.allPropertiesImplement)==null?void 0:c.toFlatGenerationTarget(i))||[]])}clearErrors(){var i,r;return this.errors=[],this.properties.forEach(a=>a.clearErrors()),this.methods.forEach(a=>a.clearErrors()),this.abstractMethods.forEach(a=>a.clearErrors()),(i=this.additionalPropertiesDataType)==null||i.clearErrors(),(r=this.allPropertiesImplement)==null||r.clearErrors(),this}validate(){return this.errors=EAi(this),{success:!0}}async validateAsync(i={}){const r=Y.YieldTracker.from(i);return this.errors=await vAi(this,{tracker:r}),{success:!0}}getErrors(){var r,a;return[...this.errors,...this.properties.flatMap(c=>c.getErrors()),...this.methods.flatMap(c=>c.getErrors()),...this.abstractMethods.flatMap(c=>c.getErrors()),...((r=this.additionalPropertiesDataType)==null?void 0:r.getErrors())||[],...((a=this.allPropertiesImplement)==null?void 0:a.getErrors())||[]]}async getErrorsAsync(i={}){const r=Y.YieldTracker.from(i),a=[...this.errors];await r.tick();for(const c of this.properties){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.methods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}for(const c of this.abstractMethods){const e=await c.getErrorsAsync({tracker:r});a.push(...e)}if(this.additionalPropertiesDataType){const c=await this.additionalPropertiesDataType.getErrorsAsync({tracker:r});a.push(...c)}if(this.allPropertiesImplement){const c=await this.allPropertiesImplement.getErrorsAsync({tracker:r});a.push(...c)}return a}getShallowErrors(){return this.errors}implement(i,r=this.project.addChangeSet(new S(this.project,x.sessionAuthor,B().toISOString(),null,!0,"implement-built-in-base-entity")),a){const c=a1(this,i,r,a);return r==null||r.attemptAutoclose("implement-built-in-base-entity",this.id),c}getAllPropertiesImplements(){var r;const i=[];return this.allPropertiesImplement&&i.push(this.allPropertiesImplement),((r=this.extends)==null?void 0:r.type)===d.BuiltInBaseEntity&&i.push(...this.extends.getAllPropertiesImplements()||[]),i}getAllInteractiveMethods(){const i=[];if(this.interactive){if(i.push(...this.methods,...this.abstractMethods),!this.extends||this.extends.type===d.BuiltInBaseEntity&&this.extends.interactive||this.extends.type===d.PrimitiveEntity)return i;this.extends instanceof kT&&i.push(...this.extends.getAllInteractiveMethods())}return C(i)}};R(kT,"repository",{APILoad:async(i,...r)=>null});let od=kT;class w_e extends od{constructor(i){super(gn,i);R(this,"initialData");R(this,"id",Ie.PERSISTED_ENTITY);R(this,"version","1");R(this,"name",Ie.PERSISTED_ENTITY);R(this,"description",gn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",gn.abstract);R(this,"static",gn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=gn,this.project=i,this.id=gn.id,this.version=gn.version,this.name=gn.name,this.static=gn.static,this.abstract=gn.abstract,this.properties=this.initialData.properties.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=Ae(r,this.project);return a.parent=this,a}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project))}}var wn=(l=>(l.ValueMustBeString="value-must-be-string",l.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",l.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",l.MustBeUniqueAmongSameEntities="must-be-unique-among-same-entities",l))(wn||{});function Vx(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new ki({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces.`,severity:Te.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s/g,"-")}}function C_e(l,p){const i=[],r=p;if(!r)return{errors:i,override:p};if(typeof r!="string")return{errors:[],override:p};if(r.includes(" ")){const a=new ki({id:l.id+"--string-value-must-not-have-spaces",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Te.Error,code:"string-value-must-not-have-spaces",entity:l});i.push(a)}if(r.includes("-")){const a=new ki({id:l.id+"--string-value-must-not-have-dashes",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value cannot contain spaces or dashes.`,severity:Te.Error,code:"string-value-must-not-have-dashes",entity:l});i.push(a)}return{errors:i,override:r.replace(/\s|-/g,"_")}}var dd=(l=>(l.StatusCodeMustBeNumber="status-code-must-be-number",l.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",l))(dd||{});function O_e(l,p){const i=[];if(typeof p!="number"){const r=new ki({id:l.id+"--status-code-must-be-number",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number.`,severity:Te.Error,code:"status-code-must-be-number",entity:l});return i.push(r),{errors:i,override:p}}if(p<100||p>599){const r=new ki({id:l.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a number between 100 and 599.`,severity:Te.Error,code:"status-code-must-be-between-100-and-599",entity:l});i.push(r)}return{errors:i,override:p}}class __e extends od{constructor(i){var f,h;super(ts,i);R(this,"initialData");R(this,"id",Ie.HTTP_ENDPOINT);R(this,"version","1");R(this,"name",Ie.HTTP_ENDPOINT);R(this,"description",ts.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",ts.abstract);R(this,"static",ts.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=ts,this.project=i,this.id=ts.id,this.version=ts.version,this.name=ts.name,this.static=ts.static,this.abstract=ts.abstract,this.properties=this.initialData.properties.map(m=>{const E=Ae(m,this.project);return E.setParent(this,null),E.initChildren(null),E}),this.methods=this.initialData.methods.map(m=>{const E=Ae(m,this.project);return E.parent=this,E}),this.abstractMethods=this.initialData.abstractMethods.map(m=>{const E=Ae(m,this.project);return E.parent=this,E}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(m,E)=>{var j;const b=Vx(m,E),A=m.parent,_=A.properties.find(M=>M.implements.find(G=>G.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id)),N=(j=_==null?void 0:_.getDefaultValue())==null?void 0:j.value;if(m.project.entities.filter(M=>ai(M,Ie.HTTP_ENDPOINT)&&M.id!==A.id).some(M=>{var re,ee;const G=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));if(((re=G==null?void 0:G.getDefaultValue())==null?void 0:re.value)!==N)return!1;const q=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(!q)throw new Error(`"Path" property not found in endpoint entity "${M.name}" (${M.id})`);return((ee=q.getDefaultValue())==null?void 0:ee.value)===E})){const M=new ki({id:m.id+"--"+wn.MustBeUniqueAmongSameEntities,message:`Path "${E}" is already in use by another endpoint with the ${N} method.`,severity:Te.Error,code:wn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(M)}return b};const a=this.properties.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id);a&&(a._codeNativeValueValidation=(m,E)=>{var j;const b={errors:[],override:E},A=m.parent,_=A.properties.find(M=>M.implements.find(G=>G.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id)),N=(j=_==null?void 0:_.getDefaultValue())==null?void 0:j.value;if(m.project.entities.filter(M=>ai(M,Ie.HTTP_ENDPOINT)&&M.id!==A.id).some(M=>{var re,ee;const G=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id));if(((re=G==null?void 0:G.getDefaultValue())==null?void 0:re.value)!==N)return!1;const q=M.properties.find(de=>de.implements.find(ie=>ie.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.method.id));return((ee=q==null?void 0:q.getDefaultValue())==null?void 0:ee.value)===E})){const M=new ki({id:m.id+"--"+wn.MustBeUniqueAmongSameEntities,message:`Method "${E}" cannot be used because another endpoint is already using the ${E} method on path "${N}".`,severity:Te.Error,code:wn.MustBeUniqueAmongSameEntities,entity:m});b.errors.push(M)}return b});const c=this.abstractMethods.find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!c)throw new Error("Handler method not found in endpoint entity");const e=(((h=(f=c.dataType)==null?void 0:f.entity)==null?void 0:h.properties)||[]).find(m=>m.id===ne["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.dataType.entity.properties.statusCode.id);if(!e)throw new Error("Status code output not found in handler method");e._codeNativeValueValidation=(m,E)=>O_e(m,E)}}var NT=(l=>(l.InvalidCharacters="cron-invalid-characters",l.MustHaveSixFields="cron-must-have-six-fields",l.DayOfMonthAndWeekConflict="cron-day-of-month-and-week-conflict",l))(NT||{});function V_e(l,p){const i=[];let r=p;if(typeof p!="string"){const e=new ki({id:l.id+"--"+wn.ValueMustBeString,message:`Entity of type ${l.type} with id "${l.id}" has an invalid value. The cron expression must be a string.`,severity:Te.Error,code:wn.ValueMustBeString,entity:l});return i.push(e),{errors:i,override:""}}r=p.trimStart().replace(/\s{2,}/g," ");const a=/[^0-9A-Z *?\-/,LW#]/g;if(a.test(r)){const e=Array.from(new Set(r.match(a)));i.push(new ki({id:l.id+"--cron-invalid-characters",message:`Cron expression contains invalid characters: "${e.join(", ")}". Only alphanumeric characters and (* ? - / , L W #) are allowed.`,severity:Te.Error,code:"cron-invalid-characters",entity:l})),r=r.replace(a,"")}const c=r.split(" ").filter(Boolean);if(c.length!==6)i.push(new ki({id:l.id+"--cron-must-have-six-fields",message:`AWS Cron expressions must have exactly 6 fields separated by spaces (Minutes, Hours, Day-of-month, Month, Day-of-week, Year). Currently has ${c.length}.`,severity:Te.Error,code:"cron-must-have-six-fields",entity:l}));else{const e=c[2],f=c[4];e!=="?"&&f!=="?"&&(i.push(new ki({id:l.id+"--cron-day-of-month-and-week-conflict",message:"AWS restricts defining both Day-of-month and Day-of-week simultaneously. If you specify one, the other must be '?'",severity:Te.Error,code:"cron-day-of-month-and-week-conflict",entity:l})),e==="*"&&f==="*"&&(c[4]="?",r=c.join(" ")))}return{errors:i,override:r}}class P_e extends od{constructor(i){super(Vs,i);R(this,"initialData");R(this,"id",Ie.CRON_JOB);R(this,"version","1");R(this,"name",Ie.CRON_JOB);R(this,"description",Vs.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",Vs.abstract);R(this,"static",Vs.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=Vs,this.project=i,this.id=Vs.id,this.version=Vs.version,this.name=Vs.name,this.static=Vs.static,this.abstract=Vs.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===ne["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.properties.expression.id);if(!r)throw new Error("Expression property not found in cron job entity");r._codeNativeValueValidation=(a,c)=>V_e(a,c)}}class N_e extends od{constructor(i){super(jn,i);R(this,"initialData");R(this,"id",Ie.RELATIONAL_DATABASE);R(this,"version","1");R(this,"name",Ie.RELATIONAL_DATABASE);R(this,"description",jn.description);R(this,"type",d.BuiltInBaseEntity);R(this,"abstract",jn.abstract);R(this,"static",jn.static);R(this,"properties",[]);R(this,"methods",[]);R(this,"abstractMethods",[]);R(this,"extends",null);R(this,"errors",[]);R(this,"project");this.initialData=jn,this.project=i,this.id=jn.id,this.version=jn.version,this.name=jn.name,this.static=jn.static,this.abstract=jn.abstract,this.properties=this.initialData.properties.map(a=>{const c=Ae(a,this.project);return c.setParent(this,null),c.initChildren(null),c}),this.methods=this.initialData.methods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const c=Ae(a,this.project);return c.parent=this,c}),this.initialData.extends&&(this.extends=Ae(this.initialData.extends,this.project));const r=this.properties.find(a=>a.id===ne["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!r)throw new Error("Path property not found in endpoint entity");r._codeNativeValueValidation=(a,c)=>C_e(a,c)}}class x_e extends Hi{constructor(i){super(la,i);R(this,"id",la.id);R(this,"name",la.name);R(this,"description",la.description);R(this,"version",la.version);R(this,"autoexecutable",!1);R(this,"type",d.ActionDescriptor);R(this,"inputs",[]);R(this,"dataType",null);R(this,"error",null);R(this,"project");this.project=i,this.inputs=la.inputs.map(r=>{const a=Ae(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.dataType=Ae(la.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(null),this.error=la.error?Ae(la.error,this.project):null}}var as=(l=>(l.UUIDMustBeString="uuid-must-be-string",l.UUIDMustBeValidFormat="uuid-must-be-valid-format",l.UUIDMustNotContainSpaces="uuid-must-not-contain-spaces",l))(as||{});function PAi(l,p){const i=[];if(typeof p!="string"){const a=new ki({id:l.id+"--uuid-must-be-string",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be text.`,severity:Te.Error,code:"uuid-must-be-string",entity:l});return i.push(a),{errors:i,override:p}}const r=Vx(l,p);if(r.errors.length>0)return i.push(...r.errors),{errors:i,override:p};if(!vx(p)){const a=new ki({id:l.id+"--uuid-must-be-valid-format",message:`Entity of type ${l.type} with id "${l.id}" has an invalid value "${p}". The value must be a valid UUID format. Eg: "123e4567-e89b-12d3-a456-426614174000".`,severity:Te.Error,code:"uuid-must-be-valid-format",entity:l});i.push(a)}return{errors:i,override:p}}var Me=(l=>(l.Inherited="inherited",l.DefaultValue="default-value",l.Missing="missing",l.Empty="empty",l.AutoCalculated="auto-calculated",l.QueuedAutocalculation="queued-autocalculation",l.External="external",l.Testing="testing",l.ExecutionResult="execution-result",l))(Me||{});const $_e={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function IT(l,p){return{...$_e,id:l,project:p}}class gT{constructor(p,i){R(this,"initialized",!1);R(this,"id");R(this,"project");R(this,"values",{});R(this,"onWriteCallback",()=>{});R(this,"onRemoveCallback",()=>{});this.id=p,this.project=i,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var r;if(!((r=this.project)!=null&&r.id)||this.initialized)return;const p={},i={};Object.keys(p).forEach(a=>{const c=p[a],e=new xr(c,this.project);try{if(c.parent){const m=this.project.findSubscribedInstanceFromReference(c.parent);if(!m)return;e.setParent(m,null),e.hydrateAncestors(),e.initChildren(null)}else if(c.standaloneParent){const m=this.project.findSubscribedInstanceFromReference(c.standaloneParent);if(!m)return;e.standalone=!0,e.setStandaloneParent(m,null),e.hydrateAncestors(),e.initChildren(null)}i[a]=e;const f=e.parent||e.standaloneParent,h=J_e(e,f,this.project);h?i[a]=h:delete p[a]}catch(f){Y.Logger.error("Error hydrating ancestors: ",f),delete p[a]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(i=>{p[i]=this.values[i].toJSON()}),p}writeValue(p,i){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let a=this.values[p.id];if(!a)if(i instanceof xr)a=i;else if(i)a=tr(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:d.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:rf(p.getDataType(null))};a=tr(c,this.project)}a.standalone=!0,a.initialData.standaloneParent||Y.Logger.warn("instance.initialData: ",a.initialData),a.setStandaloneParent(p,null),a.hydrateAncestors(),a.initChildren(null),i&&(a.metaSync({...i},null),a.setValueAsType(i.valueAsType,null)),this.values[p.id]=a,this.onWriteCallback(p,a)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const i=this.project.get(p);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function Rr(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)}function Px(l){if(Array.isArray(l))return l.map(h=>typeof h=="number"?h:e(h)?Number(h):String(h));const p=[];let i=0,r="",a=!1,c=null;for(;i<l.length;){const h=l[i];if(h==="."&&!a){r.length&&(p.push(f(r)),r=""),i++;continue}if(h==="["&&!a){r.length&&(p.push(f(r)),r=""),a=!0,i++;continue}if(a){if(!c&&(h==='"'||h==="'")){c=h,i++;continue}if(c){if(h==="\\"&&i+1<l.length){r+=l[i+1],i+=2;continue}if(h===c){c=null,i++;continue}r+=h,i++;continue}if(h==="]"){p.push(f(r)),r="",a=!1,i++;continue}if(/\s/.test(h)&&!c){i++;continue}r+=h,i++;continue}r+=h,i++}return r.length&&p.push(f(r)),p;function e(h){return/^[0-9]+$/.test(h)}function f(h){const m=h.trim();return e(m)?Number(m):m}}function s1(l,p,i){if(l==null)return i;const r=Px(p);let a=l;for(let c=0;c<r.length;c++){const e=r[c];if(a==null)return i;if(Array.isArray(a)&&typeof e=="number"){if(!(e in a))return i;a=a[e]}else{if(!Object.prototype.hasOwnProperty.call(a,e))return i;a=a[e]}}return a}const NAi=new Set(["__proto__","prototype","constructor"]);function L_e(l){return typeof l=="string"&&NAi.has(l)}function xAi(l,p,i,r){const{createMissing:a=!0,coerce:c=!0}=r??{};if(l==null||typeof l!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=Px(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let f=l;for(let h=0;h<e.length;h++){const m=e[h];if(L_e(m))throw new Error(`Refusing to set unsafe key "${String(m)}" on object.`);const E=h===e.length-1,A=typeof e[h+1]=="number",_=Array.isArray(f)&&typeof m=="number";if(E){if(_&&f[m]==null&&!a)throw new Error(`set(...) missing array index "${String(m)}" (createMissing=false).`);return f[m]=i,l}else{if(!Object.prototype.hasOwnProperty.call(f,m)||f[m]==null){if(!a)throw new Error(`set(...) missing parent at segment "${String(m)}" (createMissing=false).`);f[m]=A?[]:{}}else{const N=f[m],P=N!==null&&typeof N=="object",j=Array.isArray(N);if(A){if(!j){if(!c)throw new Error(`set(...) expected an array at "${String(m)}" but found non-array (coerce=false).`);f[m]=[]}}else if(!P||j){if(!c)throw new Error(`set(...) expected an object at "${String(m)}" but found non-object (coerce=false).`);f[m]={}}}f=f[m]}}return l}function Nx(l,p,i,r){const a=Px(p);if(a.length===0)return l;function c(e,f){const h=a[f],m=f===a.length-1;if(r==="strict-set"||r==="strict-delete"){if(L_e(h))throw new Error(`Unsafe key "${String(h)}"`);if(e==null||typeof e!="object"&&!Array.isArray(e))throw new Error(`Missing parent or invalid container at segment "${String(h)}".`);if(r==="strict-delete"&&m&&!(h in e))return e}let E;if(Array.isArray(e))E=[...e];else if(e&&typeof e=="object")E={...e};else if(r==="safe-set")E=typeof h=="number"?[]:{};else throw new Error(`Cannot traverse path at "${String(h)}"`);if(m)return r==="strict-delete"?delete E[h]:E[h]=i,E;const b=e?e[h]:void 0;if(r==="safe-set"&&b==null){const A=typeof a[f+1]=="number",_=c(A?[]:{},f+1);return E[h]=_,E}return E[h]=c(b,f+1),E}if(l==null&&r==="safe-set"){const e=typeof a[0]=="number";return c(e?[]:{},0)}return c(l,0)}const Ck=Symbol("missing"),$Ai=l=>l!=null&&typeof l=="object";function l1(l,p){if(typeof l!="string")throw new TypeError(`${p} expects the key to be a string.`);return l}function wm(l,p){if(typeof l!="string"&&!Array.isArray(l))throw new TypeError(`${p} expects the path to be string or array.`);return l}function Sf(l,p){if(!Rr(l))throw new TypeError(`${p} expects the first argument to be an object.`);return l??{}}function B_e(l,p){const i=l1(p,"ReadKey");return(l??{})[i]}function M_e(l,p,i){const r=l1(p,"WriteKey");if(l&&typeof l=="object"){const a=Array.isArray(l)?[...l]:{...l};return a[r]=i,a}return{[r]:i}}function G_e(l,p){if(!l||typeof l!="object")return{};const i=String(p),{[i]:r,...a}=l;return a}function j_e(l,p,i){const r=Sf(l,"ReadNestedKey"),a=wm(p,"ReadNestedKey");return s1(r,a,i)}function k_e(l,p,i){const r=Sf(l,"WriteNestedKey"),a=wm(p,"WriteNestedKey");return Nx(r,a,i,"strict-set")}function U_e(l,p,i){const r=Sf(l,"WriteSafeNestedKeyRecursively"),a=wm(p,"WriteSafeNestedKeyRecursively");return Nx(r,a,i,"safe-set")}function F_e(l,p){const i=Sf(l,"DeleteNestedKey"),r=wm(p,"DeleteNestedKey");return Nx(i,r,null,"strict-delete")}function K_e(l,p){const i=l1(p,"HasKey"),r=l;return r!=null&&$Ai(r)&&Object.prototype.hasOwnProperty.call(r,i)}function q_e(l,p,i){const r=l1(p,"KeyValueEquals");return l==null||typeof l!="object"?!1:l[r]===i}function S_e(l,p){const i=l,r=wm(p,"HasNestedKey");return s1(i,r,Ck)!==Ck}function Z_e(l,p,i){const r=wm(p,"NestedKeyValueEquals");return s1(l,r)===i}function H_e(...l){const p={};for(let i=0;i<l.length;i++){const r=l[i];if(r!=null){if(!Rr(r))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,r)}}return p}function W_e(l){const p=Sf(l,"ObjectKeys");return Object.keys(p)}function z_e(l){const p=Sf(l,"ObjectValues");return Object.values(p)}function Y_e(l){const p=Sf(l,"ObjectEntries");return Object.entries(p)}function LAi(l){return{execution:null,project:l,localTestValues:IT("local-test-values",l),resolvedValues:IT("resolved-values",l),persistedExecutionResults:IT("persisted-execution-results",l),lastExecutionResults:IT("last-execution-results",l),getValueTypePreference:()=>null,setValueTypePreference:()=>{}}}function Vu(l,p,i,r){var f;let a;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:a=ye.EntityTemplate;break;case ye.String:a=ye.String;break;case ye.Number:a=ye.Number;break;case ye.Boolean:a=ye.Boolean;break;case ye.Null:a=ye.Null;break;case ye.Enum:a=ye.Enum;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Untyped:a=ye.Untyped;break;case ye.KeyValue:a=ye.KeyValue;break;case ye.Date:a=ye.Date;break;case ye.UUID:a=ye.UUID;break;case ye.File:a=ye.File;break;case ye.Void:a=ye.Void;break;case ye.ActionDescriptor:a=ye.ActionDescriptor;break;case ye.Bytes:a=ye.Bytes;break;default:throw new Error(`Primitive type ${le(l.entity,i)} is not supported`)}else a=ye.Untyped;const c=xr.new(r);c.name=a,c.parent=p.toReference();const e=Ae(c,i);return e.hydrateAncestors(),r==null||r.add(e,W.Added),e.addSelfToProject(r),e.initChildren(r),e}function id(l,p,i=new Set){var r,a,c;if(i.has(l.id))return[];if(i.add(l.id),xt.includes(l.type)){const e=Tr(l);return C([e,...[e].flatMap(f=>id(f,p,i))])}else if(l.type===d.OutputMap){if(xt.includes(l.parent.type)&&((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static)return C([l,l.declaration,...[l,l.declaration].flatMap(e=>id(e,p,i))])}else if(l.type===d.InputMap&&xt.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&&(c=l.declaration)!=null&&c.static)return C([l.declaration,...[l.declaration].flatMap(e=>id(e,p,i))]);return[l]}function J_e(l,p,i){return l}function Cm(l,p,i=!1){const r=l.readsValue;let a=null;const c=mf(r,p,i);if(c){const e={sources:[c],target:l};a={value:c.value,valueOwner:l,type:Me.Inherited,inheritanceLink:e}}return a}function Nt(l,p,i){var f;if(!p)return null;let r;if(((f=l==null?void 0:l.entity)==null?void 0:f.type)===d.PrimitiveEntity)switch(l.entity.name){case ye.EntityTemplate:r=ye.EntityTemplate;break;case ye.String:r=ye.String;break;case ye.Number:r=ye.Number;break;case ye.Boolean:r=ye.Boolean;break;case ye.Null:r=ye.Null;break;case ye.Enum:r=ye.Enum;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Untyped:r=ye.Untyped;break;case ye.KeyValue:r=ye.KeyValue;break;case ye.Date:r=ye.Date;break;case ye.UUID:r=ye.UUID;break;case ye.File:r=ye.File;break;case ye.Void:r=ye.Void;break;case ye.ActionDescriptor:r=ye.ActionDescriptor;break;case ye.Bytes:r=ye.Bytes;break;default:throw new Error(`Primitive type ${le(l.entity,i)} is not supported`)}else r=ye.Untyped;if(!i.get(p.id))return null;const c=xr.new(null);c.name=r,c.standaloneParent=p.toReference();let e=new xr(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p,null),e.initChildren(null),e}function Q_e(l,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(l)&&!i){const f=(c=p.lastExecutionResults)==null?void 0:c.readValue(l.id);if(f)return{value:f,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(e=p.localTestValues)==null?void 0:e.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}function QA(l,p,i,r=!1){var e,f;const a={...l},c=p.type===d.VariableDeclaration?p.inputs:At.includes(p.type)?p.outputs:[];if(!c||c.length===0)return a;for(const h of c){if(!qE(h))continue;const m=KT(h,i,r);if(m&&m.value){const E=le(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||Qi(E);a[b]=Ln((m==null?void 0:m.value)||null)?a[b]:(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function RT(l,p,i,r=!1){var e,f;const a={...l},c=p.inputs;if(!c)return a;for(const h of c){if(!qE(h))continue;const m=pE(h,i,r);if(m&&m.value){const E=le(h,i.project),b=h.codeName||((e=h.declaration)==null?void 0:e.codeName)||Qi(E);a[b]=(f=m==null?void 0:m.value)==null?void 0:f.value}}return a}function X_e(l,p,i=!1){var E,b,A,_,N,P,j,M;let r={};if(((b=(E=l.getDataType(null))==null?void 0:E.entity)==null?void 0:b.type)===d.DefinitionEntity&&(r={...r,...((A=l.getDataType(null))==null?void 0:A.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const G=(_=p.lastExecutionResults)==null?void 0:_.readValue(l.id);if(G){if(Rr(G.value)){const re={...r,...G.value},ee={...RT(re,l,p,i)};G.metaSync({value:ee},null)}return{value:G,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=!!((N=p.execution)!=null&&N.entities.length),c=(P=p.execution)==null?void 0:P.hasEntity(l),e=l.readsValue;let f=null;if(e){const G=(j=p.execution)==null?void 0:j.hasEntity(e);if((!a||a&&G&&c||a&&!G&&!c)&&(f=Cm(l,p,i),f&&f.value&&Rr(f.value.value))){const re={...r,...f.value.value},ee={...RT(re,l,p,i)};f.value.metaSync({value:ee},null)}}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const G=h;if(G&&G.value===null&&G.autogeneration){const q=sD(G);if(G.metaSync({value:q},null),Rr(q)){const re={...RT(q,l,p,i)};G.metaSync({value:re},null)}}(i||m===null||m!==Me.Testing)&&(f={value:G,valueOwner:l,type:Ln(G)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const G=(M=p.localTestValues)==null?void 0:M.readValue(l.id);if(G){if(Rr(G.value)){const q={...r,...G.value},re={...RT(q,l,p,i)};G.metaSync({value:re},null)}return{value:G,valueOwner:l,type:Me.Testing,inheritanceLink:null}}}return Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function xx(l,p,i=!1){var e,f,h,m,E,b,A,_,N;let r={};if(((f=(e=l.getDataType(null))==null?void 0:e.entity)==null?void 0:f.type)===d.DefinitionEntity&&(r={...r,...((h=l.getDataType(null))==null?void 0:h.entity).getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(l)&&!i){const P=(m=p.lastExecutionResults)==null?void 0:m.readValue(l.id);if(P){if(Rr(P.value)){const M={...r,...P.value},G=QA(M,l,p,i);P==null||P.metaSync({value:G},null)}return{value:P,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}}const a=(E=p.localTestValues)==null?void 0:E.readValue(l.id),c=p.getValueTypePreference(l.id);if(a&&!i&&(c===null||c!==Me.DefaultValue)){if(Rr(a.value)){const j={...r,...a.value},M=QA(j,l,p,i);a.metaSync({value:M},null)}return{value:a,valueOwner:l,type:Me.Testing,inheritanceLink:null}}if((b=l.getDataType(null))!=null&&b.entity&&((_=(A=l.getDataType(null))==null?void 0:A.entity)==null?void 0:_.type)===d.DefinitionEntity&&((N=l.getDataType(null))!=null&&N.isObject())){const P=Nt(l.dataType,l,p.project),j=QA(r,l,p,i);return P==null||P.metaSync({value:j},null),{value:P,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null}}return null}function uE(l,p,i=!1){var E,b,A,_,N;if((E=l.dataType)!=null&&E.isObject())return X_e(l,p,i);const r=yt(l),a=!!((b=p.execution)!=null&&b.entities.length),c=(A=p.execution)==null?void 0:A.hasEntity(r),e=l.readsValue;let f=null;if(e){const P=(_=p.execution)==null?void 0:_.hasEntity(e);(!a||a&&P&&c||a&&!P&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const P=h;if(P&&P.value===null&&P.autogeneration){const j=sD(P);P.metaSync({value:j},null)}(i||m===null||m!==Me.Testing)&&(f={value:P,valueOwner:l,type:Ln(P)?l.readsValue?Me.Inherited:Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const P=(N=p.localTestValues)==null?void 0:N.readValue(l.id);if(P)return{value:P,valueOwner:l,type:Me.Testing,inheritanceLink:null}}return Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function $x(l,p,i=!1){var e,f,h;if((e=l.dataType)!=null&&e.isObject())return xx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const m=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(m)return{value:m,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(h=p.localTestValues)==null?void 0:h.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:uE(l,p,i)}function Lx(l,p,i=!1){var A,_,N,P;const r=!!((A=p.execution)!=null&&A.entities.length),a=(_=p.execution)==null?void 0:_.hasEntity(l);let c=null;const e=l.readsValue;if(e){const j=(N=p.execution)==null?void 0:N.hasEntity(e);(!r||r&&j&&a||r&&!j&&!a)&&(c=Cm(l,p,i))}const f=l.declaration;if(!c&&f){const j=uE(f,p);j&&j.value&&(c=j)}const h=p.getValueTypePreference(l.id);if(!c||(c.type===Me.DefaultValue||c.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(P=p.localTestValues)==null?void 0:P.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=cd(l),E=l.getDataType(null);return m&&a&&(!(c!=null&&c.value)||!La(E)&&pd(c==null?void 0:c.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:a&&!m&&Ln((c==null?void 0:c.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:c||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function eVe(l,p,i=!1){return $x(l.declaration,p,i)}function tVe(l,p,i=!1){var A,_,N,P;if(!i&&p.execution&&p.execution.hasEntity(l)){const j=(A=p.lastExecutionResults)==null?void 0:A.readValue(l.id);if(j)return{value:j,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=yt(l),a=l.parent.type===d.FunctionDeclaration&&l.parent.parent.type===d.Loop?l.parent:null,c=!!((_=p.execution)!=null&&_.hasEntity(r))||!!a&&!!((N=p.execution)!=null&&N.hasEntity(a));let e=null;const f=l.defaultValue,h=p.getValueTypePreference(l.id);if(f){const j=f||null;if(j&&j.value===null&&j.autogeneration){const M=sD(j);j.metaSync({value:M},null)}(i||h===null||h!==Me.Testing)&&(e={value:j,valueOwner:l,type:Ln(j)?Me.Empty:Me.DefaultValue,inheritanceLink:null})}if(!e||(e.type===Me.DefaultValue||e.type===Me.External)&&!i||h===null||h!==Me.DefaultValue){const j=(P=p.localTestValues)==null?void 0:P.readValue(l.id),M=p.getValueTypePreference(l.id);if(j&&!i&&(M===null||M!==Me.DefaultValue))return{value:j,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const m=cd(l),E=l.getDataType(null);let b=m&&c&&(!(e!=null&&e.value)||!La(E)&&pd(e==null?void 0:e.value));return r.type===d.Loop&&c&&(b=!1),b?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:c&&!m&&Ln((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e||{value:null,valueOwner:l,type:Me.External,inheritanceLink:null}}function Bx(l,p,i=!1){var _,N,P,j,M,G;if((_=l.getDataType(null))!=null&&_.isObject())return xx(l,p);if(p.execution&&p.execution.hasEntity(l)&&!i){const q=(N=p.lastExecutionResults)==null?void 0:N.readValue(l.id);if(q)return{value:q,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=yt(l),a=!!((P=p.execution)!=null&&P.entities.length),c=(j=p.execution)==null?void 0:j.hasEntity(r),e=l.readsValue;let f=null;if(e){const q=(M=p.execution)==null?void 0:M.hasEntity(e);(!a||a&&q&&c||a&&!q&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h){const q=h;(i||m===null||m!==Me.Testing)&&(f={value:q,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null})}if(!f||(f.type===Me.DefaultValue||f.type===Me.External)&&!i||m===null||m!==Me.DefaultValue){const q=(G=p.localTestValues)==null?void 0:G.readValue(l.id);if(q)return{value:q,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=cd(l),b=l.getDataType(null);return E&&(!(f!=null&&f.value)||!La(b)&&pd(f==null?void 0:f.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:!E&&Ln((f==null?void 0:f.value)||null)?{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function iVe(l,p,i=!1){var f,h,m,E,b,A,_,N,P,j,M,G,q;if(p.execution&&p.execution.hasEntity(l)&&!i){const re=(f=p.lastExecutionResults)==null?void 0:f.readValue(l.id);if(re)return{value:re,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=Op(l);if(cp.includes(r.type)){const re=mf(r,p,i),ee=l.codeName||((h=l.declaration)==null?void 0:h.codeName)||Qi(le(l,p.project));if(re!=null&&re.value&&Rr(re.value.value)){const de=re.value.value[ee],ie=Nt(l.getDataType(null),l,p.project);return ie==null||ie.metaSync({value:de},null),{value:ie,valueOwner:l,type:!xt.includes(r.type)&&re.type===Me.Empty?Me.QueuedAutocalculation:re.type,inheritanceLink:{sources:[re],target:l}}}return{value:null,valueOwner:l,type:xt.includes(r.type)?Me.Empty:Me.QueuedAutocalculation,inheritanceLink:null}}const a=(m=p.execution)==null?void 0:m.hasEntity(r),c=((E=p.execution)==null?void 0:E.state)===Qx.Running;if((b=p.persistedExecutionResults)!=null&&b.values[l.id]&&!a&&!c&&!i){const re=(A=p.persistedExecutionResults)==null?void 0:A.readValue(l.id);if((re==null?void 0:re.value)!==null||(re==null?void 0:re.valueAsType)!==null)return{value:re,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const e=l.parent;if(!e)throw new Error(`Couldn't find the parent that generates the output ${l.id}`);switch(e.type){case d.VariableInstance:{const ee=Lx(e,p,i);if(ee&&ee.value){const ie=l.declaration;if(Rr(ee.value.value)){const se=ee.value.value[ie.name],ue=Nt(((_=l.declaration)==null?void 0:_.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:se},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const de=Nt(((N=l.declaration)==null?void 0:N.dataType)||null,l,p.project);return de==null||de.metaSync({value:null},null),{value:de,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.VariableDeclaration:{const ee=uE(e,p,i);if(ee&&ee.value){const ie=l.declaration;if(Rr(ee.value.value)){const se=ee.value.value[ie.name],ue=Nt(((P=l.declaration)==null?void 0:P.dataType)||null,l,p.project);return ue==null||ue.metaSync({value:se},null),{value:ue,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:[ee],target:l}}}}const de=Nt(((j=l.declaration)==null?void 0:j.dataType)||null,l,p.project);return de==null||de.metaSync({value:null},null),{value:de,valueOwner:l,type:Me.Inherited,inheritanceLink:{sources:ee?[ee]:[],target:l}}}case d.Operation:{const re=e.outputs.map(de=>{var ie,se;if((ie=p.persistedExecutionResults)!=null&&ie.values[de.id]){const ue=(se=p.persistedExecutionResults)==null?void 0:se.values[de.id];if(ue.value!==null||ue.valueAsType!==null)return{value:ue,valueOwner:de,type:Me.ExecutionResult,inheritanceLink:null}}}).filter(de=>!!de),ee=Nt(((M=l.declaration)==null?void 0:M.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.FunctionCall:{const re=e.inputs.map(de=>AI(de,p,i)).filter(de=>!!de),ee=Nt(((G=l.declaration)==null?void 0:G.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.Loop:{const re=e.inputs.map(de=>AI(de,p,i)).filter(de=>!!de),ee=Nt(((q=l.declaration)==null?void 0:q.dataType)||null,l,p.project);return ee==null||ee.metaSync({value:null},null),{value:ee,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:re.length?{sources:re,target:l}:null}}case d.Search:return{value:null,valueOwner:l,type:Me.QueuedAutocalculation,inheritanceLink:null}}return null}function R_(l,p,i=!1){var b,A,_;if(![...At,...xt].includes(l.parent.type)||!qE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return mf(l.declaration,p);const r=pE(l,p,i);if(r&&r.type!==Me.Empty&&r.type!==Me.Missing)return r;const a=Tr(l.parent),c=Yo(a,p,i),e=l.codeName||((A=l.declaration)==null?void 0:A.codeName)||Qi(le(l,p.project)),f=Nt(l.getDataType(null),l,p.project),h=cd(l),m=(_=c==null?void 0:c.value)==null?void 0:_.value;if(m&&Rr(m)){let N=m[e];m[e]===void 0&&(N=null),f==null||f.metaSync({value:N},null);const P=cd(l),j=l.getDataType(null);return P&&(!f||!La(j)&&pd(f))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:f,valueOwner:l,type:c.type,inheritanceLink:{sources:c?[c]:[],target:l}}}return h?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:null,valueOwner:l,type:l.readsValue?Me.Inherited:Me.Empty,inheritanceLink:null}}function D_(l,p,i=!1){var b,A,_,N,P,j,M,G;if(![...At,...xt].includes(l.parent.type)||!qE(l))return null;if(((b=l.declaration)==null?void 0:b.type)===d.Property&&l.declaration.static)return mf(l.declaration,p,i);const r=At.includes(l.parent.type)?l.parent:Tr(l.parent),a=mf(r,p,i);let c=l;r.type===d.VariableDeclaration&&(c=(l.parent===r?l:r.inputs.find(re=>{var ee,de;return((ee=re.declaration)==null?void 0:ee.id)===((de=l.declaration)==null?void 0:de.id)}))||l);const e=KT(c,p,i),f=l.codeName||((A=l.declaration)==null?void 0:A.codeName)||Qi(le(l,p.project)),h=(r.type===d.VariableDeclaration,l.defaultValue||Nt(l.getDataType(null),l,p.project)),m=(_=a==null?void 0:a.value)==null?void 0:_.value;if(((a==null?void 0:a.type)===Me.ExecutionResult||(a==null?void 0:a.type)===Me.Testing)&&!i&&m&&Rr(m)){let q=m[f];return m[f]===void 0&&(q=null),h==null||h.metaSync({value:q},null),{value:h,valueOwner:l,type:a.type,inheritanceLink:{sources:a?[a]:[],target:l}}}if(e&&e.type!==Me.Empty&&e.type!==Me.Missing)return e;if(m&&Rr(m)){let q=m[f];m[f]===void 0&&(q=null),h!=null&&h.standaloneParent&&(h==null||h.metaSync({value:q},null));const re=cd(l),ee=l.getDataType(null),de=re&&(!h||!La(ee)&&pd(h)),ie=!!((N=p.execution)!=null&&N.entities.length),se=(P=p.execution)==null?void 0:P.hasEntity(r),ue=r.readsValue;if(ue){const z=(j=p.execution)==null?void 0:j.hasEntity(ue);if(de&&(!ie||ie&&z&&se||ie&&!z&&!se))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}if(l.readsValue){const z=(M=p.execution)==null?void 0:M.hasEntity(l.readsValue);if(de&&(!ie||ie&&z&&se||ie&&!z&&!se))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return de?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:{value:h,valueOwner:l,type:((G=h==null?void 0:h.parent)==null?void 0:G.id)===(l==null?void 0:l.id)?a.type:Me.Inherited,inheritanceLink:{sources:a?[a]:[],target:l}}}return KT(l,p,i)}function pE(l,p,i=!1){var _,N,P,j,M,G;const r=yt(l),a=!!((_=p.execution)!=null&&_.entities.length),c=(N=p.execution)==null?void 0:N.hasEntity(r),e=l.readsValue;let f=null;if(e){const q=(P=p.execution)==null?void 0:P.hasEntity(e);(!a||a&&q&&c||a&&!q&&!c)&&(f=Cm(l,p,i))}const h=l.defaultValue,m=p.getValueTypePreference(l.id);if(!f&&h&&(i||m===null||m!==Me.Testing)&&(f={value:h,valueOwner:l,type:pd(h)?Me.Empty:Me.DefaultValue,inheritanceLink:null}),!f||f.type===Me.DefaultValue||(f==null?void 0:f.type)===Me.Empty){const q=(j=p.persistedExecutionResults)==null?void 0:j.readValue(l.id);if(q&&!i)return{value:q,valueOwner:l,type:Me.Testing,inheritanceLink:null};const re=(M=p.localTestValues)==null?void 0:M.readValue(l.id);if(re&&!i&&(m===null||m!==Me.DefaultValue))return{value:re,valueOwner:l,type:Me.Testing,inheritanceLink:null}}const E=cd(l),b=l.getDataType(null),A=E&&(!(f!=null&&f.value)||!La(b)&&pd(f==null?void 0:f.value));if(l.readsValue){const q=(G=p.execution)==null?void 0:G.hasEntity(l.readsValue);if(A&&(!a||a&&q&&c||a&&!q&&!c))return{value:null,valueOwner:l,type:Me.Inherited,inheritanceLink:null}}return A?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:(f==null?void 0:f.inheritanceLink)||null}:!E&&(!f||f.type===Me.Inherited)&&!(f!=null&&f.inheritanceLink)?{value:null,valueOwner:l,type:l.readsValue||!(f!=null&&f.value)?Me.Inherited:Me.Empty,inheritanceLink:null}:f}function KT(l,p,i=!1){var e,f;if(p.execution&&p.execution.hasEntity(l)&&!i){const h=(e=p.lastExecutionResults)==null?void 0:e.readValue(l.id);if(h)return{value:h,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(f=p.localTestValues)==null?void 0:f.readValue(l.id),a=p.getValueTypePreference(l.id);return r&&!i&&(a===null||a!==Me.DefaultValue)?{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null}:pE(l,p,i)}function AI(l,p,i=!1){var r,a;return xt.includes(l.parent.type)&&(r=Tr(l.parent).dataType)!=null&&r.isObject()||At.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?R_(l,p,i):pE(l,p,i)}function rVe(l,p,i=!1){var r,a;return xt.includes(l.parent.type)&&(r=Tr(l.parent).dataType)!=null&&r.isObject()||At.includes(l.parent.type)&&(a=l.parent.getDataType(null))!=null&&a.isObject()?D_(l,p,i):KT(l,p,i)}function nVe(l,p,i=!1){var E,b;if(!l.static)return null;if(p.execution){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(A&&!i)return{value:A,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=cd(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!La(h)&&pd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Ln(e==null?void 0:e.value)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function aVe(l,p,i=!1){var E,b;if(p.execution&&p.execution.hasEntity(l)&&!i){const A=(E=p.lastExecutionResults)==null?void 0:E.readValue(l.id);if(A)return{value:A,valueOwner:l,type:Me.ExecutionResult,inheritanceLink:null}}const r=(b=p.localTestValues)==null?void 0:b.readValue(l.id),a=p.getValueTypePreference(l.id);if(r&&!i&&(a===null||a!==Me.DefaultValue))return{value:r,valueOwner:l,type:Me.Testing,inheritanceLink:null};const c=l.defaultValue;let e=null;c&&(i||a===null||a!==Me.Testing)&&(e={value:c,valueOwner:l,type:Me.DefaultValue,inheritanceLink:null});const f=cd(l),h=l.getDataType(null);return f&&(!(e!=null&&e.value)||!La(h)&&pd(e==null?void 0:e.value))?{value:null,valueOwner:l,type:Me.Missing,inheritanceLink:null}:Ln((e==null?void 0:e.value)||null)?{value:null,valueOwner:l,type:Me.Empty,inheritanceLink:null}:e}function mf(l,p,i=!1){switch(l.type){case d.ArgumentDeclaration:return tVe(l,p,i);case d.InputMap:return rVe(l,p,i);case d.VariableDeclaration:return $x(l,p,i);case d.VariableInstance:return eVe(l,p,i);case d.OutputMap:return iVe(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return Bx(l,p,i);case d.Property:return nVe(l,p,i);case d.ValueDescriptor:return aVe(l,p,i);case d.Operation:case d.FunctionCall:case d.InternalCall:case d.Search:return Q_e(l,p,i);default:return null}}function Yo(l,p,i=!1){switch(l.type){case d.InputMap:return AI(l,p,i);case d.VariableDeclaration:return uE(l,p,i);case d.VariableInstance:return Lx(l,p,i);case d.ReturnStatement:case d.BreakStatement:case d.ContinueStatement:return Bx(l,p,i);default:return null}}function BAi(l){var p;if(l&&l.type===Me.DefaultValue&&l.value&&l.valueOwner&&(!ig.includes(l.valueOwner.type)||((p=l.valueOwner.defaultValue)==null?void 0:p.id)===l.value.id)){const i=Nt(l.valueOwner.getDataType(null),l.valueOwner,l.valueOwner.project);return{type:Me.DefaultValue,value:i,valueOwner:l.valueOwner,inheritanceLink:null}}return l}function cf(l,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,N,P,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let M=a?m.defaultValue:e==null?void 0:e.readValue(m.id);M?!a&&M&&M.id===((A=m.defaultValue)==null?void 0:A.id)&&(M=Nt(m.getDataType(null),m,p)):a?M=Vu(m.getDataType(null),m,p,c):M=Nt(m.getDataType(null),m,p);const G=le(l,p),q=l.codeName||((_=l.extends)==null?void 0:_.codeName)||((N=l.implements[0])==null?void 0:N.codeName)||Qi(G);let re={};((j=(P=m.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(re={...re,...m.dataType.entity.getActiveRawDefaultValue()}),Rr(M==null?void 0:M.value)&&(re={...re,...M.value}),re[q]=i,M==null||M.metaSync({value:re},c),a||e==null||e.writeValue(m,M);return}}),c}function qT(l,p,i,r){var _,N,P,j;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Tr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=Nt(f.getDataType(null),f,p)):a?m=Vu(f.getDataType(null),f,p,c):m=Nt(f.getDataType(null),f,p);const E=le(l,p),b=l.codeName||((N=l.declaration)==null?void 0:N.codeName)||Qi(E);let A={};if(((j=(P=f.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),Rr(m==null?void 0:m.value)&&(A={...A,...m.value}),A[b]=i,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),(i===""||i===null||i===void 0)&&l.type===d.OutputMap){const M=f.inputs.find(G=>{var q,re;return((q=G.declaration)==null?void 0:q.id)===((re=l.declaration)==null?void 0:re.id)||le(G,p)===E});if(M){let G=a?M.defaultValue:e==null?void 0:e.readValue(M.id);G&&G.metaSync({value:null},c),a||e==null||e.removeValue(M.id)}}return c}function sVe(l,p,i){var e,f,h,m,E;let r=!1,a=null,c=null;if(i instanceof S?(r=!0,a=i,c=null):(a=null,c=i),xt.includes(l.type)){const b=Tr(l);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(A=>{var _,N,P,j,M,G;if(((_=A.declaration)==null?void 0:_.type)===d.Property&&A.declaration.static){let q=r?((N=A.getDefaultValue)==null?void 0:N.call(A))||null:c==null?void 0:c.readValue(A.declaration.id);q?!r&&q&&q.id===((P=A.declaration.defaultValue)==null?void 0:P.id)&&(q=Nt(A.declaration.getDataType(null),A.declaration,p)):r?q=Vu(A.declaration.getDataType(null),A.declaration,p,a):q=Nt(A.declaration.getDataType(null),A.declaration,p),q==null||q.metaSync({value:null},a),r||c==null||c.removeValue((j=A.declaration)==null?void 0:j.id)}else if(((M=A.declaration)==null?void 0:M.type)===d.Property){let q=r?((G=A.getDefaultValue)==null?void 0:G.call(A))||null:c==null?void 0:c.readValue(A.id);q&&q.metaSync({value:null},a),r||c==null||c.removeValue(A.id)}})}else l.type===d.InputMap?((f=l.declaration)==null?void 0:f.type)===d.Property&&l.declaration.static?cf(l.declaration,p,null,i):xt.includes(l.parent.type)&&((h=l.declaration)==null?void 0:h.type)===d.Property&&qT(l,p,null,i):l.type===d.OutputMap?((m=l.declaration)==null?void 0:m.type)===d.Property&&l.declaration.static?cf(l.declaration,p,null,i):xt.includes(l.parent.type)&&((E=l.declaration)==null?void 0:E.type)===d.Property&&qT(l,p,null,i):l.type===d.Property&&l.static&&cf(l,p,null,i);return a}function lVe(l,p,i,r){var f,h,m,E,b,A,_;let a=!1,c=null,e=null;if(r instanceof S?(a=!0,c=r,e=null):(c=null,e=r),xt.includes(p.type)){const N=Tr(p);if((f=N.dataType)!=null&&f.isObject()){let P={};((m=(h=N.dataType)==null?void 0:h.entity)==null?void 0:m.type)===d.DefinitionEntity&&(P={...P,...N.dataType.entity.getActiveRawDefaultValue()});const j=Rr(l)?l:P;N.inputs.forEach(M=>{var G,q,re,ee,de,ie;if(((G=M.declaration)==null?void 0:G.type)===d.Property&&M.declaration.static){let se=a?((q=p.getDefaultValue)==null?void 0:q.call(p))||null:e==null?void 0:e.readValue(M.declaration.id);se?!a&&se&&se.id===((re=M.declaration.defaultValue)==null?void 0:re.id)&&(se=Nt(M.declaration.getDataType(null),M.declaration,i)):a?se=Vu(M.declaration.getDataType(null),M.declaration,i,c):se=Nt(M.declaration.getDataType(null),M.declaration,i);const ue=le(M,i),z=M.codeName||((ee=M.declaration)==null?void 0:ee.codeName)||Qi(ue),X=j[z];se==null||se.metaSync({value:X},c),a||e==null||e.writeValue(M.declaration,se)}else if(((de=M.declaration)==null?void 0:de.type)===d.Property){let se=a?((ie=p.getDefaultValue)==null?void 0:ie.call(p))||null:e==null?void 0:e.readValue(M.id);se&&se.metaSync({value:null},c),a||e==null||e.removeValue(M.id)}})}}else p.type===d.InputMap?((E=p.declaration)==null?void 0:E.type)===d.Property&&p.declaration.static?cf(p.declaration,i,l,r):xt.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===d.Property&&qT(p,i,l,r):p.type===d.OutputMap?((A=p.declaration)==null?void 0:A.type)===d.Property&&p.declaration.static?cf(p.declaration,i,null,r):xt.includes(p.parent.type)&&((_=p.declaration)==null?void 0:_.type)===d.Property&&qT(p,i,null,r):p.type===d.Property&&p.static&&cf(p,i,l,r);return c}function MAi(l,p,i){const r=id(l,p);let a=!1,c=null,e=null;return i instanceof S?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?((m=f.getDefaultValue)==null?void 0:m.call(f))||null:e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),sVe(f,p,i)}),c}function GAi(l,p,i,r){const a=id(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),i.diggestedBuiltInBaseEntitiesIds.has(p.id)||a.forEach(h=>{var E,b,A,_;if(i.diggestedBuiltInBaseEntitiesIds.has(h.id))return;let m=null;if(c){const N=((E=h.getDefaultValue)==null?void 0:E.call(h))||null;N&&(i.diggestedBuiltInBaseEntitiesIds.has(N.id)||((b=N.parent)==null?void 0:b.id)!==h.id?m=N.clone(e,h):m=N)}else m=f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((_=(A=h.getDefaultValue)==null?void 0:A.call(h))==null?void 0:_.id)&&(m=Nt(h.getDataType(null),h,i)):c?(m=Vu(h.getDataType(null),h,i,e),e==null||e.add(m,W.Added)):m=Nt(h.getDataType(null),h,i),m==null||m.setValueAsType(null,e),m==null||m.metaSync({value:l},e),c||f==null||f.writeValue(h,m),lVe(l,h,i,r)}),e}function ff(l,p,i,r){let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=l.parent;return p.getVariableDeclarations().forEach(m=>{var b,A,_,N,P,j;const E=m.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===f.id){let M=a?m.defaultValue:e==null?void 0:e.readValue(m.id);M?!a&&M&&M.id===((A=m.defaultValue)==null?void 0:A.id)&&(M=Nt(m.getDataType(null),m,p)):a?M=Vu(m.getDataType(null),m,p,c):M=Nt(m.getDataType(null),m,p);const G=le(l,p),q=l.codeName||((_=l.extends)==null?void 0:_.codeName)||((N=l.implements[0])==null?void 0:N.codeName)||Qi(G);let re={};((j=(P=m.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(re={...re,...m.dataType.entity.getActiveRawDefaultValue()}),Rr(M==null?void 0:M.value)&&(re={...re,...M.value}),Array.isArray(i)?re[q]=(i==null?void 0:i.map(ee=>ee.toShallowJSON()))||null:re[q]=(i==null?void 0:i.toShallowJSON())||null,M==null||M.metaSync({value:re},c),a||e==null||e.writeValue(m,M);return}}),c}function ST(l,p,i,r){var _,N,P,j;let a=!1,c=null,e=null;r instanceof S?(a=!0,c=r,e=null):(c=null,e=r);const f=Tr(l.parent),h=f.getDataType(null);if(!(h!=null&&h.isObject()))return c;let m=a?f.defaultValue:e==null?void 0:e.readValue(f.id);m?!a&&m&&m.id===((_=f.defaultValue)==null?void 0:_.id)&&(m=Nt(f.getDataType(null),f,p)):a?m=Vu(f.getDataType(null),f,p,c):m=Nt(f.getDataType(null),f,p);const E=le(l,p),b=l.codeName||((N=l.declaration)==null?void 0:N.codeName)||Qi(E);let A={};if(((j=(P=f.dataType)==null?void 0:P.entity)==null?void 0:j.type)===d.DefinitionEntity&&(A={...A,...f.dataType.entity.getActiveRawDefaultValue()}),Rr(m==null?void 0:m.value)&&(A={...A,...m.value}),Array.isArray(i)?A[b]=(i==null?void 0:i.map(M=>M.toShallowJSON()))||null:A[b]=(i==null?void 0:i.toShallowJSON())||null,m==null||m.metaSync({value:A},c),a||e==null||e.writeValue(f,m),i==null&&l.type===d.OutputMap){const M=f.inputs.find(G=>{var q,re;return((q=G.declaration)==null?void 0:q.id)===((re=l.declaration)==null?void 0:re.id)||le(G,p)===E});if(M){let G=a?M.defaultValue:e==null?void 0:e.readValue(M.id);G&&(Array.isArray(i)?G==null||G.setValueAsTypeList(i,c):G==null||G.setValueAsTypeSingle(i,c)),a||e==null||e.removeValue(M.id)}}return c}function oVe(l,p,i){var r,a,c,e;return l.type===d.InputMap?((r=l.declaration)==null?void 0:r.type)===d.Property&&l.declaration.static?ff(l.declaration,p,null,i):xt.includes(l.parent.type)&&((a=l.declaration)==null?void 0:a.type)===d.Property&&ST(l,p,null,i):l.type===d.OutputMap?((c=l.declaration)==null?void 0:c.type)===d.Property&&l.declaration.static?ff(l.declaration,p,null,i):xt.includes(l.parent.type)&&((e=l.declaration)==null?void 0:e.type)===d.Property&&ST(l,p,null,i):l.type===d.Property&&l.static&&ff(l,p,null,i),i}function dVe(l,p,i,r){var a,c,e,f;return p.type===d.InputMap?((a=p.declaration)==null?void 0:a.type)===d.Property&&p.declaration.static?ff(p.declaration,i,l,r):xt.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===d.Property&&ST(p,i,l,r):p.type===d.OutputMap?((e=p.declaration)==null?void 0:e.type)===d.Property&&p.declaration.static?ff(p.declaration,i,null,r):xt.includes(p.parent.type)&&((f=p.declaration)==null?void 0:f.type)===d.Property&&ST(p,i,null,r):p.type===d.Property&&p.static&&ff(p,i,l,r),r}function jAi(l,p,i){const r=id(l,p);let a=!1,c=null,e=null;return i instanceof S?(a=!0,c=i,e=null):(c=null,e=i),r.forEach(f=>{var m;let h=a?(m=f.getDefaultValue)==null?void 0:m.call(f):e==null?void 0:e.readValue(f.id);a?h==null||h.remove({ignoreUpstream:!1},c):e==null||e.removeValue(f.id),oVe(f,p,i)}),c}function kAi(l,p,i,r){const a=id(p,i);let c=!1,e=null,f=null;return r instanceof S?(c=!0,e=r,f=null):(e=null,f=r),a.forEach(h=>{var E,b,A;let m=c?(E=h.getDefaultValue)==null?void 0:E.call(h):f==null?void 0:f.readValue(h.id);m?!c&&m&&m.id===((A=(b=h.getDefaultValue)==null?void 0:b.call(h))==null?void 0:A.id)&&(m=Nt(h.getDataType(null),h,h.project)):c?m=Vu(h.getDataType(null),h,i,e):m=Nt(h.getDataType(null),h,i),Array.isArray(l)?m==null||m.setValueAsTypeList(l,e):m==null||m.setValueAsTypeSingle(l,e),m==null||m.metaSync({value:null},e),c||f==null||f.writeValue(h,m),dVe(l,h,i,r)}),e}class o1{constructor(p,i){this.extensionsRegistry=p,this.contextType=i,this.off=this.extensionsRegistry.off.bind(this.extensionsRegistry),this.on=this.extensionsRegistry.on.bind(this.extensionsRegistry),this.emit=this.extensionsRegistry.emit.bind(this.extensionsRegistry),this.emitAsync=this.extensionsRegistry.emitAsync.bind(this.extensionsRegistry),this.emitAsyncAll=this.extensionsRegistry.emitAsyncAll.bind(this.extensionsRegistry),this.emitAsyncAllSettled=this.extensionsRegistry.emitAsyncAllSettled.bind(this.extensionsRegistry),this.emitAsyncSequentially=this.extensionsRegistry.emitAsyncSequentially.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAll=this.extensionsRegistry.emitAsyncSequentiallyAll.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAllSettled=this.extensionsRegistry.emitAsyncSequentiallyAllSettled.bind(this.extensionsRegistry)}on(p,i){this.extensionsRegistry.on(p,i)}emit(p,...i){this.extensionsRegistry.emit(p,...i)}off(p,i){this.extensionsRegistry.off(p,i)}emitAsync(p,...i){return this.extensionsRegistry.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.extensionsRegistry.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.extensionsRegistry.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.extensionsRegistry.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...i)}}var Oe=(l=>(l[l.High=1]="High",l[l.Normal=5]="Normal",l[l.Low=10]="Low",l))(Oe||{}),ae=(l=>(l.Logic="logic",l.EditorGUI="editor-gui",l.GUI="gui",l.Editor="editor",l.Compile="compile",l.PublicationRun="publication-run",l))(ae||{}),_e=(l=>(l.All="*",l.OnAll="on:*",l.EmitAll="emit:*",l.ReadAll="read:*",l.WriteAll="write:*",l.UpdateAll="update:*",l.DoAll="do:*",l.OnLogicAll="on:logic:*",l.EmitLogicAll="emit:logic:*",l.ReadLogicAll="read:logic:*",l.WriteLogicAll="write:logic:*",l.UpdateLogicAll="update:logic:*",l.DoLogicAll="do:logic:*",l.OnGUIAll="on:gui:*",l.EmitGUIAll="emit:gui:*",l.ReadGUIAll="read:gui:*",l.WriteGUIAll="write:gui:*",l.UpdateGUIAll="update:gui:*",l.DoGUIAll="do:gui:*",l.OnEditorAll="on:editor:*",l.EmitEditorAll="emit:editor:*",l.ReadEditorAll="read:editor:*",l.WriteEditorAll="write:editor:*",l.UpdateEditorAll="update:editor:*",l.DoEditorAll="do:editor:*",l.OnCompileBefore="on:compile:before:DefinitionEntity",l.OnCompileDefault="on:compile:default:DefinitionEntity",l.OnCompileAfter="on:compile:after:DefinitionEntity",l.EmitCompile="emit:compile:DefinitionEntity",l.DoEditorPublish="do:editor:publish",l.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",l.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",l.UpdateGUIGlobalTheme="update:gui:global:theme",l))(_e||{});class uVe{constructor(p){R(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,i){this.state.set(p,i)}delete(p){this.state.delete(p)}}class pVe extends uVe{constructor(p,i){super(i),this.parentExtension=p}}class Pe{constructor(p,i){R(this,"manifest");R(this,"module");R(this,"state");this.extensionsRegistry=p,this.state=new pVe(this,i)}}class w_ extends o1{constructor(i,r){super(i,ae.Logic);R(this,"id");this._project=r,this.id=r.id}get type(){return this._project.type}get name(){return this._project.name}get description(){return this._project.description}get version(){return this._project.version}get createdAt(){return this._project.createdAt}get previousVersion(){return this._project.previousVersion}get author(){return this._project.author}get deleted(){return this._project.deleted}get editable(){return this._project.editable}get deletable(){return this._project.deletable}get entities(){return[...this._project.entities]}get projects(){return[...this._project.projects]}get functions(){return[...this._project.functions]}get events(){return[...this._project.events]}get variableDeclarations(){return[...this._project.variableDeclarations]}get variableInstances(){return[...this._project.variableInstances]}get conditions(){return[...this._project.conditions]}get operations(){return[...this._project.operations]}get functionCalls(){return[...this._project.functionCalls]}get loops(){return[...this._project.loops]}get searches(){return[...this._project.searches]}get primitives(){return[...this._project.primitives]}get builtInBaseEntities(){return[...this._project.builtInBaseEntities]}get operationDeclarations(){return[...this._project.operationDeclarations]}get globalEventActionDescriptors(){return[...this._project.globalEventActionDescriptors]}get loopDeclarations(){return[...this._project.loopDeclarations]}get loopDeclarationsBodies(){return[...this._project.loopDeclarationsBodies]}get conditionDeclarations(){return[...this._project.conditionDeclarations]}get valueDescriptors(){return[...this._project.valueDescriptors]}get dataTypes(){return[...this._project.dataTypes]}get errors(){return[...this._project.errors]}get history(){return[...this._project.history]}get undoableStackValueIndex(){return this._project.undoableStackValueIndex}get knownVersions(){return this._project.knownVersions}get activeVersion(){return this._project.activeVersion}get initialized(){return this._project.initialized}get startedInitialization(){return this._project.startedInitialization}closePersistChangeSetsSequentially(){return this._project.closePersistChangeSetsSequentially()}persistChangeSetSequentially(i){return this._project.persistChangeSetSequentially(i)}toLatestChangeSet(i,r,a,c=!1,e="here-this"){return this._project.toLatestChangeSet(i,r,a,c,e)}addChangeSet(i){return this._project.addChangeSet(i)}discardChangeSet(i){return this._project.discardChangeSet(i)}subscribeDependents(i){return this._project.subscribeDependents(i)}unsubscribeDependents(i){return this._project.unsubscribeDependents(i)}syncDependents(i){return this._project.syncDependents(i)}onDetachedDependencyRemoved(i,r,a){return this._project.onDetachedDependencyRemoved(i,r,a)}onDetachedDependencyRestored(i,r,a){return this._project.onDetachedDependencyRestored(i,r,a)}increaseVersion(i){return this._project.increaseVersion(i)}captureVersion(){return this._project.captureVersion()}restoreVersion(i){return this._project.restoreVersion(i)}updateWithShallowTransfer(i,r){return this._project.updateWithShallowTransfer(i,r)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(i=null){return this._project.afterAllChildrenInitialized(i)}addSelfToProject(i){return this._project.addSelfToProject(i)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(i){return this._project.isOperationDeclaration(i)}isGlobalEventActionDescriptor(i){return this._project.isGlobalEventActionDescriptor(i)}isLoopDeclaration(i){return this._project.isLoopDeclaration(i)}isConditionDeclaration(i){return this._project.isConditionDeclaration(i)}findSubscribedBuiltInInstance(i){return this._project.findSubscribedBuiltInInstance(i)}get(i){return this._project.get(i)}getDeleted(i){return this._project.getDeleted(i)}getManaged(i){return this._project.getManaged(i)}getBuiltIn(i){return this._project.getBuiltIn(i)}findSubscribedInstanceFromReference(i){return this._project.findSubscribedInstanceFromReference(i)}findSubscribedBuiltInInstanceFromReference(i){return this._project.findSubscribedBuiltInInstanceFromReference(i)}metaSync(i,r){return this._project.metaSync(i,r)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(i){return this._project.toFlat(i)}toFlatIds(i){return this._project.toFlatIds(i)}toMeta(){return this._project.toMeta()}toJSON(i){return this._project.toJSON(i)}toJSONClone(i){return this._project.toJSONClone(i)}toReference(i){return this._project.toReference(i)}toShallowJSON(i){return this._project.toShallowJSON(i)}toFlatJSON(i){return this._project.toFlatJSON(i)}toGenerationTarget(i){return this._project.toGenerationTarget(i)}toFlatGenerationTarget(i){return this._project.toFlatGenerationTarget(i)}clearErrors(){return this._project.clearErrors()}validate(){return this._project.validate()}validateChildren(){return this._project.validateChildren()}getErrors(){return this._project.getErrors()}getShallowErrors(){return this._project.getShallowErrors()}addDefinitionEntity(i){return this._project.addDefinitionEntity(i)}addFunctionDeclaration(i){return this._project.addFunctionDeclaration(i)}addFunctionCall(i){return this._project.addFunctionCall(i)}addVariableDeclaration(i){return this._project.addVariableDeclaration(i)}addVariableInstance(i){return this._project.addVariableInstance(i)}addInstalledProject(i){return this._project.addInstalledProject(i)}addGlobalEvent(i){return this._project.addGlobalEvent(i)}addCondition(i){return this._project.addCondition(i)}addOperation(i){return this._project.addOperation(i)}addLoop(i){return this._project.addLoop(i)}addSearch(i){return this._project.addSearch(i)}removeDefinitionEntity(i){return this._project.removeDefinitionEntity(i)}removeCondition(i){return this._project.removeCondition(i)}removeOperation(i){return this._project.removeOperation(i)}removeLoop(i){return this._project.removeLoop(i)}removeSearch(i){return this._project.removeSearch(i)}removeFunctionCall(i){return this._project.removeFunctionCall(i)}removeVariableInstance(i){return this._project.removeVariableInstance(i)}removeVariableDeclaration(i){return this._project.removeVariableDeclaration(i)}removeFunctionDeclaration(i){return this._project.removeFunctionDeclaration(i)}removeInstalledProject(i){return this._project.removeInstalledProject(i)}removeGlobalEvent(i){return this._project.removeGlobalEvent(i)}removeTopLevelVariableDeclaration(i){return this._project.removeTopLevelVariableDeclaration(i)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(i){return this._project.getFunctionDeclaration(i)}getConditions(){return this._project.getConditions()}getOperations(){return this._project.getOperations()}getVariables(){return this._project.getVariables()}getVariableInstances(){return this._project.getVariableInstances()}getVariableDeclarations(){return this._project.getVariableDeclarations()}getLoops(){return this._project.getLoops()}getSearches(){return this._project.getSearches()}getBuiltInPersistedEntity(){return this._project.getBuiltInPersistedEntity()}requestActiveDynamicValue(i,r=!1){return this._project.requestActiveDynamicValue(i,r)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(i){return this._project.applyExternalChangeSet(i)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function UAi(l,p){return p instanceof w_?p:new w_(l,p)}const eh="built-in-function-implementations__",$e="operations-implementations__",es="conditions-implementations__",Ve={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:eh+Nr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:eh+Nr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:eh+Nr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:eh+Nr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:$e+Ut.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:$e+Ut.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:$e+Ut.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:$e+Ut.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:$e+da.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:$e+Le.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:$e+ls.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:$e+fe.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:$e+fe.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:$e+fe.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:$e+fe.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:$e+fe.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:$e+fe.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:$e+fe.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:$e+fe.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:$e+fe.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:$e+fe.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:$e+fe.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:$e+fe.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:$e+fe.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:$e+fe.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:$e+fe.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:$e+fe.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:$e+fe.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:$e+fe.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:$e+fe.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:$e+fe.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:$e+fe.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:$e+fe.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:$e+fe.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:$e+fe.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:$e+fe.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:$e+fe.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:$e+fe.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:$e+fe.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:$e+fe.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:$e+fe.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:$e+fe.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:$e+H.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:$e+H.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:$e+H.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:$e+H.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:$e+fe.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:$e+fe.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:$e+fe.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:$e+H.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:$e+H.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:$e+H.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:$e+H.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:$e+H.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:$e+H.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:$e+H.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:$e+H.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:$e+H.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:$e+H.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:$e+H.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:$e+H.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:$e+H.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:$e+H.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:$e+H.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:$e+H.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:$e+H.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:$e+H.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:$e+H.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:$e+H.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:$e+H.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:$e+H.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:$e+H.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:$e+H.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:$e+H.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:$e+H.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:$e+H.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:$e+H.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:$e+H.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:$e+H.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:$e+H.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:$e+H.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:$e+H.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:$e+H.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:$e+H.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:$e+H.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:$e+H.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:$e+H.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:$e+H.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:$e+H.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:$e+H.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:$e+pe.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:$e+pe.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:$e+pe.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:$e+pe.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:$e+pe.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:$e+pe.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:$e+pe.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:$e+pe.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:$e+pe.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:$e+pe.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:$e+pe.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:$e+pe.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:$e+pe.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:$e+pe.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:$e+pe.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:$e+pe.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:$e+pe.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:$e+pe.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:$e+pe.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:$e+pe.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:$e+pe.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:$e+pe.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:$e+pe.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:$e+pe.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:$e+pe.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:$e+pe.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:$e+pe.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:$e+pe.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:$e+pe.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:$e+pe.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:$e+pe.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:$e+pe.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:$e+pe.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:$e+pe.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:$e+pe.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:$e+pe.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:$e+pe.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:$e+pe.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:$e+pe.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:$e+pe.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:$e+pe.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:$e+pe.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:$e+nt.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:$e+nt.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:$e+nt.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:$e+nt.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:$e+nt.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:$e+nt.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:$e+nt.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:$e+nt.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:$e+nt.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:$e+nt.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:$e+H.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:$e+H.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:$e+H.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:$e+H.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:$e+K.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:$e+K.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:$e+K.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:$e+K.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:$e+K.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:$e+K.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:$e+K.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:$e+K.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:$e+K.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:$e+K.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:$e+K.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:$e+K.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:$e+K.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:$e+K.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:$e+K.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:$e+K.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:$e+K.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:$e+K.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:$e+K.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:$e+K.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:$e+K.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:$e+K.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:$e+K.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:$e+K.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:$e+K.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:$e+K.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:$e+K.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:$e+K.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:$e+K.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:$e+K.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:$e+K.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:$e+K.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:$e+K.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:$e+K.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:$e+K.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:es+K.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:es+K.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:es+K.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:es+K.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:es+K.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:es+K.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:es+K.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:es+K.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:$e+K.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:$e+K.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:$e+K.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:$e+K.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:$e+K.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:$e+K.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:$e+K.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:$e+K.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:$e+K.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:$e+K.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:$e+K.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:$e+K.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:$e+K.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:$e+Le.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:$e+Le.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:$e+Le.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:$e+Le.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:$e+Le.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:$e+Le.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:$e+Le.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:es+Le.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:es+Le.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:es+Le.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:es+Le.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:es+Le.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:$e+Le.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:$e+Le.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:$e+Le.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:$e+Le.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:$e+Qe.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:$e+Pi.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:$e+Pi.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:$e+nt.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:$e+Pi.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:$e+Pi.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:$e+yn.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:$e+yn.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:$e+ur.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:$e+ur.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:$e+ur.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:$e+Qe.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:$e+Qe.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:$e+Qe.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:$e+Qe.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:$e+Qe.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:$e+Qe.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:$e+Qe.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:$e+Qe.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:$e+Qe.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:$e+Qe.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:$e+fn.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:$e+fn.Stringify};class cVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION,version:"1.0.0",description:'Implementation for the built-in function "Abort Execution". It terminates the execution of the current entity being run.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class fVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete Persisted Entity". It deletes the current entity as an entry in the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class yVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class hVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,entity:i,error:null,result:null})})}}class mVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Editor]});R(this,"module",{main:async(i,r)=>({error:"Search module not implemented",data:null})})}}class TVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:Oe.High,permissions:[_e.All],contexts:[]});R(this,"module",uV)}}const vVe=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class EVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.Empty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=vVe(r),c=!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bVe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.NotEmpty);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=vVe(r),c=!!a;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}const zI=class zI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.PrimitiveEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&zI.primitiveSet.has(E)?_=b===A:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)===JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(zI,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let II=zI;const YI=class YI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic);if(!r)return;const a=r.get(Ut.PrimitiveNotEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{var a,c,e,f,h,m;try{const E=(c=(a=r[0])==null?void 0:a.value)==null?void 0:c.name,b=(f=(e=r[0])==null?void 0:e.value)==null?void 0:f.value,A=(m=(h=r[1])==null?void 0:h.value)==null?void 0:m.value;let _=!1;return E&&YI.primitiveSet.has(E)?_=b!==A:E===ye.Untyped||E===ye.KeyValue?_=JSON.stringify(b)!==JSON.stringify(A):_=!1,{value:U.Success,error:null,result:_}}catch(E){return{value:U.UnhandledError,error:E,result:null}}}})}};R(YI,"primitiveSet",new Set([ye.String,ye.Number,ye.Boolean,ye.Null,ye.Enum,ye.Date,ye.UUID]));let gI=YI;var AVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(c,e,f){var h=e.prototype;f.utc=function(P){var j={date:P,utc:!0,args:arguments};return new e(j)},h.utc=function(P){var j=f(this.toDate(),{locale:this.$L,utc:!0});return P?j.add(this.utcOffset(),i):j},h.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var m=h.parse;h.parse=function(P){P.utc&&(this.$u=!0),this.$utils().u(P.$offset)||(this.$offset=P.$offset),m.call(this,P)};var E=h.init;h.init=function(){if(this.$u){var P=this.$d;this.$y=P.getUTCFullYear(),this.$M=P.getUTCMonth(),this.$D=P.getUTCDate(),this.$W=P.getUTCDay(),this.$H=P.getUTCHours(),this.$m=P.getUTCMinutes(),this.$s=P.getUTCSeconds(),this.$ms=P.getUTCMilliseconds()}else E.call(this)};var b=h.utcOffset;h.utcOffset=function(P,j){var M=this.$utils().u;if(M(P))return this.$u?0:M(this.$offset)?b.call(this):this.$offset;if(typeof P=="string"&&(P=function(ee){ee===void 0&&(ee="");var de=ee.match(r);if(!de)return null;var ie=(""+de[0]).match(a)||["-",0,0],se=ie[0],ue=60*+ie[1]+ +ie[2];return ue===0?0:se==="+"?ue:-ue}(P),P===null))return this;var G=Math.abs(P)<=16?60*P:P;if(G===0)return this.utc(j);var q=this.clone();if(j)return q.$offset=G,q.$u=!1,q;var re=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(q=this.local().add(G+re,i)).$offset=G,q.$x.$localOffset=re,q};var A=h.format;h.format=function(P){var j=P||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return A.call(this,j)},h.valueOf=function(){var P=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*P},h.isUTC=function(){return!!this.$u},h.toISOString=function(){return this.toDate().toISOString()},h.toString=function(){return this.toDate().toUTCString()};var _=h.toDate;h.toDate=function(P){return P==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():_.call(this)};var N=h.diff;h.diff=function(P,j,M){if(P&&this.$u===P.$u)return N.call(this,P,j,M);var G=this.local(),q=f(P).local();return N.call(G,q,j,M)}}})})(AVe);var FAi=AVe.exports;const KAi=Es(FAi);var IVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,c,e){var f,h=function(A,_,N){N===void 0&&(N={});var P=new Date(A),j=function(M,G){G===void 0&&(G={});var q=G.timeZoneName||"short",re=M+"|"+q,ee=r[re];return ee||(ee=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:M,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:q}),r[re]=ee),ee}(_,N);return j.formatToParts(P)},m=function(A,_){for(var N=h(A,_),P=[],j=0;j<N.length;j+=1){var M=N[j],G=M.type,q=M.value,re=i[G];re>=0&&(P[re]=parseInt(q,10))}var ee=P[3],de=ee===24?0:ee,ie=P[0]+"-"+P[1]+"-"+P[2]+" "+de+":"+P[4]+":"+P[5]+":000",se=+A;return(e.utc(ie).valueOf()-(se-=se%1e3))/6e4},E=c.prototype;E.tz=function(A,_){A===void 0&&(A=f);var N,P=this.utcOffset(),j=this.toDate(),M=j.toLocaleString("en-US",{timeZone:A}),G=Math.round((j-new Date(M))/1e3/60),q=15*-Math.round(j.getTimezoneOffset()/15)-G;if(!Number(q))N=this.utcOffset(0,_);else if(N=e(M,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(q,!0),_){var re=N.utcOffset();N=N.add(P-re,"minute")}return N.$x.$timezone=A,N},E.offsetName=function(A){var _=this.$x.$timezone||e.tz.guess(),N=h(this.valueOf(),_,{timeZoneName:A}).find(function(P){return P.type.toLowerCase()==="timezonename"});return N&&N.value};var b=E.startOf;E.startOf=function(A,_){if(!this.$x||!this.$x.$timezone)return b.call(this,A,_);var N=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call(N,A,_).tz(this.$x.$timezone,!0)},e.tz=function(A,_,N){var P=N&&_,j=N||_||f,M=m(+e(),j);if(typeof A!="string")return e(A).tz(j);var G=function(de,ie,se){var ue=de-60*ie*1e3,z=m(ue,se);if(ie===z)return[ue,ie];var X=m(ue-=60*(z-ie)*1e3,se);return z===X?[ue,z]:[de-60*Math.min(z,X)*1e3,Math.max(z,X)]}(e.utc(A,P).valueOf(),M,j),q=G[0],re=G[1],ee=e(q).utcOffset(re);return ee.$x.$timezone=j,ee},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(A){f=A}}})})(IVe);var qAi=IVe.exports;const SAi=Es(qAi);var gVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){r.prototype.isBetween=function(c,e,f,h){var m=a(c),E=a(e),b=(h=h||"()")[0]==="(",A=h[1]===")";return(b?this.isAfter(m,f):!this.isBefore(m,f))&&(A?this.isBefore(E,f):!this.isAfter(E,f))||(b?this.isBefore(m,f):!this.isAfter(m,f))&&(A?this.isAfter(E,f):!this.isBefore(E,f))}}})})(gVe);var ZAi=gVe.exports;const HAi=Es(ZAi);var RVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isSameOrAfter=function(a,c){return this.isSame(a,c)||this.isAfter(a,c)}}})})(RVe);var WAi=RVe.exports;const zAi=Es(WAi);var DVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isSameOrBefore=function(a,c){return this.isSame(a,c)||this.isBefore(a,c)}}})})(DVe);var YAi=DVe.exports;const JAi=Es(YAi);var wVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="week",r="year";return function(a,c,e){var f=c.prototype;f.week=function(h){if(h===void 0&&(h=null),h!==null)return this.add(7*(h-this.week()),"day");var m=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=e(this).startOf(r).add(1,r).date(m),b=e(this).endOf(i);if(E.isBefore(b))return 1}var A=e(this).startOf(r).date(m).startOf(i).subtract(1,"millisecond"),_=this.diff(A,i,!0);return _<0?e(this).startOf("week").week():Math.ceil(_)},f.weeks=function(h){return h===void 0&&(h=null),this.week(h)}}})})(wVe);var QAi=wVe.exports;const XAi=Es(QAi);var CVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="day";return function(r,a,c){var e=function(m){return m.add(4-m.isoWeekday(),i)},f=a.prototype;f.isoWeekYear=function(){return e(this).year()},f.isoWeek=function(m){if(!this.$utils().u(m))return this.add(7*(m-this.isoWeek()),i);var E,b,A,_,N=e(this),P=(E=this.isoWeekYear(),b=this.$u,A=(b?c.utc:c)().year(E).startOf("year"),_=4-A.isoWeekday(),A.isoWeekday()>4&&(_+=7),A.add(_,i));return N.diff(P,"week")+1},f.isoWeekday=function(m){return this.$utils().u(m)?this.day()||7:this.day(this.day()%7?m:m-7)};var h=f.startOf;f.startOf=function(m,E){var b=this.$utils(),A=!!b.u(E)||E;return b.p(m)==="isoweek"?A?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):h.bind(this)(m,E)}}})})(CVe);var eIi=CVe.exports;const tIi=Es(eIi);var OVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i="month",r="quarter";return function(a,c){var e=c.prototype;e.quarter=function(m){return this.$utils().u(m)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(m-1))};var f=e.add;e.add=function(m,E){return m=Number(m),this.$utils().p(E)===r?this.add(3*m,i):f.bind(this)(m,E)};var h=e.startOf;e.startOf=function(m,E){var b=this.$utils(),A=!!b.u(E)||E;if(b.p(m)===r){var _=this.quarter()-1;return A?this.month(3*_).startOf(i).startOf("day"):this.month(3*_+2).endOf(i).endOf("day")}return h.bind(this)(m,E)}}})})(OVe);var iIi=OVe.exports;const rIi=Es(iIi);var _Ve={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){r.prototype.dayOfYear=function(c){var e=Math.round((a(this).startOf("day")-a(this).startOf("year"))/864e5)+1;return c==null?e:this.add(c-e,"day")}}})})(_Ve);var nIi=_Ve.exports;const aIi=Es(nIi);var VVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r,a){i=i||{};var c=r.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function f(m,E,b,A){return c.fromToBase(m,E,b,A)}a.en.relativeTime=e,c.fromToBase=function(m,E,b,A,_){for(var N,P,j,M=b.$locale().relativeTime||e,G=i.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],q=G.length,re=0;re<q;re+=1){var ee=G[re];ee.d&&(N=A?a(m).diff(b,ee.d,!0):b.diff(m,ee.d,!0));var de=(i.rounding||Math.round)(Math.abs(N));if(j=N>0,de<=ee.r||!ee.r){de<=1&&re>0&&(ee=G[re-1]);var ie=M[ee.l];_&&(de=_(""+de)),P=typeof ie=="string"?ie.replace("%d",de):ie(de,E,ee.l,j);break}}if(E)return P;var se=j?M.future:M.past;return typeof se=="function"?se(P):se.replace("%s",P)},c.to=function(m,E){return f(m,E,this,!0)},c.from=function(m,E){return f(m,E,this)};var h=function(m){return m.$u?a.utc():a()};c.toNow=function(m){return this.to(h(this),m)},c.fromNow=function(m){return this.from(h(this),m)}}})})(VVe);var sIi=VVe.exports;const lIi=Es(sIi);var PVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){var i,r,a=1e3,c=6e4,e=36e5,f=864e5,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m=31536e6,E=2628e6,b=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,A={years:m,months:E,days:f,hours:e,minutes:c,seconds:a,milliseconds:1,weeks:6048e5},_=function(de){return de instanceof re},N=function(de,ie,se){return new re(de,se,ie.$l)},P=function(de){return r.p(de)+"s"},j=function(de){return de<0},M=function(de){return j(de)?Math.ceil(de):Math.floor(de)},G=function(de){return Math.abs(de)},q=function(de,ie){return de?j(de)?{negative:!0,format:""+G(de)+ie}:{negative:!1,format:""+de+ie}:{negative:!1,format:""}},re=function(){function de(se,ue,z){var X=this;if(this.$d={},this.$l=z,se===void 0&&(this.$ms=0,this.parseFromMilliseconds()),ue)return N(se*A[P(ue)],this);if(typeof se=="number")return this.$ms=se,this.parseFromMilliseconds(),this;if(typeof se=="object")return Object.keys(se).forEach(function(me){X.$d[P(me)]=se[me]}),this.calMilliseconds(),this;if(typeof se=="string"){var ce=se.match(b);if(ce){var oe=ce.slice(2).map(function(me){return me!=null?Number(me):0});return this.$d.years=oe[0],this.$d.months=oe[1],this.$d.weeks=oe[2],this.$d.days=oe[3],this.$d.hours=oe[4],this.$d.minutes=oe[5],this.$d.seconds=oe[6],this.calMilliseconds(),this}}return this}var ie=de.prototype;return ie.calMilliseconds=function(){var se=this;this.$ms=Object.keys(this.$d).reduce(function(ue,z){return ue+(se.$d[z]||0)*A[z]},0)},ie.parseFromMilliseconds=function(){var se=this.$ms;this.$d.years=M(se/m),se%=m,this.$d.months=M(se/E),se%=E,this.$d.days=M(se/f),se%=f,this.$d.hours=M(se/e),se%=e,this.$d.minutes=M(se/c),se%=c,this.$d.seconds=M(se/a),se%=a,this.$d.milliseconds=se},ie.toISOString=function(){var se=q(this.$d.years,"Y"),ue=q(this.$d.months,"M"),z=+this.$d.days||0;this.$d.weeks&&(z+=7*this.$d.weeks);var X=q(z,"D"),ce=q(this.$d.hours,"H"),oe=q(this.$d.minutes,"M"),me=this.$d.seconds||0;this.$d.milliseconds&&(me+=this.$d.milliseconds/1e3,me=Math.round(1e3*me)/1e3);var ve=q(me,"S"),we=se.negative||ue.negative||X.negative||ce.negative||oe.negative||ve.negative,Re=ce.format||oe.format||ve.format?"T":"",xe=(we?"-":"")+"P"+se.format+ue.format+X.format+Re+ce.format+oe.format+ve.format;return xe==="P"||xe==="-P"?"P0D":xe},ie.toJSON=function(){return this.toISOString()},ie.format=function(se){var ue=se||"YYYY-MM-DDTHH:mm:ss",z={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return ue.replace(h,function(X,ce){return ce||String(z[X])})},ie.as=function(se){return this.$ms/A[P(se)]},ie.get=function(se){var ue=this.$ms,z=P(se);return z==="milliseconds"?ue%=1e3:ue=z==="weeks"?M(ue/A[z]):this.$d[z],ue||0},ie.add=function(se,ue,z){var X;return X=ue?se*A[P(ue)]:_(se)?se.$ms:N(se,this).$ms,N(this.$ms+X*(z?-1:1),this)},ie.subtract=function(se,ue){return this.add(se,ue,!0)},ie.locale=function(se){var ue=this.clone();return ue.$l=se,ue},ie.clone=function(){return N(this.$ms,this)},ie.humanize=function(se){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!se)},ie.valueOf=function(){return this.asMilliseconds()},ie.milliseconds=function(){return this.get("milliseconds")},ie.asMilliseconds=function(){return this.as("milliseconds")},ie.seconds=function(){return this.get("seconds")},ie.asSeconds=function(){return this.as("seconds")},ie.minutes=function(){return this.get("minutes")},ie.asMinutes=function(){return this.as("minutes")},ie.hours=function(){return this.get("hours")},ie.asHours=function(){return this.as("hours")},ie.days=function(){return this.get("days")},ie.asDays=function(){return this.as("days")},ie.weeks=function(){return this.get("weeks")},ie.asWeeks=function(){return this.as("weeks")},ie.months=function(){return this.get("months")},ie.asMonths=function(){return this.as("months")},ie.years=function(){return this.get("years")},ie.asYears=function(){return this.as("years")},de}(),ee=function(de,ie,se){return de.add(ie.years()*se,"y").add(ie.months()*se,"M").add(ie.days()*se,"d").add(ie.hours()*se,"h").add(ie.minutes()*se,"m").add(ie.seconds()*se,"s").add(ie.milliseconds()*se,"ms")};return function(de,ie,se){i=se,r=se().$utils(),se.duration=function(X,ce){var oe=se.locale();return N(X,{$l:oe},ce)},se.isDuration=_;var ue=ie.prototype.add,z=ie.prototype.subtract;ie.prototype.add=function(X,ce){return _(X)?ee(this,X,1):ue.bind(this)(X,ce)},ie.prototype.subtract=function(X,ce){return _(X)?ee(this,X,-1):z.bind(this)(X,ce)}}})})(PVe);var oIi=PVe.exports;const dIi=Es(oIi);var NVe={exports:{}};(function(l,p){(function(i,r){l.exports=r()})(Zr,function(){return function(i,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(NVe);var uIi=NVe.exports;const pIi=Es(uIi);B.extend(KAi);B.extend(SAi);B.extend(HAi);B.extend(zAi);B.extend(JAi);B.extend(XAi);B.extend(tIi);B.extend(rIi);B.extend(aIi);B.extend(lIi);B.extend(dIi);B.extend(pIi);const Vt=l=>B(l),hr=l=>l.toISOString();function xVe(){return hr(B())}function $Ve(l,p){return Vt(l).format(p)}function LVe(l){return hr(B(l))}function BVe(l){if(l==null)throw new TypeError("ToDate expects a non-null value.");if(typeof l=="string"){const p=B(l);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof l=="number"&&Number.isFinite(l)){const p=Math.abs(l)<1e12?B.unix(l):B(l);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(l instanceof Date){const p=B(l);if(!p.isValid())throw new TypeError("Invalid Date object.");return p.toISOString()}throw new TypeError("Unsupported value type for ToDate. Provide a string, number, or Date.")}function MVe(l,p,i){return hr(Vt(l).add(p,i))}function GVe(l,p,i){return hr(Vt(l).subtract(p,i))}function jVe(l,p,i,r=!1){return Vt(l).diff(Vt(p),i,r)}function kVe(l){return Vt(l).unix()}function UVe(l){return hr(B.unix(l))}function FVe(l){return hr(Vt(l))}function KVe(l){return Vt(l).year()}function qVe(l){return Vt(l).month()}function SVe(l){return Vt(l).date()}function ZVe(l){return Vt(l).hour()}function HVe(l){return Vt(l).minute()}function WVe(l){return Vt(l).second()}function zVe(l){return Vt(l).millisecond()}function YVe(l){return Vt(l).isoWeekday()}function JVe(l){return Vt(l).week()}function QVe(l){return Vt(l).quarter()}function XVe(l){return Vt(l).dayOfYear()}function ePe(l){return Vt(l).daysInMonth()}function tPe(l,p){return hr(Vt(l).year(p))}function iPe(l,p){return hr(Vt(l).month(p))}function rPe(l,p){return hr(Vt(l).date(p))}function nPe(l,p){return hr(Vt(l).hour(p))}function aPe(l,p){return hr(Vt(l).minute(p))}function sPe(l,p){return hr(Vt(l).second(p))}function lPe(l,p){return hr(Vt(l).millisecond(p))}function oPe(l,p){return hr(Vt(l).isoWeekday(p))}function dPe(l,p){return hr(Vt(l).quarter(p))}function uPe(l,p){return hr(Vt(l).startOf(p))}function pPe(l,p){return hr(Vt(l).endOf(p))}function cPe(l,p){const i=Vt(l),r=i.startOf(p),a=i.endOf(p),c=r.valueOf()+(a.valueOf()-r.valueOf())/2;return hr(i.valueOf()<c?r:a)}function fPe(l,p,i){return Vt(l).isBefore(Vt(p),i)}function yPe(l,p,i){return Vt(l).isAfter(Vt(p),i)}function hPe(l,p,i){return Vt(l).isSame(Vt(p),i)}function mPe(l,p,i){return Vt(l).isSameOrBefore(Vt(p),i)}function TPe(l,p,i){return Vt(l).isSameOrAfter(Vt(p),i)}function vPe(l,p,i,r,a="()"){return Vt(l).isBetween(Vt(p),Vt(i),r,a)}function EPe(l){return B(l).isValid()}function bPe(l){return Vt(l).isLeapYear()}function APe(l,p,i){const r=Vt(l);return r.isBefore(p)?hr(Vt(p)):r.isAfter(i)?hr(Vt(i)):hr(r)}function IPe(l){if(l.length===0)throw new Error("minOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isBefore(p)&&(p=r)}return hr(p)}function gPe(l){if(l.length===0)throw new Error("maxOf requires at least one date");let p=Vt(l[0]);for(let i=1;i<l.length;i++){const r=Vt(l[i]);r.isAfter(p)&&(p=r)}return hr(p)}function RPe(l,p=!1){return Vt(l).fromNow(p)}function DPe(l,p=!1){return Vt(l).toNow(p)}function wPe(l,p,i=!0){const r=Vt(l).diff(Vt(p),"millisecond",!0),a=Math.abs(r),e=B.duration(a,"milliseconds").humanize();return i?r>=0?`in ${e}`:`${e} ago`:e}function CPe(l,p,i=["6","7"],r=[]){const a=m=>r.some(E=>Vt(E).isSame(m,"day")),c=m=>((m.day()+6)%7+1).toString();let e=Vt(l);const f=p>=0?1:-1;let h=Math.abs(p);for(;h>0;){e=e.add(f,"day");const m=c(e);!i.includes(m)&&!a(e)&&h--}return hr(e)}function OPe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.add(1,"day"),i.isoWeekday()===r)return hr(i);return hr(i)}function _Pe(l,p){let i=Vt(l);const r=p;for(let a=0;a<7;a++)if(i=i.subtract(1,"day"),i.isoWeekday()===r)return hr(i);return hr(i)}const VPe="Local";function Mx(){try{const l=Intl.DateTimeFormat().resolvedOptions().timeZone;if(l&&typeof l=="string")return l}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function Gx(){const l=Mx();if(l)return l;throw new Error("Unable to detect current IANA timezone from host environment.")}function PPe(l,p,i=!1){let r=p;if(r===VPe){const e=Mx();if(!e)throw new Error("Unable to detect current timezone from host environment.");r=e}const a=r?B.tz(l,r):Vt(l),c=i?a.utc(!0):a.utc();return hr(c)}function NPe(l,p,i=!1){const r=Vt(l);return hr(i?r.tz(p,!0):r.tz(p))}function xPe(l,p){const i=l===VPe?Gx():l;return Vt(p).tz(i).utcOffset()}function $Pe(l,p,i=!1){return hr(Vt(l).utcOffset(p,i))}class LPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetCurrentTimestamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=xVe();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FormatDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=$Ve(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class MPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ParseDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=LVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class GPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.AddToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=MVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SubtractFromDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=GVe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.DifferenceBetweenDates);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2],h=a[3]??!1,m=jVe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cIi extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=BVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class UPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class FPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FromUnix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=UVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class KPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToISOString);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=FVe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=KVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class SPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=qVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ZPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=SVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class HPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=ZVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class WPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=HVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=WVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class YPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=zVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class JPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=YVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class QPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetWeekOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=JVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class XPe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=QVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDayOfYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=XVe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetDaysInMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=ePe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetCurrentIanaTimeZone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=Gx();return{value:U.Success,error:null,result:a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=tPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMonth);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=iPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetDate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=rPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetHour);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=nPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMinute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=aPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class oNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetSecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=sPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class dNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetMillisecond);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=lPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class uNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetIsoWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=oPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class pNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetQuarter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=dPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class cNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.StartOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=uPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class fNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.EndOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=pPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.RoundTo);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=cPe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class hNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=fPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class mNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=yPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class TNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSame);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=hPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSameOrBefore);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=mPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ENe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsSameOrAfter);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=TPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsBetween);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)||((_=b.value)==null?void 0:_.value)}),c=a[0],e=a[1],f=a[2],h=a[3],m=a[4],E=vPe(c,e,f,h,m??void 0);return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ANe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsValid);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=EPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class INe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.IsLeapYear);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)}),c=bPe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ClampToRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=APe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class RNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=IPe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class DNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),c=a.length===1&&Array.isArray(a[0])?a[0]:a,e=gPe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.FromNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=RPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class CNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToNow);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),f=DPe(a,c??!1);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class ONe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.HumanizeDiff);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=wPe(a,c,e??!0);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _Ne extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.AddBusinessDays);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??void 0,h=a[3]??[],m=CPe(c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class VNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.NextWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=OPe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class PNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.PreviousWeekday);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)}),e=_Pe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class NNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ToUTC);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]||void 0,f=a[2]??!1,h=PPe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.ConvertTimezone);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=NPe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $Ne extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.GetTimezoneOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=xPe(a,c);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class LNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(K.SetUTCOffset);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),h=$Pe(a,c,e??!1);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class BNe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(ls.Wait);a&&(a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)||((h=e.value)==null?void 0:h.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:U.Success,error:null,result:null})}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const fIi=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,jx=l=>l===null||["string","number","boolean"].includes(typeof l);function Kn(l,p="Input must be an array"){if(!Array.isArray(l))throw new TypeError(p);return l}function _o(l){const p=Kn(l,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function kx(l){return Array.isArray(l)?l:[]}function $s(l){return Number(l)}function MNe(l){if(!l||l.length===0)throw new TypeError("No input lists provided");if(!l.every(r=>Array.isArray(r)))throw new TypeError("All inputs must be arrays");const[p,...i]=l;return i.reduce((r,a)=>r.concat(a),p)}function GNe(l,...p){if(!Array.isArray(l))throw new TypeError("First input must be an array");if(!p.every(i=>Array.isArray(i)))throw new TypeError("All subsequent inputs must be arrays");return l.concat(...p)}function jNe(l,p){const i=_o(l),r=$s(p);return[i.slice(0,r),i.slice(r)]}function kNe(l){return _o(l).slice().reverse()}function UNe(l){return _o(l).slice(0,-1)}function FNe(l){return _o(l).slice(1)}function KNe(l,p,i){const r=Kn(l),a=$s(p);if(a<0||a>r.length)throw new TypeError("Index out of bounds");return[...r.slice(0,a),i,...r.slice(a)]}function qNe(l,p,i){const r=_o(l),a=$s(p);if(a<0||a>=r.length)throw new TypeError("Index out of bounds");const c=[...r];return c[a]=i,c}function SNe(l,p,i){const r=_o(l),a=r.indexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function ZNe(l,p,i){const r=_o(l),a=r.lastIndexOf(p);if(a===-1)return r;const c=[...r];return c[a]=i,c}function HNe(l,p,i){return _o(l).map(a=>a===p?i:a)}function WNe(l,p){const i=_o(l),r=$s(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i[r]}function zNe(l){return _o(l)[0]}function YNe(l){const p=_o(l);return p[p.length-1]}function JNe(l,p,...i){return[...Kn(l),p,...i]}function QNe(l,p){const i=Kn(l);return[p,...i]}function XNe(l){return Kn(l).length}function exe(l,p){const i=Kn(l),r=$s(p);if(r<0||r>=i.length)throw new TypeError("Index out of bounds");return i.slice(0,r).concat(i.slice(r+1))}function txe(l,p){const i=Kn(l),r=Math.max(0,$s(p)??0);return i.slice(0,r)}function ixe(l,p){const i=Kn(l),r=Math.max(0,$s(p)??0);return r===0?[]:i.slice(-r)}function rxe(l,p,i){const r=Kn(l),a=p==null?void 0:$s(p),c=i==null?void 0:$s(i);return r.slice(a,c)}function nxe(l,p){return Kn(l).indexOf(p)}function axe(l,p){return Kn(l).lastIndexOf(p)}function sxe(l){const p=Kn(l),i=[],r=new Set;for(const a of p)r.has(a)||(r.add(a),i.push(a));return i}function lxe(l){return Kn(l).reduce((i,r)=>i.concat(r),[])}function oxe(l){const p=Kn(l);if(p.length<=1)return[...p];const i=p[0],r=typeof i=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),a=typeof i=="string"&&p.every(e=>typeof e=="string");let c=null;if(r?c="number":a&&(c=p.every(f=>fIi.test(f)&&B(f).isValid())?"date":"string"),!c)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return c==="number"?[...p].sort((e,f)=>e-f):c==="string"?[...p].sort((e,f)=>e.localeCompare(f)):[...p].sort((e,f)=>B(e).valueOf()-B(f).valueOf())}function dxe(l){const i=[...Kn(l)];for(let r=i.length-1;r>0;r--){const a=Math.floor(n1()*(r+1));[i[r],i[a]]=[i[a],i[r]]}return i}function uxe(l,p){const i=Kn(l),r=Math.max(1,$s(p)||1),a=[];for(let c=0;c<i.length;c+=r)a.push(i.slice(c,c+r));return a}function pxe(l,p,i){const r=Kn(l),a=Math.max(0,$s(p)||0);if(r.length>=a)return[...r];const c=a-r.length;return Array(c).fill(i).concat(r)}function cxe(l,p,i){const r=Kn(l),a=Math.max(0,$s(p)||0);if(r.length>=a)return[...r];const c=a-r.length,e=Array(c).fill(i);return r.concat(e)}function fxe(l,p){const i=Kn(l),r=Math.max(0,$s(p)||0),a=[];for(let c=0;c<r;c++)a.push(...i);return a}function yxe(l,p){if(!jx(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return kx(l).some(r=>r===p)}function hxe(l,p){const i=kx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(jx))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return r.every(a=>i.includes(a))}function mxe(l,p){const i=kx(l),r=Array.isArray(p)?p:[p];if(r.length===0)return!1;if(!r.every(jx))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return r.some(a=>i.includes(a))}class Txe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=MNe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class vxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Split);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],[f,h]=jNe(c,e);return{value:U.Success,error:null,result:[f,h]}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Exe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=kNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class bxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.DeleteLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=UNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Axe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.DeleteFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=FNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Ixe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=KNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class gxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=qNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Rxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=SNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Dxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=ZNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class wxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.ReplaceAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2],h=HNe(c,e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Cxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=WNe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Oxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetFirst);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=zNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _xe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.GetLast);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0],e=YNe(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Vxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a.slice(2),h=JNe(c,e,...f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Pxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(fe.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=QNe(c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Nxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(c=>{var e,f;return((e=c.value)==null?void 0:e.valueAsType)??((f=c.value)==null?void 0:f.value)});return{value:U.Success,error:null,result:XNe(a)}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class xxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=exe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $xe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetFirstNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=txe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Lxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLastNItems);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=ixe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Bxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=rxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Mxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Concat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),[c,...e]=a,f=GNe(c,...e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Gxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=nxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class jxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=axe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class kxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Unique);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=sxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Uxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Flatten);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=lxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Fxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT,version:"1.0.0",description:"List sort (non-mutating). Supports lists of strings (alphabetic), numbers (numeric), or ISO date strings (chronological).",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Sort);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=oxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Kxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Shuffle);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=dxe(a);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class qxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Chunk);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=uxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Sxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=pxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Zxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=cxe(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Hxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=fxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Wxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=yxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class zxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.ContainsAll);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=hxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Yxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(fe.ContainsAny);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=mxe(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class yIi extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.GetLength);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.length;return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Jxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Join);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{var a,c,e;try{const f=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.separator.id}),h=((a=f==null?void 0:f.value)==null?void 0:a.value)||"",m=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.first.id}),E=((c=m==null?void 0:m.value)==null?void 0:c.value)||"",b=r.find(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.second.id}),A=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",N=r.filter(j=>{var M,G;return((G=(M=j.valueOwner)==null?void 0:M.declaration)==null?void 0:G.id)===ne.operation[H.Join].inputs.dynamicString.id}).map(j=>{var M,G;return((M=j.value)==null?void 0:M.valueAsType)||((G=j.value)==null?void 0:G.value)||""}),P=[E,A,...N].join(h);return{value:U.Success,error:null,result:P}}catch(f){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:f,result:null}}}})}}class Qxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f={firstPart:c.slice(0,e),secondPart:c.slice(e)};return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class Xxe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS,version:"1.0.0",description:"String split at all the occurrences of separators operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtAllSeparators);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1],f=c.split(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class e$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR,version:"1.0.0",description:"String split at the first occurrence of a separator operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtFirstSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.indexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class t$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR,version:"1.0.0",description:"String split at the last occurrence of a separator operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.SplitAtLastSeparator);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=c.lastIndexOf(e),h={firstPart:c.slice(0,f),secondPart:c.slice(f+e.length)};return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class i$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class r$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class n$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Reverse);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.split("").reverse().join("");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class a$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ToLowerCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toLowerCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class s$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ToUpperCase);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)||((m=f.value)==null?void 0:m.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const e=c.toUpperCase();return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class l$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.DeleteAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=Math.min(f,c.length-e),m=c.slice(0,e)+c.slice(e+h);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class o$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.AddAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,e)+f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class d$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=f+c.slice(e);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class u$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1]??1,f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.slice(0,-e)+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class p$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceAtIndex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2]??1,h=a[3];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const m=(c.slice(0,e)||"")+h+(c.slice(e+f)||"");return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class c$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceFirstMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.replace(e,f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class f$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceLastMatch);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)||((A=E.value)==null?void 0:A.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.lastIndexOf(e),m=h===-1?c:c.substring(0,h)+f+c.substring(h+e.length);return{value:U.Success,error:null,result:m}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class y$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.ReplaceAllMatches);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1],f=a[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const h=c.split(e).join(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class h$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetIndexItem);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.charAt(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class m$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetLastNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(-e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class T$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetFirstNChars);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=c.slice(0,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class v$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.GetIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No search value provided",result:null};const f=c.indexOf(e);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class E$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Append);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)||((b=m.value)==null?void 0:b.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No value to append provided",result:null};const f=a.slice(2);if(!f.every(m=>typeof m=="string"))return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"All values to append must be strings",result:null};const h=[c,e,...f].join("");return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class b$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(H.Prepend);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const a=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)||((E=h.value)==null?void 0:E.value)}),c=a[0],e=a[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:"No string provided",result:null};const f=e+c;return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class A$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Trim);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trim();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class I$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.TrimStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimStart();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class g$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.TrimEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=a.trimEnd();return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class R$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Substring);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.substring(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class D$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Slice);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.slice(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class w$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.GetLastIndexOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.lastIndexOf(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class C$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.PadStart);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padStart(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class O$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.PadEnd);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)}),f=a.padEnd(c,e??void 0);return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class _$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Repeat);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.repeat(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class V$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),f=new RegExp(String(c??""),e?String(e):void 0),h=String(a??"").match(f);return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class P$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchAllRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(b=>{var A,_;return((A=b.value)==null?void 0:A.valueAsType)??((_=b.value)==null?void 0:_.value)}),f=e?String(e):"",h=f.includes("g")?f:f+"g",m=new RegExp(String(c??""),h),E=Array.from(String(a??"").matchAll(m),b=>Array.from(b));return{value:U.Success,error:null,result:E}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class N$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.SearchRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(h=>{var m,E;return((m=h.value)==null?void 0:m.valueAsType)??((E=h.value)==null?void 0:E.value)});let f=-1;try{const h=new RegExp(String(c??""),e?String(e):void 0);f=String(a??"").search(h)}catch{f=-1}return{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class x$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.ReplaceRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f]=r.map(E=>{var b,A;return((b=E.value)==null?void 0:b.valueAsType)??((A=E.value)==null?void 0:A.value)});let h=String(a??"");const m=new RegExp(String(c??""),f?String(f):void 0);return h=h.replace(m,String(e??"")),{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class $$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.NormalizeUnicode);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)}),e=a.normalize(c||"NFC");return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}const JI=class JI extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemoveDiacritics);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=r.map(e=>{var f,h;return((f=e.value)==null?void 0:f.valueAsType)??((h=e.value)==null?void 0:h.value)}),c=String(a??"").normalize("NFD").replace(JI.COMBINING_MARKS,"");return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}};R(JI,"COMBINING_MARKS",/[\u0300-\u036f]/g);let RI=JI;class L$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.CountOccurrences);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=f===""?0:e.split(f).length-1;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class B$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EnsurePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e:f+e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class M$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EnsureSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e:e+f;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class G$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemovePrefix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.startsWith(f)?e.slice(f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class j$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.RemoveSuffix);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)}),e=String(a??""),f=String(c??""),h=e.endsWith(f)?e.slice(0,-f.length):e;return{value:U.Success,error:null,result:h}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class k$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.StartsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("StartsWith expects two strings.");const e=a.startsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class U$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.EndsWith);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("EndsWith expects two strings.");const e=a.endsWith(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class F$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.Contains);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=r.map(f=>{var h,m;return((h=f.value)==null?void 0:h.valueAsType)??((m=f.value)==null?void 0:m.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("Contains expects two strings.");const e=a.includes(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class K$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(H.MatchesRegex);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=r.map(m=>{var E,b;return((E=m.value)==null?void 0:E.valueAsType)??((b=m.value)==null?void 0:b.value)});if(typeof a!="string"||typeof c!="string")throw new TypeError("MatchesRegex expects source and pattern to be strings.");if(!(e===void 0||typeof e=="string"))throw new TypeError("MatchesRegex flags must be a string if provided.");let f=!1;return f=new RegExp(c,e).test(a),{value:U.Success,error:null,result:f}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}function q$e(l,p){const i=Number(l),a=10**Math.max(0,Number(p)||0);return Math.round(i*a)/a}function S$e(l,p){const i=Number(l),r=Math.abs(Number(p)||0);return r===0?i:Math.round(i/r)*r}function Z$e(l,p,i){const r=Number(l),a=Number(p),c=Number(i);return Math.min(Math.max(r,a),c)}function H$e(l,p,i,r,a){const c=Number(l),e=Number(p),f=Number(i),h=Number(r),m=Number(a);if(e===f)throw new Error("Input range cannot be zero");const E=(c-e)/(f-e);return h+E*(m-h)}function W$e(...l){const p=l.map(r=>Number(r));return p.length===0?0:p.reduce((r,a)=>r+a,0)/p.length}function z$e(...l){const p=l.map(r=>Number(r)).sort((r,a)=>r-a);if(p.length===0)return 0;const i=Math.floor(p.length/2);return p.length%2?p[i]:(p[i-1]+p[i])/2}function Y$e(l,p){const i=Number(l),r=Number(p);return r===0?NaN:i<0&&r%2===1?-Math.pow(-i,1/r):Math.pow(i,1/r)}function J$e(l,p){const i=Number(l),r=Number(p);return i===0?1/0:(r-i)/i*100}const Ni=l=>l.map(p=>{var i,r;return((i=p.value)==null?void 0:i.valueAsType)??((r=p.value)==null?void 0:r.value)});class Q$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Addition);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e+f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class X$e extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Subtraction);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e-f,0);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class eLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Multiplication);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const c=Ni(r).reduce((e,f)=>e*f,1);return{value:U.Success,error:null,result:c}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class tLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Division);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a/c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class iLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Remainder);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r);if(c===0)throw new Error("Division by zero is not allowed");const e=a%c;return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class rLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(a=>a.contextType===ae.Logic);if(r){const a=r.get(pe.Exponentiation);a&&(a.autoexecutable=!0,a.implementation=this.module.main)}},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Math.pow(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class nLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Negate);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:-a}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class aLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Absolute);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.abs(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class sLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Sign);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sign(Number(a))}}catch(a){return{value:i.catchesError||i.errorCalls.length?U.CaughtError:U.UnhandledError,error:a,result:null}}}})}}class lLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Round);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.round(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class oLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Floor);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.floor(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class dLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Ceil);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.ceil(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class uLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Trunc);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.trunc(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class pLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.RoundToDecimals);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=q$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class cLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP,version:"1.0.0",description:"Snap a number to the nearest multiple of step (>=0 step)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.SnapToStep);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=S$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class fLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Clamp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e]=Ni(r),f=Z$e(a,c,e);return{value:U.Success,error:null,result:f}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class yLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MapRange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c,e,f,h]=Ni(r),m=H$e(a,c,e,f,h);return{value:U.Success,error:null,result:m}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class hLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Average);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r),c=W$e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class mLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Median);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r),c=z$e(...a);return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class TLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MinOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r).map(Number),c=a.length?Math.min(...a):1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class vLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MaxOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const a=Ni(r).map(Number),c=a.length?Math.max(...a):-1/0;return{value:U.Success,error:null,result:c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ELe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.SquareRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sqrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class bLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.CubeRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.cbrt(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ALe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.NthRoot);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Y$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class ILe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Exp);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.exp(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class gLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LogNatural);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.log(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class RLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Log10);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r),c=Number(a),e=Math.log10?Math.log10(c):Math.log(c)/Math.LN10;return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class DLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Sin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.sin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class wLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Cos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.cos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class CLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Tan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.tan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class OLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Asin);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.asin(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class _Le extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Acos);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.acos(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class VLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Atan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Math.atan(Number(a))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class PLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.Atan2);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:Math.atan2(Number(a),Number(c))}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class NLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.ToRadians);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Number(a)*Math.PI/180}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class xLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.ToDegrees);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a]=Ni(r);return{value:U.Success,error:null,result:Number(a)*180/Math.PI}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class $Le extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.PercentOf);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=Number(a)/100*Number(c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class C_ extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.PercentageChange);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r),e=J$e(a,c);return{value:U.Success,error:null,result:e}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class LLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LessThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a<c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class BLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MoreThan);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a>c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class MLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.LessThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a<=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}class GLe extends Pe{constructor(){super(...arguments);R(this,"manifest",{id:Ve.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:Oe.High,permissions:[_e.All],contexts:[ae.Logic]});R(this,"module",{init:i=>{const r=i.find(c=>c.contextType===ae.Logic),a=r==null?void 0:r.get(pe.MoreThanOrEqual);a&&(a.autoexecutable=!0,a.implementation=this.module.main)},main:async(i,r)=>{try{const[a,c]=Ni(r);return{value:U.Success,error:null,result:a>=c}}catch(a){return{value:U.UnhandledError,error:a,result:null}}}})}}function jLe(l,p){return function(){return l.apply(p,arguments)}}const{toString:hIi}=Object.prototype,{getPrototypeOf:Ux}=Object,{iterator:d1,toStringTag:kLe}=Symbol,u1=(l=>p=>{const i=hIi.call(p);return l[i]||(l[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Vo=l=>(l=l.toLowerCase(),p=>u1(p)===l),p1=l=>p=>typeof p===l,{isArray:Om}=Array,mh=p1("undefined");function cE(l){return l!==null&&!mh(l)&&l.constructor!==null&&!mh(l.constructor)&&ss(l.constructor.isBuffer)&&l.constructor.isBuffer(l)}const ULe=Vo("ArrayBuffer");function mIi(l){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(l):p=l&&l.buffer&&ULe(l.buffer),p}const TIi=p1("string"),ss=p1("function"),FLe=p1("number"),fE=l=>l!==null&&typeof l=="object",vIi=l=>l===!0||l===!1,XA=l=>{if(u1(l)!=="object")return!1;const p=Ux(l);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(kLe in l)&&!(d1 in l)},EIi=l=>{if(!fE(l)||cE(l))return!1;try{return Object.keys(l).length===0&&Object.getPrototypeOf(l)===Object.prototype}catch{return!1}},bIi=Vo("Date"),AIi=Vo("File"),IIi=l=>!!(l&&typeof l.uri<"u"),gIi=l=>l&&typeof l.getParts<"u",RIi=Vo("Blob"),DIi=Vo("FileList"),wIi=l=>fE(l)&&ss(l.pipe);function CIi(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ok=CIi(),_k=typeof Ok.FormData<"u"?Ok.FormData:void 0,OIi=l=>{let p;return l&&(_k&&l instanceof _k||ss(l.append)&&((p=u1(l))==="formdata"||p==="object"&&ss(l.toString)&&l.toString()==="[object FormData]"))},_Ii=Vo("URLSearchParams"),[VIi,PIi,NIi,xIi]=["ReadableStream","Request","Response","Headers"].map(Vo),$Ii=l=>l.trim?l.trim():l.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yE(l,p,{allOwnKeys:i=!1}={}){if(l===null||typeof l>"u")return;let r,a;if(typeof l!="object"&&(l=[l]),Om(l))for(r=0,a=l.length;r<a;r++)p.call(null,l[r],r,l);else{if(cE(l))return;const c=i?Object.getOwnPropertyNames(l):Object.keys(l),e=c.length;let f;for(r=0;r<e;r++)f=c[r],p.call(null,l[f],f,l)}}function KLe(l,p){if(cE(l))return null;p=p.toLowerCase();const i=Object.keys(l);let r=i.length,a;for(;r-- >0;)if(a=i[r],p===a.toLowerCase())return a;return null}const lf=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),qLe=l=>!mh(l)&&l!==lf;function O_(){const{caseless:l,skipUndefined:p}=qLe(this)&&this||{},i={},r=(a,c)=>{if(c==="__proto__"||c==="constructor"||c==="prototype")return;const e=l&&KLe(i,c)||c;XA(i[e])&&XA(a)?i[e]=O_(i[e],a):XA(a)?i[e]=O_({},a):Om(a)?i[e]=a.slice():(!p||!mh(a))&&(i[e]=a)};for(let a=0,c=arguments.length;a<c;a++)arguments[a]&&yE(arguments[a],r);return i}const LIi=(l,p,i,{allOwnKeys:r}={})=>(yE(p,(a,c)=>{i&&ss(a)?Object.defineProperty(l,c,{value:jLe(a,i),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(l,c,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),l),BIi=l=>(l.charCodeAt(0)===65279&&(l=l.slice(1)),l),MIi=(l,p,i,r)=>{l.prototype=Object.create(p.prototype,r),Object.defineProperty(l.prototype,"constructor",{value:l,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(l,"super",{value:p.prototype}),i&&Object.assign(l.prototype,i)},GIi=(l,p,i,r)=>{let a,c,e;const f={};if(p=p||{},l==null)return p;do{for(a=Object.getOwnPropertyNames(l),c=a.length;c-- >0;)e=a[c],(!r||r(e,l,p))&&!f[e]&&(p[e]=l[e],f[e]=!0);l=i!==!1&&Ux(l)}while(l&&(!i||i(l,p))&&l!==Object.prototype);return p},jIi=(l,p,i)=>{l=String(l),(i===void 0||i>l.length)&&(i=l.length),i-=p.length;const r=l.indexOf(p,i);return r!==-1&&r===i},kIi=l=>{if(!l)return null;if(Om(l))return l;let p=l.length;if(!FLe(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=l[p];return i},UIi=(l=>p=>l&&p instanceof l)(typeof Uint8Array<"u"&&Ux(Uint8Array)),FIi=(l,p)=>{const r=(l&&l[d1]).call(l);let a;for(;(a=r.next())&&!a.done;){const c=a.value;p.call(l,c[0],c[1])}},KIi=(l,p)=>{let i;const r=[];for(;(i=l.exec(p))!==null;)r.push(i);return r},qIi=Vo("HTMLFormElement"),SIi=l=>l.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,r,a){return r.toUpperCase()+a}),Vk=(({hasOwnProperty:l})=>(p,i)=>l.call(p,i))(Object.prototype),ZIi=Vo("RegExp"),SLe=(l,p)=>{const i=Object.getOwnPropertyDescriptors(l),r={};yE(i,(a,c)=>{let e;(e=p(a,c,l))!==!1&&(r[c]=e||a)}),Object.defineProperties(l,r)},HIi=l=>{SLe(l,(p,i)=>{if(ss(l)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const r=l[i];if(ss(r)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},WIi=(l,p)=>{const i={},r=a=>{a.forEach(c=>{i[c]=!0})};return Om(l)?r(l):r(String(l).split(p)),i},zIi=()=>{},YIi=(l,p)=>l!=null&&Number.isFinite(l=+l)?l:p;function JIi(l){return!!(l&&ss(l.append)&&l[kLe]==="FormData"&&l[d1])}const QIi=l=>{const p=new Array(10),i=(r,a)=>{if(fE(r)){if(p.indexOf(r)>=0)return;if(cE(r))return r;if(!("toJSON"in r)){p[a]=r;const c=Om(r)?[]:{};return yE(r,(e,f)=>{const h=i(e,a+1);!mh(h)&&(c[f]=h)}),p[a]=void 0,c}}return r};return i(l,0)},XIi=Vo("AsyncFunction"),egi=l=>l&&(fE(l)||ss(l))&&ss(l.then)&&ss(l.catch),ZLe=((l,p)=>l?setImmediate:p?((i,r)=>(lf.addEventListener("message",({source:a,data:c})=>{a===lf&&c===i&&r.length&&r.shift()()},!1),a=>{r.push(a),lf.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",ss(lf.postMessage)),tgi=typeof queueMicrotask<"u"?queueMicrotask.bind(lf):typeof process<"u"&&process.nextTick||ZLe,igi=l=>l!=null&&ss(l[d1]),qe={isArray:Om,isArrayBuffer:ULe,isBuffer:cE,isFormData:OIi,isArrayBufferView:mIi,isString:TIi,isNumber:FLe,isBoolean:vIi,isObject:fE,isPlainObject:XA,isEmptyObject:EIi,isReadableStream:VIi,isRequest:PIi,isResponse:NIi,isHeaders:xIi,isUndefined:mh,isDate:bIi,isFile:AIi,isReactNativeBlob:IIi,isReactNative:gIi,isBlob:RIi,isRegExp:ZIi,isFunction:ss,isStream:wIi,isURLSearchParams:_Ii,isTypedArray:UIi,isFileList:DIi,forEach:yE,merge:O_,extend:LIi,trim:$Ii,stripBOM:BIi,inherits:MIi,toFlatObject:GIi,kindOf:u1,kindOfTest:Vo,endsWith:jIi,toArray:kIi,forEachEntry:FIi,matchAll:KIi,isHTMLForm:qIi,hasOwnProperty:Vk,hasOwnProp:Vk,reduceDescriptors:SLe,freezeMethods:HIi,toObjectSet:WIi,toCamelCase:SIi,noop:zIi,toFiniteNumber:YIi,findKey:KLe,global:lf,isContextDefined:qLe,isSpecCompliantForm:JIi,toJSONObject:QIi,isAsyncFn:XIi,isThenable:egi,setImmediate:ZLe,asap:tgi,isIterable:igi};class Ka extends Error{static from(p,i,r,a,c,e){const f=new Ka(p.message,i||p.code,r,a,c);return f.cause=p,f.name=p.name,p.status!=null&&f.status==null&&(f.status=p.status),e&&Object.assign(f,e),f}constructor(p,i,r,a,c){super(p),Object.defineProperty(this,"message",{value:p,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,i&&(this.code=i),r&&(this.config=r),a&&(this.request=a),c&&(this.response=c,this.status=c.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qe.toJSONObject(this.config),code:this.code,status:this.status}}}Ka.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ka.ERR_BAD_OPTION="ERR_BAD_OPTION";Ka.ECONNABORTED="ECONNABORTED";Ka.ETIMEDOUT="ETIMEDOUT";Ka.ERR_NETWORK="ERR_NETWORK";Ka.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ka.ERR_DEPRECATED="ERR_DEPRECATED";Ka.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ka.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ka.ERR_CANCELED="ERR_CANCELED";Ka.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ka.ERR_INVALID_URL="ERR_INVALID_URL";const Ji=Ka,rgi=null;function __(l){return qe.isPlainObject(l)||qe.isArray(l)}function HLe(l){return qe.endsWith(l,"[]")?l.slice(0,-2):l}function FO(l,p,i){return l?l.concat(p).map(function(a,c){return a=HLe(a),!i&&c?"["+a+"]":a}).join(i?".":""):p}function ngi(l){return qe.isArray(l)&&!l.some(__)}const agi=qe.toFlatObject(qe,{},null,function(p){return/^is[A-Z]/.test(p)});function c1(l,p,i){if(!qe.isObject(l))throw new TypeError("target must be an object");p=p||new FormData,i=qe.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(P,j){return!qe.isUndefined(j[P])});const r=i.metaTokens,a=i.visitor||E,c=i.dots,e=i.indexes,h=(i.Blob||typeof Blob<"u"&&Blob)&&qe.isSpecCompliantForm(p);if(!qe.isFunction(a))throw new TypeError("visitor must be a function");function m(N){if(N===null)return"";if(qe.isDate(N))return N.toISOString();if(qe.isBoolean(N))return N.toString();if(!h&&qe.isBlob(N))throw new Ji("Blob is not supported. Use a Buffer instead.");return qe.isArrayBuffer(N)||qe.isTypedArray(N)?h&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function E(N,P,j){let M=N;if(qe.isReactNative(p)&&qe.isReactNativeBlob(N))return p.append(FO(j,P,c),m(N)),!1;if(N&&!j&&typeof N=="object"){if(qe.endsWith(P,"{}"))P=r?P:P.slice(0,-2),N=JSON.stringify(N);else if(qe.isArray(N)&&ngi(N)||(qe.isFileList(N)||qe.endsWith(P,"[]"))&&(M=qe.toArray(N)))return P=HLe(P),M.forEach(function(q,re){!(qe.isUndefined(q)||q===null)&&p.append(e===!0?FO([P],re,c):e===null?P:P+"[]",m(q))}),!1}return __(N)?!0:(p.append(FO(j,P,c),m(N)),!1)}const b=[],A=Object.assign(agi,{defaultVisitor:E,convertValue:m,isVisitable:__});function _(N,P){if(!qe.isUndefined(N)){if(b.indexOf(N)!==-1)throw Error("Circular reference detected in "+P.join("."));b.push(N),qe.forEach(N,function(M,G){(!(qe.isUndefined(M)||M===null)&&a.call(p,M,qe.isString(G)?G.trim():G,P,A))===!0&&_(M,P?P.concat(G):[G])}),b.pop()}}if(!qe.isObject(l))throw new TypeError("data must be an object");return _(l),p}function Pk(l){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(l).replace(/[!'()~]|%20|%00/g,function(r){return p[r]})}function Fx(l,p){this._pairs=[],l&&c1(l,this,p)}const WLe=Fx.prototype;WLe.append=function(p,i){this._pairs.push([p,i])};WLe.toString=function(p){const i=p?function(r){return p.call(this,r,Pk)}:Pk;return this._pairs.map(function(a){return i(a[0])+"="+i(a[1])},"").join("&")};function sgi(l){return encodeURIComponent(l).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zLe(l,p,i){if(!p)return l;const r=i&&i.encode||sgi,a=qe.isFunction(i)?{serialize:i}:i,c=a&&a.serialize;let e;if(c?e=c(p,a):e=qe.isURLSearchParams(p)?p.toString():new Fx(p,a).toString(r),e){const f=l.indexOf("#");f!==-1&&(l=l.slice(0,f)),l+=(l.indexOf("?")===-1?"?":"&")+e}return l}class lgi{constructor(){this.handlers=[]}use(p,i,r){return this.handlers.push({fulfilled:p,rejected:i,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){qe.forEach(this.handlers,function(r){r!==null&&p(r)})}}const Nk=lgi,Kx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ogi=typeof URLSearchParams<"u"?URLSearchParams:Fx,dgi=typeof FormData<"u"?FormData:null,ugi=typeof Blob<"u"?Blob:null,pgi={isBrowser:!0,classes:{URLSearchParams:ogi,FormData:dgi,Blob:ugi},protocols:["http","https","file","blob","url","data"]},qx=typeof window<"u"&&typeof document<"u",V_=typeof navigator=="object"&&navigator||void 0,cgi=qx&&(!V_||["ReactNative","NativeScript","NS"].indexOf(V_.product)<0),fgi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),ygi=qx&&window.location.href||"http://localhost",hgi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qx,hasStandardBrowserEnv:cgi,hasStandardBrowserWebWorkerEnv:fgi,navigator:V_,origin:ygi},Symbol.toStringTag,{value:"Module"})),Ta={...hgi,...pgi};function mgi(l,p){return c1(l,new Ta.classes.URLSearchParams,{visitor:function(i,r,a,c){return Ta.isNode&&qe.isBuffer(i)?(this.append(r,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function Tgi(l){return qe.matchAll(/\w+|\[(\w*)]/g,l).map(p=>p[0]==="[]"?"":p[1]||p[0])}function vgi(l){const p={},i=Object.keys(l);let r;const a=i.length;let c;for(r=0;r<a;r++)c=i[r],p[c]=l[c];return p}function YLe(l){function p(i,r,a,c){let e=i[c++];if(e==="__proto__")return!0;const f=Number.isFinite(+e),h=c>=i.length;return e=!e&&qe.isArray(a)?a.length:e,h?(qe.hasOwnProp(a,e)?a[e]=[a[e],r]:a[e]=r,!f):((!a[e]||!qe.isObject(a[e]))&&(a[e]=[]),p(i,r,a[e],c)&&qe.isArray(a[e])&&(a[e]=vgi(a[e])),!f)}if(qe.isFormData(l)&&qe.isFunction(l.entries)){const i={};return qe.forEachEntry(l,(r,a)=>{p(Tgi(r),a,i,0)}),i}return null}function Egi(l,p,i){if(qe.isString(l))try{return(p||JSON.parse)(l),qe.trim(l)}catch(r){if(r.name!=="SyntaxError")throw r}return(i||JSON.stringify)(l)}const Sx={transitional:Kx,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const r=i.getContentType()||"",a=r.indexOf("application/json")>-1,c=qe.isObject(p);if(c&&qe.isHTMLForm(p)&&(p=new FormData(p)),qe.isFormData(p))return a?JSON.stringify(YLe(p)):p;if(qe.isArrayBuffer(p)||qe.isBuffer(p)||qe.isStream(p)||qe.isFile(p)||qe.isBlob(p)||qe.isReadableStream(p))return p;if(qe.isArrayBufferView(p))return p.buffer;if(qe.isURLSearchParams(p))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let f;if(c){if(r.indexOf("application/x-www-form-urlencoded")>-1)return mgi(p,this.formSerializer).toString();if((f=qe.isFileList(p))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return c1(f?{"files[]":p}:p,h&&new h,this.formSerializer)}}return c||a?(i.setContentType("application/json",!1),Egi(p)):p}],transformResponse:[function(p){const i=this.transitional||Sx.transitional,r=i&&i.forcedJSONParsing,a=this.responseType==="json";if(qe.isResponse(p)||qe.isReadableStream(p))return p;if(p&&qe.isString(p)&&(r&&!this.responseType||a)){const e=!(i&&i.silentJSONParsing)&&a;try{return JSON.parse(p,this.parseReviver)}catch(f){if(e)throw f.name==="SyntaxError"?Ji.from(f,Ji.ERR_BAD_RESPONSE,this,null,this.response):f}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ta.classes.FormData,Blob:Ta.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qe.forEach(["delete","get","head","post","put","patch"],l=>{Sx.headers[l]={}});const Zx=Sx,bgi=qe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Agi=l=>{const p={};let i,r,a;return l&&l.split(`
50
50
  `).forEach(function(e){a=e.indexOf(":"),i=e.substring(0,a).trim().toLowerCase(),r=e.substring(a+1).trim(),!(!i||p[i]&&bgi[i])&&(i==="set-cookie"?p[i]?p[i].push(r):p[i]=[r]:p[i]=p[i]?p[i]+", "+r:r)}),p},xk=Symbol("internals");function x0(l){return l&&String(l).trim().toLowerCase()}function eI(l){return l===!1||l==null?l:qe.isArray(l)?l.map(eI):String(l)}function Igi(l){const p=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(l);)p[r[1]]=r[2];return p}const ggi=l=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(l.trim());function KO(l,p,i,r,a){if(qe.isFunction(r))return r.call(this,p,i);if(a&&(p=i),!!qe.isString(p)){if(qe.isString(r))return p.indexOf(r)!==-1;if(qe.isRegExp(r))return r.test(p)}}function Rgi(l){return l.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(p,i,r)=>i.toUpperCase()+r)}function Dgi(l,p){const i=qe.toCamelCase(" "+p);["get","set","has"].forEach(r=>{Object.defineProperty(l,r+i,{value:function(a,c,e){return this[r].call(this,p,a,c,e)},configurable:!0})})}class f1{constructor(p){p&&this.set(p)}set(p,i,r){const a=this;function c(f,h,m){const E=x0(h);if(!E)throw new Error("header name must be a non-empty string");const b=qe.findKey(a,E);(!b||a[b]===void 0||m===!0||m===void 0&&a[b]!==!1)&&(a[b||h]=eI(f))}const e=(f,h)=>qe.forEach(f,(m,E)=>c(m,E,h));if(qe.isPlainObject(p)||p instanceof this.constructor)e(p,i);else if(qe.isString(p)&&(p=p.trim())&&!ggi(p))e(Agi(p),i);else if(qe.isObject(p)&&qe.isIterable(p)){let f={},h,m;for(const E of p){if(!qe.isArray(E))throw TypeError("Object iterator must return a key-value pair");f[m=E[0]]=(h=f[m])?qe.isArray(h)?[...h,E[1]]:[h,E[1]]:E[1]}e(f,i)}else p!=null&&c(i,p,r);return this}get(p,i){if(p=x0(p),p){const r=qe.findKey(this,p);if(r){const a=this[r];if(!i)return a;if(i===!0)return Igi(a);if(qe.isFunction(i))return i.call(this,a,r);if(qe.isRegExp(i))return i.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(p,i){if(p=x0(p),p){const r=qe.findKey(this,p);return!!(r&&this[r]!==void 0&&(!i||KO(this,this[r],r,i)))}return!1}delete(p,i){const r=this;let a=!1;function c(e){if(e=x0(e),e){const f=qe.findKey(r,e);f&&(!i||KO(r,r[f],f,i))&&(delete r[f],a=!0)}}return qe.isArray(p)?p.forEach(c):c(p),a}clear(p){const i=Object.keys(this);let r=i.length,a=!1;for(;r--;){const c=i[r];(!p||KO(this,this[c],c,p,!0))&&(delete this[c],a=!0)}return a}normalize(p){const i=this,r={};return qe.forEach(this,(a,c)=>{const e=qe.findKey(r,c);if(e){i[e]=eI(a),delete i[c];return}const f=p?Rgi(c):String(c).trim();f!==c&&delete i[c],i[f]=eI(a),r[f]=!0}),this}concat(...p){return this.constructor.concat(this,...p)}toJSON(p){const i=Object.create(null);return qe.forEach(this,(r,a)=>{r!=null&&r!==!1&&(i[a]=p&&qe.isArray(r)?r.join(", "):r)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([p,i])=>p+": "+i).join(`
51
51
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const r=new this(p);return i.forEach(a=>r.set(a)),r}static accessor(p){const r=(this[xk]=this[xk]={accessors:{}}).accessors,a=this.prototype;function c(e){const f=x0(e);r[f]||(Dgi(a,e),r[f]=!0)}return qe.isArray(p)?p.forEach(c):c(p),this}}f1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);qe.reduceDescriptors(f1.prototype,({value:l},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>l,set(r){this[i]=r}}});qe.freezeMethods(f1);const zl=f1;function qO(l,p){const i=this||Zx,r=p||i,a=zl.from(r.headers);let c=r.data;return qe.forEach(l,function(f){c=f.call(i,c,a.normalize(),p?p.status:void 0)}),a.normalize(),c}function JLe(l){return!!(l&&l.__CANCEL__)}class wgi extends Ji{constructor(p,i,r){super(p??"canceled",Ji.ERR_CANCELED,i,r),this.name="CanceledError",this.__CANCEL__=!0}}const hE=wgi;function QLe(l,p,i){const r=i.config.validateStatus;!i.status||!r||r(i.status)?l(i):p(new Ji("Request failed with status code "+i.status,[Ji.ERR_BAD_REQUEST,Ji.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function Cgi(l){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return p&&p[1]||""}function Ogi(l,p){l=l||10;const i=new Array(l),r=new Array(l);let a=0,c=0,e;return p=p!==void 0?p:1e3,function(h){const m=Date.now(),E=r[c];e||(e=m),i[a]=h,r[a]=m;let b=c,A=0;for(;b!==a;)A+=i[b++],b=b%l;if(a=(a+1)%l,a===c&&(c=(c+1)%l),m-e<p)return;const _=E&&m-E;return _?Math.round(A*1e3/_):void 0}}function _gi(l,p){let i=0,r=1e3/p,a,c;const e=(m,E=Date.now())=>{i=E,a=null,c&&(clearTimeout(c),c=null),l(...m)};return[(...m)=>{const E=Date.now(),b=E-i;b>=r?e(m,E):(a=m,c||(c=setTimeout(()=>{c=null,e(a)},r-b)))},()=>a&&e(a)]}const DI=(l,p,i=3)=>{let r=0;const a=Ogi(50,250);return _gi(c=>{const e=c.loaded,f=c.lengthComputable?c.total:void 0,h=e-r,m=a(h),E=e<=f;r=e;const b={loaded:e,total:f,progress:f?e/f:void 0,bytes:h,rate:m||void 0,estimated:m&&f&&E?(f-e)/m:void 0,event:c,lengthComputable:f!=null,[p?"download":"upload"]:!0};l(b)},i)},$k=(l,p)=>{const i=l!=null;return[r=>p[0]({lengthComputable:i,total:l,loaded:r}),p[1]]},Lk=l=>(...p)=>qe.asap(()=>l(...p)),Vgi=Ta.hasStandardBrowserEnv?((l,p)=>i=>(i=new URL(i,Ta.origin),l.protocol===i.protocol&&l.host===i.host&&(p||l.port===i.port)))(new URL(Ta.origin),Ta.navigator&&/(msie|trident)/i.test(Ta.navigator.userAgent)):()=>!0,Pgi=Ta.hasStandardBrowserEnv?{write(l,p,i,r,a,c,e){if(typeof document>"u")return;const f=[`${l}=${encodeURIComponent(p)}`];qe.isNumber(i)&&f.push(`expires=${new Date(i).toUTCString()}`),qe.isString(r)&&f.push(`path=${r}`),qe.isString(a)&&f.push(`domain=${a}`),c===!0&&f.push("secure"),qe.isString(e)&&f.push(`SameSite=${e}`),document.cookie=f.join("; ")},read(l){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+l+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(l){this.write(l,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ngi(l){return typeof l!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function xgi(l,p){return p?l.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):l}function XLe(l,p,i){let r=!Ngi(p);return l&&(r||i==!1)?xgi(l,p):p}const Bk=l=>l instanceof zl?{...l}:l;function Tf(l,p){p=p||{};const i={};function r(m,E,b,A){return qe.isPlainObject(m)&&qe.isPlainObject(E)?qe.merge.call({caseless:A},m,E):qe.isPlainObject(E)?qe.merge({},E):qe.isArray(E)?E.slice():E}function a(m,E,b,A){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m,b,A)}else return r(m,E,b,A)}function c(m,E){if(!qe.isUndefined(E))return r(void 0,E)}function e(m,E){if(qe.isUndefined(E)){if(!qe.isUndefined(m))return r(void 0,m)}else return r(void 0,E)}function f(m,E,b){if(b in p)return r(m,E);if(b in l)return r(void 0,m)}const h={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:f,headers:(m,E,b)=>a(Bk(m),Bk(E),b,!0)};return qe.forEach(Object.keys({...l,...p}),function(E){if(E==="__proto__"||E==="constructor"||E==="prototype")return;const b=qe.hasOwnProp(h,E)?h[E]:a,A=b(l[E],p[E],E);qe.isUndefined(A)&&b!==f||(i[E]=A)}),i}const e2e=l=>{const p=Tf({},l);let{data:i,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:c,headers:e,auth:f}=p;if(p.headers=e=zl.from(e),p.url=zLe(XLe(p.baseURL,p.url,p.allowAbsoluteUrls),l.params,l.paramsSerializer),f&&e.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),qe.isFormData(i)){if(Ta.hasStandardBrowserEnv||Ta.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(qe.isFunction(i.getHeaders)){const h=i.getHeaders(),m=["content-type","content-length"];Object.entries(h).forEach(([E,b])=>{m.includes(E.toLowerCase())&&e.set(E,b)})}}if(Ta.hasStandardBrowserEnv&&(r&&qe.isFunction(r)&&(r=r(p)),r||r!==!1&&Vgi(p.url))){const h=a&&c&&Pgi.read(c);h&&e.set(a,h)}return p},$gi=typeof XMLHttpRequest<"u",Lgi=$gi&&function(l){return new Promise(function(i,r){const a=e2e(l);let c=a.data;const e=zl.from(a.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:m}=a,E,b,A,_,N;function P(){_&&_(),N&&N(),a.cancelToken&&a.cancelToken.unsubscribe(E),a.signal&&a.signal.removeEventListener("abort",E)}let j=new XMLHttpRequest;j.open(a.method.toUpperCase(),a.url,!0),j.timeout=a.timeout;function M(){if(!j)return;const q=zl.from("getAllResponseHeaders"in j&&j.getAllResponseHeaders()),ee={data:!f||f==="text"||f==="json"?j.responseText:j.response,status:j.status,statusText:j.statusText,headers:q,config:l,request:j};QLe(function(ie){i(ie),P()},function(ie){r(ie),P()},ee),j=null}"onloadend"in j?j.onloadend=M:j.onreadystatechange=function(){!j||j.readyState!==4||j.status===0&&!(j.responseURL&&j.responseURL.indexOf("file:")===0)||setTimeout(M)},j.onabort=function(){j&&(r(new Ji("Request aborted",Ji.ECONNABORTED,l,j)),j=null)},j.onerror=function(re){const ee=re&&re.message?re.message:"Network Error",de=new Ji(ee,Ji.ERR_NETWORK,l,j);de.event=re||null,r(de),j=null},j.ontimeout=function(){let re=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const ee=a.transitional||Kx;a.timeoutErrorMessage&&(re=a.timeoutErrorMessage),r(new Ji(re,ee.clarifyTimeoutError?Ji.ETIMEDOUT:Ji.ECONNABORTED,l,j)),j=null},c===void 0&&e.setContentType(null),"setRequestHeader"in j&&qe.forEach(e.toJSON(),function(re,ee){j.setRequestHeader(ee,re)}),qe.isUndefined(a.withCredentials)||(j.withCredentials=!!a.withCredentials),f&&f!=="json"&&(j.responseType=a.responseType),m&&([A,N]=DI(m,!0),j.addEventListener("progress",A)),h&&j.upload&&([b,_]=DI(h),j.upload.addEventListener("progress",b),j.upload.addEventListener("loadend",_)),(a.cancelToken||a.signal)&&(E=q=>{j&&(r(!q||q.type?new hE(null,l,j):q),j.abort(),j=null)},a.cancelToken&&a.cancelToken.subscribe(E),a.signal&&(a.signal.aborted?E():a.signal.addEventListener("abort",E)));const G=Cgi(a.url);if(G&&Ta.protocols.indexOf(G)===-1){r(new Ji("Unsupported protocol "+G+":",Ji.ERR_BAD_REQUEST,l));return}j.send(c||null)})},Bgi=(l,p)=>{const{length:i}=l=l?l.filter(Boolean):[];if(p||i){let r=new AbortController,a;const c=function(m){if(!a){a=!0,f();const E=m instanceof Error?m:this.reason;r.abort(E instanceof Ji?E:new hE(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new Ji(`timeout of ${p}ms exceeded`,Ji.ETIMEDOUT))},p);const f=()=>{l&&(e&&clearTimeout(e),e=null,l.forEach(m=>{m.unsubscribe?m.unsubscribe(c):m.removeEventListener("abort",c)}),l=null)};l.forEach(m=>m.addEventListener("abort",c));const{signal:h}=r;return h.unsubscribe=()=>qe.asap(f),h}},Mgi=Bgi,Ggi=function*(l,p){let i=l.byteLength;if(!p||i<p){yield l;return}let r=0,a;for(;r<i;)a=r+p,yield l.slice(r,a),r=a},jgi=async function*(l,p){for await(const i of kgi(l))yield*Ggi(i,p)},kgi=async function*(l){if(l[Symbol.asyncIterator]){yield*l;return}const p=l.getReader();try{for(;;){const{done:i,value:r}=await p.read();if(i)break;yield r}}finally{await p.cancel()}},Mk=(l,p,i,r)=>{const a=jgi(l,p);let c=0,e,f=h=>{e||(e=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:E}=await a.next();if(m){f(),h.close();return}let b=E.byteLength;if(i){let A=c+=b;i(A)}h.enqueue(new Uint8Array(E))}catch(m){throw f(m),m}},cancel(h){return f(h),a.return()}},{highWaterMark:2})},Gk=64*1024,{isFunction:SA}=qe,Ugi=(({Request:l,Response:p})=>({Request:l,Response:p}))(qe.global),{ReadableStream:jk,TextEncoder:kk}=qe.global,Uk=(l,...p)=>{try{return!!l(...p)}catch{return!1}},Fgi=l=>{l=qe.merge.call({skipUndefined:!0},Ugi,l);const{fetch:p,Request:i,Response:r}=l,a=p?SA(p):typeof fetch=="function",c=SA(i),e=SA(r);if(!a)return!1;const f=a&&SA(jk),h=a&&(typeof kk=="function"?(N=>P=>N.encode(P))(new kk):async N=>new Uint8Array(await new i(N).arrayBuffer())),m=c&&f&&Uk(()=>{let N=!1;const P=new i(Ta.origin,{body:new jk,method:"POST",get duplex(){return N=!0,"half"}}).headers.has("Content-Type");return N&&!P}),E=e&&f&&Uk(()=>qe.isReadableStream(new r("").body)),b={stream:E&&(N=>N.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(N=>{!b[N]&&(b[N]=(P,j)=>{let M=P&&P[N];if(M)return M.call(P);throw new Ji(`Response type '${N}' is not supported`,Ji.ERR_NOT_SUPPORT,j)})});const A=async N=>{if(N==null)return 0;if(qe.isBlob(N))return N.size;if(qe.isSpecCompliantForm(N))return(await new i(Ta.origin,{method:"POST",body:N}).arrayBuffer()).byteLength;if(qe.isArrayBufferView(N)||qe.isArrayBuffer(N))return N.byteLength;if(qe.isURLSearchParams(N)&&(N=N+""),qe.isString(N))return(await h(N)).byteLength},_=async(N,P)=>{const j=qe.toFiniteNumber(N.getContentLength());return j??A(P)};return async N=>{let{url:P,method:j,data:M,signal:G,cancelToken:q,timeout:re,onDownloadProgress:ee,onUploadProgress:de,responseType:ie,headers:se,withCredentials:ue="same-origin",fetchOptions:z}=e2e(N),X=p||fetch;ie=ie?(ie+"").toLowerCase():"text";let ce=Mgi([G,q&&q.toAbortSignal()],re),oe=null;const me=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let ve;try{if(de&&m&&j!=="get"&&j!=="head"&&(ve=await _(se,M))!==0){let et=new i(P,{method:"POST",body:M,duplex:"half"}),Ze;if(qe.isFormData(M)&&(Ze=et.headers.get("content-type"))&&se.setContentType(Ze),et.body){const[Xe,Dt]=$k(ve,DI(Lk(de)));M=Mk(et.body,Gk,Xe,Dt)}}qe.isString(ue)||(ue=ue?"include":"omit");const we=c&&"credentials"in i.prototype,Re={...z,signal:ce,method:j.toUpperCase(),headers:se.normalize().toJSON(),body:M,duplex:"half",credentials:we?ue:void 0};oe=c&&new i(P,Re);let xe=await(c?X(oe,z):X(P,Re));const je=E&&(ie==="stream"||ie==="response");if(E&&(ee||je&&me)){const et={};["status","statusText","headers"].forEach(Mt=>{et[Mt]=xe[Mt]});const Ze=qe.toFiniteNumber(xe.headers.get("content-length")),[Xe,Dt]=ee&&$k(Ze,DI(Lk(ee),!0))||[];xe=new r(Mk(xe.body,Gk,Xe,()=>{Dt&&Dt(),me&&me()}),et)}ie=ie||"text";let Se=await b[qe.findKey(b,ie)||"text"](xe,N);return!je&&me&&me(),await new Promise((et,Ze)=>{QLe(et,Ze,{data:Se,headers:zl.from(xe.headers),status:xe.status,statusText:xe.statusText,config:N,request:oe})})}catch(we){throw me&&me(),we&&we.name==="TypeError"&&/Load failed|fetch/i.test(we.message)?Object.assign(new Ji("Network Error",Ji.ERR_NETWORK,N,oe,we&&we.response),{cause:we.cause||we}):Ji.from(we,we&&we.code,N,oe,we&&we.response)}}},Kgi=new Map,t2e=l=>{let p=l&&l.env||{};const{fetch:i,Request:r,Response:a}=p,c=[r,a,i];let e=c.length,f=e,h,m,E=Kgi;for(;f--;)h=c[f],m=E.get(h),m===void 0&&E.set(h,m=f?new Map:Fgi(p)),E=m;return m};t2e();const Hx={http:rgi,xhr:Lgi,fetch:{get:t2e}};qe.forEach(Hx,(l,p)=>{if(l){try{Object.defineProperty(l,"name",{value:p})}catch{}Object.defineProperty(l,"adapterName",{value:p})}});const Fk=l=>`- ${l}`,qgi=l=>qe.isFunction(l)||l===null||l===!1;function Sgi(l,p){l=qe.isArray(l)?l:[l];const{length:i}=l;let r,a;const c={};for(let e=0;e<i;e++){r=l[e];let f;if(a=r,!qgi(r)&&(a=Hx[(f=String(r)).toLowerCase()],a===void 0))throw new Ji(`Unknown adapter '${f}'`);if(a&&(qe.isFunction(a)||(a=a.get(p))))break;c[f||"#"+e]=a}if(!a){const e=Object.entries(c).map(([h,m])=>`adapter ${h} `+(m===!1?"is not supported by the environment":"is not available in the build"));let f=i?e.length>1?`since :
52
52
  `+e.map(Fk).join(`