@fincity/kirun-js 1.0.3 → 1.1.0
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/__tests__/engine/function/system/array/AddFirstTest.ts +13 -12
- package/__tests__/engine/function/system/array/AddTest.ts +11 -11
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +29 -14
- package/__tests__/engine/function/system/array/CompareTest.ts +3 -3
- package/__tests__/engine/function/system/array/CopyTest.ts +5 -5
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +10 -10
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +8 -8
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +10 -10
- package/__tests__/engine/function/system/array/DeleteTest.ts +10 -10
- package/__tests__/engine/function/system/array/DisjointTest.ts +6 -7
- package/__tests__/engine/function/system/array/Equals.ts +5 -5
- package/__tests__/engine/function/system/array/FillTest.ts +5 -5
- package/__tests__/engine/function/system/array/FrequencyTest.ts +11 -11
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +14 -20
- package/__tests__/engine/function/system/array/IndexOfTest.ts +26 -14
- package/__tests__/engine/function/system/array/InsertTest.ts +12 -12
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +9 -12
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +16 -16
- package/__tests__/engine/function/system/array/MaxTest.ts +18 -18
- package/__tests__/engine/function/system/array/MinTest.ts +18 -18
- package/__tests__/engine/function/system/array/MisMatchTest.ts +8 -11
- package/__tests__/engine/function/system/array/ReverseTest.ts +12 -12
- package/__tests__/engine/function/system/array/RotateTest.ts +6 -6
- package/__tests__/engine/function/system/array/ShuffleTest.ts +7 -4
- package/__tests__/engine/function/system/array/SortTest.ts +10 -10
- package/__tests__/engine/function/system/array/SubArrayTest.ts +19 -10
- package/__tests__/engine/function/system/context/SetFunctionTest.ts +24 -5
- package/__tests__/engine/function/system/math/AddTest.ts +2 -2
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +4 -4
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +8 -4
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +6 -6
- package/__tests__/engine/function/system/string/PostPadTest.ts +6 -6
- package/__tests__/engine/function/system/string/PrePadTest.ts +8 -8
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +15 -6
- package/__tests__/engine/function/system/string/ReverseTest.ts +6 -6
- package/__tests__/engine/function/system/string/SplitTest.ts +8 -4
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +35 -11
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +14 -5
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +40 -16
- package/__tests__/engine/function/system/string/ToStringTest.ts +6 -6
- package/__tests__/engine/function/system/string/TrimToTest.ts +8 -6
- package/__tests__/engine/runtime/KIRuntimeTest.ts +148 -155
- package/__tests__/engine/util/LinkedListTest.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +344 -109
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -5
- package/src/engine/function/AbstractFunction.ts +5 -3
- package/src/engine/function/Function.ts +1 -1
- package/src/engine/function/system/GenerateEvent.ts +1 -1
- package/src/engine/function/system/If.ts +1 -1
- package/src/engine/function/system/array/Add.ts +1 -1
- package/src/engine/function/system/array/AddFirst.ts +1 -1
- package/src/engine/function/system/array/BinarySearch.ts +1 -1
- package/src/engine/function/system/array/Compare.ts +1 -1
- package/src/engine/function/system/array/Copy.ts +1 -1
- package/src/engine/function/system/array/Delete.ts +1 -1
- package/src/engine/function/system/array/DeleteFirst.ts +1 -1
- package/src/engine/function/system/array/DeleteFrom.ts +1 -1
- package/src/engine/function/system/array/DeleteLast.ts +1 -1
- package/src/engine/function/system/array/Disjoint.ts +1 -1
- package/src/engine/function/system/array/Equals.ts +2 -2
- package/src/engine/function/system/array/Fill.ts +1 -1
- package/src/engine/function/system/array/Frequency.ts +1 -1
- package/src/engine/function/system/array/IndexOf.ts +1 -1
- package/src/engine/function/system/array/IndexOfArray.ts +1 -1
- package/src/engine/function/system/array/Insert.ts +1 -1
- package/src/engine/function/system/array/LastIndexOf.ts +1 -1
- package/src/engine/function/system/array/LastIndexOfArray.ts +1 -1
- package/src/engine/function/system/array/Max.ts +1 -1
- package/src/engine/function/system/array/Min.ts +1 -1
- package/src/engine/function/system/array/MisMatch.ts +1 -1
- package/src/engine/function/system/array/Reverse.ts +1 -1
- package/src/engine/function/system/array/Rotate.ts +1 -1
- package/src/engine/function/system/array/Shuffle.ts +1 -1
- package/src/engine/function/system/array/Sort.ts +1 -1
- package/src/engine/function/system/array/SubArray.ts +1 -1
- package/src/engine/function/system/context/Create.ts +1 -1
- package/src/engine/function/system/context/Get.ts +1 -1
- package/src/engine/function/system/context/SetFunction.ts +1 -1
- package/src/engine/function/system/loop/CountLoop.ts +1 -1
- package/src/engine/function/system/loop/RangeLoop.ts +1 -1
- package/src/engine/function/system/math/Add.ts +2 -4
- package/src/engine/function/system/math/GenericMathFunction.ts +2 -4
- package/src/engine/function/system/math/Hypotenuse.ts +2 -6
- package/src/engine/function/system/math/Maximum.ts +2 -4
- package/src/engine/function/system/math/Minimum.ts +2 -4
- package/src/engine/function/system/math/Random.ts +1 -1
- package/src/engine/function/system/string/AbstractStringFunction.ts +24 -8
- package/src/engine/function/system/string/Concatenate.ts +2 -2
- package/src/engine/function/system/string/DeleteForGivenLength.ts +25 -15
- package/src/engine/function/system/string/InsertAtGivenPosition.ts +17 -7
- package/src/engine/function/system/string/PostPad.ts +20 -10
- package/src/engine/function/system/string/PrePad.ts +17 -7
- package/src/engine/function/system/string/RegionMatches.ts +40 -22
- package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +26 -13
- package/src/engine/function/system/string/Reverse.ts +4 -3
- package/src/engine/function/system/string/Split.ts +13 -4
- package/src/engine/function/system/string/ToString.ts +9 -5
- package/src/engine/function/system/string/TrimTo.ts +13 -6
- package/src/engine/runtime/KIRuntime.ts +26 -24
- package/src/engine/runtime/expression/operators/binary/index.ts +23 -0
- package/src/engine/runtime/expression/operators/unary/index.ts +5 -0
- package/src/index.ts +100 -18
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t){return Object.keys(t).forEach((function(r){"default"===r||"__esModule"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}function t(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var r={};t(r,"Tuple2",(()=>s)),t(r,"Tuple3",(()=>n)),t(r,"Tuple4",(()=>i));class s{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}}class n extends s{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}}class i extends n{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}}var a={};t(a,"HybridRepository",(()=>o));class o{constructor(...e){this.repos=e}find(e,t){for(let r of this.repos){let s=r.find(e,t);if(s)return s}}}var u={};t(u,"Schema",(()=>N));var h={};t(h,"Namespaces",(()=>l));class l{static SYSTEM="System";static SYSTEM_CTX="System.Context";static SYSTEM_LOOP="System.Loop";static SYSTEM_ARRAY="System.Array";static MATH="System.Math";static STRING="System.String";constructor(){}}var p={};function c(e){return null==e}t(p,"isNullValue",(()=>c));class m{setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!c(this.singleSchema)}static of(...e){return 1==e.length?(new m).setSingleSchema(e[0]):(new m).setTupleSchema(e)}static from(e){if(!e)return;Array.isArray(e)&&m.of(...N.fromListOfSchemas(e));let t=N.from(e);return t?m.of(t):void 0}}class g{getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(!e)return;const t=new g;return t.booleanValue=e.booleanValue,t.schemaValue=e.schemaValue,t}}var f={};let E;var T;t(f,"SchemaType",(()=>E)),(T=E||(E={})).INTEGER="Integer",T.LONG="Long",T.FLOAT="Float",T.DOUBLE="Double",T.STRING="String",T.OBJECT="Object",T.ARRAY="Array",T.BOOLEAN="Boolean",T.NULL="Null";class A{}class d extends A{constructor(e){super(),this.type=e}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}class O extends A{constructor(e){super(),this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class S{static of(...e){return 1==e.length?new O(e[0]):new d(new Set(e))}static from(e){return"string"==typeof e?S.of(e):Array.isArray(e)?S.of(...Array.of(e).map((e=>e)).map((e=>e))):void 0}}class N{static NULL=(new N).setNamespace(l.SYSTEM).setName("Null").setType(S.of(E.NULL)).setConstant(void 0);static TYPE_SCHEMA=(new N).setType(S.of(E.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=(new N).setNamespace(l.SYSTEM).setName("Schema").setType(S.of(E.OBJECT)).setProperties(new Map([["namespace",N.of("namespace",E.STRING).setDefaultValue("_")],["name",N.ofString("name")],["version",N.of("version",E.INTEGER).setDefaultValue(1)],["ref",N.ofString("ref")],["type",(new N).setAnyOf([N.TYPE_SCHEMA,N.ofArray("type",N.TYPE_SCHEMA)])],["anyOf",N.ofArray("anyOf",N.ofRef("#/"))],["allOf",N.ofArray("allOf",N.ofRef("#/"))],["oneOf",N.ofArray("oneOf",N.ofRef("#/"))],["not",N.ofRef("#/")],["title",N.ofString("title")],["description",N.ofString("description")],["id",N.ofString("id")],["examples",N.ofAny("examples")],["defaultValue",N.ofAny("defaultValue")],["comment",N.ofString("comment")],["enums",N.ofArray("enums",N.ofString("enums"))],["constant",N.ofAny("constant")],["pattern",N.ofString("pattern")],["format",N.of("format",E.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",N.ofInteger("minLength")],["maxLength",N.ofInteger("maxLength")],["multipleOf",N.ofLong("multipleOf")],["minimum",N.ofNumber("minimum")],["maximum",N.ofNumber("maximum")],["exclusiveMinimum",N.ofNumber("exclusiveMinimum")],["exclusiveMaximum",N.ofNumber("exclusiveMaximum")],["properties",N.of("properties",E.OBJECT).setAdditionalProperties((new g).setSchemaValue(N.ofRef("#/")))],["additionalProperties",(new N).setName("additionalProperty").setNamespace(l.SYSTEM).setAnyOf([N.ofBoolean("additionalProperty"),N.ofObject("additionalProperty").setRef("#/")]).setDefaultValue(!0)],["required",N.ofArray("required",N.ofString("required")).setDefaultValue([])],["propertyNames",N.ofRef("#/")],["minProperties",N.ofInteger("minProperties")],["maxProperties",N.ofInteger("maxProperties")],["patternProperties",N.of("patternProperties",E.OBJECT).setAdditionalProperties((new g).setSchemaValue(N.ofRef("#/")))],["items",(new N).setName("items").setAnyOf([N.ofRef("#/").setName("item"),N.ofArray("tuple",N.ofRef("#/"))])],["contains",N.ofRef("#/")],["minItems",N.ofInteger("minItems")],["maxItems",N.ofInteger("maxItems")],["uniqueItems",N.ofBoolean("uniqueItems")],["$defs",N.of("$defs",E.OBJECT).setAdditionalProperties((new g).setSchemaValue(N.ofRef("#/")))],["permission",N.ofString("permission")]])).setRequired([]);static ofString(e){return(new N).setType(S.of(E.STRING)).setName(e)}static ofInteger(e){return(new N).setType(S.of(E.INTEGER)).setName(e)}static ofFloat(e){return(new N).setType(S.of(E.FLOAT)).setName(e)}static ofLong(e){return(new N).setType(S.of(E.LONG)).setName(e)}static ofDouble(e){return(new N).setType(S.of(E.DOUBLE)).setName(e)}static ofAny(e){return(new N).setType(S.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.NULL,E.OBJECT)).setName(e)}static ofAnyNotNull(e){return(new N).setType(S.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.OBJECT)).setName(e)}static ofNumber(e){return(new N).setType(S.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)).setName(e)}static ofBoolean(e){return(new N).setType(S.of(E.BOOLEAN)).setName(e)}static of(e,...t){return(new N).setType(S.of(...t)).setName(e)}static ofObject(e){return(new N).setType(S.of(E.OBJECT)).setName(e)}static ofRef(e){return(new N).setRef(e)}static ofArray(e,...t){return(new N).setType(S.of(E.ARRAY)).setName(e).setItems(m.of(...t))}static fromListOfSchemas(e){if(c(e)&&!Array.isArray(e))return[];let t=[];for(let r of Array.from(e)){let e=N.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(c(e))return;const t=new Map;return Object.entries(e).forEach((([e,r])=>{let s=N.from(r);s&&t.set(e,s)})),t}static from(e,t=!1){if(c(e))return;let r=new N;return r.namespace=e.namespace,r.name=e.name,r.version=e.version,r.ref=e.ref,r.type=t?new O(E.STRING):S.from(r.type),r.anyOf=N.fromListOfSchemas(e.anyOf),r.allOf=N.fromListOfSchemas(e.allOf),r.oneOf=N.fromListOfSchemas(e.oneOf),r.not=N.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=N.fromMapOfSchemas(e.properties),r.additionalProperties=g.from(e.additionalProperties),r.required=e.required,r.propertyNames=N.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=N.fromMapOfSchemas(e.patternProperties),r.items=m.from(e.items),r.contains=N.from(e.contains),r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=N.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}namespace="_";version=1;getTitle(){return this.getFullName()}getFullName(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new O(E.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}}var I={};t(I,"SchemaValidator",(()=>F));var R={};t(R,"StringUtil",(()=>v));var w={};t(w,"KIRuntimeException",(()=>y));class y extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}var x={};t(x,"StringFormatter",(()=>_));class _{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",i=n,a=e.length;for(let o=0;o<a;o++)n=e.charAt(o),"$"==n&&"\\"==i?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,i=n;return r.toString()}constructor(){}}class v{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new y("String cannot be null");if(r<0||r>=e.length)throw new y(_.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new y(_.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return-1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return-1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}class P extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class M extends Error{constructor(e,t,r=[],s){super(t+(r?r.map((e=>e.message)).reduce(((e,t)=>e+"\n"+t),""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class L{static UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path";static CYCLIC_REFERENCE_LIMIT_COUNTER=20;static getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():e.getDefaultValue()?e.getDefaultValue():L.getDefaultValue(L.getSchemaFromRef(e,t,e.getRef()),t)}static getSchemaFromRef(e,t,r,s=0){if(++s==L.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new M(r??"","Schema has a cyclic reference");if(!e||!r||v.isNullOrBlank(r))return;if(!r.startsWith("#")){var n=L.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let i=r.split("/");return e=L.resolveInternalSchema(e,t,r,s,i,1)}static resolveInternalSchema(e,t,r,s,n,i){let a=e;for(;i<n.length;){if("$defs"===n[i]){if(++i>=n.length||!a.get$defs())throw new P(r,L.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);a=a.get$defs()?.get(n[i])}else{if(a&&(!a.getType()?.contains(E.OBJECT)||!a.getProperties()))throw new P(r,"Cannot retrievie schema from non Object type schemas");a=a.getProperties()?.get(n[i])}if(i++,!a)throw new P(r,L.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);if(!v.isNullOrBlank(a.getRef())&&(a=L.getSchemaFromRef(a,t,a.getRef(),s),!a))throw new P(r,L.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return a}static resolveExternalSchema(e,t,r){if(!t)return;let n=v.splitAtFirstOccurance(e?.getRef()??"","/");if(!n[0])return;let i=v.splitAtFirstOccurance(n[0],".");if(!i[0]||!i[1])return;let a=t.find(i[0],i[1]);if(a){if(!n[1]||""===n[1])return new s(a,r);if(r="#/"+n[1],!a)throw new P(r,L.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return new s(a,r)}}constructor(){}}class U{static validate(e,t,r,s){let n=[];return t.getOneOf()&&!t.getOneOf()?U.oneOf(e,t,r,s,n):t.getAllOf()&&!t.getAllOf()?U.allOf(e,t,r,s,n):t.getAnyOf()&&!t.getAnyOf()&&U.anyOf(e,t,r,s,n),s}static anyOf(e,t,r,s,n){let i=!1;for(let a of t.getAnyOf()??[])try{U.validate(e,a,r,s),i=!0;break}catch(e){i=!1,n.push(e)}if(!i)throw new M(F.path(e),"The value don't satisfy any of the schemas.",n)}static allOf(e,t,r,s,n){let i=0;for(let a of t.getAllOf()??[])try{U.validate(e,a,r,s),i++}catch(e){n.push(e)}if(i!==t.getAllOf()?.length)throw new M(F.path(e),"The value doesn't satisfy some of the schemas.",n)}static oneOf(e,t,r,s,n){let i=0;for(let a of t.getOneOf()??[])try{U.validate(e,a,r,s),i++}catch(e){n.push(e)}if(1!=i)throw new M(F.path(e),0==i?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}class C{static validate(e,t,r,s){if(c(s))throw new M(F.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new M(F.path(e),s.toString()+" is not an Array");let n=s;return C.checkMinMaxItems(e,t,n),C.checkItems(e,t,r,n),C.checkUniqueItems(e,t,n),C.checkContains(e,t,r,n),s}static checkContains(e,t,r,s){if(!t.getContains())return;let n=!1;for(let i=0;i<s.length;i++){let a=e?[...e]:[];try{F.validate(a,t.getContains(),r,s[i]),n=!0;break}catch(e){n=!1}}if(!n)throw new M(F.path(e),"None of the items are of type contains schema")}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()){if(new Set(r).size!==r.length)throw new M(F.path(e),"Items on the array are not unique")}}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new M(F.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new M(F.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static checkItems(e,t,r,s){if(!t.getItems())return;let n=t.getItems();if(n.getSingleSchema())for(let t=0;t<s.length;t++){let i=e?[...e]:[],a=F.validate(i,n.getSingleSchema(),r,s[t]);s[t]=a}if(n.getTupleSchema()){if(n.getTupleSchema().length!==s.length)throw new M(F.path(e),"Expected an array with only "+n.getTupleSchema().length+" but found "+s.length);for(let t=0;t<s.length;t++){let i=e?[...e]:[],a=F.validate(i,n.getTupleSchema()[t],r,s[t]);s[t]=a}}}constructor(){}}class B{static validate(e,t,r,s){if(c(s))throw new M(F.path(t),"Expected a number but found null");if("number"!=typeof s)throw new M(F.path(t),s.toString()+" is not a "+e);let n=B.extractNumber(e,t,r,s);return B.checkRange(t,r,s,n),B.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{e!=E.LONG&&e!=E.INTEGER||(n=Math.round(n))}catch(r){throw new M(F.path(t),s+" is not a number of type "+e,r)}if(c(n)||(e==E.LONG||e==E.INTEGER)&&n!=s)throw new M(F.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()){if(s%t.getMultipleOf()!=0)throw new M(F.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}}static checkRange(e,t,r,s){if(t.getMinimum()&&B.numberCompare(s,t.getMinimum())<0)throw new M(F.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(t.getMaximum()&&B.numberCompare(s,t.getMaximum())>0)throw new M(F.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(t.getExclusiveMinimum()&&B.numberCompare(s,t.getExclusiveMinimum())<=0)throw new M(F.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(t.getExclusiveMaximum()&&B.numberCompare(s,t.getExclusiveMaximum())>0)throw new M(F.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}class V{static validate(e,t,r,s){if(c(s))throw new M(F.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new M(F.path(e),s.toString()+" is not an Object");let n=s,i=new Set(Object.keys(n));V.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&V.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&V.checkRequired(e,t,n),t.getProperties()&&V.checkProperties(e,t,r,n,i),t.getPatternProperties()&&V.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&V.checkAddtionalProperties(e,t,r,n,i)}static checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{F.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new M(F.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(const s of t.getRequired()??[])if(c(r[s]))throw new M(F.path(e),s+" is mandatory")}static checkAddtionalProperties(e,t,r,s,n){let i=t.getAdditionalProperties();if(i.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[],a=F.validate(n,i.getSchemaValue(),r,s.get(t));s[t]=a}else if(!1===i.getBooleanValue()&&n.size)throw new M(F.path(e),n.toString()+" are additional properties which are not allowed.")}static checkPatternProperties(e,t,r,s,n){const i=new Map;for(const e of Array.from(t.getPatternProperties().keys()))i.set(e,new RegExp(e));for(const a of Array.from(n.values())){const o=e?[...e]:[];for(const e of Array.from(i.entries()))if(e[1].test(a)){const i=F.validate(o,t.getPatternProperties().get(e[0]),r,s[a]);s[a]=i,n.delete(a);break}}}static checkProperties(e,t,r,s,n){for(const i of Array.from(t.getProperties())){let t=s[i[0]];if(c(t))continue;let a=e?[...e]:[],o=F.validate(a,i[1],r,t);s[i[0]]=o,n.delete(i[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new M(F.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new M(F.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}let b;var D;(D=b||(b={})).DATETIME="DATETIME",D.TIME="TIME",D.DATE="DATE",D.EMAIL="EMAIL",D.REGEX="REGEX";class k{static TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/;static DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static validate(e,t,r){if(c(r))throw new M(F.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new M(F.path(e),r.toString()+" is not String");t.getFormat()==b.TIME?k.patternMatcher(e,t,r,k.TIME,"time pattern"):t.getFormat()==b.DATE?k.patternMatcher(e,t,r,k.DATE,"date pattern"):t.getFormat()==b.DATETIME?k.patternMatcher(e,t,r,k.DATETIME,"date time pattern"):t.getPattern()&&k.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new M(F.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMinLength())throw new M(F.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new M(F.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}class G{static validate(e,t,r,s,n){if(t==E.STRING)k.validate(e,r,n);else if(t==E.LONG||t==E.INTEGER||t==E.DOUBLE||t==E.FLOAT)B.validate(t,e,r,n);else if(t==E.BOOLEAN)(class{static validate(e,t,r){if(c(r))throw new M(F.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new M(F.path(e),r.toString()+" is not a boolean");return r}constructor(){}}).validate(e,r,n);else if(t==E.OBJECT)V.validate(e,r,s,n);else if(t==E.ARRAY)C.validate(e,r,s,n);else{if(t!=E.NULL)throw new M(F.path(e),t+" is not a valid type.");(class{static validate(e,t,r){if(r)throw new M(F.path(e),"Expected a null but found "+r);return r}constructor(){}}).validate(e,r,n)}return n}constructor(){}}class F{static path(e){return e?e.map((e=>e.getTitle()??"")).filter((e=>!!e)).reduce(((e,t,r)=>e+(0===r?"":".")+t),""):""}static validate(e,t,r,s){if(!t)return s;if(e||(e=new Array),e.push(t),c(s)&&!c(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(t.getConstant())return F.constantValidation(e,t,s);if(t.getEnums()&&!t.getEnums()?.length)return F.enumCheck(e,t,s);if(t.getType()&&F.typeValidation(e,t,r,s),!v.isNullOrBlank(t.getRef()))return F.validate(e,L.getSchemaFromRef(e[0],r,t.getRef()),r,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&U.validate(e,t,r,s),t.getNot()){let n=!1;try{F.validate(e,t.getNot(),r,s),n=!0}catch(e){n=!1}if(n)throw new M(F.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!t.getConstant().equals(r))throw new M(F.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new M(F.path(e),"Value is not one of "+t.getEnums())}static typeValidation(e,t,r,s){let n=!1,i=[];for(const a of Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]))try{G.validate(e,a,t,r,s),n=!0;break}catch(e){n=!1,i.push(e)}if(!n)throw new M(F.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",i)}constructor(){}}var $={};t($,"KIRunConstants",(()=>Y));class Y{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}var H={};t(H,"ExecutionException",(()=>W));class W extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}var j={};t(j,"AbstractFunction",(()=>q));class q{validateArguments(e){return Array.from(this.getSignature().getParameters().entries()).map((t=>{let r,n=t[0],i=t[1],a=e.get(t[0]);if(c(a))return new s(n,F.validate(void 0,i.getSchema(),void 0,void 0));if(!i?.isVariableArgument())return new s(n,F.validate(void 0,i.getSchema(),void 0,a));Array.isArray(a)?r=a:(r=[],r.push(a));for(const e of r)F.validate(void 0,i.getSchema(),void 0,e);return new s(n,a)})).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}execute(e){return e.setArguments(this.validateArguments(e.getArguments()??new Map)),this.internalExecute(e)}getProbableEventSignature(e){return this.getSignature().getEvents()}}var X={};t(X,"KIRuntime",(()=>ht));class Q{constructor(e){this.expression=e}getExpression(){return this.expression}}class J{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=(new N).setNamespace(l.SYSTEM).setName(J.SCHEMA_NAME).setType(S.of(E.OBJECT)).setProperties(new Map([["name",N.ofString("name")],["parameters",N.ofObject("parameter").setAdditionalProperties((new g).setSchemaValue(N.SCHEMA))]]));constructor(e,t){this.name=e,this.parameters=t}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return J.eventMapEntry(J.OUTPUT,e)}static eventMapEntry(e,t){return[e,new J(e,t)]}}class K{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return K.of(J.OUTPUT,e)}static of(e,t){return new K(e,t)}}class z{index=0;constructor(e){if(c(e))throw new y("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof K?this.fo=e:(this.fo=[],this.generator=e)}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;const e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}let Z;var ee;(ee=Z||(Z={})).CONSTANT="CONSTANT",ee.EXPRESSION="EXPRESSION";class te{static SCHEMA_NAME="Parameter";static SCHEMA=(new N).setNamespace(l.SYSTEM).setName(te.SCHEMA_NAME).setProperties(new Map([["schema",N.SCHEMA],["parameterName",N.ofString("parameterName")],["variableArgument",N.of("variableArgument",E.BOOLEAN).setDefaultValue(!1)]]));static EXPRESSION=(new N).setNamespace(l.SYSTEM).setName("ParameterExpression").setType(S.of(E.OBJECT)).setProperties(new Map([["isExpression",N.ofBoolean("isExpression").setDefaultValue(!0)],["value",N.ofAny("value")]]));variableArgument=!1;type=Z.EXPRESSION;constructor(e,t){this.schema=t,this.parameterName=e}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=Z.EXPRESSION){return[e,new te(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=Z.EXPRESSION){return new te(e,t).setType(s).setVariableArgument(r)}}let re;var se;(se=re||(re={})).VALUE="VALUE",se.EXPRESSION="EXPRESSION";var ne={};t(ne,"LinkedList",(()=>ie));class ie{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(const t of e)if(this.head){const e=new ae(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new ae(t);this.length=e.length}}push(e){const t=new ae(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");const e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;const t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw new Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new y(_.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,e=e.next,e&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw new Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw new Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw new Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw new Error("List is empty so cannot remove");--this.length;const e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{const e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length?(e.forEach(this.add.bind(this)),this):this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new ae(e,this.head),this.head.next=this.tail):(this.tail=new ae(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new ae(e),this}map(e,t){let r=new ie,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class ae{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}var oe={};t(oe,"ExpressionEvaluator",(()=>ze));class ue{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new y(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var he={};t(he,"ExpressionEvaluationException",(()=>le));class le extends Error{constructor(e,t,r){super(_.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var pe={};t(pe,"Expression",(()=>Ee));var ce={};t(ce,"ExpressionToken",(()=>me));class me{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var ge={};t(ge,"Operation",(()=>fe));class fe{static MULTIPLICATION=new fe("*");static DIVISION=new fe("/");static INTEGER_DIVISION=new fe("//");static MOD=new fe("%");static ADDITION=new fe("+");static SUBTRACTION=new fe("-");static NOT=new fe("not",void 0,!0);static AND=new fe("and",void 0,!0);static OR=new fe("or",void 0,!0);static LESS_THAN=new fe("<");static LESS_THAN_EQUAL=new fe("<=");static GREATER_THAN=new fe(">");static GREATER_THAN_EQUAL=new fe(">=");static EQUAL=new fe("=");static NOT_EQUAL=new fe("!=");static BITWISE_AND=new fe("&");static BITWISE_OR=new fe("|");static BITWISE_XOR=new fe("^");static BITWISE_COMPLEMENT=new fe("~");static BITWISE_LEFT_SHIFT=new fe("<<");static BITWISE_RIGHT_SHIFT=new fe(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new fe(">>>");static UNARY_PLUS=new fe("UN: +","+");static UNARY_MINUS=new fe("UN: -","-");static UNARY_LOGICAL_NOT=new fe("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new fe("UN: ~","~");static ARRAY_OPERATOR=new fe("[");static OBJECT_OPERATOR=new fe(".");static VALUE_OF=new Map([["MULTIPLICATION",fe.MULTIPLICATION],["DIVISION",fe.DIVISION],["INTEGER_DIVISON",fe.INTEGER_DIVISION],["MOD",fe.MOD],["ADDITION",fe.ADDITION],["SUBTRACTION",fe.SUBTRACTION],["NOT",fe.NOT],["AND",fe.AND],["OR",fe.OR],["LESS_THAN",fe.LESS_THAN],["LESS_THAN_EQUAL",fe.LESS_THAN_EQUAL],["GREATER_THAN",fe.GREATER_THAN],["GREATER_THAN_EQUAL",fe.GREATER_THAN_EQUAL],["EQUAL",fe.EQUAL],["NOT_EQUAL",fe.NOT_EQUAL],["BITWISE_AND",fe.BITWISE_AND],["BITWISE_OR",fe.BITWISE_OR],["BITWISE_XOR",fe.BITWISE_XOR],["BITWISE_COMPLEMENT",fe.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",fe.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",fe.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",fe.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",fe.UNARY_PLUS],["UNARY_MINUS",fe.UNARY_MINUS],["UNARY_LOGICAL_NOT",fe.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",fe.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",fe.ARRAY_OPERATOR],["OBJECT_OPERATOR",fe.OBJECT_OPERATOR]]);static UNARY_OPERATORS=new Set([fe.ADDITION,fe.SUBTRACTION,fe.NOT,fe.BITWISE_COMPLEMENT,fe.UNARY_PLUS,fe.UNARY_MINUS,fe.UNARY_LOGICAL_NOT,fe.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([fe.MULTIPLICATION,fe.DIVISION,fe.INTEGER_DIVISION,fe.MOD,fe.ADDITION,fe.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([fe.NOT,fe.AND,fe.OR,fe.LESS_THAN,fe.LESS_THAN_EQUAL,fe.GREATER_THAN,fe.GREATER_THAN_EQUAL,fe.EQUAL,fe.NOT_EQUAL]);static BITWISE_OPERATORS=new Set([fe.BITWISE_AND,fe.BITWISE_COMPLEMENT,fe.BITWISE_LEFT_SHIFT,fe.BITWISE_OR,fe.BITWISE_RIGHT_SHIFT,fe.BITWISE_UNSIGNED_RIGHT_SHIFT,fe.BITWISE_XOR]);static OPERATOR_PRIORITY=new Map([[fe.UNARY_PLUS,1],[fe.UNARY_MINUS,1],[fe.UNARY_LOGICAL_NOT,1],[fe.UNARY_BITWISE_COMPLEMENT,1],[fe.ARRAY_OPERATOR,1],[fe.OBJECT_OPERATOR,1],[fe.MULTIPLICATION,2],[fe.DIVISION,2],[fe.INTEGER_DIVISION,2],[fe.MOD,2],[fe.ADDITION,3],[fe.SUBTRACTION,3],[fe.BITWISE_LEFT_SHIFT,4],[fe.BITWISE_RIGHT_SHIFT,4],[fe.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[fe.LESS_THAN,5],[fe.LESS_THAN_EQUAL,5],[fe.GREATER_THAN,5],[fe.GREATER_THAN_EQUAL,5],[fe.EQUAL,6],[fe.NOT_EQUAL,6],[fe.BITWISE_AND,7],[fe.BITWISE_XOR,8],[fe.BITWISE_OR,9],[fe.AND,10],[fe.OR,11]]);static OPERATORS=new Set([...Array.from(fe.ARITHMETIC_OPERATORS),...Array.from(fe.LOGICAL_OPERATORS),...Array.from(fe.BITWISE_OPERATORS),fe.ARRAY_OPERATOR,fe.OBJECT_OPERATOR].map((e=>e.getOperator())));static OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(fe.ARITHMETIC_OPERATORS),...Array.from(fe.LOGICAL_OPERATORS),...Array.from(fe.BITWISE_OPERATORS),fe.ARRAY_OPERATOR,fe.OBJECT_OPERATOR].filter((e=>!e.shouldBeWrappedInSpace())).map((e=>e.getOperator())));static OPERATION_VALUE_OF=new Map(Array.from(fe.VALUE_OF.entries()).map((([e,t])=>[t.getOperator(),t])));static UNARY_MAP=new Map([[fe.ADDITION,fe.UNARY_PLUS],[fe.SUBTRACTION,fe.UNARY_MINUS],[fe.NOT,fe.UNARY_LOGICAL_NOT],[fe.BITWISE_COMPLEMENT,fe.UNARY_BITWISE_COMPLEMENT],[fe.UNARY_PLUS,fe.UNARY_PLUS],[fe.UNARY_MINUS,fe.UNARY_MINUS],[fe.UNARY_LOGICAL_NOT,fe.UNARY_LOGICAL_NOT],[fe.UNARY_BITWISE_COMPLEMENT,fe.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(fe.VALUE_OF.values()).map((e=>e.getOperator())).filter((e=>!e.startsWith("UN: "))).map((e=>e.length)).reduce(((e,t)=>e>t?e:t),0);constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return fe.VALUE_OF.get(e)}toString(){return this.operator}}class Ee extends me{tokens=new ie;ops=new ie;constructor(e,t,r,s){super(e||""),t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){const e=this.expression.length;let t,r="",s=new ue(""),n=0,i=!1;for(;n<e;){switch(r=this.expression[n],t=s.toString(),r){case" ":i=this.processTokenSepearator(s,t,i);break;case"(":n=this.processSubExpression(e,s,t,n,i),i=!1;break;case")":throw new le(this.expression,"Extra closing parenthesis found");case"]":throw new le(this.expression,"Extra closing square bracket found");default:let a=this.processOthers(r,e,s,t,n,i);n=a.getT1(),i=a.getT2(),i&&this.ops.peek()==fe.ARRAY_OPERATOR&&(a=this.process(e,s,n),n=a.getT1(),i=a.getT2())}++n}if(t=s.toString(),!v.isNullOrBlank(t)){if(fe.OPERATORS.has(t))throw new le(this.expression,"Expression is ending with an operator");this.tokens.push(new me(t))}}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new Ee(t.toString())),t.setLength(0),new s(r,!1)}processOthers(e,t,r,n,i,a){let o=t-i;o=o<fe.BIGGEST_OPERATOR_SIZE?o:fe.BIGGEST_OPERATOR_SIZE;for(let e=o;e>0;e--){let t=this.expression.substring(i,i+e);if(fe.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return v.isNullOrBlank(n)||(this.tokens.push(new me(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,fe.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new s(i+e-1,a)}return r.append(e),new s(i,!1)}processSubExpression(e,t,r,s,n){if(fe.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,fe.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!v.isNullOrBlank(r))throw new le(this.expression,_.format("Unkown token : $ found.",r));let i=1;const a=new ue;let o=this.expression.charAt(s);for(s++;s<e&&i>0;)o=this.expression.charAt(s),"("==o?i++:")"==o&&i--,0!=i&&(a.append(o),s++);if(")"!=o)throw new le(this.expression,"Missing a closed parenthesis");for(;a.length()>2&&"("==a.charAt(0)&&")"==a.charAt(a.length()-1);)a.deleteCharAt(0),a.setLength(a.length()-1);return this.tokens.push(new Ee(a.toString().trim())),s}processTokenSepearator(e,t,r){return v.isNullOrBlank(t)||(fe.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,fe.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new me(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r)if(s||e.isEmpty()){if(!fe.UNARY_OPERATORS.has(r))throw new le(this.expression,_.format("Extra operator $ found.",r));{const e=fe.UNARY_MAP.get(r);e&&t.push(e)}}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(fe.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new Ee("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new Ee("",s,t,r))}}t.push(r)}}hasPrecedence(e,t){let r=fe.OPERATOR_PRIORITY.get(e),s=fe.OPERATOR_PRIORITY.get(t);if(!r||!s)throw new Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new ue,t=0;const r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof Ee?s[t].toString():s[t]).append(")"),t++;else{if(0==t){const r=s[t++];e.insert(0,r.toString())}const i=s[t++];e.insert(0,r[n].getOperator()).insert(0,i.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var Te={};t(Te,"ExpressionTokenValue",(()=>Ae));class Ae extends me{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return _.format("$: $",this.expression,this.element)}}class de{nullCheck(e,t,r){if(c(e)||c(t))throw new W(_.format("$ cannot be applied to a null value",r.getOperatorName()))}}class Oe extends de{apply(e,t){return this.nullCheck(e,t,fe.ADDITION),e+t}}class Se extends de{apply(e,t){return this.nullCheck(e,t,fe.DIVISION),e/t}}class Ne extends de{apply(e,t){return this.nullCheck(e,t,fe.DIVISION),Math.floor(e/t)}}class Ie extends de{apply(e,t){return this.nullCheck(e,t,fe.MOD),e%t}}class Re extends de{apply(e,t){return this.nullCheck(e,t,fe.MULTIPLICATION),e*t}}class we extends de{apply(e,t){return this.nullCheck(e,t,fe.SUBTRACTION),e-t}}class ye extends de{apply(e,t){if(!e)throw new W("Cannot apply array operator on a null value");if(!t)throw new W("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new W(_.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new W(_.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}class xe extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_AND),e&t}}class _e extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_LEFT_SHIFT),e<<t}}class ve extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_OR),e|t}}class Pe extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_RIGHT_SHIFT),e>>t}}class Me extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}class Le extends de{apply(e,t){return this.nullCheck(e,t,fe.BITWISE_XOR),e^t}}class Ue{static findPrimitiveNullAsBoolean(e){if(!e)return new s(E.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new W(_.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new s(E.BOOLEAN,r):"string"===t?new s(E.STRING,r):Ue.findPrimitiveNumberType(r)}static findPrimitive(e){if(c(e))return new s(E.NULL,void 0);let t=typeof e;if("object"===t)throw new W(_.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new s(E.BOOLEAN,r):"string"===t?new s(E.STRING,r):Ue.findPrimitiveNumberType(r)}static findPrimitiveNumberType(e){if(c(e)||Array.isArray(e)||"object"==typeof e)throw new W(_.format("Unable to convert $ to a number.",e));let t=e;try{let e=t;return Number.isInteger(e)?new s(E.LONG,e):new s(E.DOUBLE,e)}catch(e){throw new W(_.format("Unable to convert $ to a number.",t),e)}}static compare(e,t){if(e==t)return 0;if(c(e)||c(t))return c(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}const r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach((r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s})),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return c(e)||c(t)?c(e)&&c(t)?0:c(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?E.LONG:E.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class Ce extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()!=E.BOOLEAN)throw new W(_.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=E.BOOLEAN)throw new W(_.format("Boolean value expected but found $",s.getT2()));return r.getT2()&&s.getT2()}}class Be extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);return r.getT2()==s.getT2()}}class Ve extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||s.getT1()==E.BOOLEAN)throw new W(_.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}class be extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||s.getT1()==E.BOOLEAN)throw new W(_.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}class De extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||s.getT1()==E.BOOLEAN)throw new W(_.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}class ke extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||s.getT1()==E.BOOLEAN)throw new W(_.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}class Ge extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);return r.getT2()!=s.getT2()}}class Fe extends de{apply(e,t){const r=Ue.findPrimitiveNullAsBoolean(e),s=Ue.findPrimitiveNullAsBoolean(t);if(r.getT1()!=E.BOOLEAN)throw new W(_.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=E.BOOLEAN)throw new W(_.format("Boolean value expected but found $",s.getT2()));return r.getT2()||s.getT2()}}class $e extends de{apply(e,t){if(!e)throw new W("Cannot apply array operator on a null value");if(!t)throw new W("Cannot retrive null property value");const r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new W(_.format("Cannot retrieve value from a primitive value $",e));return e[t]}}class Ye{nullCheck(e,t){if(c(e))throw new W(_.format("$ cannot be applied to a null value",t.getOperatorName()))}}class He extends Ye{apply(e){return this.nullCheck(e,fe.UNARY_MINUS),Ue.findPrimitiveNumberType(e),-e}}class We extends Ye{apply(e){return this.nullCheck(e,fe.UNARY_PLUS),Ue.findPrimitiveNumberType(e),e}}class je extends Ye{apply(e){this.nullCheck(e,fe.UNARY_BITWISE_COMPLEMENT);let t=Ue.findPrimitiveNumberType(e);if(t.getT1()!=E.INTEGER&&t.getT1()!=E.LONG)throw new W(_.format("Unable to apply bitwise operator on $",e));return~e}}class qe extends Ye{apply(e){if(this.nullCheck(e,fe.UNARY_LOGICAL_NOT),Ue.findPrimitiveNumberType(e).getT1()!=E.BOOLEAN)throw new W(_.format("Unable to apply bitwise operator on $",e));return!e}}var Xe={};t(Xe,"TokenValueExtractor",(()=>Qe));class Qe{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new y(_.format("Token $ doesn't start with $",e,t));return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(c(s))return;if(t.length==r)return s;let n=t[r].split(Qe.REGEX_SQUARE_BRACKETS).map((e=>e.trim())).filter((e=>!v.isNullOrBlank(e))).reduce(((s,n,i)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s,i)),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n,i){if(!c(n)){if(0===i){if(Array.isArray(n)){if("length"===s)return n.length;try{let e=parseInt(s);if(isNaN(e))throw new Error(_.format("$ is not a number",e));if(e>=n.length)return;return n[e]}catch(t){throw new le(e,_.format("$ couldn't be parsed into integer in $",s,e),t)}}return this.checkIfObject(e,t,r,n),n[s]}if(s?.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new le(e,_.format("$ is missing a double quote or empty key found",e));return this.checkIfObject(e,t,r,n),n[s.substring(1,s.length-1)]}try{let t=parseInt(s);if(isNaN(t))throw new Error(_.format("$ is not a number",t));if(!Array.isArray(n))throw new le(e,_.format("Expecting an array with index $ while processing the expression",t,e));if(t>=n.length)return;return n[t]}catch(t){throw new le(e,_.format("$ couldn't be parsed into integer in $",s,e),t)}}}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new le(e,_.format("Unable to retrive $ from $ in the path $",t[r],s.toString(),e))}}const Je=new Map([["true",!0],["false",!1],["null",void 0]]);class Ke extends Qe{static INSTANCE=new Ke;getValueInternal(e){if(!v.isNullOrBlank(e))return e=e.trim(),Je.has(e)?Je.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t;if(t=-1==e.indexOf(".")?parseInt(e):parseFloat(e),isNaN(t))throw new Error("Parse number error");return t}catch(t){throw new le(e,_.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new le(e,_.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}}class ze{static UNARY_OPERATORS_MAP=new Map([[fe.UNARY_BITWISE_COMPLEMENT,new je],[fe.UNARY_LOGICAL_NOT,new qe],[fe.UNARY_MINUS,new He],[fe.UNARY_PLUS,new We]]);static BINARY_OPERATORS_MAP=new Map([[fe.ADDITION,new Oe],[fe.DIVISION,new Se],[fe.INTEGER_DIVISION,new Ne],[fe.MOD,new Ie],[fe.MULTIPLICATION,new Re],[fe.SUBTRACTION,new we],[fe.BITWISE_AND,new xe],[fe.BITWISE_LEFT_SHIFT,new _e],[fe.BITWISE_OR,new ve],[fe.BITWISE_RIGHT_SHIFT,new Pe],[fe.BITWISE_UNSIGNED_RIGHT_SHIFT,new Me],[fe.BITWISE_XOR,new Le],[fe.AND,new Ce],[fe.EQUAL,new Be],[fe.GREATER_THAN,new be],[fe.GREATER_THAN_EQUAL,new Ve],[fe.LESS_THAN,new ke],[fe.LESS_THAN_EQUAL,new De],[fe.OR,new Fe],[fe.NOT_EQUAL,new Ge],[fe.ARRAY_OPERATOR,new ye],[fe.OBJECT_OPERATOR,new $e]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(ze.UNARY_OPERATORS_MAP.keys());constructor(e){e instanceof Ee?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){return this.exp||(this.exp=new Ee(this.expression)),this.evaluateExpression(this.exp,e)}getExpression(){return this.exp||(this.exp=new Ee(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),a=s.pop();if(ze.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,a)));else if(e==fe.OBJECT_OPERATOR||e==fe.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,a);else{const r=s.pop();var n=this.getValueFromToken(t,r),i=this.getValueFromToken(t,a);s.push(this.applyBinaryOperation(e,n,i))}}if(s.isEmpty())throw new W(_.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new W(_.format("Expression : $ evaluated multiple values $",e,s));const a=s.get(0);if(a instanceof Ae)return a.getElement();if(!(a instanceof Ee))return this.getValueFromToken(t,a);throw new W(_.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){const i=new ie,a=new ie;if(!s||!n)return;do{a.push(s),n instanceof Ee?i.push(new Ae(n.toString(),this.evaluateExpression(n,e))):n&&i.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop()}while(s==fe.OBJECT_OPERATOR||s==fe.ARRAY_OPERATOR);n&&(n instanceof Ee?i.push(new Ae(n.toString(),this.evaluateExpression(n,e))):i.push(n)),s&&t.push(s);let o=i.pop(),u=new ue(o instanceof Ae?o.getTokenValue():o.toString());for(;!i.isEmpty();)o=i.pop(),s=a.pop(),u.append(s.getOperator()).append(o instanceof Ae?o.getTokenValue():o.toString()),s==fe.ARRAY_OPERATOR&&u.append("]");let h=u.toString(),l=h.substring(0,h.indexOf(".")+1);if(l.length>2&&e.has(l))r.push(new Ae(h,this.getValue(h,e)));else{let e;try{e=Ke.INSTANCE.getValue(h)}catch(t){e=h}r.push(new Ae(h,e))}}applyBinaryOperation(e,t,r){if("object"===typeof t||"object"===typeof r||Array.isArray(t)||Array.isArray(r))throw new le(this.expression,_.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));let s=ze.BINARY_OPERATORS_MAP.get(e);if(!s)throw new le(this.expression,_.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new Ae(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){if("object"===typeof t||Array.isArray(t))throw new le(this.expression,_.format("The operator $ cannot be applied to $",e.getOperator(),t));let r=ze.UNARY_OPERATORS_MAP.get(e);if(!r)throw new le(this.expression,_.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new Ae(e.toString(),r.apply(t))}getValueFromToken(e,t){return t instanceof Ee?this.evaluateExpression(t,e):t instanceof Ae?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){if(e.length<=5)return Ke.INSTANCE.getValue(e);const r=e.substring(0,e.indexOf(".")+1);return(t.get(r)??Ke.INSTANCE).getValue(e)}}class Ze extends Qe{static PREFIX="Arguments.";constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(Qe.REGEX_DOT);return this.retrieveElementFrom(e,t,2,this.args.get(t[1]))}getPrefix(){return Ze.PREFIX}}class et extends Qe{static PREFIX="Context.";constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(Qe.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return-1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return et.PREFIX}}class tt extends Qe{static PREFIX="Steps.";constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(Qe.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>=t.length)return;let i=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,i)}getPrefix(){return tt.PREFIX}}class rt{count=0;valueExtractors=new Map;getContext(){return this.context}setContext(e){this.context=e;let t=new et(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){this.args=e;let t=new Ze(e);return this.valueExtractors.set(t.getPrefix(),t),this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new tt(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}}class st{outVertices=new Map;inVertices=new Set;constructor(e,t){this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new s(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new s(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new nt(!0);var r=new ie(Array.from(this.outVertices.get(e)??[]));for(r.map((e=>e.getData())).forEach((e=>t.addVertex(e)));!r.isEmpty();){var s=r.pop();Array.from(s.outVertices.values()).flatMap((e=>Array.from(e))).forEach((e=>{t.addVertex(e.getData()),r.add(e)}))}return t}toString(){var e=Array.from(this.getInVertices()).map((e=>e.getT1().getKey()+"("+e.getT2()+")")).join(", "),t=Array.from(this.outVertices.entries()).map((([e,t])=>e+": "+Array.from(t).map((e=>e.getKey())).join(","))).join("\n\t\t");return this.getKey()+":\n\tIn: "+e+"\n\tOut: \n\t\t"+t}}class nt{nodeMap=new Map;constructor(e=!1){this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map((e=>e.getData()))}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new st(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter((e=>!e.hasIncomingEdges()))}isCyclic(){let e,t=new ie(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap((e=>Array.from(e))))}return!1}addVertices(e){for(const t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map((e=>e.toString())).join("\n")}}class it{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class at{messages=new Array;dependencies=new Set;constructor(e){this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new it(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){if(!(e instanceof at))return!1;return e.statement.equals(this.statement)}}let ot;var ut;(ut=ot||(ot={})).ERROR="ERROR",ut.WARNING="WARNING",ut.MESSAGE="MESSAGE";class ht extends q{static PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value';static STEP_REGEX_PATTERN=new RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g");static VERSION=1;static MAX_EXECUTION_ITERATIONS=1e7;constructor(e,t,r){if(super(),this.fd=e,this.fd.getVersion()>ht.VERSION)throw new y("Runtime is at a lower version "+ht.VERSION+" and trying to run code from version "+this.fd.getVersion()+".");this.fRepo=t,this.sRepo=r}getSignature(){return this.fd}getExecutionPlan(e){let t=new nt;for(let r of Array.from(this.fd.getSteps().values()))t.addVertex(this.prepareStatementExecution(e,r));let r=this.makeEdges(t);if(r.length)throw new y(_.format("Found these unresolved dependencies : $ ",r.map((e=>_.format("Steps.$.$",e.getT1(),e.getT2())))));return t}internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map);let t=this.getExecutionPlan(e.getContext()),r=t.getVerticesData().filter((e=>e.getMessages().length)).map((e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(",")));if(r?.length)throw new y("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return this.executeGraph(t,e)}executeGraph(e,t){let r=new ie;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new ie;for(;!(r.isEmpty()&&s.isEmpty()||t.getEvents()?.has(J.OUTPUT));)if(this.processBranchQue(t,r,s),this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==ht.MAX_EXECUTION_ITERATIONS)throw new y("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size)throw new y("No events raised");return new z(Array.from(t.getEvents()?.entries()??[]).flatMap((e=>e[1].map((t=>K.of(e[0],t))))))}processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();this.allDependenciesResolvedVertex(s,e.getSteps())?this.executeVertex(s,e,r,t):t.add(s)}}processBranchQue(e,t,r){if(r.length){let s=r.pop();this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?this.executeBranch(e,t,s):r.add(s)}}executeBranch(e,t,r){let s,n=r.getT4();do{this.executeGraph(r.getT1(),e),s=r.getT3().next(),s&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),this.resolveInternalExpressions(s.getResult(),e)))}while(s&&s.getName()!=J.OUTPUT);s?.getName()==J.OUTPUT&&n.getOutVertices().has(J.OUTPUT)&&(n?.getOutVertices()?.get(J.OUTPUT)??[]).forEach((e=>t.add(e)))}executeVertex(e,t,r,s){let n=e.getData().getStatement(),a=this.fRepo.find(n.getNamespace(),n.getName());if(!a)throw new y(_.format("$.$ function is not found.",n.getNamespace(),n.getName()));let o=a?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,n,o??new Map),h=t.getContext(),l=a.execute((new rt).setContext(h).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount())),p=l.next();if(!p)throw new y(_.format("Executing $ returned no events",n.getStatementName()));let c=p.getName()==J.OUTPUT;if(t.getSteps()?.has(n.getStatementName())||t.getSteps().set(n.getStatementName(),new Map),t.getSteps().get(n.getStatementName()).set(p.getName(),this.resolveInternalExpressions(p.getResult(),t)),c){let t=e.getOutVertices().get(J.OUTPUT);t&&t.forEach((e=>s.add(e)))}else{let t=e.getSubGraphOfType(p.getName()),s=this.makeEdges(t);r.push(new i(t,s,l,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map((e=>new s(e[0],this.resolveInternalExpression(e[1],t)))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map):e}resolveInternalExpression(e,t){if(c(e)||"object"!=typeof e)return e;if(e instanceof Q){return new ze(e.getExpression()).evaluate(t.getValuesMap())}if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e){if(!t.has(r.getT1()))return!1;if(!t.get(r.getT1())?.get(r.getT2()))return!1}return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter((e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))})).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map((t=>{let n,i=t[1];if(!i?.length)return new s(t[0],n);let a=r.get(t[0]);return a?(n=a.isVariableArgument()?i.map((t=>this.parameterReferenceEvaluation(e,t))).flatMap((e=>Array.isArray(e)?e:[e])):this.parameterReferenceEvaluation(e,i[0]),new s(t[0],n)):new s(t[0],void 0)})).filter((e=>!c(e.getT2()))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}parameterReferenceEvaluation(e,t){let r;if(t.getType()==re.VALUE)r=this.resolveInternalExpression(t.getValue(),e);else if(t.getType()==re.EXPRESSION&&!v.isNullOrBlank(t.getExpression())){r=new ze(t.getExpression()??"").evaluate(e.getValuesMap())}return r}prepareStatementExecution(e,t){let r=new at(t),s=this.fRepo.find(t.getNamespace(),t.getName());if(!s)throw new y(_.format("$.$ was not available",t.getNamespace(),t.getName()));let n=new Map(s.getSignature().getParameters());for(let s of Array.from(t.getParameterMap().entries())){let t=n.get(s[0]);if(!t)continue;let i=s[1];if(i.length){if(t.isVariableArgument())for(let s of i)this.parameterReferenceValidation(e,r,t,s);else{let s=i[0];this.parameterReferenceValidation(e,r,t,s)}n.delete(t.getParameterName())}else c(L.getDefaultValue(t.getSchema(),this.sRepo))&&r.addMessage(ot.ERROR,_.format(ht.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}if(!c(r.getStatement().getDependentStatements()))for(let e of r.getStatement().getDependentStatements())r.addDependency(e);if(n.size)for(let e of Array.from(n.values()))c(L.getDefaultValue(e.getSchema(),this.sRepo))&&r.addMessage(ot.ERROR,_.format(ht.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return r}parameterReferenceValidation(e,t,r,n){if(n){if(n.getType()==re.VALUE){c(n.getValue())&&c(L.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(ot.ERROR,_.format(ht.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));let e=new ie;for(e.push(new s(r.getSchema(),n.getValue()));!e.isEmpty();){let r=e.pop();if(r.getT2()instanceof Q)this.addDependencies(t,r.getT2().getExpression());else{if(c(r.getT1())||c(r.getT1().getType()))continue;if(r.getT1().getType()?.contains(E.ARRAY)&&Array.isArray(r.getT2())){let t=r.getT1().getItems();if(!t)continue;if(t.isSingleType())for(let n of r.getT2())e.push(new s(t.getSingleSchema(),n));else{let n=r.getT2();for(let r=0;r<n.length;r++)e.push(new s(t.getTupleSchema()[r],n[r]))}}else if(r.getT1().getType()?.contains(E.OBJECT)&&"object"==typeof r.getT2()){let n=r.getT1();if(n.getName()===te.EXPRESSION.getName()&&n.getNamespace()===te.EXPRESSION.getNamespace()){let e=r.getT2();e.isExpression&&this.addDependencies(t,e.value)}else if(n.getProperties())for(let t of Object.entries(r.getT2()))n.getProperties().has(t[0])&&e.push(new s(n.getProperties().get(t[0]),t[1]))}}}}else if(n.getType()==re.EXPRESSION)if(v.isNullOrBlank(n.getExpression()))c(L.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(ot.ERROR,_.format(ht.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));else try{this.addDependencies(t,n.getExpression())}catch(e){t.addMessage(ot.ERROR,_.format("Error evaluating $ : $",n.getExpression(),e))}}else c(L.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(ot.ERROR,_.format(ht.PARAMETER_NEEDS_A_VALUE,r.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(ht.STEP_REGEX_PATTERN)??[]).forEach((t=>e.addDependency(t)))}makeEdges(e){let t=e.getNodeMap().values(),r=[];for(let n of Array.from(t))for(let t of n.getData().getDependencies()){let i=t.indexOf(".",6),a=t.substring(6,i),o=t.indexOf(".",i+1),u=-1==o?t.substring(i+1):t.substring(i+1,o);e.getNodeMap().has(a)||r.push(new s(a,u));let h=e.getNodeMap().get(a);h&&n.addInEdgeTo(h,u)}return r}}e(module.exports,r),e(module.exports,{}),e(module.exports,a),e(module.exports,u),e(module.exports,f),e(module.exports,I),e(module.exports,$),e(module.exports,H),e(module.exports,w),e(module.exports,{}),e(module.exports,j),e(module.exports,h),e(module.exports,X),e(module.exports,pe),e(module.exports,oe),e(module.exports,Xe),e(module.exports,he),e(module.exports,ce),e(module.exports,Te),e(module.exports,ge),e(module.exports,ne),e(module.exports,p),e(module.exports,x),e(module.exports,R);
|
|
1
|
+
function e(e,t){return Object.keys(t).forEach((function(r){"default"===r||"__esModule"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}function t(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}var r={};t(r,"KIRunSchemaRepository",(()=>P));var s={};t(s,"Schema",(()=>N));var n={};t(n,"Namespaces",(()=>a));class a{static SYSTEM="System";static SYSTEM_CTX="System.Context";static SYSTEM_LOOP="System.Loop";static SYSTEM_ARRAY="System.Array";static MATH="System.Math";static STRING="System.String";constructor(){}}var i={};t(i,"ArraySchemaType",(()=>l));var o={};function u(e){return null==e}t(o,"isNullValue",(()=>u));class l{setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!u(this.singleSchema)}static of(...e){return 1==e.length?(new l).setSingleSchema(e[0]):(new l).setTupleSchema(e)}static from(e){if(!e)return;Array.isArray(e)&&l.of(...N.fromListOfSchemas(e));let t=N.from(e);return t?l.of(t):void 0}}var p={};t(p,"AdditionalPropertiesType",(()=>h));class h{getBooleanValue(){return this.booleanValue}getSchemaValue(){return this.schemaValue}setBooleanValue(e){return this.booleanValue=e,this}setSchemaValue(e){return this.schemaValue=e,this}static from(e){if(!e)return;const t=new h;return t.booleanValue=e.booleanValue,t.schemaValue=e.schemaValue,t}}var m={};let c;var g;t(m,"SchemaType",(()=>c)),(g=c||(c={})).INTEGER="Integer",g.LONG="Long",g.FLOAT="Float",g.DOUBLE="Double",g.STRING="String",g.OBJECT="Object",g.ARRAY="Array",g.BOOLEAN="Boolean",g.NULL="Null";var f={};t(f,"TypeUtil",(()=>w));var E={};t(E,"MultipleType",(()=>A));var T={};t(T,"Type",(()=>d));class d{}class A extends d{constructor(e){super(),this.type=e}getType(){return this.type}setType(e){return this.type=e,this}getAllowedSchemaTypes(){return this.type}contains(e){return this.type?.has(e)}}var S={};t(S,"SingleType",(()=>O));class O extends d{constructor(e){super(),this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class w{static of(...e){return 1==e.length?new O(e[0]):new A(new Set(e))}static from(e){return"string"==typeof e?w.of(e):Array.isArray(e)?w.of(...Array.of(e).map((e=>e)).map((e=>e))):void 0}}class N{static NULL=(new N).setNamespace(a.SYSTEM).setName("Null").setType(w.of(c.NULL)).setConstant(void 0);static TYPE_SCHEMA=(new N).setType(w.of(c.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=(new N).setNamespace(a.SYSTEM).setName("Schema").setType(w.of(c.OBJECT)).setProperties(new Map([["namespace",N.of("namespace",c.STRING).setDefaultValue("_")],["name",N.ofString("name")],["version",N.of("version",c.INTEGER).setDefaultValue(1)],["ref",N.ofString("ref")],["type",(new N).setAnyOf([N.TYPE_SCHEMA,N.ofArray("type",N.TYPE_SCHEMA)])],["anyOf",N.ofArray("anyOf",N.ofRef("#/"))],["allOf",N.ofArray("allOf",N.ofRef("#/"))],["oneOf",N.ofArray("oneOf",N.ofRef("#/"))],["not",N.ofRef("#/")],["title",N.ofString("title")],["description",N.ofString("description")],["id",N.ofString("id")],["examples",N.ofAny("examples")],["defaultValue",N.ofAny("defaultValue")],["comment",N.ofString("comment")],["enums",N.ofArray("enums",N.ofString("enums"))],["constant",N.ofAny("constant")],["pattern",N.ofString("pattern")],["format",N.of("format",c.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",N.ofInteger("minLength")],["maxLength",N.ofInteger("maxLength")],["multipleOf",N.ofLong("multipleOf")],["minimum",N.ofNumber("minimum")],["maximum",N.ofNumber("maximum")],["exclusiveMinimum",N.ofNumber("exclusiveMinimum")],["exclusiveMaximum",N.ofNumber("exclusiveMaximum")],["properties",N.of("properties",c.OBJECT).setAdditionalProperties((new h).setSchemaValue(N.ofRef("#/")))],["additionalProperties",(new N).setName("additionalProperty").setNamespace(a.SYSTEM).setAnyOf([N.ofBoolean("additionalProperty"),N.ofObject("additionalProperty").setRef("#/")]).setDefaultValue(!0)],["required",N.ofArray("required",N.ofString("required")).setDefaultValue([])],["propertyNames",N.ofRef("#/")],["minProperties",N.ofInteger("minProperties")],["maxProperties",N.ofInteger("maxProperties")],["patternProperties",N.of("patternProperties",c.OBJECT).setAdditionalProperties((new h).setSchemaValue(N.ofRef("#/")))],["items",(new N).setName("items").setAnyOf([N.ofRef("#/").setName("item"),N.ofArray("tuple",N.ofRef("#/"))])],["contains",N.ofRef("#/")],["minItems",N.ofInteger("minItems")],["maxItems",N.ofInteger("maxItems")],["uniqueItems",N.ofBoolean("uniqueItems")],["$defs",N.of("$defs",c.OBJECT).setAdditionalProperties((new h).setSchemaValue(N.ofRef("#/")))],["permission",N.ofString("permission")]])).setRequired([]);static ofString(e){return(new N).setType(w.of(c.STRING)).setName(e)}static ofInteger(e){return(new N).setType(w.of(c.INTEGER)).setName(e)}static ofFloat(e){return(new N).setType(w.of(c.FLOAT)).setName(e)}static ofLong(e){return(new N).setType(w.of(c.LONG)).setName(e)}static ofDouble(e){return(new N).setType(w.of(c.DOUBLE)).setName(e)}static ofAny(e){return(new N).setType(w.of(c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE,c.STRING,c.BOOLEAN,c.ARRAY,c.NULL,c.OBJECT)).setName(e)}static ofAnyNotNull(e){return(new N).setType(w.of(c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE,c.STRING,c.BOOLEAN,c.ARRAY,c.OBJECT)).setName(e)}static ofNumber(e){return(new N).setType(w.of(c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE)).setName(e)}static ofBoolean(e){return(new N).setType(w.of(c.BOOLEAN)).setName(e)}static of(e,...t){return(new N).setType(w.of(...t)).setName(e)}static ofObject(e){return(new N).setType(w.of(c.OBJECT)).setName(e)}static ofRef(e){return(new N).setRef(e)}static ofArray(e,...t){return(new N).setType(w.of(c.ARRAY)).setName(e).setItems(l.of(...t))}static fromListOfSchemas(e){if(u(e)&&!Array.isArray(e))return[];let t=[];for(let r of Array.from(e)){let e=N.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(u(e))return;const t=new Map;return Object.entries(e).forEach((([e,r])=>{let s=N.from(r);s&&t.set(e,s)})),t}static from(e,t=!1){if(u(e))return;let r=new N;return r.namespace=e.namespace,r.name=e.name,r.version=e.version,r.ref=e.ref,r.type=t?new O(c.STRING):w.from(r.type),r.anyOf=N.fromListOfSchemas(e.anyOf),r.allOf=N.fromListOfSchemas(e.allOf),r.oneOf=N.fromListOfSchemas(e.oneOf),r.not=N.from(e.not),r.description=e.description,r.examples=e.examples?[...e.examples]:void 0,r.defaultValue=e.defaultValue,r.comment=e.comment,r.enums=e.enums?[...e.enums]:void 0,r.constant=e.constant,r.pattern=e.pattern,r.format=e.format,r.minLength=e.minLength,r.maxLength=e.maxLength,r.multipleOf=e.multipleOf,r.minimum=e.minimum,r.maximum=e.maximum,r.exclusiveMinimum=e.exclusiveMinimum,r.exclusiveMaximum=e.exclusiveMaximum,r.properties=N.fromMapOfSchemas(e.properties),r.additionalProperties=h.from(e.additionalProperties),r.required=e.required,r.propertyNames=N.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=N.fromMapOfSchemas(e.patternProperties),r.items=l.from(e.items),r.contains=N.from(e.contains),r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=N.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}namespace="_";version=1;getTitle(){return this.getFullName()}getFullName(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}get$defs(){return this.$defs}set$defs(e){return this.$defs=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getVersion(){return this.version}setVersion(e){return this.version=e,this}getRef(){return this.ref}setRef(e){return this.ref=e,this}getType(){return this.type}setType(e){return this.type=e,this}getAnyOf(){return this.anyOf}setAnyOf(e){return this.anyOf=e,this}getAllOf(){return this.allOf}setAllOf(e){return this.allOf=e,this}getOneOf(){return this.oneOf}setOneOf(e){return this.oneOf=e,this}getNot(){return this.not}setNot(e){return this.not=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getExamples(){return this.examples}setExamples(e){return this.examples=e,this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}getComment(){return this.comment}setComment(e){return this.comment=e,this}getEnums(){return this.enums}setEnums(e){return this.enums=e,this}getConstant(){return this.constant}setConstant(e){return this.constant=e,this}getPattern(){return this.pattern}setPattern(e){return this.pattern=e,this}getFormat(){return this.format}setFormat(e){return this.format=e,this}getMinLength(){return this.minLength}setMinLength(e){return this.minLength=e,this}getMaxLength(){return this.maxLength}setMaxLength(e){return this.maxLength=e,this}getMultipleOf(){return this.multipleOf}setMultipleOf(e){return this.multipleOf=e,this}getMinimum(){return this.minimum}setMinimum(e){return this.minimum=e,this}getMaximum(){return this.maximum}setMaximum(e){return this.maximum=e,this}getExclusiveMinimum(){return this.exclusiveMinimum}setExclusiveMinimum(e){return this.exclusiveMinimum=e,this}getExclusiveMaximum(){return this.exclusiveMaximum}setExclusiveMaximum(e){return this.exclusiveMaximum=e,this}getProperties(){return this.properties}setProperties(e){return this.properties=e,this}getAdditionalProperties(){return this.additionalProperties}setAdditionalProperties(e){return this.additionalProperties=e,this}getRequired(){return this.required}setRequired(e){return this.required=e,this}getPropertyNames(){return this.propertyNames}setPropertyNames(e){return this.propertyNames=e,this.propertyNames.type=new O(c.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinItems(){return this.minItems}setMinItems(e){return this.minItems=e,this}getMaxItems(){return this.maxItems}setMaxItems(e){return this.maxItems=e,this}getUniqueItems(){return this.uniqueItems}setUniqueItems(e){return this.uniqueItems=e,this}getPermission(){return this.permission}setPermission(e){return this.permission=e,this}}var x={};t(x,"Parameter",(()=>y));var R={};let I;var v;t(R,"ParameterType",(()=>I)),(v=I||(I={})).CONSTANT="CONSTANT",v.EXPRESSION="EXPRESSION";class y{static SCHEMA_NAME="Parameter";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(y.SCHEMA_NAME).setProperties(new Map([["schema",N.SCHEMA],["parameterName",N.ofString("parameterName")],["variableArgument",N.of("variableArgument",c.BOOLEAN).setDefaultValue(!1)]]));static EXPRESSION=(new N).setNamespace(a.SYSTEM).setName("ParameterExpression").setType(w.of(c.OBJECT)).setProperties(new Map([["isExpression",N.ofBoolean("isExpression").setDefaultValue(!0)],["value",N.ofAny("value")]]));variableArgument=!1;type=I.EXPRESSION;constructor(e,t){this.schema=t,this.parameterName=e}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getParameterName(){return this.parameterName}setParameterName(e){return this.parameterName=e,this}isVariableArgument(){return this.variableArgument}setVariableArgument(e){return this.variableArgument=e,this}getType(){return this.type}setType(e){return this.type=e,this}static ofEntry(e,t,r=!1,s=I.EXPRESSION){return[e,new y(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=I.EXPRESSION){return new y(e,t).setType(s).setVariableArgument(r)}}const M=new Map([["any",N.ofAny("any").setNamespace(a.SYSTEM)],["boolean",N.ofBoolean("boolean").setNamespace(a.SYSTEM)],["double",N.ofDouble("double").setNamespace(a.SYSTEM)],["float",N.ofFloat("float").setNamespace(a.SYSTEM)],["integer",N.ofInteger("integer").setNamespace(a.SYSTEM)],["long",N.ofLong("long").setNamespace(a.SYSTEM)],["number",N.ofNumber("number").setNamespace(a.SYSTEM)],["string",N.ofString("string").setNamespace(a.SYSTEM)],[y.EXPRESSION.getName(),y.EXPRESSION]]);class P{find(e,t){if(a.SYSTEM==e)return M.get(t)}}var _={};t(_,"KIRunFunctionRepository",(()=>xr));var L={};t(L,"KIRuntimeException",(()=>C));class C extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}var U={};let b;var V;t(U,"StringFormat",(()=>b)),(V=b||(b={})).DATETIME="DATETIME",V.TIME="TIME",V.DATE="DATE",V.EMAIL="EMAIL",V.REGEX="REGEX";var B={};t(B,"Event",(()=>D));class D{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(D.SCHEMA_NAME).setType(w.of(c.OBJECT)).setProperties(new Map([["name",N.ofString("name")],["parameters",N.ofObject("parameter").setAdditionalProperties((new h).setSchemaValue(N.SCHEMA))]]));constructor(e,t){this.name=e,this.parameters=t}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}static outputEventMapEntry(e){return D.eventMapEntry(D.OUTPUT,e)}static eventMapEntry(e,t){return[e,new D(e,t)]}}var G={};t(G,"EventResult",(()=>k));class k{constructor(e,t){this.name=e,this.result=t}getName(){return this.name}setName(e){return this.name=e,this}getResult(){return this.result}setResult(e){return this.result=e,this}static outputOf(e){return k.of(D.OUTPUT,e)}static of(e,t){return new k(e,t)}}var F={};t(F,"FunctionOutput",(()=>H));class H{index=0;constructor(e){if(u(e))throw new C("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof k?this.fo=e:(this.fo=[],this.generator=e)}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;const e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var Y={};t(Y,"FunctionSignature",(()=>$));class ${static SCHEMA_NAME="FunctionSignature";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName($.SCHEMA_NAME).setProperties(new Map([["name",N.ofString("name")],["namespace",N.ofString("namespace")],["parameters",N.ofObject("parameters").setAdditionalProperties((new h).setSchemaValue(y.SCHEMA))],["events",N.ofObject("events").setAdditionalProperties((new h).setSchemaValue(D.SCHEMA))]]));namespace="_";parameters=new Map;events=new Map;constructor(e){this.name=e}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameters(){return this.parameters}setParameters(e){return this.parameters=e,this}getEvents(){return this.events}setEvents(e){return this.events=e,this}}var W={};t(W,"ContextElement",(()=>j));class j{static NULL=new j(N.NULL,void 0);constructor(e,t){this.schema=e,this.element=t}getSchema(){return this.schema}setSchema(e){return this.schema=e,this}getElement(){return this.element}setElement(e){return this.element=e,this}}var q={};t(q,"StringFormatter",(()=>X));class X{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,n="",a=n,i=e.length;for(let o=0;o<i;o++)n=e.charAt(o),"$"==n&&"\\"==a?r=r.substring(0,o-1)+n:"$"==n&&s<t.length?r+=t[s++]:r+=n,a=n;return r.toString()}constructor(){}}var J={};t(J,"AbstractFunction",(()=>Ie));var Q={};t(Q,"SchemaValidator",(()=>Re));var K={};t(K,"StringUtil",(()=>z));class z{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new C("String cannot be null");if(r<0||r>=e.length)throw new C(X.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new C(X.format("Cannot search for occurance : $",s));for(;r<e.length;){if(e.charAt(r)==t&&0==--s)return r;++r}return-1}static splitAtFirstOccurance(e,t){if(!e)return[void 0,void 0];let r=e.indexOf(t);return-1==r?[e,void 0]:[e.substring(0,r),e.substring(r+1)]}static isNullOrBlank(e){return!e||""==e.trim()}}var Z={};t(Z,"SchemaUtil",(()=>ue));var ee={};t(ee,"Tuple2",(()=>te)),t(ee,"Tuple3",(()=>re)),t(ee,"Tuple4",(()=>se));class te{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}}class re extends te{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}}class se extends re{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}}var ne={};t(ne,"SchemaReferenceException",(()=>ae));class ae extends Error{constructor(e,t,r){super(e.trim()?e+"-"+t:t),this.schemaPath=e,this.cause=r}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}var ie={};t(ie,"SchemaValidationException",(()=>oe));class oe extends Error{constructor(e,t,r=[],s){super(t+(r?r.map((e=>e.message)).reduce(((e,t)=>e+"\n"+t),""):"")),this.schemaPath=e,this.cause=s}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ue{static UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path";static CYCLIC_REFERENCE_LIMIT_COUNTER=20;static getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():e.getDefaultValue()?e.getDefaultValue():ue.getDefaultValue(ue.getSchemaFromRef(e,t,e.getRef()),t)}static getSchemaFromRef(e,t,r,s=0){if(++s==ue.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new oe(r??"","Schema has a cyclic reference");if(!e||!r||z.isNullOrBlank(r))return;if(!r.startsWith("#")){var n=ue.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return e=ue.resolveInternalSchema(e,t,r,s,a,1)}static resolveInternalSchema(e,t,r,s,n,a){let i=e;for(;a<n.length;){if("$defs"===n[a]){if(++a>=n.length||!i.get$defs())throw new ae(r,ue.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(n[a])}else{if(i&&(!i.getType()?.contains(c.OBJECT)||!i.getProperties()))throw new ae(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(n[a])}if(a++,!i)throw new ae(r,ue.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);if(!z.isNullOrBlank(i.getRef())&&(i=ue.getSchemaFromRef(i,t,i.getRef(),s),!i))throw new ae(r,ue.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return i}static resolveExternalSchema(e,t,r){if(!t)return;let s=z.splitAtFirstOccurance(e?.getRef()??"","/");if(!s[0])return;let n=z.splitAtFirstOccurance(s[0],".");if(!n[0]||!n[1])return;let a=t.find(n[0],n[1]);if(a){if(!s[1]||""===s[1])return new te(a,r);if(r="#/"+s[1],!a)throw new ae(r,ue.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return new te(a,r)}}constructor(){}}var le={};t(le,"AnyOfAllOfOneOfValidator",(()=>pe));class pe{static validate(e,t,r,s){let n=[];return t.getOneOf()&&!t.getOneOf()?pe.oneOf(e,t,r,s,n):t.getAllOf()&&!t.getAllOf()?pe.allOf(e,t,r,s,n):t.getAnyOf()&&!t.getAnyOf()&&pe.anyOf(e,t,r,s,n),s}static anyOf(e,t,r,s,n){let a=!1;for(let i of t.getAnyOf()??[])try{pe.validate(e,i,r,s),a=!0;break}catch(e){a=!1,n.push(e)}if(!a)throw new oe(Re.path(e),"The value don't satisfy any of the schemas.",n)}static allOf(e,t,r,s,n){let a=0;for(let i of t.getAllOf()??[])try{pe.validate(e,i,r,s),a++}catch(e){n.push(e)}if(a!==t.getAllOf()?.length)throw new oe(Re.path(e),"The value doesn't satisfy some of the schemas.",n)}static oneOf(e,t,r,s,n){let a=0;for(let i of t.getOneOf()??[])try{pe.validate(e,i,r,s),a++}catch(e){n.push(e)}if(1!=a)throw new oe(Re.path(e),0==a?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}var he={};t(he,"TypeValidator",(()=>xe));var me={};t(me,"ArrayValidator",(()=>ce));class ce{static validate(e,t,r,s){if(u(s))throw new oe(Re.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new oe(Re.path(e),s.toString()+" is not an Array");let n=s;return ce.checkMinMaxItems(e,t,n),ce.checkItems(e,t,r,n),ce.checkUniqueItems(e,t,n),ce.checkContains(e,t,r,n),s}static checkContains(e,t,r,s){if(!t.getContains())return;let n=!1;for(let a=0;a<s.length;a++){let i=e?[...e]:[];try{Re.validate(i,t.getContains(),r,s[a]),n=!0;break}catch(e){n=!1}}if(!n)throw new oe(Re.path(e),"None of the items are of type contains schema")}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()){if(new Set(r).size!==r.length)throw new oe(Re.path(e),"Items on the array are not unique")}}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new oe(Re.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new oe(Re.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static checkItems(e,t,r,s){if(!t.getItems())return;let n=t.getItems();if(n.getSingleSchema())for(let t=0;t<s.length;t++){let a=e?[...e]:[],i=Re.validate(a,n.getSingleSchema(),r,s[t]);s[t]=i}if(n.getTupleSchema()){if(n.getTupleSchema().length!==s.length)throw new oe(Re.path(e),"Expected an array with only "+n.getTupleSchema().length+" but found "+s.length);for(let t=0;t<s.length;t++){let a=e?[...e]:[],i=Re.validate(a,n.getTupleSchema()[t],r,s[t]);s[t]=i}}}constructor(){}}var ge={};t(ge,"BooleanValidator",(()=>fe));class fe{static validate(e,t,r){if(u(r))throw new oe(Re.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new oe(Re.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var Ee={};t(Ee,"NullValidator",(()=>Te));class Te{static validate(e,t,r){if(r)throw new oe(Re.path(e),"Expected a null but found "+r);return r}constructor(){}}var de={};t(de,"NumberValidator",(()=>Ae));class Ae{static validate(e,t,r,s){if(u(s))throw new oe(Re.path(t),"Expected a number but found null");if("number"!=typeof s)throw new oe(Re.path(t),s.toString()+" is not a "+e);let n=Ae.extractNumber(e,t,r,s);return Ae.checkRange(t,r,s,n),Ae.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{e!=c.LONG&&e!=c.INTEGER||(n=Math.round(n))}catch(r){throw new oe(Re.path(t),s+" is not a number of type "+e,r)}if(u(n)||(e==c.LONG||e==c.INTEGER)&&n!=s)throw new oe(Re.path(t),s.toString()+" is not a number of type "+e);return n}static checkMultipleOf(e,t,r,s){if(t.getMultipleOf()){if(s%t.getMultipleOf()!=0)throw new oe(Re.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}}static checkRange(e,t,r,s){if(t.getMinimum()&&Ae.numberCompare(s,t.getMinimum())<0)throw new oe(Re.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(t.getMaximum()&&Ae.numberCompare(s,t.getMaximum())>0)throw new oe(Re.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(t.getExclusiveMinimum()&&Ae.numberCompare(s,t.getExclusiveMinimum())<=0)throw new oe(Re.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(t.getExclusiveMaximum()&&Ae.numberCompare(s,t.getExclusiveMaximum())>0)throw new oe(Re.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var Se={};t(Se,"ObjectValidator",(()=>Oe));class Oe{static validate(e,t,r,s){if(u(s))throw new oe(Re.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new oe(Re.path(e),s.toString()+" is not an Object");let n=s,a=new Set(Object.keys(n));Oe.checkMinMaxProperties(e,t,a),t.getPropertyNames()&&Oe.checkPropertyNameSchema(e,t,r,a),t.getRequired()&&Oe.checkRequired(e,t,n),t.getProperties()&&Oe.checkProperties(e,t,r,n,a),t.getPatternProperties()&&Oe.checkPatternProperties(e,t,r,n,a),t.getAdditionalProperties()&&Oe.checkAddtionalProperties(e,t,r,n,a)}static checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{Re.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new oe(Re.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(const s of t.getRequired()??[])if(u(r[s]))throw new oe(Re.path(e),s+" is mandatory")}static checkAddtionalProperties(e,t,r,s,n){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(n.values())){let n=e?[...e]:[],i=Re.validate(n,a.getSchemaValue(),r,s.get(t));s[t]=i}else if(!1===a.getBooleanValue()&&n.size)throw new oe(Re.path(e),n.toString()+" are additional properties which are not allowed.")}static checkPatternProperties(e,t,r,s,n){const a=new Map;for(const e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(const i of Array.from(n.values())){const o=e?[...e]:[];for(const e of Array.from(a.entries()))if(e[1].test(i)){const a=Re.validate(o,t.getPatternProperties().get(e[0]),r,s[i]);s[i]=a,n.delete(i);break}}}static checkProperties(e,t,r,s,n){for(const a of Array.from(t.getProperties())){let t=s[a[0]];if(u(t))continue;let i=e?[...e]:[],o=Re.validate(i,a[1],r,t);s[a[0]]=o,n.delete(a[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new oe(Re.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new oe(Re.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var we={};t(we,"StringValidator",(()=>Ne));class Ne{static TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/;static DATETIME=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])T([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/;static validate(e,t,r){if(u(r))throw new oe(Re.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new oe(Re.path(e),r.toString()+" is not String");t.getFormat()==b.TIME?Ne.patternMatcher(e,t,r,Ne.TIME,"time pattern"):t.getFormat()==b.DATE?Ne.patternMatcher(e,t,r,Ne.DATE,"date pattern"):t.getFormat()==b.DATETIME?Ne.patternMatcher(e,t,r,Ne.DATETIME,"date time pattern"):t.getPattern()&&Ne.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new oe(Re.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMinLength())throw new oe(Re.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new oe(Re.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}class xe{static validate(e,t,r,s,n){if(t==c.STRING)Ne.validate(e,r,n);else if(t==c.LONG||t==c.INTEGER||t==c.DOUBLE||t==c.FLOAT)Ae.validate(t,e,r,n);else if(t==c.BOOLEAN)fe.validate(e,r,n);else if(t==c.OBJECT)Oe.validate(e,r,s,n);else if(t==c.ARRAY)ce.validate(e,r,s,n);else{if(t!=c.NULL)throw new oe(Re.path(e),t+" is not a valid type.");Te.validate(e,r,n)}return n}constructor(){}}class Re{static path(e){return e?e.map((e=>e.getTitle()??"")).filter((e=>!!e)).reduce(((e,t,r)=>e+(0===r?"":".")+t),""):""}static validate(e,t,r,s){if(!t)return s;if(e||(e=new Array),e.push(t),u(s)&&!u(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(t.getConstant())return Re.constantValidation(e,t,s);if(t.getEnums()&&!t.getEnums()?.length)return Re.enumCheck(e,t,s);if(t.getType()&&Re.typeValidation(e,t,r,s),!z.isNullOrBlank(t.getRef()))return Re.validate(e,ue.getSchemaFromRef(e[0],r,t.getRef()),r,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&pe.validate(e,t,r,s),t.getNot()){let n=!1;try{Re.validate(e,t.getNot(),r,s),n=!0}catch(e){n=!1}if(n)throw new oe(Re.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!t.getConstant().equals(r))throw new oe(Re.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let s=!1;for(let e of t.getEnums()??[])if(e===r){s=!0;break}if(s)return r;throw new oe(Re.path(e),"Value is not one of "+t.getEnums())}static typeValidation(e,t,r,s){let n=!1,a=[];for(const i of Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]))try{xe.validate(e,i,t,r,s),n=!0;break}catch(e){n=!1,a.push(e)}if(!n)throw new oe(Re.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",a)}constructor(){}}class Ie{validateArguments(e){return Array.from(this.getSignature().getParameters().entries()).map((t=>{let r,s=t[0],n=t[1],a=e.get(t[0]);if(u(a))return new te(s,Re.validate(void 0,n.getSchema(),void 0,void 0));if(!n?.isVariableArgument())return new te(s,Re.validate(void 0,n.getSchema(),void 0,a));Array.isArray(a)?r=a:(r=[],r.push(a));for(const e of r)Re.validate(void 0,n.getSchema(),void 0,e);return new te(s,a)})).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}async execute(e){return e.setArguments(this.validateArguments(e.getArguments()??new Map)),this.internalExecute(e)}getProbableEventSignature(e){return this.getSignature().getEvents()}}const ve=new $("Create").setNamespace(a.SYSTEM_CTX).setParameters(new Map([y.ofEntry("name",(new N).setName("name").setType(w.of(c.STRING)).setMinLength(1).setFormat(b.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,I.CONSTANT),y.ofEntry("schema",N.SCHEMA,!1,I.CONSTANT)])).setEvents(new Map([D.outputEventMapEntry(new Map)]));const ye=new $("Get").setNamespace(a.SYSTEM_CTX).setParameters(new Map([y.ofEntry("name",(new N).setName("name").setType(w.of(c.STRING)).setMinLength(1).setFormat(b.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,I.CONSTANT)])).setEvents(new Map([D.outputEventMapEntry(new Map([["value",N.ofAny("value")]]))]));var Me={};t(Me,"ExecutionException",(()=>Pe));class Pe extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}var _e={};t(_e,"Expression",(()=>Ye));var Le={};t(Le,"LinkedList",(()=>Ce));class Ce{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(const t of e)if(this.head){const e=new Ue(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new Ue(t);this.length=e.length}}push(e){const t=new Ue(e,void 0,this.head);this.head?(this.head.previous=t,this.head=t):this.tail=this.head=t,this.length++}pop(){if(!this.head)throw Error("List is empty and cannot pop further.");const e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;const t=this.head;return this.head=t.next,t.next=void 0,t.previous=void 0,this.head.previous=void 0,e}isEmpty(){return!this.length}size(){return this.length}get(e){if(e<0||e>=this.length)throw new Error(`${e} is out of bounds [0,${this.length}]`);let t=this.head;for(;e>0;)t=this.head.next,--e;return t.value}set(e,t){if(e<0||e>=this.length)throw new C(X.format("Index $ out of bound to set the value in linked list.",e));let r=this.head;for(;e>0;)r=this.head.next,--e;return r.value=t,this}toString(){let e=this.head,t="";for(;e;)t+=e.value,e=e.next,e&&(t+=", ");return`[${t}]`}toArray(){let e=[],t=this.head;for(;t;)e.push(t.value),t=t.next;return e}peek(){if(!this.head)throw new Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw new Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw new Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw new Error("List is empty so cannot remove");--this.length;const e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{const e=this.tail.previous;e.next=void 0,this.tail.previous=void 0,this.tail=e}return e}addAll(e){return e&&e.length?(e.forEach(this.add.bind(this)),this):this}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new Ue(e,this.head),this.head.next=this.tail):(this.tail=new Ue(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new Ue(e),this}map(e,t){let r=new Ce,s=this.head,n=0;for(;s;)r.add(e(s.value,n)),s=s.next,++n;return r}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class Ue{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}var be={};t(be,"StringBuilder",(()=>Ve));class Ve{constructor(e){this.str=e??""}append(e){return this.str+=e,this}toString(){return""+this.str}trim(){return this.str=this.str.trim(),this}setLength(e){return this.str=this.str.substring(0,e),this}length(){return this.str.length}charAt(e){return this.str.charAt(e)}deleteCharAt(e){return this.checkIndex(e),this.str=this.str.substring(0,e)+this.str.substring(e+1),this}insert(e,t){return this.str=this.str.substring(0,e)+t+this.str.substring(e),this}checkIndex(e){if(e>=this.str.length)throw new C(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var Be={};t(Be,"ExpressionEvaluationException",(()=>De));class De extends Error{constructor(e,t,r){super(X.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var Ge={};t(Ge,"ExpressionToken",(()=>ke));class ke{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var Fe={};t(Fe,"Operation",(()=>He));class He{static MULTIPLICATION=new He("*");static DIVISION=new He("/");static INTEGER_DIVISION=new He("//");static MOD=new He("%");static ADDITION=new He("+");static SUBTRACTION=new He("-");static NOT=new He("not",void 0,!0);static AND=new He("and",void 0,!0);static OR=new He("or",void 0,!0);static LESS_THAN=new He("<");static LESS_THAN_EQUAL=new He("<=");static GREATER_THAN=new He(">");static GREATER_THAN_EQUAL=new He(">=");static EQUAL=new He("=");static NOT_EQUAL=new He("!=");static BITWISE_AND=new He("&");static BITWISE_OR=new He("|");static BITWISE_XOR=new He("^");static BITWISE_COMPLEMENT=new He("~");static BITWISE_LEFT_SHIFT=new He("<<");static BITWISE_RIGHT_SHIFT=new He(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new He(">>>");static UNARY_PLUS=new He("UN: +","+");static UNARY_MINUS=new He("UN: -","-");static UNARY_LOGICAL_NOT=new He("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new He("UN: ~","~");static ARRAY_OPERATOR=new He("[");static OBJECT_OPERATOR=new He(".");static VALUE_OF=new Map([["MULTIPLICATION",He.MULTIPLICATION],["DIVISION",He.DIVISION],["INTEGER_DIVISON",He.INTEGER_DIVISION],["MOD",He.MOD],["ADDITION",He.ADDITION],["SUBTRACTION",He.SUBTRACTION],["NOT",He.NOT],["AND",He.AND],["OR",He.OR],["LESS_THAN",He.LESS_THAN],["LESS_THAN_EQUAL",He.LESS_THAN_EQUAL],["GREATER_THAN",He.GREATER_THAN],["GREATER_THAN_EQUAL",He.GREATER_THAN_EQUAL],["EQUAL",He.EQUAL],["NOT_EQUAL",He.NOT_EQUAL],["BITWISE_AND",He.BITWISE_AND],["BITWISE_OR",He.BITWISE_OR],["BITWISE_XOR",He.BITWISE_XOR],["BITWISE_COMPLEMENT",He.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",He.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",He.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",He.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",He.UNARY_PLUS],["UNARY_MINUS",He.UNARY_MINUS],["UNARY_LOGICAL_NOT",He.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",He.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",He.ARRAY_OPERATOR],["OBJECT_OPERATOR",He.OBJECT_OPERATOR]]);static UNARY_OPERATORS=new Set([He.ADDITION,He.SUBTRACTION,He.NOT,He.BITWISE_COMPLEMENT,He.UNARY_PLUS,He.UNARY_MINUS,He.UNARY_LOGICAL_NOT,He.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([He.MULTIPLICATION,He.DIVISION,He.INTEGER_DIVISION,He.MOD,He.ADDITION,He.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([He.NOT,He.AND,He.OR,He.LESS_THAN,He.LESS_THAN_EQUAL,He.GREATER_THAN,He.GREATER_THAN_EQUAL,He.EQUAL,He.NOT_EQUAL]);static BITWISE_OPERATORS=new Set([He.BITWISE_AND,He.BITWISE_COMPLEMENT,He.BITWISE_LEFT_SHIFT,He.BITWISE_OR,He.BITWISE_RIGHT_SHIFT,He.BITWISE_UNSIGNED_RIGHT_SHIFT,He.BITWISE_XOR]);static OPERATOR_PRIORITY=new Map([[He.UNARY_PLUS,1],[He.UNARY_MINUS,1],[He.UNARY_LOGICAL_NOT,1],[He.UNARY_BITWISE_COMPLEMENT,1],[He.ARRAY_OPERATOR,1],[He.OBJECT_OPERATOR,1],[He.MULTIPLICATION,2],[He.DIVISION,2],[He.INTEGER_DIVISION,2],[He.MOD,2],[He.ADDITION,3],[He.SUBTRACTION,3],[He.BITWISE_LEFT_SHIFT,4],[He.BITWISE_RIGHT_SHIFT,4],[He.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[He.LESS_THAN,5],[He.LESS_THAN_EQUAL,5],[He.GREATER_THAN,5],[He.GREATER_THAN_EQUAL,5],[He.EQUAL,6],[He.NOT_EQUAL,6],[He.BITWISE_AND,7],[He.BITWISE_XOR,8],[He.BITWISE_OR,9],[He.AND,10],[He.OR,11]]);static OPERATORS=new Set([...Array.from(He.ARITHMETIC_OPERATORS),...Array.from(He.LOGICAL_OPERATORS),...Array.from(He.BITWISE_OPERATORS),He.ARRAY_OPERATOR,He.OBJECT_OPERATOR].map((e=>e.getOperator())));static OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(He.ARITHMETIC_OPERATORS),...Array.from(He.LOGICAL_OPERATORS),...Array.from(He.BITWISE_OPERATORS),He.ARRAY_OPERATOR,He.OBJECT_OPERATOR].filter((e=>!e.shouldBeWrappedInSpace())).map((e=>e.getOperator())));static OPERATION_VALUE_OF=new Map(Array.from(He.VALUE_OF.entries()).map((([e,t])=>[t.getOperator(),t])));static UNARY_MAP=new Map([[He.ADDITION,He.UNARY_PLUS],[He.SUBTRACTION,He.UNARY_MINUS],[He.NOT,He.UNARY_LOGICAL_NOT],[He.BITWISE_COMPLEMENT,He.UNARY_BITWISE_COMPLEMENT],[He.UNARY_PLUS,He.UNARY_PLUS],[He.UNARY_MINUS,He.UNARY_MINUS],[He.UNARY_LOGICAL_NOT,He.UNARY_LOGICAL_NOT],[He.UNARY_BITWISE_COMPLEMENT,He.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(He.VALUE_OF.values()).map((e=>e.getOperator())).filter((e=>!e.startsWith("UN: "))).map((e=>e.length)).reduce(((e,t)=>e>t?e:t),0);constructor(e,t,r=!1){this.operator=e,this.operatorName=t??e,this._shouldBeWrappedInSpace=r}getOperator(){return this.operator}getOperatorName(){return this.operatorName}shouldBeWrappedInSpace(){return this._shouldBeWrappedInSpace}valueOf(e){return He.VALUE_OF.get(e)}toString(){return this.operator}}class Ye extends ke{tokens=new Ce;ops=new Ce;constructor(e,t,r,s){super(e||""),t&&this.tokens.push(t),r&&this.tokens.push(r),s&&this.ops.push(s),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){const e=this.expression.length;let t,r="",s=new Ve(""),n=0,a=!1;for(;n<e;){switch(r=this.expression[n],t=s.toString(),r){case" ":a=this.processTokenSepearator(s,t,a);break;case"(":n=this.processSubExpression(e,s,t,n,a),a=!1;break;case")":throw new De(this.expression,"Extra closing parenthesis found");case"]":throw new De(this.expression,"Extra closing square bracket found");default:let i=this.processOthers(r,e,s,t,n,a);n=i.getT1(),a=i.getT2(),a&&this.ops.peek()==He.ARRAY_OPERATOR&&(i=this.process(e,s,n),n=i.getT1(),a=i.getT2())}++n}if(t=s.toString(),!z.isNullOrBlank(t)){if(He.OPERATORS.has(t))throw new De(this.expression,"Expression is ending with an operator");this.tokens.push(new ke(t))}}process(e,t,r){let s=1;for(++r;r<e&&0!=s;){let e=this.expression.charAt(r);"]"==e?--s:"["==e&&++s,0!=s&&(t.append(e),r++)}return this.tokens.push(new Ye(t.toString())),t.setLength(0),new te(r,!1)}processOthers(e,t,r,s,n,a){let i=t-n;i=i<He.BIGGEST_OPERATOR_SIZE?i:He.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(n,n+e);if(He.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return z.isNullOrBlank(s)||(this.tokens.push(new ke(s)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,He.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new te(n+e-1,a)}return r.append(e),new te(n,!1)}processSubExpression(e,t,r,s,n){if(He.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,He.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!z.isNullOrBlank(r))throw new De(this.expression,X.format("Unkown token : $ found.",r));let a=1;const i=new Ve;let o=this.expression.charAt(s);for(s++;s<e&&a>0;)o=this.expression.charAt(s),"("==o?a++:")"==o&&a--,0!=a&&(i.append(o),s++);if(")"!=o)throw new De(this.expression,"Missing a closed parenthesis");for(;i.length()>2&&"("==i.charAt(0)&&")"==i.charAt(i.length()-1);)i.deleteCharAt(0),i.setLength(i.length()-1);return this.tokens.push(new Ye(i.toString().trim())),s}processTokenSepearator(e,t,r){return z.isNullOrBlank(t)||(He.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,He.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new ke(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r)if(s||e.isEmpty()){if(!He.UNARY_OPERATORS.has(r))throw new De(this.expression,X.format("Extra operator $ found.",r));{const e=He.UNARY_MAP.get(r);e&&t.push(e)}}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(He.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new Ye("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new Ye("",s,t,r))}}t.push(r)}}hasPrecedence(e,t){let r=He.OPERATOR_PRIORITY.get(e),s=He.OPERATOR_PRIORITY.get(t);if(!r||!s)throw new Error("Unknown operators provided");return s<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new Ve,t=0;const r=this.ops.toArray(),s=this.tokens.toArray();for(let n=0;n<r.length;n++)if(r[n].getOperator().startsWith("UN: "))e.append("(").append(r[n].getOperator().substring(4)).append(s[t]instanceof Ye?s[t].toString():s[t]).append(")"),t++;else{if(0==t){const r=s[t++];e.insert(0,r.toString())}const a=s[t++];e.insert(0,r[n].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var $e={};t($e,"ExpressionEvaluator",(()=>rr));var We={};t(We,"ExpressionTokenValue",(()=>je));class je extends ke{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return X.format("$: $",this.expression,this.element)}}var qe={};t(qe,"ArithmeticAdditionOperator",(()=>Qe));var Xe={};t(Xe,"BinaryOperator",(()=>Je));class Je{nullCheck(e,t,r){if(u(e)||u(t))throw new Pe(X.format("$ cannot be applied to a null value",r.getOperatorName()))}}class Qe extends Je{apply(e,t){return this.nullCheck(e,t,He.ADDITION),e+t}}var Ke={};t(Ke,"ArithmeticDivisionOperator",(()=>ze));class ze extends Je{apply(e,t){return this.nullCheck(e,t,He.DIVISION),e/t}}var Ze={};t(Ze,"ArithmeticIntegerDivisionOperator",(()=>et));class et extends Je{apply(e,t){return this.nullCheck(e,t,He.DIVISION),Math.floor(e/t)}}var tt={};t(tt,"ArithmeticModulusOperator",(()=>rt));class rt extends Je{apply(e,t){return this.nullCheck(e,t,He.MOD),e%t}}var st={};t(st,"ArithmeticMultiplicationOperator",(()=>nt));class nt extends Je{apply(e,t){return this.nullCheck(e,t,He.MULTIPLICATION),e*t}}var at={};t(at,"ArithmeticSubtractionOperator",(()=>it));class it extends Je{apply(e,t){return this.nullCheck(e,t,He.SUBTRACTION),e-t}}var ot={};t(ot,"ArrayOperator",(()=>ut));class ut extends Je{apply(e,t){if(!e)throw new Pe("Cannot apply array operator on a null value");if(!t)throw new Pe("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new Pe(X.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new Pe(X.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var lt={};t(lt,"BitwiseAndOperator",(()=>pt));class pt extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_AND),e&t}}var ht={};t(ht,"BitwiseLeftShiftOperator",(()=>mt));class mt extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_LEFT_SHIFT),e<<t}}var ct={};t(ct,"BitwiseOrOperator",(()=>gt));class gt extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_OR),e|t}}var ft={};t(ft,"BitwiseRightShiftOperator",(()=>Et));class Et extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_RIGHT_SHIFT),e>>t}}var Tt={};t(Tt,"BitwiseUnsignedRightShiftOperator",(()=>dt));class dt extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var At={};t(At,"BitwiseXorOperator",(()=>St));class St extends Je{apply(e,t){return this.nullCheck(e,t,He.BITWISE_XOR),e^t}}var Ot={};t(Ot,"LogicalAndOperator",(()=>xt));var wt={};t(wt,"PrimitiveUtil",(()=>Nt));class Nt{static findPrimitiveNullAsBoolean(e){if(!e)return new te(c.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new Pe(X.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new te(c.BOOLEAN,r):"string"===t?new te(c.STRING,r):Nt.findPrimitiveNumberType(r)}static findPrimitive(e){if(u(e))return new te(c.NULL,void 0);let t=typeof e;if("object"===t)throw new Pe(X.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new te(c.BOOLEAN,r):"string"===t?new te(c.STRING,r):Nt.findPrimitiveNumberType(r)}static findPrimitiveNumberType(e){if(u(e)||Array.isArray(e)||"object"==typeof e)throw new Pe(X.format("Unable to convert $ to a number.",e));let t=e;try{let e=t;return Number.isInteger(e)?new te(c.LONG,e):new te(c.DOUBLE,e)}catch(e){throw new Pe(X.format("Unable to convert $ to a number.",t),e)}}static compare(e,t){if(e==t)return 0;if(u(e)||u(t))return u(e)?-1:1;if(Array.isArray(e)||Array.isArray(t)){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!=t.length)return e.length-t.length;for(let r=0;r<e.length;r++){let s=this.compare(e[r],t[r]);if(0!=s)return s}return 0}return Array.isArray(e)?-1:1}const r=typeof e,s=typeof t;return"object"===r||"object"===s?("object"===r&&"object"===s&&Object.keys(e).forEach((r=>{let s=this.compare(e[r],t[r]);if(0!=s)return s})),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return u(e)||u(t)?u(e)&&u(t)?0:u(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?c.LONG:c.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class xt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()!=c.BOOLEAN)throw new Pe(X.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=c.BOOLEAN)throw new Pe(X.format("Boolean value expected but found $",s.getT2()));return r.getT2()&&s.getT2()}}var Rt={};t(Rt,"LogicalEqualOperator",(()=>It));class It extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);return r.getT2()==s.getT2()}}var vt={};t(vt,"LogicalGreaterThanEqualOperator",(()=>yt));class yt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()==c.BOOLEAN||s.getT1()==c.BOOLEAN)throw new Pe(X.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var Mt={};t(Mt,"LogicalGreaterThanOperator",(()=>Pt));class Pt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()==c.BOOLEAN||s.getT1()==c.BOOLEAN)throw new Pe(X.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var _t={};t(_t,"LogicalLessThanEqualOperator",(()=>Lt));class Lt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()==c.BOOLEAN||s.getT1()==c.BOOLEAN)throw new Pe(X.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var Ct={};t(Ct,"LogicalLessThanOperator",(()=>Ut));class Ut extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()==c.BOOLEAN||s.getT1()==c.BOOLEAN)throw new Pe(X.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var bt={};t(bt,"LogicalNotEqualOperator",(()=>Vt));class Vt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);return r.getT2()!=s.getT2()}}var Bt={};t(Bt,"LogicalOrOperator",(()=>Dt));class Dt extends Je{apply(e,t){const r=Nt.findPrimitiveNullAsBoolean(e),s=Nt.findPrimitiveNullAsBoolean(t);if(r.getT1()!=c.BOOLEAN)throw new Pe(X.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=c.BOOLEAN)throw new Pe(X.format("Boolean value expected but found $",s.getT2()));return r.getT2()||s.getT2()}}var Gt={};t(Gt,"ObjectOperator",(()=>kt));class kt extends Je{apply(e,t){if(!e)throw new Pe("Cannot apply array operator on a null value");if(!t)throw new Pe("Cannot retrive null property value");const r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new Pe(X.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var Ft={};t(Ft,"ArithmeticUnaryMinusOperator",(()=>$t));var Ht={};t(Ht,"UnaryOperator",(()=>Yt));class Yt{nullCheck(e,t){if(u(e))throw new Pe(X.format("$ cannot be applied to a null value",t.getOperatorName()))}}class $t extends Yt{apply(e){return this.nullCheck(e,He.UNARY_MINUS),Nt.findPrimitiveNumberType(e),-e}}var Wt={};t(Wt,"ArithmeticUnaryPlusOperator",(()=>jt));class jt extends Yt{apply(e){return this.nullCheck(e,He.UNARY_PLUS),Nt.findPrimitiveNumberType(e),e}}var qt={};t(qt,"BitwiseComplementOperator",(()=>Xt));class Xt extends Yt{apply(e){this.nullCheck(e,He.UNARY_BITWISE_COMPLEMENT);let t=Nt.findPrimitiveNumberType(e);if(t.getT1()!=c.INTEGER&&t.getT1()!=c.LONG)throw new Pe(X.format("Unable to apply bitwise operator on $",e));return~e}}var Jt={};t(Jt,"LogicalNotOperator",(()=>Qt));class Qt extends Yt{apply(e){if(this.nullCheck(e,He.UNARY_LOGICAL_NOT),Nt.findPrimitiveNumberType(e).getT1()!=c.BOOLEAN)throw new Pe(X.format("Unable to apply bitwise operator on $",e));return!e}}var Kt={};t(Kt,"LiteralTokenValueExtractor",(()=>tr));var zt={};t(zt,"TokenValueExtractor",(()=>Zt));class Zt{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new C(X.format("Token $ doesn't start with $",e,t));return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(u(s))return;if(t.length==r)return s;let n=t[r].split(Zt.REGEX_SQUARE_BRACKETS).map((e=>e.trim())).filter((e=>!z.isNullOrBlank(e))).reduce(((s,n,a)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,n,s,a)),s);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,s,n,a){if(!u(n)){if(0===a){if(Array.isArray(n)){if("length"===s)return n.length;try{let e=parseInt(s);if(isNaN(e))throw new Error(X.format("$ is not a number",e));if(e>=n.length)return;return n[e]}catch(t){throw new De(e,X.format("$ couldn't be parsed into integer in $",s,e),t)}}return this.checkIfObject(e,t,r,n),n[s]}if(s?.startsWith('"')){if(!s.endsWith('"')||1==s.length||2==s.length)throw new De(e,X.format("$ is missing a double quote or empty key found",e));return this.checkIfObject(e,t,r,n),n[s.substring(1,s.length-1)]}try{let t=parseInt(s);if(isNaN(t))throw new Error(X.format("$ is not a number",t));if(!Array.isArray(n))throw new De(e,X.format("Expecting an array with index $ while processing the expression",t,e));if(t>=n.length)return;return n[t]}catch(t){throw new De(e,X.format("$ couldn't be parsed into integer in $",s,e),t)}}}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new De(e,X.format("Unable to retrive $ from $ in the path $",t[r],s.toString(),e))}}const er=new Map([["true",!0],["false",!1],["null",void 0]]);class tr extends Zt{static INSTANCE=new tr;getValueInternal(e){if(!z.isNullOrBlank(e))return e=e.trim(),er.has(e)?er.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t;if(t=-1==e.indexOf(".")?parseInt(e):parseFloat(e),isNaN(t))throw new Error("Parse number error");return t}catch(t){throw new De(e,X.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new De(e,X.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}}class rr{static UNARY_OPERATORS_MAP=new Map([[He.UNARY_BITWISE_COMPLEMENT,new Xt],[He.UNARY_LOGICAL_NOT,new Qt],[He.UNARY_MINUS,new $t],[He.UNARY_PLUS,new jt]]);static BINARY_OPERATORS_MAP=new Map([[He.ADDITION,new Qe],[He.DIVISION,new ze],[He.INTEGER_DIVISION,new et],[He.MOD,new rt],[He.MULTIPLICATION,new nt],[He.SUBTRACTION,new it],[He.BITWISE_AND,new pt],[He.BITWISE_LEFT_SHIFT,new mt],[He.BITWISE_OR,new gt],[He.BITWISE_RIGHT_SHIFT,new Et],[He.BITWISE_UNSIGNED_RIGHT_SHIFT,new dt],[He.BITWISE_XOR,new St],[He.AND,new xt],[He.EQUAL,new It],[He.GREATER_THAN,new Pt],[He.GREATER_THAN_EQUAL,new yt],[He.LESS_THAN,new Ut],[He.LESS_THAN_EQUAL,new Lt],[He.OR,new Dt],[He.NOT_EQUAL,new Vt],[He.ARRAY_OPERATOR,new ut],[He.OBJECT_OPERATOR,new kt]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(rr.UNARY_OPERATORS_MAP.keys());constructor(e){e instanceof Ye?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){return this.exp||(this.exp=new Ye(this.expression)),this.evaluateExpression(this.exp,e)}getExpression(){return this.exp||(this.exp=new Ye(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),s=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),i=s.pop();if(rr.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,i)));else if(e==He.OBJECT_OPERATOR||e==He.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,i);else{const r=s.pop();var n=this.getValueFromToken(t,r),a=this.getValueFromToken(t,i);s.push(this.applyBinaryOperation(e,n,a))}}if(s.isEmpty())throw new Pe(X.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new Pe(X.format("Expression : $ evaluated multiple values $",e,s));const i=s.get(0);if(i instanceof je)return i.getElement();if(!(i instanceof Ye))return this.getValueFromToken(t,i);throw new Pe(X.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){const a=new Ce,i=new Ce;if(!s||!n)return;do{i.push(s),n instanceof Ye?a.push(new je(n.toString(),this.evaluateExpression(n,e))):n&&a.push(n),n=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop()}while(s==He.OBJECT_OPERATOR||s==He.ARRAY_OPERATOR);n&&(n instanceof Ye?a.push(new je(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);let o=a.pop(),u=new Ve(o instanceof je?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),u.append(s.getOperator()).append(o instanceof je?o.getTokenValue():o.toString()),s==He.ARRAY_OPERATOR&&u.append("]");let l=u.toString(),p=l.substring(0,l.indexOf(".")+1);if(p.length>2&&e.has(p))r.push(new je(l,this.getValue(l,e)));else{let e;try{e=tr.INSTANCE.getValue(l)}catch(t){e=l}r.push(new je(l,e))}}applyBinaryOperation(e,t,r){if("object"===typeof t||"object"===typeof r||Array.isArray(t)||Array.isArray(r))throw new De(this.expression,X.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));let s=rr.BINARY_OPERATORS_MAP.get(e);if(!s)throw new De(this.expression,X.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new je(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){if("object"===typeof t||Array.isArray(t))throw new De(this.expression,X.format("The operator $ cannot be applied to $",e.getOperator(),t));let r=rr.UNARY_OPERATORS_MAP.get(e);if(!r)throw new De(this.expression,X.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new je(e.toString(),r.apply(t))}getValueFromToken(e,t){return t instanceof Ye?this.evaluateExpression(t,e):t instanceof je?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){if(e.length<=5)return tr.INSTANCE.getValue(e);const r=e.substring(0,e.indexOf(".")+1);return(t.get(r)??tr.INSTANCE).getValue(e)}}const sr=new $("Set").setNamespace(a.SYSTEM_CTX).setParameters(new Map([y.ofEntry("name",(new N).setName("name").setType(w.of(c.STRING)).setMinLength(1),!1,I.CONSTANT),y.ofEntry("value",N.ofAny("value"))])).setEvents(new Map([D.outputEventMapEntry(new Map)]));const nr=new $("GenerateEvent").setNamespace(a.SYSTEM).setParameters(new Map([y.ofEntry("eventName",N.ofString("eventName")),y.ofEntry("results",N.ofObject("results").setProperties(new Map([["name",N.ofString("name")],["value",y.EXPRESSION]])),!0)])).setEvents(new Map([D.outputEventMapEntry(new Map)]));class ar extends Ie{static CONDITION="condition";static SIGNATURE=new $("If").setNamespace(a.SYSTEM).setParameters(new Map([y.ofEntry(ar.CONDITION,N.of(ar.CONDITION,c.BOOLEAN))])).setEvents(new Map([D.eventMapEntry(D.TRUE,new Map),D.eventMapEntry(D.FALSE,new Map),D.outputEventMapEntry(new Map)]));getSignature(){return ar.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(ar.CONDITION);return new H([k.of(t?D.TRUE:D.FALSE,new Map),k.outputOf(new Map)])}}const ir=new $("CountLoop").setNamespace(a.SYSTEM_LOOP).setParameters(new Map([y.ofEntry("count",N.of("count",c.INTEGER).setDefaultValue(1))])).setEvents(new Map([D.eventMapEntry(D.ITERATION,new Map([["index",N.of("index",c.INTEGER)]])),D.outputEventMapEntry(new Map([["value",N.of("value",c.INTEGER)]]))]));const or=new $("RangeLoop").setNamespace(a.SYSTEM_LOOP).setParameters(new Map([y.ofEntry("from",N.of("from",c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE).setDefaultValue(0)),y.ofEntry("to",N.of("to",c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE).setDefaultValue(1)),y.ofEntry("step",N.of("step",c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE).setDefaultValue(1).setNot((new N).setConstant(0)))])).setEvents(new Map([D.eventMapEntry(D.ITERATION,new Map([["index",N.of("index",c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE)]])),D.outputEventMapEntry(new Map([["value",N.of("value",c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE)]]))]));const ur=new $("Add").setNamespace(a.MATH).setParameters(new Map([["value",new y("value",N.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([D.outputEventMapEntry(new Map([["value",N.ofNumber("value")]]))]));const lr=[()=>new Map([["value",new y("value",N.ofNumber("value"))]]),()=>new Map([["value1",new y("value1",N.ofNumber("value1"))],["value2",new y("value2",N.ofNumber("value2"))]])];class pr extends Ie{constructor(e,t,r=1,...s){super(),s&&s.length||(s=[c.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new $(e).setNamespace(a.MATH).setParameters(lr[r-1]()).setEvents(new Map([D.outputEventMapEntry(new Map([["value",(new N).setType(w.of(...s)).setName("value")]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=Nt.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?"value":"value1")).getT2();return 2==this.parametersNumber&&(t=Nt.findPrimitiveNumberType(e.getArguments()?.get("value2")).getT2()),new H([k.outputOf(new Map([["value",this.mathFunction.call(this,r,t)]]))])}}class hr extends Ie{static SIGNATURE=new $("Hypotenuse").setNamespace(a.MATH).setParameters(new Map([["value",new y("value",N.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([D.outputEventMapEntry(new Map([["value",(new N).setType(w.of(c.DOUBLE)).setName("value")]]))]));constructor(){super()}getSignature(){return hr.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get("value");return new H([k.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>e+t*t),0))]]))])}}const mr=new $("Maximum").setNamespace(a.MATH).setParameters(new Map([["value",new y("value",N.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([D.outputEventMapEntry(new Map([["value",N.ofNumber("value")]]))]));const cr=new $("Minimum").setNamespace(a.MATH).setParameters(new Map([["value",new y("value",N.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([D.outputEventMapEntry(new Map([["value",N.ofNumber("value")]]))]));var gr={};t(gr,"MapUtil",(()=>fr)),t(gr,"MapEntry",(()=>Er));class fr{static of(e,t,r,s,n,a,i,o,l,p,h,m,c,g,f,E,T,d,A,S){const O=new Map;return u(e)||u(t)||O.set(e,t),u(r)||u(s)||O.set(r,s),u(n)||u(a)||O.set(n,a),u(i)||u(o)||O.set(i,o),u(l)||u(p)||O.set(l,p),u(h)||u(m)||O.set(h,m),u(c)||u(g)||O.set(c,g),u(f)||u(E)||O.set(f,E),u(T)||u(d)||O.set(T,d),u(A)||u(S)||O.set(A,S),O}static ofArrayEntries(...e){const t=new Map;for(const[r,s]of e)t.set(r,s);return t}static entry(e,t){return new Er(e,t)}static ofEntries(...e){const t=new Map;for(const r of e)t.set(r.k,r.v);return t}constructor(){}}class Er{constructor(e,t){this.k=e,this.v=t}}class Tr extends Ie{static SIGNATURE=new $("Random").setNamespace(a.MATH).setEvents(new Map([D.outputEventMapEntry(fr.of("value",N.ofDouble("value")))]));getSignature(){return Tr.SIGNATURE}async internalExecute(e){return new H([k.outputOf(new Map([["value",Math.random()]]))])}}const dr={Absolute:new pr("Absolute",(e=>Math.abs(e)),1,c.INTEGER,c.LONG,c.FLOAT,c.DOUBLE),ACosine:new pr("ArcCosine",(e=>Math.acos(e))),ASine:new pr("ArcSine",(e=>Math.asin(e))),ATangent:new pr("ArcTangent",(e=>Math.atan(e))),Ceiling:new pr("Ceiling",(e=>Math.ceil(e))),Cosine:new pr("Cosine",(e=>Math.cos(e))),CosineH:new pr("HyperbolicCosine",(e=>Math.cosh(e))),CubeRoot:new pr("CubeRoot",(e=>Math.cbrt(e))),Exponential:new pr("Exponential",(e=>Math.exp(e))),Expm1:new pr("ExponentialMinus1",(e=>Math.expm1(e))),Floor:new pr("Floor",(e=>Math.floor(e))),Log:new pr("LogNatural",(e=>Math.log(e))),Log10:new pr("Log10",(e=>Math.log10(e))),Round:new pr("Round",(e=>Math.round(e)),1,c.INTEGER,c.LONG),Sine:new pr("Sine",(e=>Math.sin(e))),SineH:new pr("HyperbolicSine",(e=>Math.sinh(e))),Tangent:new pr("Tangent",(e=>Math.tan(e))),TangentH:new pr("HyperbolicTangent",(e=>Math.tanh(e))),ToDegrees:new pr("ToDegrees",(e=>e*(Math.PI/180))),ToRadians:new pr("ToRadians",(e=>e*(180/Math.PI))),SquareRoot:new pr("SquareRoot",(e=>Math.sqrt(e))),ArcTangent:new pr("ArcTangent2",((e,t)=>Math.atan2(e,t)),2),Power:new pr("Power",((e,t)=>Math.pow(e,t)),2),Add:new class extends Ie{getSignature(){return ur}async internalExecute(e){let t=e.getArguments()?.get("value");return new H([k.outputOf(new Map([["value",t.reduce(((e,t)=>e+t),0)]]))])}},Hypotenuse:new hr,Maximum:new class extends Ie{getSignature(){return mr}async internalExecute(e){let t=e.getArguments()?.get("value");return new H([k.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>!e&&0!==e||t>e?t:e)))]]))])}},Minimum:new class extends Ie{getSignature(){return cr}async internalExecute(e){let t=e.getArguments()?.get("value");return new H([k.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>!e&&0!==e||t<e?t:e)))]]))])}},Random:new Tr};class Ar{find(e,t){if(e==a.MATH)return dr[t]}}var Sr={};t(Sr,"HybridRepository",(()=>Or));class Or{constructor(...e){this.repos=e}find(e,t){for(let r of this.repos){let s=r.find(e,t);if(s)return s}}}function wr(e){return[e.getSignature().getName(),e]}const Nr=new Map([[a.SYSTEM_CTX,new Map([wr(new class extends Ie{getSignature(){return ve}async internalExecute(e){const t=e?.getArguments()?.get("name");if(e?.getContext()?.has(t))throw new C(X.format("Context already has an element for '$' ",t));let r=N.from(e?.getArguments()?.get("schema"));if(!r)throw new C("Schema is not supplied.");return e.getContext().set(t,new j(r,u(r.getDefaultValue())?void 0:r.getDefaultValue())),new H([k.outputOf(new Map)])}}),wr(new class extends Ie{getSignature(){return ye}async internalExecute(e){const t=e?.getArguments()?.get("name");if(!e.getContext()?.has(t))throw new C(X.format("Context don't have an element for '$' ",t));return new H([k.outputOf(new Map(["value",e.getContext()?.get(t)?.getElement()]))])}}),wr(new class extends Ie{getSignature(){return sr}async internalExecute(e){let t=e?.getArguments()?.get("name");if(z.isNullOrBlank(t))throw new C("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get("value");const s=new Ye(t),n=s.getTokens().peekLast();if(!n.getExpression().startsWith("Context")||n instanceof Ye||n instanceof je&&!n.getElement().toString().startsWith("Context"))throw new Pe(X.format("The context path $ is not a valid path in context",t));for(const e of s.getOperations().toArray())if(e!=He.ARRAY_OPERATOR&&e!=He.OBJECT_OPERATOR)throw new Pe(X.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<s.getTokens().size();r++){let n=s.getTokens().get(r);n instanceof Ye&&s.getTokens().set(r,new je(t,new rr(n).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,s){const n=s.getTokens();n.removeLast();const a=s.getOperations();a.removeLast();let i=e.getContext()?.get(n.removeLast().getExpression());if(u(i))throw new C(X.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new H([k.outputOf(new Map)]);let o=i.getElement(),l=a.removeLast(),p=n.removeLast(),h=p instanceof je?p.getElement():p.getExpression();for(u(o)&&(o=l==He.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=l==He.OBJECT_OPERATOR?this.getDataFromObject(o,h,a.peekLast()):this.getDataFromArray(o,h,a.peekLast()),l=a.removeLast(),p=n.removeLast(),h=p instanceof je?p.getElement():p.getExpression();return l==He.OBJECT_OPERATOR?this.putDataInObject(o,h,r):this.putDataInArray(o,h,r),new H([k.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new C(X.format("Expected an array but found $",e));const s=parseInt(t);if(isNaN(s))throw new C(X.format("Expected an array index but found $",t));if(s<0)throw new C(X.format("Array index is out of bound - $",t));let n=e[s];return u(n)&&(n=r==He.OBJECT_OPERATOR?{}:[],e[s]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new C(X.format("Expected an object but found $",e));let s=e[t];return u(s)&&(s=r==He.OBJECT_OPERATOR?{}:[],e[t]=s),s}putDataInArray(e,t,r){if(!Array.isArray(e))throw new C(X.format("Expected an array but found $",e));const s=parseInt(t);if(isNaN(s))throw new C(X.format("Expected an array index but found $",t));if(s<0)throw new C(X.format("Array index is out of bound - $",t));e[s]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new C(X.format("Expected an object but found $",e));e[t]=r}})])],[a.SYSTEM_LOOP,new Map([wr(new class extends Ie{getSignature(){return or}async internalExecute(e){let t=e.getArguments()?.get("from"),r=e.getArguments()?.get("to"),s=e.getArguments()?.get("step");const n=s>0;let a=t,i=!1;return new H({next(){if(i)return;if(n&&a>=r||!n&&a<=r)return i=!0,k.outputOf(new Map([["value",a]]));const e=k.of(D.ITERATION,new Map([["index",a]]));return a+=s,e}})}}),wr(new class extends Ie{getSignature(){return ir}async internalExecute(e){let t=e.getArguments()?.get("count"),r=0;return new H({next(){if(r>=t)return k.outputOf(new Map([["value",r]]));const e=k.of(D.ITERATION,new Map([["index",r]]));return++r,e}})}})])],[a.SYSTEM,new Map([wr(new ar),wr(new class extends Ie{getSignature(){return nr}async internalExecute(e){const t=e.getEvents(),r=e.getArguments()?.get("eventName"),s=e?.getArguments()?.get("results").map((t=>{let r=t.value;if(u(r))throw new C("Expect a value object");let s=r.value;return r.isExpression&&(s=new rr(s).evaluate(e.getValuesMap())),[t.name,s]})).reduce(((e,t)=>(e.set(t[0],t[1]),e)),new Map);return t?.has(r)||t?.set(r,[]),t?.get(r)?.push(s),new H([k.outputOf(new Map)])}})])]]);class xr extends Or{constructor(){super({find:(e,t)=>Nr.get(e)?.get(t)},new Ar)}}var Rr={};t(Rr,"ArrayUtil",(()=>Ir));class Ir{static removeAListFrom(e,t){if(!(t&&e&&e.length&&t.length))return;const r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}var vr={};t(vr,"StatementExecution",(()=>Pr));var yr={};t(yr,"StatementMessage",(()=>Mr));class Mr{constructor(e,t){this.message=t,this.messageType=e}getMessageType(){return this.messageType}setMessageType(e){return this.messageType=e,this}getMessage(){return this.message}setMessage(e){return this.message=e,this}toString(){return`${this.messageType} : ${this.message}`}}class Pr{messages=new Array;dependencies=new Set;constructor(e){this.statement=e}getStatement(){return this.statement}setStatement(e){return this.statement=e,this}getMessages(){return this.messages}setMessages(e){return this.messages=e,this}getDependencies(){return this.dependencies}setDependencies(e){return this.dependencies=e,this}getUniqueKey(){return this.statement.getStatementName()}addMessage(e,t){this.messages.push(new Mr(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){if(!(e instanceof Pr))return!1;return e.statement.equals(this.statement)}}var _r={};t(_r,"ContextTokenValueExtractor",(()=>Lr));class Lr extends Zt{static PREFIX="Context.";constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(Zt.REGEX_DOT),r=t[1],s=r.indexOf("["),n=2;return-1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),n=1),this.retrieveElementFrom(e,t,n,this.context.get(r)?.getElement())}getPrefix(){return Lr.PREFIX}}var Cr={};t(Cr,"OutputMapTokenValueExtractor",(()=>Ur));class Ur extends Zt{static PREFIX="Steps.";constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(Zt.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let n=s.get(t[r++]);if(!n||r>=t.length)return;let a=n.get(t[r++]);return this.retrieveElementFrom(e,t,r,a)}getPrefix(){return Ur.PREFIX}}var br={};t(br,"ArgumentsTokenValueExtractor",(()=>Vr));class Vr extends Zt{static PREFIX="Arguments.";constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(Zt.REGEX_DOT);return this.retrieveElementFrom(e,t,2,this.args.get(t[1]))}getPrefix(){return Vr.PREFIX}}var Br={};t(Br,"GraphVertex",(()=>kr));var Dr={};t(Dr,"ExecutionGraph",(()=>Gr));class Gr{nodeMap=new Map;constructor(e=!1){this.isSubGrph=e}getVerticesData(){return Array.from(this.nodeMap.values()).map((e=>e.getData()))}addVertex(e){if(!this.nodeMap.has(e.getUniqueKey())){let t=new kr(this,e);this.nodeMap.set(e.getUniqueKey(),t)}return this.nodeMap.get(e.getUniqueKey())}getVertex(e){return this.nodeMap.get(e)}getVertexData(e){if(this.nodeMap.has(e))return this.nodeMap.get(e).getData()}getVerticesWithNoIncomingEdges(){return Array.from(this.nodeMap.values()).filter((e=>!e.hasIncomingEdges()))}isCyclic(){let e,t=new Ce(this.getVerticesWithNoIncomingEdges()),r=new Set;for(;!t.isEmpty();){if(r.has(t.getFirst().getKey()))return!0;e=t.removeFirst(),r.add(e.getKey()),e.hasOutgoingEdges()&&t.addAll(Array.from(e.getOutVertices().values()).flatMap((e=>Array.from(e))))}return!1}addVertices(e){for(const t of e)this.addVertex(t)}getNodeMap(){return this.nodeMap}isSubGraph(){return this.isSubGrph}toString(){return"Execution Graph : \n"+Array.from(this.nodeMap.values()).map((e=>e.toString())).join("\n")}}class kr{outVertices=new Map;inVertices=new Set;constructor(e,t){this.data=t,this.graph=e}getData(){return this.data}setData(e){return this.data=e,this}getOutVertices(){return this.outVertices}setOutVertices(e){return this.outVertices=e,this}getInVertices(){return this.inVertices}setInVertices(e){return this.inVertices=e,this}getGraph(){return this.graph}setGraph(e){return this.graph=e,this}getKey(){return this.data.getUniqueKey()}addOutEdgeTo(e,t){return this.outVertices.has(e)||this.outVertices.set(e,new Set),this.outVertices.get(e).add(t),t.inVertices.add(new te(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new te(e,t)),e.outVertices.has(t)||e.outVertices.set(t,new Set),e.outVertices.get(t).add(this),e}hasIncomingEdges(){return!!this.inVertices.size}hasOutgoingEdges(){return!!this.outVertices.size}getSubGraphOfType(e){let t=new Gr(!0);var r=new Ce(Array.from(this.outVertices.get(e)??[]));for(r.map((e=>e.getData())).forEach((e=>t.addVertex(e)));!r.isEmpty();){var s=r.pop();Array.from(s.outVertices.values()).flatMap((e=>Array.from(e))).forEach((e=>{t.addVertex(e.getData()),r.add(e)}))}return t}toString(){var e=Array.from(this.getInVertices()).map((e=>e.getT1().getKey()+"("+e.getT2()+")")).join(", "),t=Array.from(this.outVertices.entries()).map((([e,t])=>e+": "+Array.from(t).map((e=>e.getKey())).join(","))).join("\n\t\t");return this.getKey()+":\n\tIn: "+e+"\n\tOut: \n\t\t"+t}}var Fr={};t(Fr,"KIRuntime",(()=>zr));var Hr={};t(Hr,"JsonExpression",(()=>Yr));class Yr{constructor(e){this.expression=e}getExpression(){return this.expression}}var $r={};let Wr;var jr;t($r,"ParameterReferenceType",(()=>Wr)),(jr=Wr||(Wr={})).VALUE="VALUE",jr.EXPRESSION="EXPRESSION";var qr={};t(qr,"FunctionExecutionParameters",(()=>Xr));class Xr{count=0;valueExtractors=new Map;getContext(){return this.context}setContext(e){this.context=e;let t=new Lr(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){this.args=e;let t=new Vr(e);return this.valueExtractors.set(t.getPrefix(),t),this}getEvents(){return this.events}setEvents(e){return this.events=e,this}getStatementExecution(){return this.statementExecution}setStatementExecution(e){return this.statementExecution=e,this}getSteps(){return this.steps}setSteps(e){this.steps=e;let t=new Ur(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}}var Jr={};let Qr;var Kr;t(Jr,"StatementMessageType",(()=>Qr)),(Kr=Qr||(Qr={})).ERROR="ERROR",Kr.WARNING="WARNING",Kr.MESSAGE="MESSAGE";class zr extends Ie{static PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value';static STEP_REGEX_PATTERN=new RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g");static VERSION=1;static MAX_EXECUTION_ITERATIONS=1e7;constructor(e,t,r){if(super(),this.fd=e,this.fd.getVersion()>zr.VERSION)throw new C("Runtime is at a lower version "+zr.VERSION+" and trying to run code from version "+this.fd.getVersion()+".");this.fRepo=t,this.sRepo=r}getSignature(){return this.fd}async getExecutionPlan(e){let t=new Gr;for(let r of Array.from(this.fd.getSteps().values()))t.addVertex(this.prepareStatementExecution(e,r));let r=this.makeEdges(t);if(r.length)throw new C(X.format("Found these unresolved dependencies : $ ",r.map((e=>X.format("Steps.$.$",e.getT1(),e.getT2())))));return t}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map);let t=await this.getExecutionPlan(e.getContext()),r=t.getVerticesData().filter((e=>e.getMessages().length)).map((e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(",")));if(r?.length)throw new C("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new Ce;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new Ce;for(;!(r.isEmpty()&&s.isEmpty()||t.getEvents()?.has(D.OUTPUT));)if(await this.processBranchQue(t,r,s),await this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==zr.MAX_EXECUTION_ITERATIONS)throw new C("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size)throw new C("No events raised");return new H(Array.from(t.getEvents()?.entries()??[]).flatMap((e=>e[1].map((t=>k.of(e[0],t))))))}async processExecutionQue(e,t,r){if(!t.isEmpty()){let s=t.pop();await this.allDependenciesResolvedVertex(s,e.getSteps())?await this.executeVertex(s,e,r,t):t.add(s)}}async processBranchQue(e,t,r){if(r.length){let s=r.pop();await this.allDependenciesResolvedTuples(s.getT2(),e.getSteps())?await this.executeBranch(e,t,s):r.add(s)}}async executeBranch(e,t,r){let s,n=r.getT4();do{await this.executeGraph(r.getT1(),e),s=r.getT3().next(),s&&(e.getSteps()?.has(n.getData().getStatement().getStatementName())||e.getSteps()?.set(n.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(n.getData().getStatement().getStatementName())?.set(s.getName(),await this.resolveInternalExpressions(s.getResult(),e)))}while(s&&s.getName()!=D.OUTPUT);s?.getName()==D.OUTPUT&&n.getOutVertices().has(D.OUTPUT)&&(n?.getOutVertices()?.get(D.OUTPUT)??[]).forEach((e=>t.add(e)))}async executeVertex(e,t,r,s){let n=e.getData().getStatement(),a=this.fRepo.find(n.getNamespace(),n.getName());if(!a)throw new C(X.format("$.$ function is not found.",n.getNamespace(),n.getName()));let i=a?.getSignature().getParameters(),o=this.getArgumentsFromParametersMap(t,n,i??new Map),u=t.getContext(),l=await a.execute((new Xr).setContext(u).setArguments(o).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount())),p=l.next();if(!p)throw new C(X.format("Executing $ returned no events",n.getStatementName()));let h=p.getName()==D.OUTPUT;if(t.getSteps()?.has(n.getStatementName())||t.getSteps().set(n.getStatementName(),new Map),t.getSteps().get(n.getStatementName()).set(p.getName(),this.resolveInternalExpressions(p.getResult(),t)),h){let t=e.getOutVertices().get(D.OUTPUT);t&&t.forEach((e=>s.add(e)))}else{let t=e.getSubGraphOfType(p.getName()),s=this.makeEdges(t);r.push(new se(t,s,l,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map((e=>new te(e[0],this.resolveInternalExpression(e[1],t)))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map):e}resolveInternalExpression(e,t){if(u(e)||"object"!=typeof e)return e;if(e instanceof Yr){return new rr(e.getExpression()).evaluate(t.getValuesMap())}if(Array.isArray(e)){let r=[];for(let s of e)r.push(this.resolveInternalExpression(s,t));return r}if("object"==typeof e){let r={};for(let s of Object.entries(e))r[s[0]]=this.resolveInternalExpression(s[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e){if(!t.has(r.getT1()))return!1;if(!t.get(r.getT1())?.get(r.getT2()))return!1}return!0}allDependenciesResolvedVertex(e,t){return!e.getInVertices().size||0==Array.from(e.getInVertices()).filter((e=>{let r=e.getT1().getData().getStatement().getStatementName(),s=e.getT2();return!(t.has(r)&&t.get(r)?.has(s))})).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map((t=>{let s,n=t[1];if(!n?.length)return new te(t[0],s);let a=r.get(t[0]);return a?(s=a.isVariableArgument()?n.map((t=>this.parameterReferenceEvaluation(e,t))).flatMap((e=>Array.isArray(e)?e:[e])):this.parameterReferenceEvaluation(e,n[0]),new te(t[0],s)):new te(t[0],void 0)})).filter((e=>!u(e.getT2()))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}parameterReferenceEvaluation(e,t){let r;if(t.getType()==Wr.VALUE)r=this.resolveInternalExpression(t.getValue(),e);else if(t.getType()==Wr.EXPRESSION&&!z.isNullOrBlank(t.getExpression())){r=new rr(t.getExpression()??"").evaluate(e.getValuesMap())}return r}prepareStatementExecution(e,t){let r=new Pr(t),s=this.fRepo.find(t.getNamespace(),t.getName());if(!s)throw new C(X.format("$.$ was not available",t.getNamespace(),t.getName()));let n=new Map(s.getSignature().getParameters());for(let s of Array.from(t.getParameterMap().entries())){let t=n.get(s[0]);if(!t)continue;let a=s[1];if(a.length){if(t.isVariableArgument())for(let s of a)this.parameterReferenceValidation(e,r,t,s);else{let s=a[0];this.parameterReferenceValidation(e,r,t,s)}n.delete(t.getParameterName())}else u(ue.getDefaultValue(t.getSchema(),this.sRepo))&&r.addMessage(Qr.ERROR,X.format(zr.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}if(!u(r.getStatement().getDependentStatements()))for(let e of r.getStatement().getDependentStatements())r.addDependency(e);if(n.size)for(let e of Array.from(n.values()))u(ue.getDefaultValue(e.getSchema(),this.sRepo))&&r.addMessage(Qr.ERROR,X.format(zr.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return r}parameterReferenceValidation(e,t,r,s){if(s){if(s.getType()==Wr.VALUE){u(s.getValue())&&u(ue.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Qr.ERROR,X.format(zr.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));let e=new Ce;for(e.push(new te(r.getSchema(),s.getValue()));!e.isEmpty();){let r=e.pop();if(r.getT2()instanceof Yr)this.addDependencies(t,r.getT2().getExpression());else{if(u(r.getT1())||u(r.getT1().getType()))continue;if(r.getT1().getType()?.contains(c.ARRAY)&&Array.isArray(r.getT2())){let t=r.getT1().getItems();if(!t)continue;if(t.isSingleType())for(let s of r.getT2())e.push(new te(t.getSingleSchema(),s));else{let s=r.getT2();for(let r=0;r<s.length;r++)e.push(new te(t.getTupleSchema()[r],s[r]))}}else if(r.getT1().getType()?.contains(c.OBJECT)&&"object"==typeof r.getT2()){let s=r.getT1();if(s.getName()===y.EXPRESSION.getName()&&s.getNamespace()===y.EXPRESSION.getNamespace()){let e=r.getT2();e.isExpression&&this.addDependencies(t,e.value)}else if(s.getProperties())for(let t of Object.entries(r.getT2()))s.getProperties().has(t[0])&&e.push(new te(s.getProperties().get(t[0]),t[1]))}}}}else if(s.getType()==Wr.EXPRESSION)if(z.isNullOrBlank(s.getExpression()))u(ue.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Qr.ERROR,X.format(zr.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));else try{this.addDependencies(t,s.getExpression())}catch(e){t.addMessage(Qr.ERROR,X.format("Error evaluating $ : $",s.getExpression(),e))}}else u(ue.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Qr.ERROR,X.format(zr.PARAMETER_NEEDS_A_VALUE,r.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(zr.STEP_REGEX_PATTERN)??[]).forEach((t=>e.addDependency(t)))}makeEdges(e){let t=e.getNodeMap().values(),r=[];for(let s of Array.from(t))for(let t of s.getData().getDependencies()){let n=t.indexOf(".",6),a=t.substring(6,n),i=t.indexOf(".",n+1),o=-1==i?t.substring(n+1):t.substring(n+1,i);e.getNodeMap().has(a)||r.push(new te(a,o));let u=e.getNodeMap().get(a);u&&s.addInEdgeTo(u,o)}return r}}var Zr={};e(Zr,Ft),e(Zr,Wt),e(Zr,qt),e(Zr,Jt),e(Zr,Ht);var es={};e(es,qe),e(es,Ke),e(es,Ze),e(es,tt),e(es,st),e(es,at),e(es,ot),e(es,Xe),e(es,lt),e(es,ht),e(es,ct),e(es,ft),e(es,Tt),e(es,At),e(es,Ot),e(es,Rt),e(es,vt),e(es,Mt),e(es,_t),e(es,bt),e(es,Ct),e(es,Bt),e(es,Gt);var ts={};t(ts,"KIRunConstants",(()=>rs));class rs{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}var ss={};t(ss,"Position",(()=>ns));class ns{static SCHEMA_NAME="Position";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(ns.SCHEMA_NAME).setType(w.of(c.OBJECT)).setProperties(new Map([["left",N.ofFloat("left")],["top",N.ofFloat("top")]]));constructor(e,t){this.left=e,this.top=t}getLeft(){return this.left}setLeft(e){return this.left=e,this}getTop(){return this.top}setTop(e){return this.top=e,this}}var as={};t(as,"FunctionDefinition",(()=>ms));var is={};t(is,"Statement",(()=>hs));var os={};t(os,"AbstractStatement",(()=>us));class us{getComment(){return this.comment}setComment(e){return this.comment=e,this}getDescription(){return this.description}setDescription(e){return this.description=e,this}getPosition(){return this.position}setPosition(e){return this.position=e,this}}var ls={};t(ls,"ParameterReference",(()=>ps));class ps{static SCHEMA_NAME="ParameterReference";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(ps.SCHEMA_NAME).setType(w.of(c.OBJECT)).setProperties(new Map([["references",N.ofString("references")],["value",N.ofAny("value")],["expression",N.ofString("expression")]]));constructor(e){this.type=e}getType(){return this.type}setType(e){return this.type=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}getExpression(){return this.expression}setExpression(e){return this.expression=e,this}static ofExpression(e){return new ps(Wr.EXPRESSION).setExpression(e)}static ofValue(e){return new ps(Wr.VALUE).setValue(e)}}class hs extends us{static SCHEMA_NAME="Statement";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(hs.SCHEMA_NAME).setType(w.of(c.OBJECT)).setProperties(new Map([["statementName",N.ofString("statementName")],["comment",N.ofString("comment")],["description",N.ofString("description")],["namespace",N.ofString("namespace")],["name",N.ofString("name")],["dependentStatements",N.ofArray("dependentstatement",N.ofString("dependentstatement"))],["parameterMap",(new N).setName("parameterMap").setAdditionalProperties((new h).setSchemaValue(N.ofArray("parameterReference",ps.SCHEMA)))],["position",ns.SCHEMA]]));constructor(e,t,r){super(),this.statementName=e,this.namespace=t,this.name=r}getStatementName(){return this.statementName}setStatementName(e){return this.statementName=e,this}getNamespace(){return this.namespace}setNamespace(e){return this.namespace=e,this}getName(){return this.name}setName(e){return this.name=e,this}getParameterMap(){return this.parameterMap||(this.parameterMap=new Map),this.parameterMap}setParameterMap(e){return this.parameterMap=e,this}getDependentStatements(){return this.dependentStatements??[]}setDependentStatements(e){return this.dependentStatements=e,this}equals(e){if(!(e instanceof hs))return!1;return e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}}class ms extends ${static SCHEMA_NAME1="FunctionDefinition";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(ms.SCHEMA_NAME1).setProperties(new Map([["name",N.ofString("name")],["namespace",N.ofString("namespace")],["parameters",N.ofArray("parameters",y.SCHEMA)],["events",N.ofObject("events").setAdditionalProperties((new h).setSchemaValue(D.SCHEMA))],["parts",N.ofObject("parts").setAdditionalProperties((new h).setSchemaValue($.SCHEMA))],["steps",N.ofObject("steps").setAdditionalProperties((new h).setSchemaValue(hs.SCHEMA))]]));version=1;constructor(e){super(e)}getVersion(){return this.version}setVersion(e){return this.version=e,this}getSteps(){return this.steps??new Map}setSteps(e){return this.steps=e,this}getStepGroups(){return this.stepGroups}setStepGroups(e){return this.stepGroups=e,this}}var cs={};t(cs,"StatementGroup",(()=>gs));class gs extends us{static SCHEMA_NAME="StatementGroup";static SCHEMA=(new N).setNamespace(a.SYSTEM).setName(gs.SCHEMA_NAME).setType(w.of(c.OBJECT)).setProperties(new Map([["statementGroupName",N.ofString("statementGroupName")],["comment",N.ofString("comment")],["description",N.ofString("description")],["position",ns.SCHEMA]]));constructor(e){super(),this.statementGroupName=e}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}}var fs={};t(fs,"Argument",(()=>Es));class Es{argumentIndex=0;constructor(e,t,r){this.argumentIndex=e,this.name=t,this.value=r}getArgumentIndex(){return this.argumentIndex}setArgumentIndex(e){return this.argumentIndex=e,this}getName(){return this.name}setName(e){return this.name=e,this}getValue(){return this.value}setValue(e){return this.value=e,this}static of(e,t){return new Es(0,e,t)}}e(module.exports,r),e(module.exports,_),e(module.exports,{}),e(module.exports,wt),e(module.exports,gr),e(module.exports,o),e(module.exports,Le),e(module.exports,be),e(module.exports,q),e(module.exports,K),e(module.exports,ee),e(module.exports,Rr),e(module.exports,vr),e(module.exports,yr),e(module.exports,W),e(module.exports,_r),e(module.exports,Cr),e(module.exports,br),e(module.exports,Br),e(module.exports,{}),e(module.exports,Dr),e(module.exports,Fr),e(module.exports,Jr),e(module.exports,qr),e(module.exports,_e),e(module.exports,qt),e(module.exports,Jt),e(module.exports,Wt),e(module.exports,Ft),e(module.exports,Zr),e(module.exports,Ht),e(module.exports,at),e(module.exports,ot),e(module.exports,Tt),e(module.exports,_t),e(module.exports,Gt),e(module.exports,ht),e(module.exports,vt),e(module.exports,Mt),e(module.exports,st),e(module.exports,ft),e(module.exports,ct),e(module.exports,bt),e(module.exports,qe),e(module.exports,lt),e(module.exports,Xe),e(module.exports,Ot),e(module.exports,Ct),e(module.exports,Bt),e(module.exports,es),e(module.exports,Ke),e(module.exports,At),e(module.exports,tt),e(module.exports,Ze),e(module.exports,Rt),e(module.exports,zt),e(module.exports,Kt),e(module.exports,$e),e(module.exports,Fe),e(module.exports,Ge),e(module.exports,Be),e(module.exports,We),e(module.exports,{}),e(module.exports,J),e(module.exports,n),e(module.exports,Hr),e(module.exports,s),e(module.exports,de),e(module.exports,ge),e(module.exports,Ee),e(module.exports,me),e(module.exports,le),e(module.exports,we),e(module.exports,Se),e(module.exports,Q),e(module.exports,ie),e(module.exports,ne),e(module.exports,he),e(module.exports,i),e(module.exports,S),e(module.exports,f),e(module.exports,E),e(module.exports,T),e(module.exports,m),e(module.exports,p),e(module.exports,Z),e(module.exports,U),e(module.exports,Sr),e(module.exports,ts),e(module.exports,x),e(module.exports,F),e(module.exports,ss),e(module.exports,as),e(module.exports,$r),e(module.exports,G),e(module.exports,os),e(module.exports,is),e(module.exports,{}),e(module.exports,cs),e(module.exports,Y),e(module.exports,B),e(module.exports,R),e(module.exports,fs),e(module.exports,ls),e(module.exports,Me),e(module.exports,L);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|