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