@fincity/kirun-js 1.0.5 → 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 +258 -109
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- 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/index.ts +100 -21
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}function t(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}var r={};e(r,"Tuple2",(()=>s)),e(r,"Tuple3",(()=>n)),e(r,"Tuple4",(()=>a));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 a extends n{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}}e({},"HybridRepository",(()=>i));class i{constructor(...e){this.repos=e}find(e,t){for(let r of this.repos){let s=r.find(e,t);if(s)return s}}}e({},"Schema",(()=>T));e({},"Namespaces",(()=>o));class o{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(){}}function h(e){return null==e}e({},"isNullValue",(()=>h));class u{setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!h(this.singleSchema)}static of(...e){return 1==e.length?(new u).setSingleSchema(e[0]):(new u).setTupleSchema(e)}static from(e){if(!e)return;Array.isArray(e)&&u.of(...T.fromListOfSchemas(e));let t=T.from(e);return t?u.of(t):void 0}}class l{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 l;return t.booleanValue=e.booleanValue,t.schemaValue=e.schemaValue,t}}let p;var c;e({},"SchemaType",(()=>p)),(c=p||(p={})).INTEGER="Integer",c.LONG="Long",c.FLOAT="Float",c.DOUBLE="Double",c.STRING="String",c.OBJECT="Object",c.ARRAY="Array",c.BOOLEAN="Boolean",c.NULL="Null";class m{}class g extends m{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 f extends m{constructor(e){super(),this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class E{static of(...e){return 1==e.length?new f(e[0]):new g(new Set(e))}static from(e){return"string"==typeof e?E.of(e):Array.isArray(e)?E.of(...Array.of(e).map((e=>e)).map((e=>e))):void 0}}class T{static NULL=(new T).setNamespace(o.SYSTEM).setName("Null").setType(E.of(p.NULL)).setConstant(void 0);static TYPE_SCHEMA=(new T).setType(E.of(p.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=(new T).setNamespace(o.SYSTEM).setName("Schema").setType(E.of(p.OBJECT)).setProperties(new Map([["namespace",T.of("namespace",p.STRING).setDefaultValue("_")],["name",T.ofString("name")],["version",T.of("version",p.INTEGER).setDefaultValue(1)],["ref",T.ofString("ref")],["type",(new T).setAnyOf([T.TYPE_SCHEMA,T.ofArray("type",T.TYPE_SCHEMA)])],["anyOf",T.ofArray("anyOf",T.ofRef("#/"))],["allOf",T.ofArray("allOf",T.ofRef("#/"))],["oneOf",T.ofArray("oneOf",T.ofRef("#/"))],["not",T.ofRef("#/")],["title",T.ofString("title")],["description",T.ofString("description")],["id",T.ofString("id")],["examples",T.ofAny("examples")],["defaultValue",T.ofAny("defaultValue")],["comment",T.ofString("comment")],["enums",T.ofArray("enums",T.ofString("enums"))],["constant",T.ofAny("constant")],["pattern",T.ofString("pattern")],["format",T.of("format",p.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",T.ofInteger("minLength")],["maxLength",T.ofInteger("maxLength")],["multipleOf",T.ofLong("multipleOf")],["minimum",T.ofNumber("minimum")],["maximum",T.ofNumber("maximum")],["exclusiveMinimum",T.ofNumber("exclusiveMinimum")],["exclusiveMaximum",T.ofNumber("exclusiveMaximum")],["properties",T.of("properties",p.OBJECT).setAdditionalProperties((new l).setSchemaValue(T.ofRef("#/")))],["additionalProperties",(new T).setName("additionalProperty").setNamespace(o.SYSTEM).setAnyOf([T.ofBoolean("additionalProperty"),T.ofObject("additionalProperty").setRef("#/")]).setDefaultValue(!0)],["required",T.ofArray("required",T.ofString("required")).setDefaultValue([])],["propertyNames",T.ofRef("#/")],["minProperties",T.ofInteger("minProperties")],["maxProperties",T.ofInteger("maxProperties")],["patternProperties",T.of("patternProperties",p.OBJECT).setAdditionalProperties((new l).setSchemaValue(T.ofRef("#/")))],["items",(new T).setName("items").setAnyOf([T.ofRef("#/").setName("item"),T.ofArray("tuple",T.ofRef("#/"))])],["contains",T.ofRef("#/")],["minItems",T.ofInteger("minItems")],["maxItems",T.ofInteger("maxItems")],["uniqueItems",T.ofBoolean("uniqueItems")],["$defs",T.of("$defs",p.OBJECT).setAdditionalProperties((new l).setSchemaValue(T.ofRef("#/")))],["permission",T.ofString("permission")]])).setRequired([]);static ofString(e){return(new T).setType(E.of(p.STRING)).setName(e)}static ofInteger(e){return(new T).setType(E.of(p.INTEGER)).setName(e)}static ofFloat(e){return(new T).setType(E.of(p.FLOAT)).setName(e)}static ofLong(e){return(new T).setType(E.of(p.LONG)).setName(e)}static ofDouble(e){return(new T).setType(E.of(p.DOUBLE)).setName(e)}static ofAny(e){return(new T).setType(E.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.NULL,p.OBJECT)).setName(e)}static ofAnyNotNull(e){return(new T).setType(E.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE,p.STRING,p.BOOLEAN,p.ARRAY,p.OBJECT)).setName(e)}static ofNumber(e){return(new T).setType(E.of(p.INTEGER,p.LONG,p.FLOAT,p.DOUBLE)).setName(e)}static ofBoolean(e){return(new T).setType(E.of(p.BOOLEAN)).setName(e)}static of(e,...t){return(new T).setType(E.of(...t)).setName(e)}static ofObject(e){return(new T).setType(E.of(p.OBJECT)).setName(e)}static ofRef(e){return(new T).setRef(e)}static ofArray(e,...t){return(new T).setType(E.of(p.ARRAY)).setName(e).setItems(u.of(...t))}static fromListOfSchemas(e){if(h(e)&&!Array.isArray(e))return[];let t=[];for(let r of Array.from(e)){let e=T.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(h(e))return;const t=new Map;return Object.entries(e).forEach((([e,r])=>{let s=T.from(r);s&&t.set(e,s)})),t}static from(e,t=!1){if(h(e))return;let r=new T;return r.namespace=e.namespace,r.name=e.name,r.version=e.version,r.ref=e.ref,r.type=t?new f(p.STRING):E.from(r.type),r.anyOf=T.fromListOfSchemas(e.anyOf),r.allOf=T.fromListOfSchemas(e.allOf),r.oneOf=T.fromListOfSchemas(e.oneOf),r.not=T.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=T.fromMapOfSchemas(e.properties),r.additionalProperties=l.from(e.additionalProperties),r.required=e.required,r.propertyNames=T.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=T.fromMapOfSchemas(e.patternProperties),r.items=u.from(e.items),r.contains=T.from(e.contains),r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=T.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 f(p.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}}e({},"SchemaValidator",(()=>L));e({},"StringUtil",(()=>d));e({},"KIRuntimeException",(()=>A));class A extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}e({},"StringFormatter",(()=>O));class O{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(){}}class d{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new A("String cannot be null");if(r<0||r>=e.length)throw new A(O.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new A(O.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 S 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 N 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 I{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():I.getDefaultValue(I.getSchemaFromRef(e,t,e.getRef()),t)}static getSchemaFromRef(e,t,r,s=0){if(++s==I.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new N(r??"","Schema has a cyclic reference");if(!e||!r||d.isNullOrBlank(r))return;if(!r.startsWith("#")){var n=I.resolveExternalSchema(e,t,r);n&&(e=n.getT1(),r=n.getT2())}let a=r.split("/");return e=I.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 S(r,I.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(n[a])}else{if(i&&(!i.getType()?.contains(p.OBJECT)||!i.getProperties()))throw new S(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(n[a])}if(a++,!i)throw new S(r,I.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);if(!d.isNullOrBlank(i.getRef())&&(i=I.getSchemaFromRef(i,t,i.getRef(),s),!i))throw new S(r,I.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return i}static resolveExternalSchema(e,t,r){if(!t)return;let n=d.splitAtFirstOccurance(e?.getRef()??"","/");if(!n[0])return;let a=d.splitAtFirstOccurance(n[0],".");if(!a[0]||!a[1])return;let i=t.find(a[0],a[1]);if(i){if(!n[1]||""===n[1])return new s(i,r);if(r="#/"+n[1],!i)throw new S(r,I.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return new s(i,r)}}constructor(){}}class R{static validate(e,t,r,s){let n=[];return t.getOneOf()&&!t.getOneOf()?R.oneOf(e,t,r,s,n):t.getAllOf()&&!t.getAllOf()?R.allOf(e,t,r,s,n):t.getAnyOf()&&!t.getAnyOf()&&R.anyOf(e,t,r,s,n),s}static anyOf(e,t,r,s,n){let a=!1;for(let i of t.getAnyOf()??[])try{R.validate(e,i,r,s),a=!0;break}catch(e){a=!1,n.push(e)}if(!a)throw new N(L.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{R.validate(e,i,r,s),a++}catch(e){n.push(e)}if(a!==t.getAllOf()?.length)throw new N(L.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{R.validate(e,i,r,s),a++}catch(e){n.push(e)}if(1!=a)throw new N(L.path(e),0==a?"The value does not satisfy any schema":"The value satisfy more than one schema",n)}constructor(){}}class w{static validate(e,t,r,s){if(h(s))throw new N(L.path(e),"Expected an array but found null");if(!Array.isArray(s))throw new N(L.path(e),s.toString()+" is not an Array");let n=s;return w.checkMinMaxItems(e,t,n),w.checkItems(e,t,r,n),w.checkUniqueItems(e,t,n),w.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{L.validate(i,t.getContains(),r,s[a]),n=!0;break}catch(e){n=!1}}if(!n)throw new N(L.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 N(L.path(e),"Items on the array are not unique")}}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new N(L.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new N(L.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=L.validate(a,n.getSingleSchema(),r,s[t]);s[t]=i}if(n.getTupleSchema()){if(n.getTupleSchema().length!==s.length)throw new N(L.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=L.validate(a,n.getTupleSchema()[t],r,s[t]);s[t]=i}}}constructor(){}}class y{static validate(e,t,r,s){if(h(s))throw new N(L.path(t),"Expected a number but found null");if("number"!=typeof s)throw new N(L.path(t),s.toString()+" is not a "+e);let n=y.extractNumber(e,t,r,s);return y.checkRange(t,r,s,n),y.checkMultipleOf(t,r,s,n),s}static extractNumber(e,t,r,s){let n=s;try{e!=p.LONG&&e!=p.INTEGER||(n=Math.round(n))}catch(r){throw new N(L.path(t),s+" is not a number of type "+e,r)}if(h(n)||(e==p.LONG||e==p.INTEGER)&&n!=s)throw new N(L.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 N(L.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}}static checkRange(e,t,r,s){if(t.getMinimum()&&y.numberCompare(s,t.getMinimum())<0)throw new N(L.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(t.getMaximum()&&y.numberCompare(s,t.getMaximum())>0)throw new N(L.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(t.getExclusiveMinimum()&&y.numberCompare(s,t.getExclusiveMinimum())<=0)throw new N(L.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(t.getExclusiveMaximum()&&y.numberCompare(s,t.getExclusiveMaximum())>0)throw new N(L.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}class x{static validate(e,t,r,s){if(h(s))throw new N(L.path(e),"Expected an object but found null");if("object"!=typeof s||Array.isArray(s))throw new N(L.path(e),s.toString()+" is not an Object");let n=s,a=new Set(Object.keys(n));x.checkMinMaxProperties(e,t,a),t.getPropertyNames()&&x.checkPropertyNameSchema(e,t,r,a),t.getRequired()&&x.checkRequired(e,t,n),t.getProperties()&&x.checkProperties(e,t,r,n,a),t.getPatternProperties()&&x.checkPatternProperties(e,t,r,n,a),t.getAdditionalProperties()&&x.checkAddtionalProperties(e,t,r,n,a)}static checkPropertyNameSchema(e,t,r,s){for(let n of Array.from(s.values()))try{L.validate(e,t.getPropertyNames(),r,n)}catch(t){throw new N(L.path(e),"Property name '"+n+"' does not fit the property schema")}}static checkRequired(e,t,r){for(const s of t.getRequired()??[])if(h(r[s]))throw new N(L.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=L.validate(n,a.getSchemaValue(),r,s.get(t));s[t]=i}else if(!1===a.getBooleanValue()&&n.size)throw new N(L.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=L.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(h(t))continue;let i=e?[...e]:[],o=L.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 N(L.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new N(L.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}let _;var v;(v=_||(_={})).DATETIME="DATETIME",v.TIME="TIME",v.DATE="DATE",v.EMAIL="EMAIL",v.REGEX="REGEX";class P{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(h(r))throw new N(L.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new N(L.path(e),r.toString()+" is not String");t.getFormat()==_.TIME?P.patternMatcher(e,t,r,P.TIME,"time pattern"):t.getFormat()==_.DATE?P.patternMatcher(e,t,r,P.DATE,"date pattern"):t.getFormat()==_.DATETIME?P.patternMatcher(e,t,r,P.DATETIME,"date time pattern"):t.getPattern()&&P.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let s=r.length;if(t.getMinLength()&&s<t.getMinLength())throw new N(L.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&s>t.getMinLength())throw new N(L.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,n){if(!s.test(r))throw new N(L.path(e),r.toString()+" is not matched with the "+n)}constructor(){}}class M{static validate(e,t,r,s,n){if(t==p.STRING)P.validate(e,r,n);else if(t==p.LONG||t==p.INTEGER||t==p.DOUBLE||t==p.FLOAT)y.validate(t,e,r,n);else if(t==p.BOOLEAN)(class{static validate(e,t,r){if(h(r))throw new N(L.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new N(L.path(e),r.toString()+" is not a boolean");return r}constructor(){}}).validate(e,r,n);else if(t==p.OBJECT)x.validate(e,r,s,n);else if(t==p.ARRAY)w.validate(e,r,s,n);else{if(t!=p.NULL)throw new N(L.path(e),t+" is not a valid type.");(class{static validate(e,t,r){if(r)throw new N(L.path(e),"Expected a null but found "+r);return r}constructor(){}}).validate(e,r,n)}return n}constructor(){}}class L{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),h(s)&&!h(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(t.getConstant())return L.constantValidation(e,t,s);if(t.getEnums()&&!t.getEnums()?.length)return L.enumCheck(e,t,s);if(t.getType()&&L.typeValidation(e,t,r,s),!d.isNullOrBlank(t.getRef()))return L.validate(e,I.getSchemaFromRef(e[0],r,t.getRef()),r,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&R.validate(e,t,r,s),t.getNot()){let n=!1;try{L.validate(e,t.getNot(),r,s),n=!0}catch(e){n=!1}if(n)throw new N(L.path(e),"Schema validated value in not condition.")}return s}static constantValidation(e,t,r){if(!t.getConstant().equals(r))throw new N(L.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 N(L.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{M.validate(e,i,t,r,s),n=!0;break}catch(e){n=!1,a.push(e)}if(!n)throw new N(L.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",a)}constructor(){}}e({},"KIRunConstants",(()=>U));class U{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}e({},"ExecutionException",(()=>B));class B extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}e({},"AbstractFunction",(()=>C));class C{validateArguments(e){return Array.from(this.getSignature().getParameters().entries()).map((t=>{let r,n=t[0],a=t[1],i=e.get(t[0]);if(h(i))return new s(n,L.validate(void 0,a.getSchema(),void 0,void 0));if(!a?.isVariableArgument())return new s(n,L.validate(void 0,a.getSchema(),void 0,i));Array.isArray(i)?r=i:(r=[],r.push(i));for(const e of r)L.validate(void 0,a.getSchema(),void 0,e);return new s(n,i)})).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()}}e({},"KIRuntime",(()=>Et));class b{constructor(e){this.expression=e}getExpression(){return this.expression}}class V{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=(new T).setNamespace(o.SYSTEM).setName(V.SCHEMA_NAME).setType(E.of(p.OBJECT)).setProperties(new Map([["name",T.ofString("name")],["parameters",T.ofObject("parameter").setAdditionalProperties((new l).setSchemaValue(T.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 V.eventMapEntry(V.OUTPUT,e)}static eventMapEntry(e,t){return[e,new V(e,t)]}}class D{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 D.of(V.OUTPUT,e)}static of(e,t){return new D(e,t)}}class k{index=0;constructor(e){if(h(e))throw new A("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof D?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 G;var F;(F=G||(G={})).CONSTANT="CONSTANT",F.EXPRESSION="EXPRESSION";class ${static SCHEMA_NAME="Parameter";static SCHEMA=(new T).setNamespace(o.SYSTEM).setName($.SCHEMA_NAME).setProperties(new Map([["schema",T.SCHEMA],["parameterName",T.ofString("parameterName")],["variableArgument",T.of("variableArgument",p.BOOLEAN).setDefaultValue(!1)]]));static EXPRESSION=(new T).setNamespace(o.SYSTEM).setName("ParameterExpression").setType(E.of(p.OBJECT)).setProperties(new Map([["isExpression",T.ofBoolean("isExpression").setDefaultValue(!0)],["value",T.ofAny("value")]]));variableArgument=!1;type=G.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=G.EXPRESSION){return[e,new $(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=G.EXPRESSION){return new $(e,t).setType(s).setVariableArgument(r)}}let Y;var H;(H=Y||(Y={})).VALUE="VALUE",H.EXPRESSION="EXPRESSION";e({},"LinkedList",(()=>W));class W{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(const t of e)if(this.head){const e=new q(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new q(t);this.length=e.length}}push(e){const t=new q(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 A(O.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 q(e,this.head),this.head.next=this.tail):(this.tail=new q(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new q(e),this}map(e,t){let r=new W,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 q{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}e({},"ExpressionEvaluator",(()=>at));class j{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 A(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}e({},"ExpressionEvaluationException",(()=>X));class X extends Error{constructor(e,t,r){super(O.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}e({},"Expression",(()=>K));e({},"ExpressionToken",(()=>Q));class Q{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}e({},"Operation",(()=>J));class J{static MULTIPLICATION=new J("*");static DIVISION=new J("/");static INTEGER_DIVISION=new J("//");static MOD=new J("%");static ADDITION=new J("+");static SUBTRACTION=new J("-");static NOT=new J("not",void 0,!0);static AND=new J("and",void 0,!0);static OR=new J("or",void 0,!0);static LESS_THAN=new J("<");static LESS_THAN_EQUAL=new J("<=");static GREATER_THAN=new J(">");static GREATER_THAN_EQUAL=new J(">=");static EQUAL=new J("=");static NOT_EQUAL=new J("!=");static BITWISE_AND=new J("&");static BITWISE_OR=new J("|");static BITWISE_XOR=new J("^");static BITWISE_COMPLEMENT=new J("~");static BITWISE_LEFT_SHIFT=new J("<<");static BITWISE_RIGHT_SHIFT=new J(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new J(">>>");static UNARY_PLUS=new J("UN: +","+");static UNARY_MINUS=new J("UN: -","-");static UNARY_LOGICAL_NOT=new J("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new J("UN: ~","~");static ARRAY_OPERATOR=new J("[");static OBJECT_OPERATOR=new J(".");static VALUE_OF=new Map([["MULTIPLICATION",J.MULTIPLICATION],["DIVISION",J.DIVISION],["INTEGER_DIVISON",J.INTEGER_DIVISION],["MOD",J.MOD],["ADDITION",J.ADDITION],["SUBTRACTION",J.SUBTRACTION],["NOT",J.NOT],["AND",J.AND],["OR",J.OR],["LESS_THAN",J.LESS_THAN],["LESS_THAN_EQUAL",J.LESS_THAN_EQUAL],["GREATER_THAN",J.GREATER_THAN],["GREATER_THAN_EQUAL",J.GREATER_THAN_EQUAL],["EQUAL",J.EQUAL],["NOT_EQUAL",J.NOT_EQUAL],["BITWISE_AND",J.BITWISE_AND],["BITWISE_OR",J.BITWISE_OR],["BITWISE_XOR",J.BITWISE_XOR],["BITWISE_COMPLEMENT",J.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",J.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",J.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",J.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",J.UNARY_PLUS],["UNARY_MINUS",J.UNARY_MINUS],["UNARY_LOGICAL_NOT",J.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",J.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",J.ARRAY_OPERATOR],["OBJECT_OPERATOR",J.OBJECT_OPERATOR]]);static UNARY_OPERATORS=new Set([J.ADDITION,J.SUBTRACTION,J.NOT,J.BITWISE_COMPLEMENT,J.UNARY_PLUS,J.UNARY_MINUS,J.UNARY_LOGICAL_NOT,J.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([J.MULTIPLICATION,J.DIVISION,J.INTEGER_DIVISION,J.MOD,J.ADDITION,J.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([J.NOT,J.AND,J.OR,J.LESS_THAN,J.LESS_THAN_EQUAL,J.GREATER_THAN,J.GREATER_THAN_EQUAL,J.EQUAL,J.NOT_EQUAL]);static BITWISE_OPERATORS=new Set([J.BITWISE_AND,J.BITWISE_COMPLEMENT,J.BITWISE_LEFT_SHIFT,J.BITWISE_OR,J.BITWISE_RIGHT_SHIFT,J.BITWISE_UNSIGNED_RIGHT_SHIFT,J.BITWISE_XOR]);static OPERATOR_PRIORITY=new Map([[J.UNARY_PLUS,1],[J.UNARY_MINUS,1],[J.UNARY_LOGICAL_NOT,1],[J.UNARY_BITWISE_COMPLEMENT,1],[J.ARRAY_OPERATOR,1],[J.OBJECT_OPERATOR,1],[J.MULTIPLICATION,2],[J.DIVISION,2],[J.INTEGER_DIVISION,2],[J.MOD,2],[J.ADDITION,3],[J.SUBTRACTION,3],[J.BITWISE_LEFT_SHIFT,4],[J.BITWISE_RIGHT_SHIFT,4],[J.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[J.LESS_THAN,5],[J.LESS_THAN_EQUAL,5],[J.GREATER_THAN,5],[J.GREATER_THAN_EQUAL,5],[J.EQUAL,6],[J.NOT_EQUAL,6],[J.BITWISE_AND,7],[J.BITWISE_XOR,8],[J.BITWISE_OR,9],[J.AND,10],[J.OR,11]]);static OPERATORS=new Set([...Array.from(J.ARITHMETIC_OPERATORS),...Array.from(J.LOGICAL_OPERATORS),...Array.from(J.BITWISE_OPERATORS),J.ARRAY_OPERATOR,J.OBJECT_OPERATOR].map((e=>e.getOperator())));static OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(J.ARITHMETIC_OPERATORS),...Array.from(J.LOGICAL_OPERATORS),...Array.from(J.BITWISE_OPERATORS),J.ARRAY_OPERATOR,J.OBJECT_OPERATOR].filter((e=>!e.shouldBeWrappedInSpace())).map((e=>e.getOperator())));static OPERATION_VALUE_OF=new Map(Array.from(J.VALUE_OF.entries()).map((([e,t])=>[t.getOperator(),t])));static UNARY_MAP=new Map([[J.ADDITION,J.UNARY_PLUS],[J.SUBTRACTION,J.UNARY_MINUS],[J.NOT,J.UNARY_LOGICAL_NOT],[J.BITWISE_COMPLEMENT,J.UNARY_BITWISE_COMPLEMENT],[J.UNARY_PLUS,J.UNARY_PLUS],[J.UNARY_MINUS,J.UNARY_MINUS],[J.UNARY_LOGICAL_NOT,J.UNARY_LOGICAL_NOT],[J.UNARY_BITWISE_COMPLEMENT,J.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(J.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 J.VALUE_OF.get(e)}toString(){return this.operator}}class K extends Q{tokens=new W;ops=new W;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 j(""),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 X(this.expression,"Extra closing parenthesis found");case"]":throw new X(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()==J.ARRAY_OPERATOR&&(i=this.process(e,s,n),n=i.getT1(),a=i.getT2())}++n}if(t=s.toString(),!d.isNullOrBlank(t)){if(J.OPERATORS.has(t))throw new X(this.expression,"Expression is ending with an operator");this.tokens.push(new Q(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 K(t.toString())),t.setLength(0),new s(r,!1)}processOthers(e,t,r,n,a,i){let o=t-a;o=o<J.BIGGEST_OPERATOR_SIZE?o:J.BIGGEST_OPERATOR_SIZE;for(let e=o;e>0;e--){let t=this.expression.substring(a,a+e);if(J.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return d.isNullOrBlank(n)||(this.tokens.push(new Q(n)),i=!1),this.checkUnaryOperator(this.tokens,this.ops,J.OPERATION_VALUE_OF.get(t),i),i=!0,r.setLength(0),new s(a+e-1,i)}return r.append(e),new s(a,!1)}processSubExpression(e,t,r,s,n){if(J.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,J.OPERATION_VALUE_OF.get(r),n),t.setLength(0);else if(!d.isNullOrBlank(r))throw new X(this.expression,O.format("Unkown token : $ found.",r));let a=1;const i=new j;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 X(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 K(i.toString().trim())),s}processTokenSepearator(e,t,r){return d.isNullOrBlank(t)||(J.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,J.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new Q(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r)if(s||e.isEmpty()){if(!J.UNARY_OPERATORS.has(r))throw new X(this.expression,O.format("Extra operator $ found.",r));{const e=J.UNARY_MAP.get(r);e&&t.push(e)}}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(J.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new K("",t,void 0,r))}else{let t=e.pop(),s=e.pop();e.push(new K("",s,t,r))}}t.push(r)}}hasPrecedence(e,t){let r=J.OPERATOR_PRIORITY.get(e),s=J.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 j,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 K?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}}e({},"ExpressionTokenValue",(()=>z));class z extends Q{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return O.format("$: $",this.expression,this.element)}}var Z={};e(Z,"ArithmeticAdditionOperator",(()=>re));var ee={};e(ee,"BinaryOperator",(()=>te));class te{nullCheck(e,t,r){if(h(e)||h(t))throw new B(O.format("$ cannot be applied to a null value",r.getOperatorName()))}}class re extends te{apply(e,t){return this.nullCheck(e,t,J.ADDITION),e+t}}var se={};e(se,"ArithmeticDivisionOperator",(()=>ne));class ne extends te{apply(e,t){return this.nullCheck(e,t,J.DIVISION),e/t}}var ae={};e(ae,"ArithmeticIntegerDivisionOperator",(()=>ie));class ie extends te{apply(e,t){return this.nullCheck(e,t,J.DIVISION),Math.floor(e/t)}}var oe={};e(oe,"ArithmeticModulusOperator",(()=>he));class he extends te{apply(e,t){return this.nullCheck(e,t,J.MOD),e%t}}var ue={};e(ue,"ArithmeticMultiplicationOperator",(()=>le));class le extends te{apply(e,t){return this.nullCheck(e,t,J.MULTIPLICATION),e*t}}var pe={};e(pe,"ArithmeticSubtractionOperator",(()=>ce));class ce extends te{apply(e,t){return this.nullCheck(e,t,J.SUBTRACTION),e-t}}var me={};e(me,"ArrayOperator",(()=>ge));class ge extends te{apply(e,t){if(!e)throw new B("Cannot apply array operator on a null value");if(!t)throw new B("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new B(O.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new B(O.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var fe={};e(fe,"BitwiseAndOperator",(()=>Ee));class Ee extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_AND),e&t}}var Te={};e(Te,"BitwiseLeftShiftOperator",(()=>Ae));class Ae extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_LEFT_SHIFT),e<<t}}var Oe={};e(Oe,"BitwiseOrOperator",(()=>de));class de extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_OR),e|t}}var Se={};e(Se,"BitwiseRightShiftOperator",(()=>Ne));class Ne extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_RIGHT_SHIFT),e>>t}}var Ie={};e(Ie,"BitwiseUnsignedRightShiftOperator",(()=>Re));class Re extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var we={};e(we,"BitwiseXorOperator",(()=>ye));class ye extends te{apply(e,t){return this.nullCheck(e,t,J.BITWISE_XOR),e^t}}var xe={};e(xe,"LogicalAndOperator",(()=>ve));class _e{static findPrimitiveNullAsBoolean(e){if(!e)return new s(p.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new B(O.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new s(p.BOOLEAN,r):"string"===t?new s(p.STRING,r):_e.findPrimitiveNumberType(r)}static findPrimitive(e){if(h(e))return new s(p.NULL,void 0);let t=typeof e;if("object"===t)throw new B(O.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new s(p.BOOLEAN,r):"string"===t?new s(p.STRING,r):_e.findPrimitiveNumberType(r)}static findPrimitiveNumberType(e){if(h(e)||Array.isArray(e)||"object"==typeof e)throw new B(O.format("Unable to convert $ to a number.",e));let t=e;try{let e=t;return Number.isInteger(e)?new s(p.LONG,e):new s(p.DOUBLE,e)}catch(e){throw new B(O.format("Unable to convert $ to a number.",t),e)}}static compare(e,t){if(e==t)return 0;if(h(e)||h(t))return h(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 h(e)||h(t)?h(e)&&h(t)?0:h(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)?p.LONG:p.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class ve extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()!=p.BOOLEAN)throw new B(O.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=p.BOOLEAN)throw new B(O.format("Boolean value expected but found $",s.getT2()));return r.getT2()&&s.getT2()}}var Pe={};e(Pe,"LogicalEqualOperator",(()=>Me));class Me extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);return r.getT2()==s.getT2()}}var Le={};e(Le,"LogicalGreaterThanEqualOperator",(()=>Ue));class Ue extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new B(O.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var Be={};e(Be,"LogicalGreaterThanOperator",(()=>Ce));class Ce extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new B(O.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var be={};e(be,"LogicalLessThanEqualOperator",(()=>Ve));class Ve extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new B(O.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var De={};e(De,"LogicalLessThanOperator",(()=>ke));class ke extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==p.BOOLEAN||s.getT1()==p.BOOLEAN)throw new B(O.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var Ge={};e(Ge,"LogicalNotEqualOperator",(()=>Fe));class Fe extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);return r.getT2()!=s.getT2()}}var $e={};e($e,"LogicalOrOperator",(()=>Ye));class Ye extends te{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()!=p.BOOLEAN)throw new B(O.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=p.BOOLEAN)throw new B(O.format("Boolean value expected but found $",s.getT2()));return r.getT2()||s.getT2()}}var He={};e(He,"ObjectOperator",(()=>We));class We extends te{apply(e,t){if(!e)throw new B("Cannot apply array operator on a null value");if(!t)throw new B("Cannot retrive null property value");const r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new B(O.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var qe={};e(qe,"ArithmeticUnaryMinusOperator",(()=>Qe));var je={};e(je,"UnaryOperator",(()=>Xe));class Xe{nullCheck(e,t){if(h(e))throw new B(O.format("$ cannot be applied to a null value",t.getOperatorName()))}}class Qe extends Xe{apply(e){return this.nullCheck(e,J.UNARY_MINUS),_e.findPrimitiveNumberType(e),-e}}var Je={};e(Je,"ArithmeticUnaryPlusOperator",(()=>Ke));class Ke extends Xe{apply(e){return this.nullCheck(e,J.UNARY_PLUS),_e.findPrimitiveNumberType(e),e}}var ze={};e(ze,"BitwiseComplementOperator",(()=>Ze));class Ze extends Xe{apply(e){this.nullCheck(e,J.UNARY_BITWISE_COMPLEMENT);let t=_e.findPrimitiveNumberType(e);if(t.getT1()!=p.INTEGER&&t.getT1()!=p.LONG)throw new B(O.format("Unable to apply bitwise operator on $",e));return~e}}var et={};e(et,"LogicalNotOperator",(()=>tt));class tt extends Xe{apply(e){if(this.nullCheck(e,J.UNARY_LOGICAL_NOT),_e.findPrimitiveNumberType(e).getT1()!=p.BOOLEAN)throw new B(O.format("Unable to apply bitwise operator on $",e));return!e}}e({},"TokenValueExtractor",(()=>rt));class rt{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new A(O.format("Token $ doesn't start with $",e,t));return this.getValueInternal(e)}retrieveElementFrom(e,t,r,s){if(h(s))return;if(t.length==r)return s;let n=t[r].split(rt.REGEX_SQUARE_BRACKETS).map((e=>e.trim())).filter((e=>!d.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(!h(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(O.format("$ is not a number",e));if(e>=n.length)return;return n[e]}catch(t){throw new X(e,O.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 X(e,O.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(O.format("$ is not a number",t));if(!Array.isArray(n))throw new X(e,O.format("Expecting an array with index $ while processing the expression",t,e));if(t>=n.length)return;return n[t]}catch(t){throw new X(e,O.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 X(e,O.format("Unable to retrive $ from $ in the path $",t[r],s.toString(),e))}}const st=new Map([["true",!0],["false",!1],["null",void 0]]);class nt extends rt{static INSTANCE=new nt;getValueInternal(e){if(!d.isNullOrBlank(e))return e=e.trim(),st.has(e)?st.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 X(e,O.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new X(e,O.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}}class at{static UNARY_OPERATORS_MAP=new Map([[J.UNARY_BITWISE_COMPLEMENT,new Ze],[J.UNARY_LOGICAL_NOT,new tt],[J.UNARY_MINUS,new Qe],[J.UNARY_PLUS,new Ke]]);static BINARY_OPERATORS_MAP=new Map([[J.ADDITION,new re],[J.DIVISION,new ne],[J.INTEGER_DIVISION,new ie],[J.MOD,new he],[J.MULTIPLICATION,new le],[J.SUBTRACTION,new ce],[J.BITWISE_AND,new Ee],[J.BITWISE_LEFT_SHIFT,new Ae],[J.BITWISE_OR,new de],[J.BITWISE_RIGHT_SHIFT,new Ne],[J.BITWISE_UNSIGNED_RIGHT_SHIFT,new Re],[J.BITWISE_XOR,new ye],[J.AND,new ve],[J.EQUAL,new Me],[J.GREATER_THAN,new Ce],[J.GREATER_THAN_EQUAL,new Ue],[J.LESS_THAN,new ke],[J.LESS_THAN_EQUAL,new Ve],[J.OR,new Ye],[J.NOT_EQUAL,new Fe],[J.ARRAY_OPERATOR,new ge],[J.OBJECT_OPERATOR,new We]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(at.UNARY_OPERATORS_MAP.keys());constructor(e){e instanceof K?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){return this.exp||(this.exp=new K(this.expression)),this.evaluateExpression(this.exp,e)}getExpression(){return this.exp||(this.exp=new K(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(at.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,i)));else if(e==J.OBJECT_OPERATOR||e==J.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 B(O.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new B(O.format("Expression : $ evaluated multiple values $",e,s));const i=s.get(0);if(i instanceof z)return i.getElement();if(!(i instanceof K))return this.getValueFromToken(t,i);throw new B(O.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,n){const a=new W,i=new W;if(!s||!n)return;do{i.push(s),n instanceof K?a.push(new z(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==J.OBJECT_OPERATOR||s==J.ARRAY_OPERATOR);n&&(n instanceof K?a.push(new z(n.toString(),this.evaluateExpression(n,e))):a.push(n)),s&&t.push(s);let o=a.pop(),h=new j(o instanceof z?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),s=i.pop(),h.append(s.getOperator()).append(o instanceof z?o.getTokenValue():o.toString()),s==J.ARRAY_OPERATOR&&h.append("]");let u=h.toString(),l=u.substring(0,u.indexOf(".")+1);if(l.length>2&&e.has(l))r.push(new z(u,this.getValue(u,e)));else{let e;try{e=nt.INSTANCE.getValue(u)}catch(t){e=u}r.push(new z(u,e))}}applyBinaryOperation(e,t,r){if("object"===typeof t||"object"===typeof r||Array.isArray(t)||Array.isArray(r))throw new X(this.expression,O.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));let s=at.BINARY_OPERATORS_MAP.get(e);if(!s)throw new X(this.expression,O.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new z(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){if("object"===typeof t||Array.isArray(t))throw new X(this.expression,O.format("The operator $ cannot be applied to $",e.getOperator(),t));let r=at.UNARY_OPERATORS_MAP.get(e);if(!r)throw new X(this.expression,O.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new z(e.toString(),r.apply(t))}getValueFromToken(e,t){return t instanceof K?this.evaluateExpression(t,e):t instanceof z?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){if(e.length<=5)return nt.INSTANCE.getValue(e);const r=e.substring(0,e.indexOf(".")+1);return(t.get(r)??nt.INSTANCE).getValue(e)}}class it extends rt{static PREFIX="Arguments.";constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(rt.REGEX_DOT);return this.retrieveElementFrom(e,t,2,this.args.get(t[1]))}getPrefix(){return it.PREFIX}}class ot extends rt{static PREFIX="Context.";constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(rt.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 ot.PREFIX}}class ht extends rt{static PREFIX="Steps.";constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(rt.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 ht.PREFIX}}class ut{count=0;valueExtractors=new Map;getContext(){return this.context}setContext(e){this.context=e;let t=new ot(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){this.args=e;let t=new it(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 ht(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 lt{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 pt(!0);var r=new W(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 pt{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 lt(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 W(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 ct{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 mt{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 ct(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){if(!(e instanceof mt))return!1;return e.statement.equals(this.statement)}}let gt;var ft;(ft=gt||(gt={})).ERROR="ERROR",ft.WARNING="WARNING",ft.MESSAGE="MESSAGE";class Et extends C{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()>Et.VERSION)throw new A("Runtime is at a lower version "+Et.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 pt;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 A(O.format("Found these unresolved dependencies : $ ",r.map((e=>O.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 A("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 W;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new W;for(;!(r.isEmpty()&&s.isEmpty()||t.getEvents()?.has(V.OUTPUT));)if(this.processBranchQue(t,r,s),this.processExecutionQue(t,r,s),t.setCount(t.getCount()+1),t.getCount()==Et.MAX_EXECUTION_ITERATIONS)throw new A("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size)throw new A("No events raised");return new k(Array.from(t.getEvents()?.entries()??[]).flatMap((e=>e[1].map((t=>D.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()!=V.OUTPUT);s?.getName()==V.OUTPUT&&n.getOutVertices().has(V.OUTPUT)&&(n?.getOutVertices()?.get(V.OUTPUT)??[]).forEach((e=>t.add(e)))}executeVertex(e,t,r,s){let n=e.getData().getStatement(),i=this.fRepo.find(n.getNamespace(),n.getName());if(!i)throw new A(O.format("$.$ function is not found.",n.getNamespace(),n.getName()));let o=i?.getSignature().getParameters(),h=this.getArgumentsFromParametersMap(t,n,o??new Map),u=t.getContext(),l=i.execute((new ut).setContext(u).setArguments(h).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount())),p=l.next();if(!p)throw new A(O.format("Executing $ returned no events",n.getStatementName()));let c=p.getName()==V.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(V.OUTPUT);t&&t.forEach((e=>s.add(e)))}else{let t=e.getSubGraphOfType(p.getName()),s=this.makeEdges(t);r.push(new a(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(h(e)||"object"!=typeof e)return e;if(e instanceof b){return new at(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,a=t[1];if(!a?.length)return new s(t[0],n);let i=r.get(t[0]);return i?(n=i.isVariableArgument()?a.map((t=>this.parameterReferenceEvaluation(e,t))).flatMap((e=>Array.isArray(e)?e:[e])):this.parameterReferenceEvaluation(e,a[0]),new s(t[0],n)):new s(t[0],void 0)})).filter((e=>!h(e.getT2()))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}parameterReferenceEvaluation(e,t){let r;if(t.getType()==Y.VALUE)r=this.resolveInternalExpression(t.getValue(),e);else if(t.getType()==Y.EXPRESSION&&!d.isNullOrBlank(t.getExpression())){r=new at(t.getExpression()??"").evaluate(e.getValuesMap())}return r}prepareStatementExecution(e,t){let r=new mt(t),s=this.fRepo.find(t.getNamespace(),t.getName());if(!s)throw new A(O.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 h(I.getDefaultValue(t.getSchema(),this.sRepo))&&r.addMessage(gt.ERROR,O.format(Et.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}if(!h(r.getStatement().getDependentStatements()))for(let e of r.getStatement().getDependentStatements())r.addDependency(e);if(n.size)for(let e of Array.from(n.values()))h(I.getDefaultValue(e.getSchema(),this.sRepo))&&r.addMessage(gt.ERROR,O.format(Et.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return r}parameterReferenceValidation(e,t,r,n){if(n){if(n.getType()==Y.VALUE){h(n.getValue())&&h(I.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(gt.ERROR,O.format(Et.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));let e=new W;for(e.push(new s(r.getSchema(),n.getValue()));!e.isEmpty();){let r=e.pop();if(r.getT2()instanceof b)this.addDependencies(t,r.getT2().getExpression());else{if(h(r.getT1())||h(r.getT1().getType()))continue;if(r.getT1().getType()?.contains(p.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(p.OBJECT)&&"object"==typeof r.getT2()){let n=r.getT1();if(n.getName()===$.EXPRESSION.getName()&&n.getNamespace()===$.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()==Y.EXPRESSION)if(d.isNullOrBlank(n.getExpression()))h(I.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(gt.ERROR,O.format(Et.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));else try{this.addDependencies(t,n.getExpression())}catch(e){t.addMessage(gt.ERROR,O.format("Error evaluating $ : $",n.getExpression(),e))}}else h(I.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(gt.ERROR,O.format(Et.PARAMETER_NEEDS_A_VALUE,r.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(Et.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 a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),h=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)||r.push(new s(i,h));let u=e.getNodeMap().get(i);u&&n.addInEdgeTo(u,h)}return r}}var Tt={};t(Tt,Z),t(Tt,se),t(Tt,ae),t(Tt,oe),t(Tt,ue),t(Tt,pe),t(Tt,me),t(Tt,ee),t(Tt,fe),t(Tt,Te),t(Tt,Oe),t(Tt,Se),t(Tt,Ie),t(Tt,we),t(Tt,xe),t(Tt,Pe),t(Tt,Le),t(Tt,Be),t(Tt,be),t(Tt,Ge),t(Tt,De),t(Tt,$e),t(Tt,He);var At={};t(At,qe),t(At,Je),t(At,ze),t(At,et),t(At,je);export{s as Tuple2,n as Tuple3,a as Tuple4,i as HybridRepository,T as Schema,p as SchemaType,L as SchemaValidator,U as KIRunConstants,B as ExecutionException,A as KIRuntimeException,C as AbstractFunction,o as Namespaces,Et as KIRuntime,K as Expression,at as ExpressionEvaluator,rt as TokenValueExtractor,X as ExpressionEvaluationException,Q as ExpressionToken,z as ExpressionTokenValue,J as Operation,W as LinkedList,h as isNullValue,O as StringFormatter,d as StringUtil,re as ArithmeticAdditionOperator,ne as ArithmeticDivisionOperator,ie as ArithmeticIntegerDivisionOperator,he as ArithmeticModulusOperator,le as ArithmeticMultiplicationOperator,ce as ArithmeticSubtractionOperator,ge as ArrayOperator,te as BinaryOperator,Ee as BitwiseAndOperator,Ae as BitwiseLeftShiftOperator,de as BitwiseOrOperator,Ne as BitwiseRightShiftOperator,Re as BitwiseUnsignedRightShiftOperator,ye as BitwiseXorOperator,ve as LogicalAndOperator,Me as LogicalEqualOperator,Ue as LogicalGreaterThanEqualOperator,Ce as LogicalGreaterThanOperator,Ve as LogicalLessThanEqualOperator,Fe as LogicalNotEqualOperator,ke as LogicalLessThanOperator,Ye as LogicalOrOperator,We as ObjectOperator,Qe as ArithmeticUnaryMinusOperator,Ke as ArithmeticUnaryPlusOperator,Ze as BitwiseComplementOperator,tt as LogicalNotOperator,Xe as UnaryOperator};
|
|
1
|
+
function e(e,t,r,s){Object.defineProperty(e,t,{get:r,set:s,enumerable:!0,configurable:!0})}function t(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}e({},"KIRunSchemaRepository",(()=>T));e({},"Schema",(()=>c));e({},"Namespaces",(()=>r));class r{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(){}}e({},"ArraySchemaType",(()=>a));function s(e){return null==e}e({},"isNullValue",(()=>s));class a{setSingleSchema(e){return this.singleSchema=e,this}setTupleSchema(e){return this.tupleSchema=e,this}getSingleSchema(){return this.singleSchema}getTupleSchema(){return this.tupleSchema}isSingleType(){return!s(this.singleSchema)}static of(...e){return 1==e.length?(new a).setSingleSchema(e[0]):(new a).setTupleSchema(e)}static from(e){if(!e)return;Array.isArray(e)&&a.of(...c.fromListOfSchemas(e));let t=c.from(e);return t?a.of(t):void 0}}e({},"AdditionalPropertiesType",(()=>n));class n{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 n;return t.booleanValue=e.booleanValue,t.schemaValue=e.schemaValue,t}}let i;var o;e({},"SchemaType",(()=>i)),(o=i||(i={})).INTEGER="Integer",o.LONG="Long",o.FLOAT="Float",o.DOUBLE="Double",o.STRING="String",o.OBJECT="Object",o.ARRAY="Array",o.BOOLEAN="Boolean",o.NULL="Null";e({},"TypeUtil",(()=>h));e({},"MultipleType",(()=>l));e({},"Type",(()=>u));class u{}class l extends u{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)}}e({},"SingleType",(()=>p));class p extends u{constructor(e){super(),this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class h{static of(...e){return 1==e.length?new p(e[0]):new l(new Set(e))}static from(e){return"string"==typeof e?h.of(e):Array.isArray(e)?h.of(...Array.of(e).map((e=>e)).map((e=>e))):void 0}}class c{static NULL=(new c).setNamespace(r.SYSTEM).setName("Null").setType(h.of(i.NULL)).setConstant(void 0);static TYPE_SCHEMA=(new c).setType(h.of(i.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=(new c).setNamespace(r.SYSTEM).setName("Schema").setType(h.of(i.OBJECT)).setProperties(new Map([["namespace",c.of("namespace",i.STRING).setDefaultValue("_")],["name",c.ofString("name")],["version",c.of("version",i.INTEGER).setDefaultValue(1)],["ref",c.ofString("ref")],["type",(new c).setAnyOf([c.TYPE_SCHEMA,c.ofArray("type",c.TYPE_SCHEMA)])],["anyOf",c.ofArray("anyOf",c.ofRef("#/"))],["allOf",c.ofArray("allOf",c.ofRef("#/"))],["oneOf",c.ofArray("oneOf",c.ofRef("#/"))],["not",c.ofRef("#/")],["title",c.ofString("title")],["description",c.ofString("description")],["id",c.ofString("id")],["examples",c.ofAny("examples")],["defaultValue",c.ofAny("defaultValue")],["comment",c.ofString("comment")],["enums",c.ofArray("enums",c.ofString("enums"))],["constant",c.ofAny("constant")],["pattern",c.ofString("pattern")],["format",c.of("format",i.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",c.ofInteger("minLength")],["maxLength",c.ofInteger("maxLength")],["multipleOf",c.ofLong("multipleOf")],["minimum",c.ofNumber("minimum")],["maximum",c.ofNumber("maximum")],["exclusiveMinimum",c.ofNumber("exclusiveMinimum")],["exclusiveMaximum",c.ofNumber("exclusiveMaximum")],["properties",c.of("properties",i.OBJECT).setAdditionalProperties((new n).setSchemaValue(c.ofRef("#/")))],["additionalProperties",(new c).setName("additionalProperty").setNamespace(r.SYSTEM).setAnyOf([c.ofBoolean("additionalProperty"),c.ofObject("additionalProperty").setRef("#/")]).setDefaultValue(!0)],["required",c.ofArray("required",c.ofString("required")).setDefaultValue([])],["propertyNames",c.ofRef("#/")],["minProperties",c.ofInteger("minProperties")],["maxProperties",c.ofInteger("maxProperties")],["patternProperties",c.of("patternProperties",i.OBJECT).setAdditionalProperties((new n).setSchemaValue(c.ofRef("#/")))],["items",(new c).setName("items").setAnyOf([c.ofRef("#/").setName("item"),c.ofArray("tuple",c.ofRef("#/"))])],["contains",c.ofRef("#/")],["minItems",c.ofInteger("minItems")],["maxItems",c.ofInteger("maxItems")],["uniqueItems",c.ofBoolean("uniqueItems")],["$defs",c.of("$defs",i.OBJECT).setAdditionalProperties((new n).setSchemaValue(c.ofRef("#/")))],["permission",c.ofString("permission")]])).setRequired([]);static ofString(e){return(new c).setType(h.of(i.STRING)).setName(e)}static ofInteger(e){return(new c).setType(h.of(i.INTEGER)).setName(e)}static ofFloat(e){return(new c).setType(h.of(i.FLOAT)).setName(e)}static ofLong(e){return(new c).setType(h.of(i.LONG)).setName(e)}static ofDouble(e){return(new c).setType(h.of(i.DOUBLE)).setName(e)}static ofAny(e){return(new c).setType(h.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.NULL,i.OBJECT)).setName(e)}static ofAnyNotNull(e){return(new c).setType(h.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE,i.STRING,i.BOOLEAN,i.ARRAY,i.OBJECT)).setName(e)}static ofNumber(e){return(new c).setType(h.of(i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)).setName(e)}static ofBoolean(e){return(new c).setType(h.of(i.BOOLEAN)).setName(e)}static of(e,...t){return(new c).setType(h.of(...t)).setName(e)}static ofObject(e){return(new c).setType(h.of(i.OBJECT)).setName(e)}static ofRef(e){return(new c).setRef(e)}static ofArray(e,...t){return(new c).setType(h.of(i.ARRAY)).setName(e).setItems(a.of(...t))}static fromListOfSchemas(e){if(s(e)&&!Array.isArray(e))return[];let t=[];for(let r of Array.from(e)){let e=c.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(s(e))return;const t=new Map;return Object.entries(e).forEach((([e,r])=>{let s=c.from(r);s&&t.set(e,s)})),t}static from(e,t=!1){if(s(e))return;let r=new c;return r.namespace=e.namespace,r.name=e.name,r.version=e.version,r.ref=e.ref,r.type=t?new p(i.STRING):h.from(r.type),r.anyOf=c.fromListOfSchemas(e.anyOf),r.allOf=c.fromListOfSchemas(e.allOf),r.oneOf=c.fromListOfSchemas(e.oneOf),r.not=c.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=c.fromMapOfSchemas(e.properties),r.additionalProperties=n.from(e.additionalProperties),r.required=e.required,r.propertyNames=c.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=c.fromMapOfSchemas(e.patternProperties),r.items=a.from(e.items),r.contains=c.from(e.contains),r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=c.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 p(i.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}}e({},"Parameter",(()=>f));let m;var g;e({},"ParameterType",(()=>m)),(g=m||(m={})).CONSTANT="CONSTANT",g.EXPRESSION="EXPRESSION";class f{static SCHEMA_NAME="Parameter";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(f.SCHEMA_NAME).setProperties(new Map([["schema",c.SCHEMA],["parameterName",c.ofString("parameterName")],["variableArgument",c.of("variableArgument",i.BOOLEAN).setDefaultValue(!1)]]));static EXPRESSION=(new c).setNamespace(r.SYSTEM).setName("ParameterExpression").setType(h.of(i.OBJECT)).setProperties(new Map([["isExpression",c.ofBoolean("isExpression").setDefaultValue(!0)],["value",c.ofAny("value")]]));variableArgument=!1;type=m.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=m.EXPRESSION){return[e,new f(e,t).setType(s).setVariableArgument(r)]}static of(e,t,r=!1,s=m.EXPRESSION){return new f(e,t).setType(s).setVariableArgument(r)}}const E=new Map([["any",c.ofAny("any").setNamespace(r.SYSTEM)],["boolean",c.ofBoolean("boolean").setNamespace(r.SYSTEM)],["double",c.ofDouble("double").setNamespace(r.SYSTEM)],["float",c.ofFloat("float").setNamespace(r.SYSTEM)],["integer",c.ofInteger("integer").setNamespace(r.SYSTEM)],["long",c.ofLong("long").setNamespace(r.SYSTEM)],["number",c.ofNumber("number").setNamespace(r.SYSTEM)],["string",c.ofString("string").setNamespace(r.SYSTEM)],[f.EXPRESSION.getName(),f.EXPRESSION]]);class T{find(e,t){if(r.SYSTEM==e)return E.get(t)}}e({},"KIRunFunctionRepository",(()=>xt));e({},"KIRuntimeException",(()=>A));class A extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}let O;var S;e({},"StringFormat",(()=>O)),(S=O||(O={})).DATETIME="DATETIME",S.TIME="TIME",S.DATE="DATE",S.EMAIL="EMAIL",S.REGEX="REGEX";e({},"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 c).setNamespace(r.SYSTEM).setName(d.SCHEMA_NAME).setType(h.of(i.OBJECT)).setProperties(new Map([["name",c.ofString("name")],["parameters",c.ofObject("parameter").setAdditionalProperties((new n).setSchemaValue(c.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)]}}e({},"EventResult",(()=>w));class w{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 w.of(d.OUTPUT,e)}static of(e,t){return new w(e,t)}}e({},"FunctionOutput",(()=>N));class N{index=0;constructor(e){if(s(e))throw new A("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof w?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}}e({},"FunctionSignature",(()=>R));class R{static SCHEMA_NAME="FunctionSignature";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(R.SCHEMA_NAME).setProperties(new Map([["name",c.ofString("name")],["namespace",c.ofString("namespace")],["parameters",c.ofObject("parameters").setAdditionalProperties((new n).setSchemaValue(f.SCHEMA))],["events",c.ofObject("events").setAdditionalProperties((new n).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}}e({},"ContextElement",(()=>y));class y{static NULL=new y(c.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}}e({},"StringFormatter",(()=>I));class I{static format(e,...t){if(!t||0==t.length)return e;let r="",s=0,a="",n=a,i=e.length;for(let o=0;o<i;o++)a=e.charAt(o),"$"==a&&"\\"==n?r=r.substring(0,o-1)+a:"$"==a&&s<t.length?r+=t[s++]:r+=a,n=a;return r.toString()}constructor(){}}e({},"AbstractFunction",(()=>$));e({},"SchemaValidator",(()=>Y));e({},"StringUtil",(()=>M));class M{constructor(){}static nthIndex(e,t,r=0,s){if(!e)throw new A("String cannot be null");if(r<0||r>=e.length)throw new A(I.format("Cannot search from index : $",r));if(s<=0||s>e.length)throw new A(I.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()}}e({},"SchemaUtil",(()=>U));var v={};e(v,"Tuple2",(()=>x)),e(v,"Tuple3",(()=>P)),e(v,"Tuple4",(()=>_));class x{constructor(e,t){this.f=e,this.s=t}getT1(){return this.f}getT2(){return this.s}}class P extends x{constructor(e,t,r){super(e,t),this.t=r}getT3(){return this.t}}class _ extends P{constructor(e,t,r,s){super(e,t,r),this.fr=s}getT4(){return this.fr}}e({},"SchemaReferenceException",(()=>L));class L 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}}e({},"SchemaValidationException",(()=>C));class C 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 U{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():U.getDefaultValue(U.getSchemaFromRef(e,t,e.getRef()),t)}static getSchemaFromRef(e,t,r,s=0){if(++s==U.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new C(r??"","Schema has a cyclic reference");if(!e||!r||M.isNullOrBlank(r))return;if(!r.startsWith("#")){var a=U.resolveExternalSchema(e,t,r);a&&(e=a.getT1(),r=a.getT2())}let n=r.split("/");return e=U.resolveInternalSchema(e,t,r,s,n,1)}static resolveInternalSchema(e,t,r,s,a,n){let o=e;for(;n<a.length;){if("$defs"===a[n]){if(++n>=a.length||!o.get$defs())throw new L(r,U.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);o=o.get$defs()?.get(a[n])}else{if(o&&(!o.getType()?.contains(i.OBJECT)||!o.getProperties()))throw new L(r,"Cannot retrievie schema from non Object type schemas");o=o.getProperties()?.get(a[n])}if(n++,!o)throw new L(r,U.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);if(!M.isNullOrBlank(o.getRef())&&(o=U.getSchemaFromRef(o,t,o.getRef(),s),!o))throw new L(r,U.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return o}static resolveExternalSchema(e,t,r){if(!t)return;let s=M.splitAtFirstOccurance(e?.getRef()??"","/");if(!s[0])return;let a=M.splitAtFirstOccurance(s[0],".");if(!a[0]||!a[1])return;let n=t.find(a[0],a[1]);if(n){if(!s[1]||""===s[1])return new x(n,r);if(r="#/"+s[1],!n)throw new L(r,U.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return new x(n,r)}}constructor(){}}e({},"AnyOfAllOfOneOfValidator",(()=>b));class b{static validate(e,t,r,s){let a=[];return t.getOneOf()&&!t.getOneOf()?b.oneOf(e,t,r,s,a):t.getAllOf()&&!t.getAllOf()?b.allOf(e,t,r,s,a):t.getAnyOf()&&!t.getAnyOf()&&b.anyOf(e,t,r,s,a),s}static anyOf(e,t,r,s,a){let n=!1;for(let i of t.getAnyOf()??[])try{b.validate(e,i,r,s),n=!0;break}catch(e){n=!1,a.push(e)}if(!n)throw new C(Y.path(e),"The value don't satisfy any of the schemas.",a)}static allOf(e,t,r,s,a){let n=0;for(let i of t.getAllOf()??[])try{b.validate(e,i,r,s),n++}catch(e){a.push(e)}if(n!==t.getAllOf()?.length)throw new C(Y.path(e),"The value doesn't satisfy some of the schemas.",a)}static oneOf(e,t,r,s,a){let n=0;for(let i of t.getOneOf()??[])try{b.validate(e,i,r,s),n++}catch(e){a.push(e)}if(1!=n)throw new C(Y.path(e),0==n?"The value does not satisfy any schema":"The value satisfy more than one schema",a)}constructor(){}}e({},"TypeValidator",(()=>H));e({},"ArrayValidator",(()=>V));class V{static validate(e,t,r,a){if(s(a))throw new C(Y.path(e),"Expected an array but found null");if(!Array.isArray(a))throw new C(Y.path(e),a.toString()+" is not an Array");let n=a;return V.checkMinMaxItems(e,t,n),V.checkItems(e,t,r,n),V.checkUniqueItems(e,t,n),V.checkContains(e,t,r,n),a}static checkContains(e,t,r,s){if(!t.getContains())return;let a=!1;for(let n=0;n<s.length;n++){let i=e?[...e]:[];try{Y.validate(i,t.getContains(),r,s[n]),a=!0;break}catch(e){a=!1}}if(!a)throw new C(Y.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 C(Y.path(e),"Items on the array are not unique")}}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new C(Y.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new C(Y.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static checkItems(e,t,r,s){if(!t.getItems())return;let a=t.getItems();if(a.getSingleSchema())for(let t=0;t<s.length;t++){let n=e?[...e]:[],i=Y.validate(n,a.getSingleSchema(),r,s[t]);s[t]=i}if(a.getTupleSchema()){if(a.getTupleSchema().length!==s.length)throw new C(Y.path(e),"Expected an array with only "+a.getTupleSchema().length+" but found "+s.length);for(let t=0;t<s.length;t++){let n=e?[...e]:[],i=Y.validate(n,a.getTupleSchema()[t],r,s[t]);s[t]=i}}}constructor(){}}e({},"BooleanValidator",(()=>B));class B{static validate(e,t,r){if(s(r))throw new C(Y.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new C(Y.path(e),r.toString()+" is not a boolean");return r}constructor(){}}e({},"NullValidator",(()=>D));class D{static validate(e,t,r){if(r)throw new C(Y.path(e),"Expected a null but found "+r);return r}constructor(){}}e({},"NumberValidator",(()=>G));class G{static validate(e,t,r,a){if(s(a))throw new C(Y.path(t),"Expected a number but found null");if("number"!=typeof a)throw new C(Y.path(t),a.toString()+" is not a "+e);let n=G.extractNumber(e,t,r,a);return G.checkRange(t,r,a,n),G.checkMultipleOf(t,r,a,n),a}static extractNumber(e,t,r,a){let n=a;try{e!=i.LONG&&e!=i.INTEGER||(n=Math.round(n))}catch(r){throw new C(Y.path(t),a+" is not a number of type "+e,r)}if(s(n)||(e==i.LONG||e==i.INTEGER)&&n!=a)throw new C(Y.path(t),a.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 C(Y.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}}static checkRange(e,t,r,s){if(t.getMinimum()&&G.numberCompare(s,t.getMinimum())<0)throw new C(Y.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(t.getMaximum()&&G.numberCompare(s,t.getMaximum())>0)throw new C(Y.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(t.getExclusiveMinimum()&&G.numberCompare(s,t.getExclusiveMinimum())<=0)throw new C(Y.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(t.getExclusiveMaximum()&&G.numberCompare(s,t.getExclusiveMaximum())>0)throw new C(Y.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}e({},"ObjectValidator",(()=>k));class k{static validate(e,t,r,a){if(s(a))throw new C(Y.path(e),"Expected an object but found null");if("object"!=typeof a||Array.isArray(a))throw new C(Y.path(e),a.toString()+" is not an Object");let n=a,i=new Set(Object.keys(n));k.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&k.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&k.checkRequired(e,t,n),t.getProperties()&&k.checkProperties(e,t,r,n,i),t.getPatternProperties()&&k.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&k.checkAddtionalProperties(e,t,r,n,i)}static checkPropertyNameSchema(e,t,r,s){for(let a of Array.from(s.values()))try{Y.validate(e,t.getPropertyNames(),r,a)}catch(t){throw new C(Y.path(e),"Property name '"+a+"' does not fit the property schema")}}static checkRequired(e,t,r){for(const a of t.getRequired()??[])if(s(r[a]))throw new C(Y.path(e),a+" is mandatory")}static checkAddtionalProperties(e,t,r,s,a){let n=t.getAdditionalProperties();if(n.getSchemaValue())for(let t of Array.from(a.values())){let a=e?[...e]:[],i=Y.validate(a,n.getSchemaValue(),r,s.get(t));s[t]=i}else if(!1===n.getBooleanValue()&&a.size)throw new C(Y.path(e),a.toString()+" are additional properties which are not allowed.")}static checkPatternProperties(e,t,r,s,a){const n=new Map;for(const e of Array.from(t.getPatternProperties().keys()))n.set(e,new RegExp(e));for(const i of Array.from(a.values())){const o=e?[...e]:[];for(const e of Array.from(n.entries()))if(e[1].test(i)){const n=Y.validate(o,t.getPatternProperties().get(e[0]),r,s[i]);s[i]=n,a.delete(i);break}}}static checkProperties(e,t,r,a,n){for(const i of Array.from(t.getProperties())){let t=a[i[0]];if(s(t))continue;let o=e?[...e]:[],u=Y.validate(o,i[1],r,t);a[i[0]]=u,n.delete(i[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new C(Y.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new C(Y.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}e({},"StringValidator",(()=>F));class F{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(s(r))throw new C(Y.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new C(Y.path(e),r.toString()+" is not String");t.getFormat()==O.TIME?F.patternMatcher(e,t,r,F.TIME,"time pattern"):t.getFormat()==O.DATE?F.patternMatcher(e,t,r,F.DATE,"date pattern"):t.getFormat()==O.DATETIME?F.patternMatcher(e,t,r,F.DATETIME,"date time pattern"):t.getPattern()&&F.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let a=r.length;if(t.getMinLength()&&a<t.getMinLength())throw new C(Y.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&a>t.getMinLength())throw new C(Y.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,s,a){if(!s.test(r))throw new C(Y.path(e),r.toString()+" is not matched with the "+a)}constructor(){}}class H{static validate(e,t,r,s,a){if(t==i.STRING)F.validate(e,r,a);else if(t==i.LONG||t==i.INTEGER||t==i.DOUBLE||t==i.FLOAT)G.validate(t,e,r,a);else if(t==i.BOOLEAN)B.validate(e,r,a);else if(t==i.OBJECT)k.validate(e,r,s,a);else if(t==i.ARRAY)V.validate(e,r,s,a);else{if(t!=i.NULL)throw new C(Y.path(e),t+" is not a valid type.");D.validate(e,r,a)}return a}constructor(){}}class Y{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,a){if(!t)return a;if(e||(e=new Array),e.push(t),s(a)&&!s(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(t.getConstant())return Y.constantValidation(e,t,a);if(t.getEnums()&&!t.getEnums()?.length)return Y.enumCheck(e,t,a);if(t.getType()&&Y.typeValidation(e,t,r,a),!M.isNullOrBlank(t.getRef()))return Y.validate(e,U.getSchemaFromRef(e[0],r,t.getRef()),r,a);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&b.validate(e,t,r,a),t.getNot()){let s=!1;try{Y.validate(e,t.getNot(),r,a),s=!0}catch(e){s=!1}if(s)throw new C(Y.path(e),"Schema validated value in not condition.")}return a}static constantValidation(e,t,r){if(!t.getConstant().equals(r))throw new C(Y.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 C(Y.path(e),"Value is not one of "+t.getEnums())}static typeValidation(e,t,r,s){let a=!1,n=[];for(const i of Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]))try{H.validate(e,i,t,r,s),a=!0;break}catch(e){a=!1,n.push(e)}if(!a)throw new C(Y.path(e),"Value "+JSON.stringify(s)+" is not of valid type(s)",n)}constructor(){}}class ${validateArguments(e){return Array.from(this.getSignature().getParameters().entries()).map((t=>{let r,a=t[0],n=t[1],i=e.get(t[0]);if(s(i))return new x(a,Y.validate(void 0,n.getSchema(),void 0,void 0));if(!n?.isVariableArgument())return new x(a,Y.validate(void 0,n.getSchema(),void 0,i));Array.isArray(i)?r=i:(r=[],r.push(i));for(const e of r)Y.validate(void 0,n.getSchema(),void 0,e);return new x(a,i)})).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 W=new R("Create").setNamespace(r.SYSTEM_CTX).setParameters(new Map([f.ofEntry("name",(new c).setName("name").setType(h.of(i.STRING)).setMinLength(1).setFormat(O.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,m.CONSTANT),f.ofEntry("schema",c.SCHEMA,!1,m.CONSTANT)])).setEvents(new Map([d.outputEventMapEntry(new Map)]));const j=new R("Get").setNamespace(r.SYSTEM_CTX).setParameters(new Map([f.ofEntry("name",(new c).setName("name").setType(h.of(i.STRING)).setMinLength(1).setFormat(O.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,m.CONSTANT)])).setEvents(new Map([d.outputEventMapEntry(new Map([["value",c.ofAny("value")]]))]));e({},"ExecutionException",(()=>q));class q extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}e({},"Expression",(()=>ee));e({},"LinkedList",(()=>X));class X{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(const t of e)if(this.head){const e=new J(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new J(t);this.length=e.length}}push(e){const t=new J(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 A(I.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 J(e,this.head),this.head.next=this.tail):(this.tail=new J(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new J(e),this}map(e,t){let r=new X,s=this.head,a=0;for(;s;)r.add(e(s.value,a)),s=s.next,++a;return r}forEach(e,t){let r=this.head,s=0;for(;r;)e(r.value,s),r=r.next,++s}}class J{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}e({},"StringBuilder",(()=>Q));class Q{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 A(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}e({},"ExpressionEvaluationException",(()=>K));class K extends Error{constructor(e,t,r){super(I.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}e({},"ExpressionToken",(()=>z));class z{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}e({},"Operation",(()=>Z));class Z{static MULTIPLICATION=new Z("*");static DIVISION=new Z("/");static INTEGER_DIVISION=new Z("//");static MOD=new Z("%");static ADDITION=new Z("+");static SUBTRACTION=new Z("-");static NOT=new Z("not",void 0,!0);static AND=new Z("and",void 0,!0);static OR=new Z("or",void 0,!0);static LESS_THAN=new Z("<");static LESS_THAN_EQUAL=new Z("<=");static GREATER_THAN=new Z(">");static GREATER_THAN_EQUAL=new Z(">=");static EQUAL=new Z("=");static NOT_EQUAL=new Z("!=");static BITWISE_AND=new Z("&");static BITWISE_OR=new Z("|");static BITWISE_XOR=new Z("^");static BITWISE_COMPLEMENT=new Z("~");static BITWISE_LEFT_SHIFT=new Z("<<");static BITWISE_RIGHT_SHIFT=new Z(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new Z(">>>");static UNARY_PLUS=new Z("UN: +","+");static UNARY_MINUS=new Z("UN: -","-");static UNARY_LOGICAL_NOT=new Z("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new Z("UN: ~","~");static ARRAY_OPERATOR=new Z("[");static OBJECT_OPERATOR=new Z(".");static VALUE_OF=new Map([["MULTIPLICATION",Z.MULTIPLICATION],["DIVISION",Z.DIVISION],["INTEGER_DIVISON",Z.INTEGER_DIVISION],["MOD",Z.MOD],["ADDITION",Z.ADDITION],["SUBTRACTION",Z.SUBTRACTION],["NOT",Z.NOT],["AND",Z.AND],["OR",Z.OR],["LESS_THAN",Z.LESS_THAN],["LESS_THAN_EQUAL",Z.LESS_THAN_EQUAL],["GREATER_THAN",Z.GREATER_THAN],["GREATER_THAN_EQUAL",Z.GREATER_THAN_EQUAL],["EQUAL",Z.EQUAL],["NOT_EQUAL",Z.NOT_EQUAL],["BITWISE_AND",Z.BITWISE_AND],["BITWISE_OR",Z.BITWISE_OR],["BITWISE_XOR",Z.BITWISE_XOR],["BITWISE_COMPLEMENT",Z.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",Z.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",Z.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",Z.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",Z.UNARY_PLUS],["UNARY_MINUS",Z.UNARY_MINUS],["UNARY_LOGICAL_NOT",Z.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",Z.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",Z.ARRAY_OPERATOR],["OBJECT_OPERATOR",Z.OBJECT_OPERATOR]]);static UNARY_OPERATORS=new Set([Z.ADDITION,Z.SUBTRACTION,Z.NOT,Z.BITWISE_COMPLEMENT,Z.UNARY_PLUS,Z.UNARY_MINUS,Z.UNARY_LOGICAL_NOT,Z.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([Z.MULTIPLICATION,Z.DIVISION,Z.INTEGER_DIVISION,Z.MOD,Z.ADDITION,Z.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([Z.NOT,Z.AND,Z.OR,Z.LESS_THAN,Z.LESS_THAN_EQUAL,Z.GREATER_THAN,Z.GREATER_THAN_EQUAL,Z.EQUAL,Z.NOT_EQUAL]);static BITWISE_OPERATORS=new Set([Z.BITWISE_AND,Z.BITWISE_COMPLEMENT,Z.BITWISE_LEFT_SHIFT,Z.BITWISE_OR,Z.BITWISE_RIGHT_SHIFT,Z.BITWISE_UNSIGNED_RIGHT_SHIFT,Z.BITWISE_XOR]);static OPERATOR_PRIORITY=new Map([[Z.UNARY_PLUS,1],[Z.UNARY_MINUS,1],[Z.UNARY_LOGICAL_NOT,1],[Z.UNARY_BITWISE_COMPLEMENT,1],[Z.ARRAY_OPERATOR,1],[Z.OBJECT_OPERATOR,1],[Z.MULTIPLICATION,2],[Z.DIVISION,2],[Z.INTEGER_DIVISION,2],[Z.MOD,2],[Z.ADDITION,3],[Z.SUBTRACTION,3],[Z.BITWISE_LEFT_SHIFT,4],[Z.BITWISE_RIGHT_SHIFT,4],[Z.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[Z.LESS_THAN,5],[Z.LESS_THAN_EQUAL,5],[Z.GREATER_THAN,5],[Z.GREATER_THAN_EQUAL,5],[Z.EQUAL,6],[Z.NOT_EQUAL,6],[Z.BITWISE_AND,7],[Z.BITWISE_XOR,8],[Z.BITWISE_OR,9],[Z.AND,10],[Z.OR,11]]);static OPERATORS=new Set([...Array.from(Z.ARITHMETIC_OPERATORS),...Array.from(Z.LOGICAL_OPERATORS),...Array.from(Z.BITWISE_OPERATORS),Z.ARRAY_OPERATOR,Z.OBJECT_OPERATOR].map((e=>e.getOperator())));static OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(Z.ARITHMETIC_OPERATORS),...Array.from(Z.LOGICAL_OPERATORS),...Array.from(Z.BITWISE_OPERATORS),Z.ARRAY_OPERATOR,Z.OBJECT_OPERATOR].filter((e=>!e.shouldBeWrappedInSpace())).map((e=>e.getOperator())));static OPERATION_VALUE_OF=new Map(Array.from(Z.VALUE_OF.entries()).map((([e,t])=>[t.getOperator(),t])));static UNARY_MAP=new Map([[Z.ADDITION,Z.UNARY_PLUS],[Z.SUBTRACTION,Z.UNARY_MINUS],[Z.NOT,Z.UNARY_LOGICAL_NOT],[Z.BITWISE_COMPLEMENT,Z.UNARY_BITWISE_COMPLEMENT],[Z.UNARY_PLUS,Z.UNARY_PLUS],[Z.UNARY_MINUS,Z.UNARY_MINUS],[Z.UNARY_LOGICAL_NOT,Z.UNARY_LOGICAL_NOT],[Z.UNARY_BITWISE_COMPLEMENT,Z.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(Z.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 Z.VALUE_OF.get(e)}toString(){return this.operator}}class ee extends z{tokens=new X;ops=new X;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 Q(""),a=0,n=!1;for(;a<e;){switch(r=this.expression[a],t=s.toString(),r){case" ":n=this.processTokenSepearator(s,t,n);break;case"(":a=this.processSubExpression(e,s,t,a,n),n=!1;break;case")":throw new K(this.expression,"Extra closing parenthesis found");case"]":throw new K(this.expression,"Extra closing square bracket found");default:let i=this.processOthers(r,e,s,t,a,n);a=i.getT1(),n=i.getT2(),n&&this.ops.peek()==Z.ARRAY_OPERATOR&&(i=this.process(e,s,a),a=i.getT1(),n=i.getT2())}++a}if(t=s.toString(),!M.isNullOrBlank(t)){if(Z.OPERATORS.has(t))throw new K(this.expression,"Expression is ending with an operator");this.tokens.push(new z(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 ee(t.toString())),t.setLength(0),new x(r,!1)}processOthers(e,t,r,s,a,n){let i=t-a;i=i<Z.BIGGEST_OPERATOR_SIZE?i:Z.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(a,a+e);if(Z.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return M.isNullOrBlank(s)||(this.tokens.push(new z(s)),n=!1),this.checkUnaryOperator(this.tokens,this.ops,Z.OPERATION_VALUE_OF.get(t),n),n=!0,r.setLength(0),new x(a+e-1,n)}return r.append(e),new x(a,!1)}processSubExpression(e,t,r,s,a){if(Z.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,Z.OPERATION_VALUE_OF.get(r),a),t.setLength(0);else if(!M.isNullOrBlank(r))throw new K(this.expression,I.format("Unkown token : $ found.",r));let n=1;const i=new Q;let o=this.expression.charAt(s);for(s++;s<e&&n>0;)o=this.expression.charAt(s),"("==o?n++:")"==o&&n--,0!=n&&(i.append(o),s++);if(")"!=o)throw new K(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 ee(i.toString().trim())),s}processTokenSepearator(e,t,r){return M.isNullOrBlank(t)||(Z.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,Z.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new z(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,s){if(r)if(s||e.isEmpty()){if(!Z.UNARY_OPERATORS.has(r))throw new K(this.expression,I.format("Extra operator $ found.",r));{const e=Z.UNARY_MAP.get(r);e&&t.push(e)}}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(Z.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=Z.OPERATOR_PRIORITY.get(e),s=Z.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 Q,t=0;const r=this.ops.toArray(),s=this.tokens.toArray();for(let a=0;a<r.length;a++)if(r[a].getOperator().startsWith("UN: "))e.append("(").append(r[a].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 n=s[t++];e.insert(0,r[a].getOperator()).insert(0,n.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}e({},"ExpressionEvaluator",(()=>ut));e({},"ExpressionTokenValue",(()=>te));class te extends z{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return I.format("$: $",this.expression,this.element)}}var re={};e(re,"ArithmeticAdditionOperator",(()=>ne));var se={};e(se,"BinaryOperator",(()=>ae));class ae{nullCheck(e,t,r){if(s(e)||s(t))throw new q(I.format("$ cannot be applied to a null value",r.getOperatorName()))}}class ne extends ae{apply(e,t){return this.nullCheck(e,t,Z.ADDITION),e+t}}var ie={};e(ie,"ArithmeticDivisionOperator",(()=>oe));class oe extends ae{apply(e,t){return this.nullCheck(e,t,Z.DIVISION),e/t}}var ue={};e(ue,"ArithmeticIntegerDivisionOperator",(()=>le));class le extends ae{apply(e,t){return this.nullCheck(e,t,Z.DIVISION),Math.floor(e/t)}}var pe={};e(pe,"ArithmeticModulusOperator",(()=>he));class he extends ae{apply(e,t){return this.nullCheck(e,t,Z.MOD),e%t}}var ce={};e(ce,"ArithmeticMultiplicationOperator",(()=>me));class me extends ae{apply(e,t){return this.nullCheck(e,t,Z.MULTIPLICATION),e*t}}var ge={};e(ge,"ArithmeticSubtractionOperator",(()=>fe));class fe extends ae{apply(e,t){return this.nullCheck(e,t,Z.SUBTRACTION),e-t}}var Ee={};e(Ee,"ArrayOperator",(()=>Te));class Te extends ae{apply(e,t){if(!e)throw new q("Cannot apply array operator on a null value");if(!t)throw new q("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new q(I.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new q(I.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var Ae={};e(Ae,"BitwiseAndOperator",(()=>Oe));class Oe extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_AND),e&t}}var Se={};e(Se,"BitwiseLeftShiftOperator",(()=>de));class de extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_LEFT_SHIFT),e<<t}}var we={};e(we,"BitwiseOrOperator",(()=>Ne));class Ne extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_OR),e|t}}var Re={};e(Re,"BitwiseRightShiftOperator",(()=>ye));class ye extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_RIGHT_SHIFT),e>>t}}var Ie={};e(Ie,"BitwiseUnsignedRightShiftOperator",(()=>Me));class Me extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var ve={};e(ve,"BitwiseXorOperator",(()=>xe));class xe extends ae{apply(e,t){return this.nullCheck(e,t,Z.BITWISE_XOR),e^t}}var Pe={};e(Pe,"LogicalAndOperator",(()=>Le));e({},"PrimitiveUtil",(()=>_e));class _e{static findPrimitiveNullAsBoolean(e){if(!e)return new x(i.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new q(I.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new x(i.BOOLEAN,r):"string"===t?new x(i.STRING,r):_e.findPrimitiveNumberType(r)}static findPrimitive(e){if(s(e))return new x(i.NULL,void 0);let t=typeof e;if("object"===t)throw new q(I.format("$ is not a primitive type",e));let r=e;return"boolean"===t?new x(i.BOOLEAN,r):"string"===t?new x(i.STRING,r):_e.findPrimitiveNumberType(r)}static findPrimitiveNumberType(e){if(s(e)||Array.isArray(e)||"object"==typeof e)throw new q(I.format("Unable to convert $ to a number.",e));let t=e;try{let e=t;return Number.isInteger(e)?new x(i.LONG,e):new x(i.DOUBLE,e)}catch(e){throw new q(I.format("Unable to convert $ to a number.",t),e)}}static compare(e,t){if(e==t)return 0;if(s(e)||s(t))return s(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,a=typeof t;return"object"===r||"object"===a?("object"===r&&"object"===a&&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 s(e)||s(t)?s(e)&&s(t)?0:s(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)?i.LONG:i.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class Le extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()!=i.BOOLEAN)throw new q(I.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=i.BOOLEAN)throw new q(I.format("Boolean value expected but found $",s.getT2()));return r.getT2()&&s.getT2()}}var Ce={};e(Ce,"LogicalEqualOperator",(()=>Ue));class Ue extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);return r.getT2()==s.getT2()}}var be={};e(be,"LogicalGreaterThanEqualOperator",(()=>Ve));class Ve extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new q(I.format("Cannot compare >= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>=s.getT2()}}var Be={};e(Be,"LogicalGreaterThanOperator",(()=>De));class De extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new q(I.format("Cannot compare > with the values $ and $",r.getT2(),s.getT2()));return r.getT2()>s.getT2()}}var Ge={};e(Ge,"LogicalLessThanEqualOperator",(()=>ke));class ke extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new q(I.format("Cannot compare <= with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<=s.getT2()}}var Fe={};e(Fe,"LogicalLessThanOperator",(()=>He));class He extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()==i.BOOLEAN||s.getT1()==i.BOOLEAN)throw new q(I.format("Cannot compare < with the values $ and $",r.getT2(),s.getT2()));return r.getT2()<s.getT2()}}var Ye={};e(Ye,"LogicalNotEqualOperator",(()=>$e));class $e extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);return r.getT2()!=s.getT2()}}var We={};e(We,"LogicalOrOperator",(()=>je));class je extends ae{apply(e,t){const r=_e.findPrimitiveNullAsBoolean(e),s=_e.findPrimitiveNullAsBoolean(t);if(r.getT1()!=i.BOOLEAN)throw new q(I.format("Boolean value expected but found $",r.getT2()));if(s.getT1()!=i.BOOLEAN)throw new q(I.format("Boolean value expected but found $",s.getT2()));return r.getT2()||s.getT2()}}var qe={};e(qe,"ObjectOperator",(()=>Xe));class Xe extends ae{apply(e,t){if(!e)throw new q("Cannot apply array operator on a null value");if(!t)throw new q("Cannot retrive null property value");const r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new q(I.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var Je={};e(Je,"ArithmeticUnaryMinusOperator",(()=>ze));var Qe={};e(Qe,"UnaryOperator",(()=>Ke));class Ke{nullCheck(e,t){if(s(e))throw new q(I.format("$ cannot be applied to a null value",t.getOperatorName()))}}class ze extends Ke{apply(e){return this.nullCheck(e,Z.UNARY_MINUS),_e.findPrimitiveNumberType(e),-e}}var Ze={};e(Ze,"ArithmeticUnaryPlusOperator",(()=>et));class et extends Ke{apply(e){return this.nullCheck(e,Z.UNARY_PLUS),_e.findPrimitiveNumberType(e),e}}var tt={};e(tt,"BitwiseComplementOperator",(()=>rt));class rt extends Ke{apply(e){this.nullCheck(e,Z.UNARY_BITWISE_COMPLEMENT);let t=_e.findPrimitiveNumberType(e);if(t.getT1()!=i.INTEGER&&t.getT1()!=i.LONG)throw new q(I.format("Unable to apply bitwise operator on $",e));return~e}}var st={};e(st,"LogicalNotOperator",(()=>at));class at extends Ke{apply(e){if(this.nullCheck(e,Z.UNARY_LOGICAL_NOT),_e.findPrimitiveNumberType(e).getT1()!=i.BOOLEAN)throw new q(I.format("Unable to apply bitwise operator on $",e));return!e}}e({},"LiteralTokenValueExtractor",(()=>ot));e({},"TokenValueExtractor",(()=>nt));class nt{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new A(I.format("Token $ doesn't start with $",e,t));return this.getValueInternal(e)}retrieveElementFrom(e,t,r,a){if(s(a))return;if(t.length==r)return a;let n=t[r].split(nt.REGEX_SQUARE_BRACKETS).map((e=>e.trim())).filter((e=>!M.isNullOrBlank(e))).reduce(((s,a,n)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,a,s,n)),a);return this.retrieveElementFrom(e,t,r+1,n)}resolveForEachPartOfTokenWithBrackets(e,t,r,a,n,i){if(!s(n)){if(0===i){if(Array.isArray(n)){if("length"===a)return n.length;try{let e=parseInt(a);if(isNaN(e))throw new Error(I.format("$ is not a number",e));if(e>=n.length)return;return n[e]}catch(t){throw new K(e,I.format("$ couldn't be parsed into integer in $",a,e),t)}}return this.checkIfObject(e,t,r,n),n[a]}if(a?.startsWith('"')){if(!a.endsWith('"')||1==a.length||2==a.length)throw new K(e,I.format("$ is missing a double quote or empty key found",e));return this.checkIfObject(e,t,r,n),n[a.substring(1,a.length-1)]}try{let t=parseInt(a);if(isNaN(t))throw new Error(I.format("$ is not a number",t));if(!Array.isArray(n))throw new K(e,I.format("Expecting an array with index $ while processing the expression",t,e));if(t>=n.length)return;return n[t]}catch(t){throw new K(e,I.format("$ couldn't be parsed into integer in $",a,e),t)}}}checkIfObject(e,t,r,s){if("object"!=typeof s||Array.isArray(s))throw new K(e,I.format("Unable to retrive $ from $ in the path $",t[r],s.toString(),e))}}const it=new Map([["true",!0],["false",!1],["null",void 0]]);class ot extends nt{static INSTANCE=new ot;getValueInternal(e){if(!M.isNullOrBlank(e))return e=e.trim(),it.has(e)?it.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 K(e,I.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new K(e,I.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}}class ut{static UNARY_OPERATORS_MAP=new Map([[Z.UNARY_BITWISE_COMPLEMENT,new rt],[Z.UNARY_LOGICAL_NOT,new at],[Z.UNARY_MINUS,new ze],[Z.UNARY_PLUS,new et]]);static BINARY_OPERATORS_MAP=new Map([[Z.ADDITION,new ne],[Z.DIVISION,new oe],[Z.INTEGER_DIVISION,new le],[Z.MOD,new he],[Z.MULTIPLICATION,new me],[Z.SUBTRACTION,new fe],[Z.BITWISE_AND,new Oe],[Z.BITWISE_LEFT_SHIFT,new de],[Z.BITWISE_OR,new Ne],[Z.BITWISE_RIGHT_SHIFT,new ye],[Z.BITWISE_UNSIGNED_RIGHT_SHIFT,new Me],[Z.BITWISE_XOR,new xe],[Z.AND,new Le],[Z.EQUAL,new Ue],[Z.GREATER_THAN,new De],[Z.GREATER_THAN_EQUAL,new Ve],[Z.LESS_THAN,new He],[Z.LESS_THAN_EQUAL,new ke],[Z.OR,new je],[Z.NOT_EQUAL,new $e],[Z.ARRAY_OPERATOR,new Te],[Z.OBJECT_OPERATOR,new Xe]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(ut.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(),i=s.pop();if(ut.UNARY_OPERATORS_MAP_KEY_SET.has(e))s.push(this.applyUnaryOperation(e,this.getValueFromToken(t,i)));else if(e==Z.OBJECT_OPERATOR||e==Z.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,s,e,i);else{const r=s.pop();var a=this.getValueFromToken(t,r),n=this.getValueFromToken(t,i);s.push(this.applyBinaryOperation(e,a,n))}}if(s.isEmpty())throw new q(I.format("Expression : $ evaluated to null",e));if(1!=s.size())throw new q(I.format("Expression : $ evaluated multiple values $",e,s));const i=s.get(0);if(i instanceof te)return i.getElement();if(!(i instanceof ee))return this.getValueFromToken(t,i);throw new q(I.format("Expression : $ evaluated to $",e,s.get(0)))}processObjectOrArrayOperator(e,t,r,s,a){const n=new X,i=new X;if(!s||!a)return;do{i.push(s),a instanceof ee?n.push(new te(a.toString(),this.evaluateExpression(a,e))):a&&n.push(a),a=r.isEmpty()?void 0:r.pop(),s=t.isEmpty()?void 0:t.pop()}while(s==Z.OBJECT_OPERATOR||s==Z.ARRAY_OPERATOR);a&&(a instanceof ee?n.push(new te(a.toString(),this.evaluateExpression(a,e))):n.push(a)),s&&t.push(s);let o=n.pop(),u=new Q(o instanceof te?o.getTokenValue():o.toString());for(;!n.isEmpty();)o=n.pop(),s=i.pop(),u.append(s.getOperator()).append(o instanceof te?o.getTokenValue():o.toString()),s==Z.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 te(l,this.getValue(l,e)));else{let e;try{e=ot.INSTANCE.getValue(l)}catch(t){e=l}r.push(new te(l,e))}}applyBinaryOperation(e,t,r){if("object"===typeof t||"object"===typeof r||Array.isArray(t)||Array.isArray(r))throw new K(this.expression,I.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));let s=ut.BINARY_OPERATORS_MAP.get(e);if(!s)throw new K(this.expression,I.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new te(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){if("object"===typeof t||Array.isArray(t))throw new K(this.expression,I.format("The operator $ cannot be applied to $",e.getOperator(),t));let r=ut.UNARY_OPERATORS_MAP.get(e);if(!r)throw new K(this.expression,I.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new te(e.toString(),r.apply(t))}getValueFromToken(e,t){return t instanceof ee?this.evaluateExpression(t,e):t instanceof te?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){if(e.length<=5)return ot.INSTANCE.getValue(e);const r=e.substring(0,e.indexOf(".")+1);return(t.get(r)??ot.INSTANCE).getValue(e)}}const lt=new R("Set").setNamespace(r.SYSTEM_CTX).setParameters(new Map([f.ofEntry("name",(new c).setName("name").setType(h.of(i.STRING)).setMinLength(1),!1,m.CONSTANT),f.ofEntry("value",c.ofAny("value"))])).setEvents(new Map([d.outputEventMapEntry(new Map)]));const pt=new R("GenerateEvent").setNamespace(r.SYSTEM).setParameters(new Map([f.ofEntry("eventName",c.ofString("eventName")),f.ofEntry("results",c.ofObject("results").setProperties(new Map([["name",c.ofString("name")],["value",f.EXPRESSION]])),!0)])).setEvents(new Map([d.outputEventMapEntry(new Map)]));class ht extends ${static CONDITION="condition";static SIGNATURE=new R("If").setNamespace(r.SYSTEM).setParameters(new Map([f.ofEntry(ht.CONDITION,c.of(ht.CONDITION,i.BOOLEAN))])).setEvents(new Map([d.eventMapEntry(d.TRUE,new Map),d.eventMapEntry(d.FALSE,new Map),d.outputEventMapEntry(new Map)]));getSignature(){return ht.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(ht.CONDITION);return new N([w.of(t?d.TRUE:d.FALSE,new Map),w.outputOf(new Map)])}}const ct=new R("CountLoop").setNamespace(r.SYSTEM_LOOP).setParameters(new Map([f.ofEntry("count",c.of("count",i.INTEGER).setDefaultValue(1))])).setEvents(new Map([d.eventMapEntry(d.ITERATION,new Map([["index",c.of("index",i.INTEGER)]])),d.outputEventMapEntry(new Map([["value",c.of("value",i.INTEGER)]]))]));const mt=new R("RangeLoop").setNamespace(r.SYSTEM_LOOP).setParameters(new Map([f.ofEntry("from",c.of("from",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(0)),f.ofEntry("to",c.of("to",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1)),f.ofEntry("step",c.of("step",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE).setDefaultValue(1).setNot((new c).setConstant(0)))])).setEvents(new Map([d.eventMapEntry(d.ITERATION,new Map([["index",c.of("index",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]])),d.outputEventMapEntry(new Map([["value",c.of("value",i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE)]]))]));const gt=new R("Add").setNamespace(r.MATH).setParameters(new Map([["value",new f("value",c.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([d.outputEventMapEntry(new Map([["value",c.ofNumber("value")]]))]));const ft=[()=>new Map([["value",new f("value",c.ofNumber("value"))]]),()=>new Map([["value1",new f("value1",c.ofNumber("value1"))],["value2",new f("value2",c.ofNumber("value2"))]])];class Et extends ${constructor(e,t,s=1,...a){super(),a&&a.length||(a=[i.DOUBLE]),this.parametersNumber=s,this.mathFunction=t,this.signature=new R(e).setNamespace(r.MATH).setParameters(ft[s-1]()).setEvents(new Map([d.outputEventMapEntry(new Map([["value",(new c).setType(h.of(...a)).setName("value")]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=_e.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?"value":"value1")).getT2();return 2==this.parametersNumber&&(t=_e.findPrimitiveNumberType(e.getArguments()?.get("value2")).getT2()),new N([w.outputOf(new Map([["value",this.mathFunction.call(this,r,t)]]))])}}class Tt extends ${static SIGNATURE=new R("Hypotenuse").setNamespace(r.MATH).setParameters(new Map([["value",new f("value",c.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([d.outputEventMapEntry(new Map([["value",(new c).setType(h.of(i.DOUBLE)).setName("value")]]))]));constructor(){super()}getSignature(){return Tt.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get("value");return new N([w.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>e+t*t),0))]]))])}}const At=new R("Maximum").setNamespace(r.MATH).setParameters(new Map([["value",new f("value",c.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([d.outputEventMapEntry(new Map([["value",c.ofNumber("value")]]))]));const Ot=new R("Minimum").setNamespace(r.MATH).setParameters(new Map([["value",new f("value",c.ofNumber("value")).setVariableArgument(!0)]])).setEvents(new Map([d.outputEventMapEntry(new Map([["value",c.ofNumber("value")]]))]));var St={};e(St,"MapUtil",(()=>dt)),e(St,"MapEntry",(()=>wt));class dt{static of(e,t,r,a,n,i,o,u,l,p,h,c,m,g,f,E,T,A,O,S){const d=new Map;return s(e)||s(t)||d.set(e,t),s(r)||s(a)||d.set(r,a),s(n)||s(i)||d.set(n,i),s(o)||s(u)||d.set(o,u),s(l)||s(p)||d.set(l,p),s(h)||s(c)||d.set(h,c),s(m)||s(g)||d.set(m,g),s(f)||s(E)||d.set(f,E),s(T)||s(A)||d.set(T,A),s(O)||s(S)||d.set(O,S),d}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 wt(e,t)}static ofEntries(...e){const t=new Map;for(const r of e)t.set(r.k,r.v);return t}constructor(){}}class wt{constructor(e,t){this.k=e,this.v=t}}class Nt extends ${static SIGNATURE=new R("Random").setNamespace(r.MATH).setEvents(new Map([d.outputEventMapEntry(dt.of("value",c.ofDouble("value")))]));getSignature(){return Nt.SIGNATURE}async internalExecute(e){return new N([w.outputOf(new Map([["value",Math.random()]]))])}}const Rt={Absolute:new Et("Absolute",(e=>Math.abs(e)),1,i.INTEGER,i.LONG,i.FLOAT,i.DOUBLE),ACosine:new Et("ArcCosine",(e=>Math.acos(e))),ASine:new Et("ArcSine",(e=>Math.asin(e))),ATangent:new Et("ArcTangent",(e=>Math.atan(e))),Ceiling:new Et("Ceiling",(e=>Math.ceil(e))),Cosine:new Et("Cosine",(e=>Math.cos(e))),CosineH:new Et("HyperbolicCosine",(e=>Math.cosh(e))),CubeRoot:new Et("CubeRoot",(e=>Math.cbrt(e))),Exponential:new Et("Exponential",(e=>Math.exp(e))),Expm1:new Et("ExponentialMinus1",(e=>Math.expm1(e))),Floor:new Et("Floor",(e=>Math.floor(e))),Log:new Et("LogNatural",(e=>Math.log(e))),Log10:new Et("Log10",(e=>Math.log10(e))),Round:new Et("Round",(e=>Math.round(e)),1,i.INTEGER,i.LONG),Sine:new Et("Sine",(e=>Math.sin(e))),SineH:new Et("HyperbolicSine",(e=>Math.sinh(e))),Tangent:new Et("Tangent",(e=>Math.tan(e))),TangentH:new Et("HyperbolicTangent",(e=>Math.tanh(e))),ToDegrees:new Et("ToDegrees",(e=>e*(Math.PI/180))),ToRadians:new Et("ToRadians",(e=>e*(180/Math.PI))),SquareRoot:new Et("SquareRoot",(e=>Math.sqrt(e))),ArcTangent:new Et("ArcTangent2",((e,t)=>Math.atan2(e,t)),2),Power:new Et("Power",((e,t)=>Math.pow(e,t)),2),Add:new class extends ${getSignature(){return gt}async internalExecute(e){let t=e.getArguments()?.get("value");return new N([w.outputOf(new Map([["value",t.reduce(((e,t)=>e+t),0)]]))])}},Hypotenuse:new Tt,Maximum:new class extends ${getSignature(){return At}async internalExecute(e){let t=e.getArguments()?.get("value");return new N([w.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>!e&&0!==e||t>e?t:e)))]]))])}},Minimum:new class extends ${getSignature(){return Ot}async internalExecute(e){let t=e.getArguments()?.get("value");return new N([w.outputOf(new Map([["value",Math.sqrt(t.reduce(((e,t)=>!e&&0!==e||t<e?t:e)))]]))])}},Random:new Nt};class yt{find(e,t){if(e==r.MATH)return Rt[t]}}e({},"HybridRepository",(()=>It));class It{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 Mt(e){return[e.getSignature().getName(),e]}const vt=new Map([[r.SYSTEM_CTX,new Map([Mt(new class extends ${getSignature(){return W}async internalExecute(e){const t=e?.getArguments()?.get("name");if(e?.getContext()?.has(t))throw new A(I.format("Context already has an element for '$' ",t));let r=c.from(e?.getArguments()?.get("schema"));if(!r)throw new A("Schema is not supplied.");return e.getContext().set(t,new y(r,s(r.getDefaultValue())?void 0:r.getDefaultValue())),new N([w.outputOf(new Map)])}}),Mt(new class extends ${getSignature(){return j}async internalExecute(e){const t=e?.getArguments()?.get("name");if(!e.getContext()?.has(t))throw new A(I.format("Context don't have an element for '$' ",t));return new N([w.outputOf(new Map(["value",e.getContext()?.get(t)?.getElement()]))])}}),Mt(new class extends ${getSignature(){return lt}async internalExecute(e){let t=e?.getArguments()?.get("name");if(M.isNullOrBlank(t))throw new A("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get("value");const s=new ee(t),a=s.getTokens().peekLast();if(!a.getExpression().startsWith("Context")||a instanceof ee||a instanceof te&&!a.getElement().toString().startsWith("Context"))throw new q(I.format("The context path $ is not a valid path in context",t));for(const e of s.getOperations().toArray())if(e!=Z.ARRAY_OPERATOR&&e!=Z.OBJECT_OPERATOR)throw new q(I.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<s.getTokens().size();r++){let a=s.getTokens().get(r);a instanceof ee&&s.getTokens().set(r,new te(t,new ut(a).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,s)}modifyContext(e,t,r,a){const n=a.getTokens();n.removeLast();const i=a.getOperations();i.removeLast();let o=e.getContext()?.get(n.removeLast().getExpression());if(s(o))throw new A(I.format("Context doesn't have any element with name '$' ",t));if(i.isEmpty())return o.setElement(r),new N([w.outputOf(new Map)]);let u=o.getElement(),l=i.removeLast(),p=n.removeLast(),h=p instanceof te?p.getElement():p.getExpression();for(s(u)&&(u=l==Z.OBJECT_OPERATOR?{}:[],o.setElement(u));!i.isEmpty();)u=l==Z.OBJECT_OPERATOR?this.getDataFromObject(u,h,i.peekLast()):this.getDataFromArray(u,h,i.peekLast()),l=i.removeLast(),p=n.removeLast(),h=p instanceof te?p.getElement():p.getExpression();return l==Z.OBJECT_OPERATOR?this.putDataInObject(u,h,r):this.putDataInArray(u,h,r),new N([w.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new A(I.format("Expected an array but found $",e));const a=parseInt(t);if(isNaN(a))throw new A(I.format("Expected an array index but found $",t));if(a<0)throw new A(I.format("Array index is out of bound - $",t));let n=e[a];return s(n)&&(n=r==Z.OBJECT_OPERATOR?{}:[],e[a]=n),n}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new A(I.format("Expected an object but found $",e));let a=e[t];return s(a)&&(a=r==Z.OBJECT_OPERATOR?{}:[],e[t]=a),a}putDataInArray(e,t,r){if(!Array.isArray(e))throw new A(I.format("Expected an array but found $",e));const s=parseInt(t);if(isNaN(s))throw new A(I.format("Expected an array index but found $",t));if(s<0)throw new A(I.format("Array index is out of bound - $",t));e[s]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new A(I.format("Expected an object but found $",e));e[t]=r}})])],[r.SYSTEM_LOOP,new Map([Mt(new class extends ${getSignature(){return mt}async internalExecute(e){let t=e.getArguments()?.get("from"),r=e.getArguments()?.get("to"),s=e.getArguments()?.get("step");const a=s>0;let n=t,i=!1;return new N({next(){if(i)return;if(a&&n>=r||!a&&n<=r)return i=!0,w.outputOf(new Map([["value",n]]));const e=w.of(d.ITERATION,new Map([["index",n]]));return n+=s,e}})}}),Mt(new class extends ${getSignature(){return ct}async internalExecute(e){let t=e.getArguments()?.get("count"),r=0;return new N({next(){if(r>=t)return w.outputOf(new Map([["value",r]]));const e=w.of(d.ITERATION,new Map([["index",r]]));return++r,e}})}})])],[r.SYSTEM,new Map([Mt(new ht),Mt(new class extends ${getSignature(){return pt}async internalExecute(e){const t=e.getEvents(),r=e.getArguments()?.get("eventName"),a=e?.getArguments()?.get("results").map((t=>{let r=t.value;if(s(r))throw new A("Expect a value object");let a=r.value;return r.isExpression&&(a=new ut(a).evaluate(e.getValuesMap())),[t.name,a]})).reduce(((e,t)=>(e.set(t[0],t[1]),e)),new Map);return t?.has(r)||t?.set(r,[]),t?.get(r)?.push(a),new N([w.outputOf(new Map)])}})])]]);class xt extends It{constructor(){super({find:(e,t)=>vt.get(e)?.get(t)},new yt)}}e({},"ArrayUtil",(()=>Pt));class Pt{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(){}}e({},"StatementExecution",(()=>Lt));e({},"StatementMessage",(()=>_t));class _t{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 Lt{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 _t(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){if(!(e instanceof Lt))return!1;return e.statement.equals(this.statement)}}e({},"ContextTokenValueExtractor",(()=>Ct));class Ct extends nt{static PREFIX="Context.";constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(nt.REGEX_DOT),r=t[1],s=r.indexOf("["),a=2;return-1!=s&&(r=t[1].substring(0,s),t[1]=t[1].substring(s),a=1),this.retrieveElementFrom(e,t,a,this.context.get(r)?.getElement())}getPrefix(){return Ct.PREFIX}}e({},"OutputMapTokenValueExtractor",(()=>Ut));class Ut extends nt{static PREFIX="Steps.";constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(nt.REGEX_DOT),r=1,s=this.output.get(t[r++]);if(!s||r>=t.length)return;let a=s.get(t[r++]);if(!a||r>=t.length)return;let n=a.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}getPrefix(){return Ut.PREFIX}}e({},"ArgumentsTokenValueExtractor",(()=>bt));class bt extends nt{static PREFIX="Arguments.";constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(nt.REGEX_DOT);return this.retrieveElementFrom(e,t,2,this.args.get(t[1]))}getPrefix(){return bt.PREFIX}}e({},"GraphVertex",(()=>Bt));e({},"ExecutionGraph",(()=>Vt));class Vt{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 Bt(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 X(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 Bt{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 x(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new x(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 Vt(!0);var r=new X(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}}e({},"KIRuntime",(()=>$t));e({},"JsonExpression",(()=>Dt));class Dt{constructor(e){this.expression=e}getExpression(){return this.expression}}let Gt;var kt;e({},"ParameterReferenceType",(()=>Gt)),(kt=Gt||(Gt={})).VALUE="VALUE",kt.EXPRESSION="EXPRESSION";e({},"FunctionExecutionParameters",(()=>Ft));class Ft{count=0;valueExtractors=new Map;getContext(){return this.context}setContext(e){this.context=e;let t=new Ct(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){this.args=e;let t=new bt(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 Ut(e);return this.valueExtractors.set(t.getPrefix(),t),this}getCount(){return this.count}setCount(e){return this.count=e,this}getValuesMap(){return this.valueExtractors}}let Ht;var Yt;e({},"StatementMessageType",(()=>Ht)),(Yt=Ht||(Ht={})).ERROR="ERROR",Yt.WARNING="WARNING",Yt.MESSAGE="MESSAGE";class $t extends ${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()>$t.VERSION)throw new A("Runtime is at a lower version "+$t.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 Vt;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 A(I.format("Found these unresolved dependencies : $ ",r.map((e=>I.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 A("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 X;r.addAll(e.getVerticesWithNoIncomingEdges());let s=new X;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()==$t.MAX_EXECUTION_ITERATIONS)throw new A("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size)throw new A("No events raised");return new N(Array.from(t.getEvents()?.entries()??[]).flatMap((e=>e[1].map((t=>w.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,a=r.getT4();do{await this.executeGraph(r.getT1(),e),s=r.getT3().next(),s&&(e.getSteps()?.has(a.getData().getStatement().getStatementName())||e.getSteps()?.set(a.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(a.getData().getStatement().getStatementName())?.set(s.getName(),await this.resolveInternalExpressions(s.getResult(),e)))}while(s&&s.getName()!=d.OUTPUT);s?.getName()==d.OUTPUT&&a.getOutVertices().has(d.OUTPUT)&&(a?.getOutVertices()?.get(d.OUTPUT)??[]).forEach((e=>t.add(e)))}async executeVertex(e,t,r,s){let a=e.getData().getStatement(),n=this.fRepo.find(a.getNamespace(),a.getName());if(!n)throw new A(I.format("$.$ function is not found.",a.getNamespace(),a.getName()));let i=n?.getSignature().getParameters(),o=this.getArgumentsFromParametersMap(t,a,i??new Map),u=t.getContext(),l=await n.execute((new Ft).setContext(u).setArguments(o).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount())),p=l.next();if(!p)throw new A(I.format("Executing $ returned no events",a.getStatementName()));let h=p.getName()==d.OUTPUT;if(t.getSteps()?.has(a.getStatementName())||t.getSteps().set(a.getStatementName(),new Map),t.getSteps().get(a.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 _(t,s,l,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map((e=>new x(e[0],this.resolveInternalExpression(e[1],t)))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map):e}resolveInternalExpression(e,t){if(s(e)||"object"!=typeof e)return e;if(e instanceof Dt){return new ut(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,a=t[1];if(!a?.length)return new x(t[0],s);let n=r.get(t[0]);return n?(s=n.isVariableArgument()?a.map((t=>this.parameterReferenceEvaluation(e,t))).flatMap((e=>Array.isArray(e)?e:[e])):this.parameterReferenceEvaluation(e,a[0]),new x(t[0],s)):new x(t[0],void 0)})).filter((e=>!s(e.getT2()))).reduce(((e,t)=>(e.set(t.getT1(),t.getT2()),e)),new Map)}parameterReferenceEvaluation(e,t){let r;if(t.getType()==Gt.VALUE)r=this.resolveInternalExpression(t.getValue(),e);else if(t.getType()==Gt.EXPRESSION&&!M.isNullOrBlank(t.getExpression())){r=new ut(t.getExpression()??"").evaluate(e.getValuesMap())}return r}prepareStatementExecution(e,t){let r=new Lt(t),a=this.fRepo.find(t.getNamespace(),t.getName());if(!a)throw new A(I.format("$.$ was not available",t.getNamespace(),t.getName()));let n=new Map(a.getSignature().getParameters());for(let a of Array.from(t.getParameterMap().entries())){let t=n.get(a[0]);if(!t)continue;let i=a[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 s(U.getDefaultValue(t.getSchema(),this.sRepo))&&r.addMessage(Ht.ERROR,I.format($t.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}if(!s(r.getStatement().getDependentStatements()))for(let e of r.getStatement().getDependentStatements())r.addDependency(e);if(n.size)for(let e of Array.from(n.values()))s(U.getDefaultValue(e.getSchema(),this.sRepo))&&r.addMessage(Ht.ERROR,I.format($t.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return r}parameterReferenceValidation(e,t,r,a){if(a){if(a.getType()==Gt.VALUE){s(a.getValue())&&s(U.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Ht.ERROR,I.format($t.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));let e=new X;for(e.push(new x(r.getSchema(),a.getValue()));!e.isEmpty();){let r=e.pop();if(r.getT2()instanceof Dt)this.addDependencies(t,r.getT2().getExpression());else{if(s(r.getT1())||s(r.getT1().getType()))continue;if(r.getT1().getType()?.contains(i.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 x(t.getSingleSchema(),s));else{let s=r.getT2();for(let r=0;r<s.length;r++)e.push(new x(t.getTupleSchema()[r],s[r]))}}else if(r.getT1().getType()?.contains(i.OBJECT)&&"object"==typeof r.getT2()){let s=r.getT1();if(s.getName()===f.EXPRESSION.getName()&&s.getNamespace()===f.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 x(s.getProperties().get(t[0]),t[1]))}}}}else if(a.getType()==Gt.EXPRESSION)if(M.isNullOrBlank(a.getExpression()))s(U.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Ht.ERROR,I.format($t.PARAMETER_NEEDS_A_VALUE,r.getParameterName()));else try{this.addDependencies(t,a.getExpression())}catch(e){t.addMessage(Ht.ERROR,I.format("Error evaluating $ : $",a.getExpression(),e))}}else s(U.getDefaultValue(r.getSchema(),this.sRepo))&&t.addMessage(Ht.ERROR,I.format($t.PARAMETER_NEEDS_A_VALUE,r.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match($t.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 a=t.indexOf(".",6),n=t.substring(6,a),i=t.indexOf(".",a+1),o=-1==i?t.substring(a+1):t.substring(a+1,i);e.getNodeMap().has(n)||r.push(new x(n,o));let u=e.getNodeMap().get(n);u&&s.addInEdgeTo(u,o)}return r}}var Wt={};t(Wt,Je),t(Wt,Ze),t(Wt,tt),t(Wt,st),t(Wt,Qe);var jt={};t(jt,re),t(jt,ie),t(jt,ue),t(jt,pe),t(jt,ce),t(jt,ge),t(jt,Ee),t(jt,se),t(jt,Ae),t(jt,Se),t(jt,we),t(jt,Re),t(jt,Ie),t(jt,ve),t(jt,Pe),t(jt,Ce),t(jt,be),t(jt,Be),t(jt,Ge),t(jt,Ye),t(jt,Fe),t(jt,We),t(jt,qe);e({},"KIRunConstants",(()=>qt));class qt{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}e({},"Position",(()=>Xt));class Xt{static SCHEMA_NAME="Position";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(Xt.SCHEMA_NAME).setType(h.of(i.OBJECT)).setProperties(new Map([["left",c.ofFloat("left")],["top",c.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}}e({},"FunctionDefinition",(()=>zt));e({},"Statement",(()=>Kt));e({},"AbstractStatement",(()=>Jt));class Jt{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}}e({},"ParameterReference",(()=>Qt));class Qt{static SCHEMA_NAME="ParameterReference";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(Qt.SCHEMA_NAME).setType(h.of(i.OBJECT)).setProperties(new Map([["references",c.ofString("references")],["value",c.ofAny("value")],["expression",c.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 Qt(Gt.EXPRESSION).setExpression(e)}static ofValue(e){return new Qt(Gt.VALUE).setValue(e)}}class Kt extends Jt{static SCHEMA_NAME="Statement";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(Kt.SCHEMA_NAME).setType(h.of(i.OBJECT)).setProperties(new Map([["statementName",c.ofString("statementName")],["comment",c.ofString("comment")],["description",c.ofString("description")],["namespace",c.ofString("namespace")],["name",c.ofString("name")],["dependentStatements",c.ofArray("dependentstatement",c.ofString("dependentstatement"))],["parameterMap",(new c).setName("parameterMap").setAdditionalProperties((new n).setSchemaValue(c.ofArray("parameterReference",Qt.SCHEMA)))],["position",Xt.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 Kt))return!1;return e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}}class zt extends R{static SCHEMA_NAME1="FunctionDefinition";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(zt.SCHEMA_NAME1).setProperties(new Map([["name",c.ofString("name")],["namespace",c.ofString("namespace")],["parameters",c.ofArray("parameters",f.SCHEMA)],["events",c.ofObject("events").setAdditionalProperties((new n).setSchemaValue(d.SCHEMA))],["parts",c.ofObject("parts").setAdditionalProperties((new n).setSchemaValue(R.SCHEMA))],["steps",c.ofObject("steps").setAdditionalProperties((new n).setSchemaValue(Kt.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}}e({},"StatementGroup",(()=>Zt));class Zt extends Jt{static SCHEMA_NAME="StatementGroup";static SCHEMA=(new c).setNamespace(r.SYSTEM).setName(Zt.SCHEMA_NAME).setType(h.of(i.OBJECT)).setProperties(new Map([["statementGroupName",c.ofString("statementGroupName")],["comment",c.ofString("comment")],["description",c.ofString("description")],["position",Xt.SCHEMA]]));constructor(e){super(),this.statementGroupName=e}getStatementGroupName(){return this.statementGroupName}setStatementGroupName(e){return this.statementGroupName=e,this}}e({},"Argument",(()=>er));class er{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 er(0,e,t)}}export{T as KIRunSchemaRepository,xt as KIRunFunctionRepository,_e as PrimitiveUtil,dt as MapUtil,wt as MapEntry,s as isNullValue,X as LinkedList,Q as StringBuilder,I as StringFormatter,M as StringUtil,x as Tuple2,P as Tuple3,_ as Tuple4,Pt as ArrayUtil,Lt as StatementExecution,_t as StatementMessage,y as ContextElement,Ct as ContextTokenValueExtractor,Ut as OutputMapTokenValueExtractor,bt as ArgumentsTokenValueExtractor,Bt as GraphVertex,Vt as ExecutionGraph,$t as KIRuntime,Ht as StatementMessageType,Ft as FunctionExecutionParameters,ee as Expression,rt as BitwiseComplementOperator,rt as BitwiseComplementOperator,at as LogicalNotOperator,at as LogicalNotOperator,et as ArithmeticUnaryPlusOperator,et as ArithmeticUnaryPlusOperator,ze as ArithmeticUnaryMinusOperator,ze as ArithmeticUnaryMinusOperator,Ke as UnaryOperator,Ke as UnaryOperator,fe as ArithmeticSubtractionOperator,fe as ArithmeticSubtractionOperator,Te as ArrayOperator,Te as ArrayOperator,Me as BitwiseUnsignedRightShiftOperator,Me as BitwiseUnsignedRightShiftOperator,ke as LogicalLessThanEqualOperator,ke as LogicalLessThanEqualOperator,Xe as ObjectOperator,Xe as ObjectOperator,de as BitwiseLeftShiftOperator,de as BitwiseLeftShiftOperator,Ve as LogicalGreaterThanEqualOperator,Ve as LogicalGreaterThanEqualOperator,De as LogicalGreaterThanOperator,De as LogicalGreaterThanOperator,me as ArithmeticMultiplicationOperator,me as ArithmeticMultiplicationOperator,ye as BitwiseRightShiftOperator,ye as BitwiseRightShiftOperator,Ne as BitwiseOrOperator,Ne as BitwiseOrOperator,$e as LogicalNotEqualOperator,$e as LogicalNotEqualOperator,ne as ArithmeticAdditionOperator,ne as ArithmeticAdditionOperator,Oe as BitwiseAndOperator,Oe as BitwiseAndOperator,ae as BinaryOperator,ae as BinaryOperator,Le as LogicalAndOperator,Le as LogicalAndOperator,He as LogicalLessThanOperator,He as LogicalLessThanOperator,je as LogicalOrOperator,je as LogicalOrOperator,oe as ArithmeticDivisionOperator,oe as ArithmeticDivisionOperator,le as ArithmeticIntegerDivisionOperator,le as ArithmeticIntegerDivisionOperator,he as ArithmeticModulusOperator,he as ArithmeticModulusOperator,xe as BitwiseXorOperator,xe as BitwiseXorOperator,Ue as LogicalEqualOperator,Ue as LogicalEqualOperator,nt as TokenValueExtractor,ot as LiteralTokenValueExtractor,ut as ExpressionEvaluator,Z as Operation,z as ExpressionToken,K as ExpressionEvaluationException,te as ExpressionTokenValue,$ as AbstractFunction,r as Namespaces,Dt as JsonExpression,c as Schema,G as NumberValidator,B as BooleanValidator,D as NullValidator,V as ArrayValidator,b as AnyOfAllOfOneOfValidator,F as StringValidator,k as ObjectValidator,Y as SchemaValidator,C as SchemaValidationException,L as SchemaReferenceException,H as TypeValidator,a as ArraySchemaType,p as SingleType,h as TypeUtil,l as MultipleType,u as Type,i as SchemaType,n as AdditionalPropertiesType,U as SchemaUtil,O as StringFormat,It as HybridRepository,qt as KIRunConstants,f as Parameter,N as FunctionOutput,Xt as Position,zt as FunctionDefinition,Gt as ParameterReferenceType,w as EventResult,Jt as AbstractStatement,Kt as Statement,Zt as StatementGroup,R as FunctionSignature,d as Event,m as ParameterType,er as Argument,Qt as ParameterReference,q as ExecutionException,A as KIRuntimeException};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|