@fincity/kirun-js 2.4.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +9 -18
- package/__tests__/engine/function/system/math/MaximumTest.ts +3 -2
- package/__tests__/engine/function/system/math/MinimumTest.ts +18 -20
- package/__tests__/engine/json/schema/covnertor/BooleanConvertorTest.ts +55 -0
- package/__tests__/engine/json/schema/covnertor/NullConvertorTest.ts +47 -0
- package/__tests__/engine/json/schema/covnertor/NumberConvertorTest.ts +154 -0
- package/__tests__/engine/json/schema/covnertor/StringConvertorTest.ts +56 -0
- package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +9 -7
- package/__tests__/engine/json/schema/validator/NotValidatorTest.ts +3 -3
- package/__tests__/engine/json/schema/validator/StringValidatorTest.ts +1 -9
- package/__tests__/engine/json/schema/validator/TypeValidatorTest.ts +290 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +80 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluatorStringLiteralTest.ts +73 -1
- 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 +14 -8
- package/dist/types.d.ts.map +1 -1
- package/generator/generateValidationCSV.ts +6 -1
- package/generator/validation-js.csv +0 -0
- package/package.json +4 -1
- package/src/engine/function/system/object/ObjectConvert.ts +73 -0
- package/src/engine/function/system/object/ObjectPutValue.ts +0 -2
- package/src/engine/json/schema/convertor/BooleanConvertor.ts +76 -0
- package/src/engine/json/schema/convertor/NullConvertor.ts +31 -0
- package/src/engine/json/schema/convertor/NumberConvertor.ts +117 -0
- package/src/engine/json/schema/convertor/StringConvertor.ts +41 -0
- package/src/engine/json/schema/convertor/enums/ConversionMode.ts +11 -0
- package/src/engine/json/schema/convertor/exception/SchemaConversionException.ts +39 -0
- package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +96 -36
- package/src/engine/json/schema/validator/ArrayValidator.ts +15 -7
- package/src/engine/json/schema/validator/ObjectValidator.ts +24 -13
- package/src/engine/json/schema/validator/SchemaValidator.ts +74 -22
- package/src/engine/json/schema/validator/TypeValidator.ts +136 -23
- package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +63 -59
- package/src/engine/util/json/ConvertorUtil.ts +51 -0
- package/src/engine/util/json/ValidatorUtil.ts +29 -0
- package/tsconfig.json +2 -1
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||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var r,n,s,a,i,o,E,u,A,l,g={};t(g,"KIRunSchemaRepository",()=>X);var h={};t(h,"AdditionalType",()=>G),t(h,"Schema",()=>b);var m={};t(m,"Namespaces",()=>T);class T{static{this.SYSTEM="System"}static{this.SYSTEM_CTX="System.Context"}static{this.SYSTEM_LOOP="System.Loop"}static{this.SYSTEM_ARRAY="System.Array"}static{this.SYSTEM_OBJECT="System.Object"}static{this.MATH="System.Math"}static{this.STRING="System.String"}static{this.DATE="System.Date"}constructor(){}}var c={};t(c,"ArraySchemaType",()=>f);var p={};function R(e){return null==e}t(p,"isNullValue",()=>R);class f{constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new b(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new b(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!R(this.singleSchema)}static of(...e){return 1==e.length?new f().setSingleSchema(e[0]):new f().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new f().setTupleSchema(b.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new f().setSingleSchema(b.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new f().setTupleSchema(b.fromListOfSchemas(e.tupleSchema));let r=b.from(e);if(r)return new f().setSingleSchema(r)}}var N={};t(N,"SchemaType",()=>o),(r=o||(o={})).INTEGER="Integer",r.LONG="Long",r.FLOAT="Float",r.DOUBLE="Double",r.STRING="String",r.OBJECT="Object",r.ARRAY="Array",r.BOOLEAN="Boolean",r.NULL="Null";var _={};t(_,"TypeUtil",()=>P);var S={};t(S,"MultipleType",()=>O);var M={};t(M,"Type",()=>w);class w{}class O extends w{constructor(e){super(),e instanceof O?this.type=new Set(Array.from(e.type)):this.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 d={};t(d,"SingleType",()=>I);class I extends w{constructor(e){super(),e instanceof I?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class P{static of(...e){return 1==e.length?new I(e[0]):new O(new Set(e))}static from(e){return"string"==typeof e?new I(o[P.fromJSONType(e)]):Array.isArray(e)?new O(new Set(e.map(P.fromJSONType).map(e=>e).map(e=>o[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const y="additionalProperty",x="additionalItems",v="enums",L="items",U="System.Schema",C="required",V="version",D="namespace";class G{constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new b(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(R(e))return;let t=new G;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=b.from(e.schemaValue):t.schemaValue=b.from(e)}return t}}class b{static{this.NULL=new b().setNamespace(T.SYSTEM).setName("Null").setType(P.of(o.NULL)).setConstant(void 0)}static{this.TYPE_SCHEMA=new b().setType(P.of(o.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"])}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName("Schema").setType(P.of(o.OBJECT)).setProperties(new Map([[D,b.of(D,o.STRING).setDefaultValue("_")],["name",b.ofString("name")],[V,b.of(V,o.INTEGER).setDefaultValue(1)],["ref",b.ofString("ref")],["type",new b().setAnyOf([b.TYPE_SCHEMA,b.ofArray("type",b.TYPE_SCHEMA)])],["anyOf",b.ofArray("anyOf",b.ofRef(U))],["allOf",b.ofArray("allOf",b.ofRef(U))],["oneOf",b.ofArray("oneOf",b.ofRef(U))],["not",b.ofRef(U)],["title",b.ofString("title")],["description",b.ofString("description")],["id",b.ofString("id")],["examples",b.ofAny("examples")],["defaultValue",b.ofAny("defaultValue")],["comment",b.ofString("comment")],[v,b.ofArray(v,b.ofString(v))],["constant",b.ofAny("constant")],["pattern",b.ofString("pattern")],["format",b.of("format",o.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",b.ofInteger("minLength")],["maxLength",b.ofInteger("maxLength")],["multipleOf",b.ofLong("multipleOf")],["minimum",b.ofNumber("minimum")],["maximum",b.ofNumber("maximum")],["exclusiveMinimum",b.ofNumber("exclusiveMinimum")],["exclusiveMaximum",b.ofNumber("exclusiveMaximum")],["properties",b.of("properties",o.OBJECT).setAdditionalProperties(new G().setSchemaValue(b.ofRef(U)))],["additionalProperties",new b().setName(y).setNamespace(T.SYSTEM).setAnyOf([b.ofBoolean(y),b.ofObject(y).setRef(U)]).setDefaultValue(!0)],[C,b.ofArray(C,b.ofString(C)).setDefaultValue([])],["propertyNames",b.ofRef(U)],["minProperties",b.ofInteger("minProperties")],["maxProperties",b.ofInteger("maxProperties")],["patternProperties",b.of("patternProperties",o.OBJECT).setAdditionalProperties(new G().setSchemaValue(b.ofRef(U)))],[L,new b().setName(L).setAnyOf([b.ofRef(U).setName("item"),b.ofArray("tuple",b.ofRef(U))])],["contains",b.ofRef(U)],["minContains",b.ofInteger("minContains")],["maxContains",b.ofInteger("maxContains")],["minItems",b.ofInteger("minItems")],["maxItems",b.ofInteger("maxItems")],["uniqueItems",b.ofBoolean("uniqueItems")],["additionalItems",new b().setName(x).setNamespace(T.SYSTEM).setAnyOf([b.ofBoolean(x),b.ofObject(x).setRef(U)])],["$defs",b.of("$defs",o.OBJECT).setAdditionalProperties(new G().setSchemaValue(b.ofRef(U)))],["permission",b.ofString("permission")]])).setRequired([])}static ofString(e){return new b().setType(P.of(o.STRING)).setName(e)}static ofInteger(e){return new b().setType(P.of(o.INTEGER)).setName(e)}static ofFloat(e){return new b().setType(P.of(o.FLOAT)).setName(e)}static ofLong(e){return new b().setType(P.of(o.LONG)).setName(e)}static ofDouble(e){return new b().setType(P.of(o.DOUBLE)).setName(e)}static ofAny(e){return new b().setType(P.of(o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE,o.STRING,o.BOOLEAN,o.ARRAY,o.NULL,o.OBJECT)).setName(e)}static ofAnyNotNull(e){return new b().setType(P.of(o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE,o.STRING,o.BOOLEAN,o.ARRAY,o.OBJECT)).setName(e)}static ofNumber(e){return new b().setType(P.of(o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE)).setName(e)}static ofBoolean(e){return new b().setType(P.of(o.BOOLEAN)).setName(e)}static of(e,...t){return new b().setType(P.of(...t)).setName(e)}static ofObject(e){return new b().setType(P.of(o.OBJECT)).setName(e)}static ofRef(e){return new b().setRef(e)}static ofArray(e,...t){return new b().setType(P.of(o.ARRAY)).setName(e).setItems(f.of(...t))}static fromListOfSchemas(e){if(R(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=b.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(R(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=b.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(R(e))return;let r=new b;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new I(o.STRING):r.type=P.from(e.type),r.anyOf=b.fromListOfSchemas(e.anyOf),r.allOf=b.fromListOfSchemas(e.allOf),r.oneOf=b.fromListOfSchemas(e.oneOf),r.not=b.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=b.fromMapOfSchemas(e.properties),r.additionalProperties=G.from(e.additionalProperties),r.required=e.required,r.propertyNames=b.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=b.fromMapOfSchemas(e.patternProperties),r.items=f.from(e.items),r.additionalItems=G.from(e.additionalItems),r.contains=b.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=b.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}constructor(e){if(this.namespace="_",this.version=1,!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,R(e.type)||(this.type=e.type instanceof I?new I(e.type):new O(e.type)),this.anyOf=e.anyOf?.map(e=>new b(e)),this.allOf=e.allOf?.map(e=>new b(e)),this.oneOf=e.oneOf?.map(e=>new b(e)),this.not=this.not?new b(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 b(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new G(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new b(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 b(e[1])])):void 0,this.items=e.items?new f(e.items):void 0,this.contains=e.contains?new b(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new G(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new b(e[1])])):void 0,this.permission=e.permission}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+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}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=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 I(o.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}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=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 F={};t(F,"Parameter",()=>$);var Y={};t(Y,"SchemaReferenceException",()=>B);class B 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 H={};t(H,"ParameterType",()=>E),(n=E||(E={})).CONSTANT="CONSTANT",n.EXPRESSION="EXPRESSION";const k="value";class ${static{this.SCHEMA_NAME="Parameter"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName($.SCHEMA_NAME).setProperties(new Map([["schema",b.SCHEMA],["parameterName",b.ofString("parameterName")],["variableArgument",b.of("variableArgument",o.BOOLEAN).setDefaultValue(!1)],["type",b.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]))}static{this.EXPRESSION=new b().setNamespace(T.SYSTEM).setName("ParameterExpression").setType(P.of(o.OBJECT)).setProperties(new Map([["isExpression",b.ofBoolean("isExpression").setDefaultValue(!0)],[k,b.ofAny(k)]]))}constructor(e,t){if(this.variableArgument=!1,this.type=E.EXPRESSION,e instanceof $)this.schema=new b(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw 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,n=E.EXPRESSION){return[e,new $(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=E.EXPRESSION){return new $(e,t).setType(n).setVariableArgument(r)}static from(e){let t=b.from(e.schema);if(!t)throw new B("","Parameter requires Schema");return new $(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??E.EXPRESSION)}}const j=new Map([["any",b.ofAny("any").setNamespace(T.SYSTEM)],["boolean",b.ofBoolean("boolean").setNamespace(T.SYSTEM)],["double",b.ofDouble("double").setNamespace(T.SYSTEM)],["float",b.ofFloat("float").setNamespace(T.SYSTEM)],["integer",b.ofInteger("integer").setNamespace(T.SYSTEM)],["long",b.ofLong("long").setNamespace(T.SYSTEM)],["number",b.ofNumber("number").setNamespace(T.SYSTEM)],["string",b.ofString("string").setNamespace(T.SYSTEM)],["Date.timeStamp",b.ofString("timeStamp").setNamespace(T.DATE)],[$.EXPRESSION.getName(),$.EXPRESSION],[b.NULL.getName(),b.NULL],[b.SCHEMA.getName(),b.SCHEMA]]),W=Array.from(j.values()).map(e=>e.getFullName());class X{async find(e,t){return T.SYSTEM!=e?Promise.resolve(void 0):Promise.resolve(j.get(t))}async filter(e){return Promise.resolve(W.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var J={};function q(e){return[e.getSignature().getName(),e]}t(J,"KIRunFunctionRepository",()=>sQ);var z={};t(z,"MapUtil",()=>K),t(z,"MapEntry",()=>Q);class K{static of(e,t,r,n,s,a,i,o,E,u,A,l,g,h,m,T,c,p,f,N){let _=new Map;return R(e)||R(t)||_.set(e,t),R(r)||R(n)||_.set(r,n),R(s)||R(a)||_.set(s,a),R(i)||R(o)||_.set(i,o),R(E)||R(u)||_.set(E,u),R(A)||R(l)||_.set(A,l),R(g)||R(h)||_.set(g,h),R(m)||R(T)||_.set(m,T),R(c)||R(p)||_.set(c,p),R(f)||R(N)||_.set(f,N),_}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new Q(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class Q{constructor(e,t){this.k=e,this.v=t}}var Z={};t(Z,"EventResult",()=>er);var ee={};t(ee,"Event",()=>et);class et{static{this.OUTPUT="output"}static{this.ERROR="error"}static{this.ITERATION="iteration"}static{this.TRUE="true"}static{this.FALSE="false"}static{this.SCHEMA_NAME="Event"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(et.SCHEMA_NAME).setType(P.of(o.OBJECT)).setProperties(new Map([["name",b.ofString("name")],["parameters",b.ofObject("parameter").setAdditionalProperties(new G().setSchemaValue(b.SCHEMA))]]))}constructor(e,t){if(e instanceof et)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new b(e[1])]));else{if(this.name=e,!t)throw 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 et.eventMapEntry(et.OUTPUT,e)}static eventMapEntry(e,t){return[e,new et(e,t)]}static from(e){return new et(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=b.from(e[1]);if(!t)throw new B("","Event expects a schema");return[e[0],t]})))}}class er{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 er.of(et.OUTPUT,e)}static of(e,t){return new er(e,t)}}var en={};t(en,"FunctionOutput",()=>ei);var es={};t(es,"KIRuntimeException",()=>ea);class ea extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class ei{constructor(e){if(this.index=0,R(e))throw new ea("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof er?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var eo={};t(eo,"FunctionSignature",()=>eE);class eE{static{this.SCHEMA_NAME="FunctionSignature"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(eE.SCHEMA_NAME).setProperties(new Map([["name",b.ofString("name")],["namespace",b.ofString("namespace")],["parameters",b.ofObject("parameters").setAdditionalProperties(new G().setSchemaValue($.SCHEMA))],["events",b.ofObject("events").setAdditionalProperties(new G().setSchemaValue(et.SCHEMA))]]))}constructor(e){this.namespace="_",this.parameters=new Map,this.events=new Map,e instanceof eE?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new $(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new et(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}getFullName(){return this.namespace+"."+this.name}}var eu={};t(eu,"AbstractFunction",()=>eW);var eA={};t(eA,"SchemaValidator",()=>ej);var el={};t(el,"deepEqual",()=>ep);var eg={};t(eg,"LinkedList",()=>eT);var eh={};t(eh,"StringFormatter",()=>em);class em{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,s="",a=s,i=e.length;for(let o=0;o<i;o++)"$"==(s=e.charAt(o))&&"\\"==a?r=r.substring(0,o-1)+s:"$"==s&&n<t.length?r+=t[n++]:r+=s,a=s;return r.toString()}constructor(){}}class eT{constructor(e){if(this.head=void 0,this.tail=void 0,this.length=0,e?.length){for(let t of e)if(this.head){let e=new ec(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new ec(t);this.length=e.length}}push(e){let t=new ec(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.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let 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 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 ea(em.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)&&(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 Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let 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}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new ec(e,this.head),this.head.next=this.tail):(this.tail=new ec(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new ec(e),this}map(e,t){let r=new eT,n=this.head,s=0;for(;n;)r.add(e(n.value,s)),n=n.next,++s;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ep(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class ec{constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ep(e,t){let r=new eT;r.push(e);let n=new eT;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let s=typeof e,a=typeof t;if("undefined"===s||"undefined"===a){if(!e&&!t)continue;return!1}if(s!==a)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let s=0;s<e.length;s++)r.push(e[s]),n.push(t[s]);continue}if("object"===s){if("object"!==a||null===e||null===t)return!1;let s=Object.entries(e),i=Object.entries(t);if(s.length!==i.length)return!1;for(let[e,a]of s)r.push(a),n.push(t[e]);continue}return!1}return!0}var eR={};t(eR,"StringUtil",()=>ef);class ef{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new ea("String cannot be null");if(r<0||r>=e.length)throw new ea(em.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new ea(em.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)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 eN={};t(eN,"SchemaUtil",()=>eI);var e_={};t(e_,"Tuple2",()=>eS),t(e_,"Tuple3",()=>eM),t(e_,"Tuple4",()=>ew);class eS{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 eM extends eS{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 ew extends eM{constructor(e,t,r,n){super(e,t,r),this.fr=n}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 eO={};t(eO,"SchemaValidationException",()=>ed);class ed extends Error{constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class eI{static{this.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path"}static{this.CYCLIC_REFERENCE_LIMIT_COUNTER=20}static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():R(e.getDefaultValue())?eI.getDefaultValue(await eI.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!R(e.getDefaultValue())?Promise.resolve(!0):R(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(o.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await eI.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==eI.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new ed(r??"","Schema has a cyclic reference");if(!e||!r||ef.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var s=await eI.resolveExternalSchema(e,t,r);s&&(e=s.getT1(),r=s.getT2())}let a=r.split("/");return 1===a.length?Promise.resolve(e):Promise.resolve(eI.resolveInternalSchema(e,t,r,n,a,1))}static async resolveInternalSchema(e,t,r,n,s,a){let i=e;if(a!==s.length){for(;a<s.length;){if("$defs"===s[a]){if(++a>=s.length||!i.get$defs())throw new B(r,eI.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(s[a])}else{if(i&&(!i.getType()?.contains(o.OBJECT)||!i.getProperties()))throw new B(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(s[a])}if(a++,!i||!ef.isNullOrBlank(i.getRef())&&!(i=await eI.getSchemaFromRef(i,t,i.getRef(),n)))throw new B(r,eI.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(i)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let n=ef.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let s=ef.splitAtFirstOccurance(n[0],".");if(!s[0]||!s[1])return Promise.resolve(void 0);let a=await t.find(s[0],s[1]);if(!a)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new eS(a,r));if(r="#/"+n[1],!a)throw new B(r,eI.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new eS(a,r))}constructor(){}}var eP={};t(eP,"AnyOfAllOfOneOfValidator",()=>ey);class ey{static validate(e,t,r,n){let s=[];return t.getOneOf()&&!t.getOneOf()?ey.oneOf(e,t,r,n,s):t.getAllOf()&&!t.getAllOf()?ey.allOf(e,t,r,n,s):t.getAnyOf()&&!t.getAnyOf()&&ey.anyOf(e,t,r,n,s),n}static anyOf(e,t,r,n,s){let a=!1;for(let i of t.getAnyOf()??[])try{ey.validate(e,i,r,n),a=!0;break}catch(e){a=!1,s.push(e)}if(!a)throw new ed(ej.path(e),"The value don't satisfy any of the schemas.",s)}static allOf(e,t,r,n,s){let a=0;for(let i of t.getAllOf()??[])try{ey.validate(e,i,r,n),a++}catch(e){s.push(e)}if(a!==t.getAllOf()?.length)throw new ed(ej.path(e),"The value doesn't satisfy some of the schemas.",s)}static oneOf(e,t,r,n,s){let a=0;for(let i of t.getOneOf()??[])try{ey.validate(e,i,r,n),a++}catch(e){s.push(e)}if(1!=a)throw new ed(ej.path(e),0==a?"The value does not satisfy any schema":"The value satisfy more than one schema",s)}constructor(){}}var ex={};t(ex,"TypeValidator",()=>e$);var ev={};t(ev,"ArrayValidator",()=>eL);class eL{static async validate(e,t,r,n){if(R(n))throw new ed(ej.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new ed(ej.path(e),n.toString()+" is not an Array");return eL.checkMinMaxItems(e,t,n),await eL.checkItems(e,t,r,n),eL.checkUniqueItems(e,t,n),await eL.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(R(e.getContains()))return;let s=await eL.countContains(t,e,r,n,R(e.getMinContains())&&R(e.getMaxContains()));if(0===s)throw new ed(ej.path(t),"None of the items are of type contains schema");if(!R(e.getMinContains())&&e.getMinContains()>s)throw new ed(ej.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+s);if(!R(e.getMaxContains())&&e.getMaxContains()<s)throw new ed(ej.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+s)}static async countContains(e,t,r,n,s){let a=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await ej.validate(o,t.getContains(),r,n[i]),a++,s)break}catch(e){}}return a}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new ed(ej.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new ed(ej.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new ed(ej.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n){if(!t.getItems())return;let s=t.getItems();if(s.getSingleSchema())for(let t=0;t<n.length;t++){let a=e?[...e]:[],i=await ej.validate(a,s.getSingleSchema(),r,n[t]);n[t]=i}if(s.getTupleSchema()){if(s.getTupleSchema().length!==n.length&&R(t?.getAdditionalItems()))throw new ed(ej.path(e),"Expected an array with only "+s.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,s),await this.checkAdditionalItems(e,t,r,n,s)}}static async checkItemsInTupleSchema(e,t,r,n){for(let s=0;s<n.getTupleSchema()?.length;s++){let a=e?[...e]:[],i=await ej.validate(a,n.getTupleSchema()[s],t,r[s]);r[s]=i}}static async checkAdditionalItems(e,t,r,n,s){if(!R(t.getAdditionalItems())){let a=t.getAdditionalItems();if(a?.getBooleanValue()){let i=b.ofAny("item");if(a?.getBooleanValue()===!1&&n.length>s.getTupleSchema()?.length)throw new ed(ej.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}else if(a?.getSchemaValue()){let i=a.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,s,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,s,a){for(let t=s.getTupleSchema()?.length;t<n.length;t++){let s=e?[...e]:[],i=await ej.validate(s,a,r,n[t]);n[t]=i}}constructor(){}}var eU={};t(eU,"BooleanValidator",()=>eC);class eC{static validate(e,t,r){if(R(r))throw new ed(ej.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new ed(ej.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eV={};t(eV,"NullValidator",()=>eD);class eD{static validate(e,t,r){if(R(r))return r;throw new ed(ej.path(e),"Expected a null but found "+r)}constructor(){}}var eG={};t(eG,"NumberValidator",()=>eb);class eb{static validate(e,t,r,n){if(R(n))throw new ed(ej.path(t),"Expected a number but found null");if("number"!=typeof n)throw new ed(ej.path(t),n.toString()+" is not a "+e);let s=eb.extractNumber(e,t,r,n);return eb.checkRange(t,r,n,s),eb.checkMultipleOf(t,r,n,s),n}static extractNumber(e,t,r,n){let s=n;try{(e==o.LONG||e==o.INTEGER)&&(s=Math.round(s))}catch(r){throw new ed(ej.path(t),n+" is not a number of type "+e,r)}if(R(s)||(e==o.LONG||e==o.INTEGER)&&s!=n)throw new ed(ej.path(t),n.toString()+" is not a number of type "+e);return s}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new ed(ej.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!R(t.getMinimum())&&0>eb.numberCompare(n,t.getMinimum()))throw new ed(ej.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!R(t.getMaximum())&&eb.numberCompare(n,t.getMaximum())>0)throw new ed(ej.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!R(t.getExclusiveMinimum())&&0>=eb.numberCompare(n,t.getExclusiveMinimum()))throw new ed(ej.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!R(t.getExclusiveMaximum())&&eb.numberCompare(n,t.getExclusiveMaximum())>0)throw new ed(ej.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eF={};t(eF,"ObjectValidator",()=>eY);class eY{static async validate(e,t,r,n){if(R(n))throw new ed(ej.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new ed(ej.path(e),n.toString()+" is not an Object");let s=new Set(Object.keys(n));eY.checkMinMaxProperties(e,t,s),t.getPropertyNames()&&await eY.checkPropertyNameSchema(e,t,r,s),t.getRequired()&&eY.checkRequired(e,t,n),t.getProperties()&&await eY.checkProperties(e,t,r,n,s),t.getPatternProperties()&&await eY.checkPatternProperties(e,t,r,n,s),t.getAdditionalProperties()&&await eY.checkAddtionalProperties(e,t,r,n,s)}static async checkPropertyNameSchema(e,t,r,n){for(let s of Array.from(n.values()))try{await ej.validate(e,t.getPropertyNames(),r,s)}catch(t){throw new ed(ej.path(e),"Property name '"+s+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(R(r[n]))throw new ed(ej.path(e),n+" is mandatory")}static async checkAddtionalProperties(e,t,r,n,s){let a=t.getAdditionalProperties();if(a.getSchemaValue())for(let t of Array.from(s.values())){let s=e?[...e]:[],i=await ej.validate(s,a.getSchemaValue(),r,n[t]);n[t]=i}else if(!1===a.getBooleanValue()&&s.size)throw new ed(ej.path(e),Array.from(s)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,s){let a=new Map;for(let e of Array.from(t.getPatternProperties().keys()))a.set(e,new RegExp(e));for(let i of Array.from(s.values())){let o=e?[...e]:[];for(let e of Array.from(a.entries()))if(e[1].test(i)){let a=await ej.validate(o,t.getPatternProperties().get(e[0]),r,n[i]);n[i]=a,s.delete(i);break}}}static async checkProperties(e,t,r,n,s){for(let a of Array.from(t.getProperties())){let t=n[a[0]];if(!n.hasOwnProperty(a[0])&&R(t)&&R(await eI.getDefaultValue(a[1],r)))continue;let i=e?[...e]:[],o=await ej.validate(i,a[1],r,t);n[a[0]]=o,s.delete(a[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new ed(ej.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new ed(ej.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var eB={};t(eB,"StringValidator",()=>ek);var eH={};t(eH,"StringFormat",()=>u),(s=u||(u={})).DATETIME="DATETIME",s.TIME="TIME",s.DATE="DATE",s.EMAIL="EMAIL",s.REGEX="REGEX";class ek{static{this.TIME=/^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?([+-][01][0-9]:[0-5][0-9])?$/}static{this.DATE=/^[0-9]{4,4}-([0][0-9]|[1][0-2])-(0[1-9]|[1-2][1-9]|3[01])$/}static{this.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{this.EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/}static validate(e,t,r){if(R(r))throw new ed(ej.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new ed(ej.path(e),r.toString()+" is not String");t.getFormat()==u.TIME?ek.patternMatcher(e,t,r,ek.TIME,"time pattern"):t.getFormat()==u.DATE?ek.patternMatcher(e,t,r,ek.DATE,"date pattern"):t.getFormat()==u.DATETIME?ek.patternMatcher(e,t,r,ek.DATETIME,"date time pattern"):t.getFormat()==u.EMAIL?ek.patternMatcher(e,t,r,ek.EMAIL,"email pattern"):t.getPattern()&&ek.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new ed(ej.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new ed(ej.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,s){if(!n.test(r))throw new ed(ej.path(e),r.toString()+" is not matched with the "+s)}constructor(){}}class e${static async validate(e,t,r,n,s){if(t==o.STRING)ek.validate(e,r,s);else if(t==o.LONG||t==o.INTEGER||t==o.DOUBLE||t==o.FLOAT)eb.validate(t,e,r,s);else if(t==o.BOOLEAN)eC.validate(e,r,s);else if(t==o.OBJECT)await eY.validate(e,r,n,s);else if(t==o.ARRAY)await eL.validate(e,r,n,s);else if(t==o.NULL)eD.validate(e,r,s);else throw new ed(ej.path(e),t+" is not a valid type.");return s}constructor(){}}class ej{static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,n){if(!t)throw new ed(ej.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),R(n)&&!R(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!R(t.getConstant()))return ej.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return ej.enumCheck(e,t,n);if(t.getFormat()&&R(t.getType()))throw new ed(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(t.getType()&&await ej.typeValidation(e,t,r,n),!ef.isNullOrBlank(t.getRef()))return await ej.validate(e,await eI.getSchemaFromRef(e[0],r,t.getRef()),r,n);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&ey.validate(e,t,r,n),t.getNot()){let s=!1;try{await ej.validate(e,t.getNot(),r,n),s=!0}catch(e){s=!1}if(s)throw new ed(ej.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ep(t.getConstant(),r))throw new ed(ej.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new ed(ej.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n){let s,a=!1,i=[];for(s of Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]))try{await e$.validate(e,s,t,r,n),a=!0;break}catch(e){a=!1,i.push(e)}if(!a)throw new ed(ej.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",i)}constructor(){}}class eW{async validateArguments(e,t,r){let n=new Map;for(let s of Array.from(this.getSignature().getParameters().entries())){let a=s[1];try{let r=await this.validateArgument(e,t,s,a);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new ea(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${a.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return n}async validateArgument(e,t,r,n){let s,a=r[0],i=e.get(r[0]);if(R(i)&&!n.isVariableArgument())return new eS(a,await ej.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new eS(a,await ej.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?s=i:(s=[],R(i)?R(n.getSchema().getDefaultValue())||s.push(n.getSchema().getDefaultValue()):s.push(i));for(let e=0;e<s.length;e++)s[e]=await ej.validate(void 0,n.getSchema(),t,s[e]);return new eS(a,s)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return this.internalExecute(e)}catch(r){let t=this.getSignature();throw new ea(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class eX extends eW{static{this.EVENT_INDEX_NAME="index"}static{this.EVENT_RESULT_NAME="result"}static{this.EVENT_INDEX=new et(et.OUTPUT,K.of(eX.EVENT_INDEX_NAME,b.ofInteger(eX.EVENT_INDEX_NAME)))}static{this.EVENT_RESULT_INTEGER=new et(et.OUTPUT,K.of(eX.EVENT_RESULT_NAME,b.ofInteger(eX.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_BOOLEAN=new et(et.OUTPUT,K.of(eX.EVENT_RESULT_NAME,b.ofBoolean(eX.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_ARRAY=new et(et.OUTPUT,K.of(eX.EVENT_RESULT_NAME,b.ofArray(eX.EVENT_RESULT_NAME,b.ofAny(eX.EVENT_RESULT_NAME))))}static{this.EVENT_RESULT_EMPTY=new et(et.OUTPUT,K.of())}static{this.EVENT_RESULT_ANY=new et(et.OUTPUT,K.of(this.EVENT_RESULT_NAME,b.ofAny(this.EVENT_RESULT_NAME)))}static{this.EVENT_RESULT_OBJECT=new et(et.OUTPUT,K.of(this.EVENT_RESULT_NAME,b.ofObject(this.EVENT_RESULT_NAME)))}static{this.PARAMETER_INT_LENGTH=$.of("length",b.ofInteger("length").setDefaultValue(-1))}static{this.PARAMETER_ARRAY_FIND=$.of("find",b.ofArray("eachFind",b.ofAny("eachFind")))}static{this.PARAMETER_INT_SOURCE_FROM=$.of("srcFrom",b.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0))}static{this.PARAMETER_INT_SECOND_SOURCE_FROM=$.of("secondSrcFrom",b.ofInteger("secondSrcFrom").setDefaultValue(0))}static{this.PARAMETER_INT_FIND_FROM=$.of("findFrom",b.ofInteger("findFrom").setDefaultValue(0))}static{this.PARAMETER_INT_OFFSET=$.of("offset",b.ofInteger("offset").setDefaultValue(0))}static{this.PARAMETER_ROTATE_LENGTH=$.of("rotateLength",b.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1))}static{this.PARAMETER_BOOLEAN_ASCENDING=$.of("ascending",b.ofBoolean("ascending").setDefaultValue(!0))}static{this.PARAMETER_KEY_PATH=$.of("keyPath",b.ofString("keyPath").setDefaultValue(""))}static{this.PARAMETER_FIND_PRIMITIVE=$.of("findPrimitive",b.of("findPrimitive",o.STRING,o.DOUBLE,o.FLOAT,o.INTEGER,o.LONG))}static{this.PARAMETER_ARRAY_SOURCE=$.of("source",b.ofArray("eachSource",b.ofAny("eachSource")))}static{this.PARAMETER_ARRAY_SECOND_SOURCE=$.of("secondSource",b.ofArray("eachSecondSource",b.ofAny("eachSecondSource")))}static{this.PARAMETER_ARRAY_SOURCE_PRIMITIVE=$.of("source",b.ofArray("eachSource",new b().setName("eachSource").setType(P.of(o.STRING,o.NULL,o.INTEGER,o.FLOAT,o.DOUBLE,o.LONG))))}static{this.PARAMETER_BOOLEAN_DEEP_COPY=$.of("deepCopy",b.ofBoolean("deepCopy").setDefaultValue(!0))}static{this.PARAMETER_ANY=$.of("element",b.ofAny("element"))}static{this.PARAMETER_ANY_NOT_NULL=$.of("elementObject",b.ofAnyNotNull("elementObject"))}static{this.PARAMETER_ANY_VAR_ARGS=$.of("element",b.ofAny("element")).setVariableArgument(!0)}static{this.PARAMETER_ARRAY_RESULT=$.of(eX.EVENT_RESULT_NAME,b.ofArray("eachResult",b.ofAny("eachResult")))}constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new eE(e).setNamespace(T.SYSTEM_ARRAY).setParameters(n).setEvents(K.of(r.getName(),r))}getSignature(){return this.signature}}class eJ extends eX{constructor(){super("Concatenate",[eX.PARAMETER_ARRAY_SOURCE,eX.PARAMETER_ARRAY_SECOND_SOURCE],eX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(eX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(eX.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,[...t,...r]]]))])}}class eq extends eX{constructor(){super("AddFirst",[eX.PARAMETER_ARRAY_SOURCE,eX.PARAMETER_ANY],eX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(eX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(eX.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new ei([er.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}const ez="keyName";class eK extends eX{constructor(){super("ArrayToArrayOfObjects",[eX.PARAMETER_ARRAY_SOURCE,$.of(ez,b.ofString(ez),!0)],eX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(eK.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ez);if(!t?.length)return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,n]]))])}}var eQ={};t(eQ,"PrimitiveUtil",()=>e1);var eZ={};t(eZ,"ExecutionException",()=>e0);class e0 extends Error{constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class e1{static findPrimitiveNullAsBoolean(e){if(R(e))return new eS(o.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e0(em.format("$ is not a primitive type",e));return"boolean"===t?new eS(o.BOOLEAN,e):"string"===t?new eS(o.STRING,e):e1.findPrimitiveNumberType(e)}static findPrimitive(e){if(R(e))return new eS(o.NULL,void 0);let t=typeof e;if("object"===t)throw new e0(em.format("$ is not a primitive type",e));return"boolean"===t?new eS(o.BOOLEAN,e):"string"===t?new eS(o.STRING,e):e1.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(R(e)||Array.isArray(e)||"object"==typeof e)throw new e0(em.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new eS(o.LONG,e);return new eS(o.DOUBLE,e)}catch(t){throw new e0(em.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(R(e)||R(t))return R(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 n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return R(e)||R(t)?R(e)&&R(t)?0:R(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)?o.LONG:o.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class e2 extends eX{constructor(){super("BinarySearch",[e2.PARAMETER_ARRAY_SOURCE_PRIMITIVE,e2.PARAMETER_INT_SOURCE_FROM,e2.PARAMETER_FIND_PRIMITIVE,e2.PARAMETER_INT_LENGTH],e2.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e2.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(e2.PARAMETER_FIND_PRIMITIVE.getParameterName()),s=e?.getArguments()?.get(e2.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new ea("Search source array cannot be empty");if(-1==s&&(s=t.length-r),(s=r+s)>t.length)throw new ea("End point for array cannot be more than the size of the source array");let a=-1;for(;r<=s;){let e=Math.floor((r+s)/2);if(0==e1.compare(t[e],n)){a=e;break}e1.compare(t[e],n)>0?s=e-1:r=e+1}return new ei([er.outputOf(new Map([[e2.EVENT_INDEX_NAME,a]]))])}}var e9={};t(e9,"ArrayUtil",()=>e4);class e4{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class e3 extends eX{constructor(){super("Compare",e4.of(e3.PARAMETER_ARRAY_SOURCE,e3.PARAMETER_INT_SOURCE_FROM,e3.PARAMETER_ARRAY_FIND,e3.PARAMETER_INT_FIND_FROM,e3.PARAMETER_INT_LENGTH),e3.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(e3.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(e3.PARAMETER_ARRAY_FIND.getParameterName()),s=e?.getArguments()?.get(e3.PARAMETER_INT_FIND_FROM.getParameterName()),a=e?.getArguments()?.get(e3.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new ea("Compare source array cannot be empty");if(0==n.length)throw new ea("Compare find array cannot be empty");if(-1==a&&(a=t.length-r),r+a>t.length)throw new ea(em.format("Source array size $ is less than comparing size $",t.length,r+a));if(s+a>n.length)throw new ea(em.format("Find array size $ is less than comparing size $",n.length,s+a));return new ei(e4.of(er.outputOf(K.of(e3.EVENT_RESULT_NAME,this.compare(t,r,r+a,n,s,s+a)))))}compare(e,t,r,n,s,a){if(r<t){let e=t;t=r,r=e}if(a<s){let e=s;s=a,a=e}if(r-t!=a-s)throw new ea(em.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,a,s));for(let a=t,i=s;a<r;a++,i++){let t=1;if(R(e[a])||R(n[i])){let r=R(e[a]);r==R(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[a],s=typeof n[i];if("object"===r||"object"===s)t=1;else if("string"===r||"string"===s){let r=""+e[a],s=""+n[i];r===s?t=0:r<s&&(t=-1)}else"boolean"===r||"boolean"===s?t=r==s?0:1:"number"===r&&"number"===s&&(t=e[a]-n[i])}if(0!=t)return t}return 0}}var e6={};function e5(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}t(e6,"duplicate",()=>e5);class e7 extends eX{constructor(){super("Copy",[e7.PARAMETER_ARRAY_SOURCE,e7.PARAMETER_INT_SOURCE_FROM,e7.PARAMETER_INT_LENGTH,e7.PARAMETER_BOOLEAN_DEEP_COPY],e7.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(e7.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e7.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(e7.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new ea(em.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var s=e?.getArguments()?.get(e7.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let a=Array(n);for(let e=r;e<r+n;e++)R(t[e])||(a[e-r]=s?e5(t[e]):t[e]);return new ei([er.outputOf(K.of(e7.EVENT_RESULT_NAME,a))])}}class e8 extends eX{constructor(){super("Delete",[eX.PARAMETER_ARRAY_SOURCE,eX.PARAMETER_ANY_VAR_ARGS],eX.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e8.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e8.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new ea("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new ea("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let s=0;s<r.length;s++)n.has(e)||0!=e1.compare(t[e],r[s])||n.add(t[e]);return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class te extends eX{constructor(){super("DeleteFirst",[te.PARAMETER_ARRAY_SOURCE],te.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(te.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new ea("Given source array is empty");return(t=[...t]).shift(),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}class tt extends eX{constructor(){super("DeleteFrom",[tt.PARAMETER_ARRAY_SOURCE,tt.PARAMETER_INT_SOURCE_FROM,tt.PARAMETER_INT_LENGTH],tt.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tt.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tt.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tt.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new ea("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new ea("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new ea("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}class tr extends eX{constructor(){super("DeleteLast",[tr.PARAMETER_ARRAY_SOURCE],tr.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tr.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new ea("Given source array is empty");return(t=[...t]).pop(),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}class tn extends eX{constructor(){super("Disjoint",[tn.PARAMETER_ARRAY_SOURCE,tn.PARAMETER_INT_SOURCE_FROM,tn.PARAMETER_ARRAY_SECOND_SOURCE,tn.PARAMETER_INT_SECOND_SOURCE_FROM,tn.PARAMETER_INT_LENGTH],tn.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tn.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tn.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tn.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(tn.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tn.PARAMETER_INT_LENGTH.getParameterName());if(-1==a&&(a=t.length<=n.length?t.length-r:n.length-s),a>t.length||a>n.length||r+a>t.length||s+a>n.length)throw new ea("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<a;e++)i.add(t[e+r]);for(let e=0;e<a;e++)o.add(n[e+s]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new ei([er.outputOf(new Map([[tn.EVENT_RESULT_NAME,[...E]]]))])}}class ts extends eX{constructor(){super("Equals",[ts.PARAMETER_ARRAY_SOURCE,ts.PARAMETER_INT_SOURCE_FROM,ts.PARAMETER_ARRAY_FIND,ts.PARAMETER_INT_FIND_FROM,ts.PARAMETER_INT_LENGTH],ts.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new e3,r=(await t.execute(e)).allResults()[0].getResult().get(ts.EVENT_RESULT_NAME);return new ei([er.outputOf(K.of(ts.EVENT_RESULT_NAME,0==r))])}}class ta extends eX{constructor(){super("Fill",[ta.PARAMETER_ARRAY_SOURCE,ta.PARAMETER_INT_SOURCE_FROM,ta.PARAMETER_INT_LENGTH,ta.PARAMETER_ANY],ta.EVENT_RESULT_EMPTY)}async internalExecute(e){var t=e?.getArguments()?.get(ta.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ta.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ta.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(ta.PARAMETER_ANY.getParameterName());if(r<0)throw new ea(em.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let a=r+n-t.length;if(t=[...t],a>0)for(let e=0;e<a;e++)t.push();for(let e=r;e<r+n;e++)t[e]=R(s)?s:e5(s);return new ei([er.outputOf(K.of(eX.EVENT_RESULT_NAME,t))])}}class ti extends eX{constructor(){super("Frequency",[ti.PARAMETER_ARRAY_SOURCE,ti.PARAMETER_ANY,ti.PARAMETER_INT_SOURCE_FROM,ti.PARAMETER_INT_LENGTH],ti.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(ti.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ti.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(ti.PARAMETER_INT_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(ti.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[ti.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new ea("Given start point is more than the size of source");let a=n+s;if(-1==s&&(a=t.length-n),a>t.length)throw new ea("Given length is more than the size of source");let i=0;for(let e=n;e<a&&e<t.length;e++)0==e1.compare(t[e],r)&&i++;return new ei([er.outputOf(new Map([[ti.EVENT_RESULT_NAME,i]]))])}}class to extends eX{constructor(){super("IndexOf",[to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_ANY_NOT_NULL,to.PARAMETER_INT_FIND_FROM],to.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(to.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(to.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[to.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new ea("The size of the search index of the array is greater than the size of the array");let s=-1;for(let e=n;e<t.length;e++)if(0==e1.compare(t[e],r)){s=e;break}return new ei([er.outputOf(new Map([[to.EVENT_RESULT_NAME,s]]))])}}class tE extends eX{constructor(){super("IndexOfArray",[tE.PARAMETER_ARRAY_SOURCE,tE.PARAMETER_ARRAY_SECOND_SOURCE,tE.PARAMETER_INT_FIND_FROM],tE.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tE.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new ei([er.outputOf(new Map([[tE.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new ea("Given from second source is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==e1.compare(t[e],r[n])){for(;n<s&&0==e1.compare(t[e+n],r[n]);)n++;if(n==s){a=e;break}}}return new ei([er.outputOf(new Map([[tE.EVENT_RESULT_NAME,a]]))])}}class tu extends eX{constructor(){super("LastIndexOf",[tu.PARAMETER_ARRAY_SOURCE,tu.PARAMETER_ANY_NOT_NULL,tu.PARAMETER_INT_FIND_FROM],tu.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tu.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(tu.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[tu.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new ea("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let s=-1;for(let e=t.length-1;e>=n;e--)if(0==e1.compare(t[e],r)){s=e;break}return new ei([er.outputOf(new Map([[tu.EVENT_RESULT_NAME,s]]))])}}class tA extends eX{constructor(){super("LastIndexOfArray",[tA.PARAMETER_ARRAY_SOURCE,tA.PARAMETER_ARRAY_SECOND_SOURCE,tA.PARAMETER_INT_FIND_FROM],tA.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tA.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[tA.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new ea("Given from index is more than the size of the source array");let s=r.length,a=-1;for(let e=n;e<t.length;e++){let n=0;if(0==e1.compare(t[e],r[n])){for(;n<s&&0==e1.compare(t[e+n],r[n]);)n++;n==s&&(a=e)}}return new ei([er.outputOf(new Map([[tA.EVENT_RESULT_NAME,a]]))])}}class tl extends eX{constructor(){super("Max",[tl.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tl.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new ea("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];e1.comparePrimitive(r,n)>=0||(r=n)}return new ei([er.outputOf(new Map([[tl.EVENT_RESULT_NAME,r]]))])}}class tg extends eX{constructor(){super("Min",[tg.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tg.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new ea("Search source array cannot be empty");for(let e=0;e<r.length;e++)!R(r[e])&&(void 0===t||0>e1.comparePrimitive(r[e],t))&&(t=r[e]);return new ei([er.outputOf(new Map([[tg.EVENT_RESULT_NAME,t]]))])}}class th extends eX{constructor(){super("MisMatch",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_INT_FIND_FROM,th.PARAMETER_ARRAY_SECOND_SOURCE,th.PARAMETER_INT_SECOND_SOURCE_FROM,th.PARAMETER_INT_LENGTH],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(th.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(th.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),s=e?.getArguments()?.get(th.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(th.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=s<n.length&&s>0?s:0;if(i+a>=t.length||o+a>n.length)throw new ea("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<a;e++)if(t[i+e]!=n[o+e]){E=e;break}return new ei([er.outputOf(new Map([[th.EVENT_RESULT_NAME,E]]))])}}class tm extends eX{constructor(){super("Reverse",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH],tm.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new ea("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let s=r+n-1;for(;r<=s;){let e=t[r],n=t[s];t[r++]=n,t[s--]=e}return new ei([er.outputOf(new Map([[tm.EVENT_RESULT_NAME,t]]))])}}class tT extends eX{constructor(){super("Rotate",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_ROTATE_LENGTH],tT.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class tc extends eX{constructor(){super("Shuffle",[tc.PARAMETER_ARRAY_SOURCE],tc.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tc.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,s=t[r];t[r]=t[e],t[e]=s,r=e}return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}var tp={};t(tp,"ObjectValueSetterExtractor",()=>tL);var tR={};t(tR,"Expression",()=>ty);var tf={};t(tf,"StringBuilder",()=>tN);class tN{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 ea(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var t_={};t(t_,"ExpressionEvaluationException",()=>tS);class tS extends Error{constructor(e,t,r){super(em.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tM={};t(tM,"ExpressionToken",()=>tw);class tw{constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tO={};t(tO,"ExpressionTokenValue",()=>td);class td extends tw{constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return em.format("$: $",this.expression,this.element)}}var tI={};t(tI,"Operation",()=>tP);class tP{static{this.MULTIPLICATION=new tP("*")}static{this.DIVISION=new tP("/")}static{this.INTEGER_DIVISION=new tP("//")}static{this.MOD=new tP("%")}static{this.ADDITION=new tP("+")}static{this.SUBTRACTION=new tP("-")}static{this.NOT=new tP("not",void 0,!0)}static{this.AND=new tP("and",void 0,!0)}static{this.OR=new tP("or",void 0,!0)}static{this.LESS_THAN=new tP("<")}static{this.LESS_THAN_EQUAL=new tP("<=")}static{this.GREATER_THAN=new tP(">")}static{this.GREATER_THAN_EQUAL=new tP(">=")}static{this.EQUAL=new tP("=")}static{this.NOT_EQUAL=new tP("!=")}static{this.BITWISE_AND=new tP("&")}static{this.BITWISE_OR=new tP("|")}static{this.BITWISE_XOR=new tP("^")}static{this.BITWISE_COMPLEMENT=new tP("~")}static{this.BITWISE_LEFT_SHIFT=new tP("<<")}static{this.BITWISE_RIGHT_SHIFT=new tP(">>")}static{this.BITWISE_UNSIGNED_RIGHT_SHIFT=new tP(">>>")}static{this.UNARY_PLUS=new tP("UN: +","+")}static{this.UNARY_MINUS=new tP("UN: -","-")}static{this.UNARY_LOGICAL_NOT=new tP("UN: not","not")}static{this.UNARY_BITWISE_COMPLEMENT=new tP("UN: ~","~")}static{this.ARRAY_OPERATOR=new tP("[")}static{this.OBJECT_OPERATOR=new tP(".")}static{this.NULLISH_COALESCING_OPERATOR=new tP("??")}static{this.CONDITIONAL_TERNARY_OPERATOR=new tP("?")}static{this.VALUE_OF=new Map([["MULTIPLICATION",tP.MULTIPLICATION],["DIVISION",tP.DIVISION],["INTEGER_DIVISON",tP.INTEGER_DIVISION],["MOD",tP.MOD],["ADDITION",tP.ADDITION],["SUBTRACTION",tP.SUBTRACTION],["NOT",tP.NOT],["AND",tP.AND],["OR",tP.OR],["LESS_THAN",tP.LESS_THAN],["LESS_THAN_EQUAL",tP.LESS_THAN_EQUAL],["GREATER_THAN",tP.GREATER_THAN],["GREATER_THAN_EQUAL",tP.GREATER_THAN_EQUAL],["EQUAL",tP.EQUAL],["NOT_EQUAL",tP.NOT_EQUAL],["BITWISE_AND",tP.BITWISE_AND],["BITWISE_OR",tP.BITWISE_OR],["BITWISE_XOR",tP.BITWISE_XOR],["BITWISE_COMPLEMENT",tP.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tP.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tP.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tP.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tP.UNARY_PLUS],["UNARY_MINUS",tP.UNARY_MINUS],["UNARY_LOGICAL_NOT",tP.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tP.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tP.ARRAY_OPERATOR],["OBJECT_OPERATOR",tP.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tP.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tP.CONDITIONAL_TERNARY_OPERATOR]])}static{this.UNARY_OPERATORS=new Set([tP.ADDITION,tP.SUBTRACTION,tP.NOT,tP.BITWISE_COMPLEMENT,tP.UNARY_PLUS,tP.UNARY_MINUS,tP.UNARY_LOGICAL_NOT,tP.UNARY_BITWISE_COMPLEMENT])}static{this.ARITHMETIC_OPERATORS=new Set([tP.MULTIPLICATION,tP.DIVISION,tP.INTEGER_DIVISION,tP.MOD,tP.ADDITION,tP.SUBTRACTION])}static{this.LOGICAL_OPERATORS=new Set([tP.NOT,tP.AND,tP.OR,tP.LESS_THAN,tP.LESS_THAN_EQUAL,tP.GREATER_THAN,tP.GREATER_THAN_EQUAL,tP.EQUAL,tP.NOT_EQUAL,tP.NULLISH_COALESCING_OPERATOR])}static{this.BITWISE_OPERATORS=new Set([tP.BITWISE_AND,tP.BITWISE_COMPLEMENT,tP.BITWISE_LEFT_SHIFT,tP.BITWISE_OR,tP.BITWISE_RIGHT_SHIFT,tP.BITWISE_UNSIGNED_RIGHT_SHIFT,tP.BITWISE_XOR])}static{this.CONDITIONAL_OPERATORS=new Set([tP.CONDITIONAL_TERNARY_OPERATOR])}static{this.OPERATOR_PRIORITY=new Map([[tP.UNARY_PLUS,1],[tP.UNARY_MINUS,1],[tP.UNARY_LOGICAL_NOT,1],[tP.UNARY_BITWISE_COMPLEMENT,1],[tP.ARRAY_OPERATOR,1],[tP.OBJECT_OPERATOR,1],[tP.MULTIPLICATION,2],[tP.DIVISION,2],[tP.INTEGER_DIVISION,2],[tP.MOD,2],[tP.ADDITION,3],[tP.SUBTRACTION,3],[tP.BITWISE_LEFT_SHIFT,4],[tP.BITWISE_RIGHT_SHIFT,4],[tP.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tP.LESS_THAN,5],[tP.LESS_THAN_EQUAL,5],[tP.GREATER_THAN,5],[tP.GREATER_THAN_EQUAL,5],[tP.EQUAL,6],[tP.NOT_EQUAL,6],[tP.BITWISE_AND,7],[tP.BITWISE_XOR,8],[tP.BITWISE_OR,9],[tP.AND,10],[tP.OR,11],[tP.NULLISH_COALESCING_OPERATOR,11],[tP.CONDITIONAL_TERNARY_OPERATOR,12]])}static{this.OPERATORS=new Set([...Array.from(tP.ARITHMETIC_OPERATORS),...Array.from(tP.LOGICAL_OPERATORS),...Array.from(tP.BITWISE_OPERATORS),tP.ARRAY_OPERATOR,tP.OBJECT_OPERATOR,...Array.from(tP.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()))}static{this.OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tP.ARITHMETIC_OPERATORS),...Array.from(tP.LOGICAL_OPERATORS),...Array.from(tP.BITWISE_OPERATORS),tP.ARRAY_OPERATOR,tP.OBJECT_OPERATOR,...Array.from(tP.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()))}static{this.OPERATION_VALUE_OF=new Map(Array.from(tP.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]))}static{this.UNARY_MAP=new Map([[tP.ADDITION,tP.UNARY_PLUS],[tP.SUBTRACTION,tP.UNARY_MINUS],[tP.NOT,tP.UNARY_LOGICAL_NOT],[tP.BITWISE_COMPLEMENT,tP.UNARY_BITWISE_COMPLEMENT],[tP.UNARY_PLUS,tP.UNARY_PLUS],[tP.UNARY_MINUS,tP.UNARY_MINUS],[tP.UNARY_LOGICAL_NOT,tP.UNARY_LOGICAL_NOT],[tP.UNARY_BITWISE_COMPLEMENT,tP.UNARY_BITWISE_COMPLEMENT]])}static{this.BIGGEST_OPERATOR_SIZE=Array.from(tP.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 tP.VALUE_OF.get(e)}toString(){return this.operator}}class ty extends tw{constructor(e,t,r,n){super(e||""),this.tokens=new eT,this.ops=new eT,t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new tN(""),s=0,a=!1;for(;s<t;){switch(r=this.expression[s],e=n.toString(),r){case" ":a=this.processTokenSepearator(n,e,a);break;case"(":s=this.processSubExpression(t,n,e,s,a),a=!1;break;case")":throw new tS(this.expression,"Extra closing parenthesis found");case"]":throw new tS(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,s);s=e.getT1(),a=e.getT2();break}case"?":if(s+1<t&&"?"!=this.expression.charAt(s+1)&&0!=s&&"?"!=this.expression.charAt(s-1))s=this.processTernaryOperator(t,n,e,s,a);else{let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tP.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,s,a);s=i.getT1(),(a=i.getT2())&&this.ops.peek()==tP.ARRAY_OPERATOR&&(s=(i=this.process(t,n,s)).getT1(),a=i.getT2())}++s}if(e=n.toString(),!ef.isNullOrBlank(e)){if(tP.OPERATORS.has(e))throw new tS(this.expression,"Expression is ending with an operator");this.tokens.push(new tw(e))}}processStringLiteral(e,t,r){let n="",s=r+1;for(;s<e;s++){let e=this.expression.charAt(s);if(e==t&&"\\"!=this.expression.charAt(s-1))break;n+=e}if(s==e&&this.expression.charAt(s-1)!=t)throw new tS(this.expression,"Missing string ending marker "+t);let a=new eS(s,!1);return this.tokens.push(new td(n,n)),a}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new ty(t.toString())),t.setLength(0),new eS(r,!1)}processOthers(e,t,r,n,s,a){let i=t-s;i=i<tP.BIGGEST_OPERATOR_SIZE?i:tP.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(s,s+e);if(tP.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return ef.isNullOrBlank(n)||(this.tokens.push(new tw(n)),a=!1),this.checkUnaryOperator(this.tokens,this.ops,tP.OPERATION_VALUE_OF.get(t),a),a=!0,r.setLength(0),new eS(s+e-1,a)}return r.append(e),new eS(s,!1)}processTernaryOperator(e,t,r,n,s){if(s)throw new tS(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new ty(r)),t.setLength(0));let a=1,i="",o=++n;for(;n<e&&a>0;)"?"==(i=this.expression.charAt(n))?++a:":"==i&&--a,++n;if(":"!=i)throw new tS(this.expression,"':' operater is missing");if(n>=e)throw new tS(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tP.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tP.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new ty("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new ty("",r,t,e))}}this.ops.push(tP.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new ty(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tS(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new ty(E)),e-1}processSubExpression(e,t,r,n,s){if(tP.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tP.OPERATION_VALUE_OF.get(r),s),t.setLength(0);else if(!ef.isNullOrBlank(r))throw new tS(this.expression,em.format("Unkown token : $ found.",r));let a=1,i=new tN,o=this.expression.charAt(n);for(n++;n<e&&a>0;)"("==(o=this.expression.charAt(n))?a++:")"==o&&a--,0!=a&&(i.append(o),n++);if(")"!=o)throw new tS(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 ty(i.toString().trim())),n}processTokenSepearator(e,t,r){return ef.isNullOrBlank(t)||(tP.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tP.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tw(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tP.UNARY_OPERATORS.has(r)){let e=tP.UNARY_MAP.get(r);e&&t.push(e)}else throw new tS(this.expression,em.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tP.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new ty("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new ty("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tP.OPERATOR_PRIORITY.get(e),n=tP.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new tN,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let s=0;s<r.length;s++)if(r[s].getOperator().startsWith("UN: "))e.append("(").append(r[s].getOperator().substring(4)).append(n[t]instanceof ty?n[t].toString():n[t]).append(")"),t++;else if(r[s]==tP.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let a=n[t++];e.insert(0,r[s].getOperator()).insert(0,a.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tx={};t(tx,"TokenValueExtractor",()=>tv);class tv{static{this.REGEX_SQUARE_BRACKETS=/[\[\]]/}static{this.REGEX_DOT=/\./}getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new ea(em.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!R(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,n){if(R(n))return;if(t.length==r)return n;let s=t[r].split(tv.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!ef.isNullOrBlank(e)).reduce((n,s,a)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,s,n,a),n);return this.retrieveElementFrom(e,t,r+1,s)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,s,a){if(!R(s)){if(0===a){if("length"===n){let e=typeof s;if("string"===e||Array.isArray(s))return s.length;if("object"===e)return Object.keys(s).length}if(Array.isArray(s))try{let e=parseInt(n);if(isNaN(e))throw Error(em.format("$ is not a number",e));if(e>=s.length)return;return s[e]}catch(t){throw new tS(e,em.format("$ couldn't be parsed into integer in $",n,e),t)}return this.checkIfObject(e,t,r,s),s[n]}if(n?.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tS(e,em.format("$ is missing a double quote or empty key found",e));return this.checkIfObject(e,t,r,s),s[n.substring(1,n.length-1)]}try{let t=parseInt(n);if(isNaN(t))throw Error(em.format("$ is not a number",t));if(!Array.isArray(s))throw new tS(e,em.format("Expecting an array with index $ while processing the expression",t,e));if(t>=s.length)return;return s[t]}catch(t){throw new tS(e,em.format("$ couldn't be parsed into integer in $",n,e),t)}}}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tS(e,em.format("Unable to retrive $ from $ in the path $",t[r],n.toString(),e))}}class tL extends tv{constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tv.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,n=!1){this.store=e5(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let s=new ty(e),a=s.getTokens();a.removeLast();let i=s.getOperations(),o=i.removeLast(),E=a.removeLast(),u=E instanceof td?E.getElement():E.getExpression(),A=this.store;for(;!i.isEmpty();)A=o==tP.OBJECT_OPERATOR?this.getDataFromObject(A,u,i.peekLast()):this.getDataFromArray(A,u,i.peekLast()),o=i.removeLast(),u=(E=a.removeLast())instanceof td?E.getElement():E.getExpression();o==tP.OBJECT_OPERATOR?this.putDataInObject(A,u,t,r,n):this.putDataInArray(A,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new ea(em.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new ea(em.format("Expected an array index but found $",t));if(n<0)throw new ea(em.format("Array index is out of bound - $",t));let s=e[n];return R(s)&&(s=r==tP.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new ea(em.format("Expected an object but found $",e));let n=e[t];return R(n)&&(n=r==tP.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,s){if(!Array.isArray(e))throw new ea(em.format("Expected an array but found $",e));let a=parseInt(t);if(isNaN(a))throw new ea(em.format("Expected an array index but found $",t));if(a<0)throw new ea(em.format("Array index is out of bound - $",t));(n||R(e[a]))&&(s&&R(r)?e.splice(a,1):e[a]=r)}putDataInObject(e,t,r,n,s){if(Array.isArray(e)||"object"!=typeof e)throw new ea(em.format("Expected an object but found $",e));(n||R(e[t]))&&(s&&R(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tU extends eX{constructor(){super("Sort",[tU.PARAMETER_ARRAY_SOURCE,tU.PARAMETER_INT_FIND_FROM,tU.PARAMETER_INT_LENGTH,tU.PARAMETER_BOOLEAN_ASCENDING,tU.PARAMETER_KEY_PATH],tU.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tU.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tU.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tU.PARAMETER_INT_LENGTH.getParameterName()),s=e?.getArguments()?.get(tU.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),a=e?.getArguments()?.get(tU.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new ea("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new tL({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&a.length?(o.setStore({a:e,b:t}),tC(o.getValue("Data.a."+a),o.getValue("Data.b."+a),s)):tC(e,t,s)),t.splice(r,n,...i),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}function tC(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class tV extends eX{constructor(){super("SubArray",[tV.PARAMETER_ARRAY_SOURCE,tV.PARAMETER_INT_FIND_FROM,tV.PARAMETER_INT_LENGTH],tV.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tV.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tV.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tV.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new ei([er.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new ea("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let s=t.slice(r,r+n);return new ei([er.outputOf(new Map([[tV.EVENT_RESULT_NAME,s]]))])}}class tD extends eX{constructor(){super("Insert",[tD.PARAMETER_ARRAY_SOURCE,tD.PARAMETER_INT_OFFSET,tD.PARAMETER_ANY],tD.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tD.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tD.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tD.PARAMETER_ANY.getParameterName());if(R(n)||R(r)||r>t.length)throw new ea("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))]);t.push(n);let s=t.length-1;for(r++;s>=r;){let e=t[s-1];t[s-1]=t[s],t[s--]=e}return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}class tG extends eX{constructor(){super("InsertLast",[tG.PARAMETER_ARRAY_SOURCE,tG.PARAMETER_ANY],tG.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tG.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tG.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,t]]))])}}class tb extends eX{constructor(){super("RemoveDuplicates",[tb.PARAMETER_ARRAY_SOURCE,tb.PARAMETER_INT_SOURCE_FROM,tb.PARAMETER_INT_LENGTH],tb.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tb.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tb.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tb.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new ea(em.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let s=[...t],a=r+n;for(let e=a-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ep(s[e],s[t])){s.splice(e,1);break}return new ei([er.outputOf(K.of(tb.EVENT_RESULT_NAME,s))])}}const tF="keyPath",tY="valuePath",tB="ignoreNullValues",tH="ignoreNullKeys",tk="ignoreDuplicateKeys";class t$ extends eX{constructor(){super("ArrayToObjects",[eX.PARAMETER_ARRAY_SOURCE,$.of(tF,b.ofString(tF)),$.of(tY,b.of(tY,o.STRING,o.NULL)),$.of(tB,b.ofBoolean(tB).setDefaultValue(!1)),$.of(tH,b.ofBoolean(tH).setDefaultValue(!0)),$.of(tk,b.ofBoolean(tk).setDefaultValue(!1))],eX.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(eX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tF),n=e?.getArguments()?.get(tY)??"",s=e?.getArguments()?.get(tB),a=e?.getArguments()?.get(tH),i=e?.getArguments()?.get(tk),o=new tL({},"Data."),E=t.filter(e=>!R(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(a&&R(E))return e;let u=n?o.getValue("Data."+n):t;return s&&R(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new ei([er.outputOf(new Map([[eX.EVENT_RESULT_NAME,E]]))])}}const tj="source",tW="delimiter",tX="result",tJ=new eE("Join").setNamespace(T.SYSTEM_ARRAY).setParameters(new Map([[tj,new $(tj,b.ofArray(tj,b.of("each",o.STRING,o.INTEGER,o.LONG,o.DOUBLE,o.FLOAT,o.NULL)))],[tW,new $(tW,b.ofString(tW).setDefaultValue(""))]])).setEvents(new Map([et.outputEventMapEntry(new Map([[tX,b.ofString(tX)]]))]));class tq extends eW{getSignature(){return tJ}async internalExecute(e){let t=e?.getArguments()?.get(tj),r=e?.getArguments()?.get(tW);return new ei([er.outputOf(new Map([[tX,t.join(r)]]))])}}class tz{static{this.repoMap=K.ofArrayEntries(q(new eJ),q(new eq),q(new e2),q(new e3),q(new e7),q(new e8),q(new te),q(new tt),q(new tr),q(new tn),q(new ts),q(new ta),q(new ti),q(new to),q(new tE),q(new tu),q(new tA),q(new tl),q(new tg),q(new th),q(new tm),q(new tT),q(new tc),q(new tU),q(new tV),q(new eK),q(new tD),q(new tG),q(new tb),q(new t$),q(new tq))}static{this.filterableNames=Array.from(tz.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=T.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(tz.repoMap.get(t))}async filter(e){return Promise.resolve(tz.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var tK={};t(tK,"ContextElement",()=>tQ);class tQ{static{this.NULL=new tQ(b.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}}const tZ="name",t0="schema",t1=new eE("Create").setNamespace(T.SYSTEM_CTX).setParameters(new Map([$.ofEntry(tZ,new b().setName(tZ).setType(P.of(o.STRING)).setMinLength(1).setFormat(u.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,E.CONSTANT),$.ofEntry(t0,b.SCHEMA,!1,E.CONSTANT)])).setEvents(new Map([et.outputEventMapEntry(new Map)])),t2="name",t9="value",t4=new eE("Get").setNamespace(T.SYSTEM_CTX).setParameters(new Map([$.ofEntry(t2,new b().setName(t2).setType(P.of(o.STRING)).setMinLength(1).setFormat(u.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,E.CONSTANT)])).setEvents(new Map([et.outputEventMapEntry(new Map([[t9,b.ofAny(t9)]]))]));var t3={};t(t3,"ExpressionEvaluator",()=>r7);var t6={};t(t6,"LogicalNullishCoalescingOperator",()=>t8);var t5={};t(t5,"BinaryOperator",()=>t7);class t7{nullCheck(e,t,r){if(R(e)||R(t))throw new e0(em.format("$ cannot be applied to a null value",r.getOperatorName()))}}class t8 extends t7{apply(e,t){return R(e)?t:e}}var re={};t(re,"ArithmeticAdditionOperator",()=>rt);class rt extends t7{apply(e,t){return R(e)?t:R(t)?e:e+t}}var rr={};t(rr,"ArithmeticDivisionOperator",()=>rn);class rn extends t7{apply(e,t){return this.nullCheck(e,t,tP.DIVISION),e/t}}var rs={};t(rs,"ArithmeticIntegerDivisionOperator",()=>ra);class ra extends t7{apply(e,t){return this.nullCheck(e,t,tP.DIVISION),Math.floor(e/t)}}var ri={};t(ri,"ArithmeticModulusOperator",()=>ro);class ro extends t7{apply(e,t){return this.nullCheck(e,t,tP.MOD),e%t}}var rE={};t(rE,"ArithmeticMultiplicationOperator",()=>ru);class ru extends t7{apply(e,t){this.nullCheck(e,t,tP.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,s=r?t:e,a="",i=s<0,o=Math.floor(s=Math.abs(s));for(;o-- >0;)a+=n;let E=Math.floor(n.length*(s-Math.floor(s)));if(E<0&&(E=-E),0!=E&&(a+=n.substring(0,E)),i){let e="";for(let t=a.length-1;t>=0;t--)e+=a[t];return e}return a}return e*t}}var rA={};t(rA,"ArithmeticSubtractionOperator",()=>rl);class rl extends t7{apply(e,t){return this.nullCheck(e,t,tP.SUBTRACTION),e-t}}var rg={};t(rg,"ArrayOperator",()=>rh);class rh extends t7{apply(e,t){if(!e)throw new e0("Cannot apply array operator on a null value");if(!t)throw new e0("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e0(em.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e0(em.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rm={};t(rm,"BitwiseAndOperator",()=>rT);class rT extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_AND),e&t}}var rc={};t(rc,"BitwiseLeftShiftOperator",()=>rp);class rp extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_LEFT_SHIFT),e<<t}}var rR={};t(rR,"BitwiseOrOperator",()=>rf);class rf extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_OR),e|t}}var rN={};t(rN,"BitwiseRightShiftOperator",()=>r_);class r_ extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_RIGHT_SHIFT),e>>t}}var rS={};t(rS,"BitwiseUnsignedRightShiftOperator",()=>rM);class rM extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rw={};t(rw,"BitwiseXorOperator",()=>rO);class rO extends t7{apply(e,t){return this.nullCheck(e,t,tP.BITWISE_XOR),e^t}}var rd={};t(rd,"LogicalAndOperator",()=>rI);class rI extends t7{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rP={};t(rP,"LogicalEqualOperator",()=>ry);class ry extends t7{apply(e,t){return ep(e,t)}}var rx={};t(rx,"LogicalGreaterThanEqualOperator",()=>rv);class rv extends t7{apply(e,t){let r=e1.findPrimitiveNullAsBoolean(e),n=e1.findPrimitiveNullAsBoolean(t);if(r.getT1()==o.BOOLEAN||n.getT1()==o.BOOLEAN)throw new e0(em.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var rL={};t(rL,"LogicalGreaterThanOperator",()=>rU);class rU extends t7{apply(e,t){let r=e1.findPrimitiveNullAsBoolean(e),n=e1.findPrimitiveNullAsBoolean(t);if(r.getT1()==o.BOOLEAN||n.getT1()==o.BOOLEAN)throw new e0(em.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rC={};t(rC,"LogicalLessThanEqualOperator",()=>rV);class rV extends t7{apply(e,t){let r=e1.findPrimitiveNullAsBoolean(e),n=e1.findPrimitiveNullAsBoolean(t);if(r.getT1()==o.BOOLEAN||n.getT1()==o.BOOLEAN)throw new e0(em.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rD={};t(rD,"LogicalLessThanOperator",()=>rG);class rG extends t7{apply(e,t){let r=e1.findPrimitiveNullAsBoolean(e),n=e1.findPrimitiveNullAsBoolean(t);if(r.getT1()==o.BOOLEAN||n.getT1()==o.BOOLEAN)throw new e0(em.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rb={};t(rb,"LogicalNotEqualOperator",()=>rF);class rF extends t7{apply(e,t){return!ep(e,t)}}var rY={};t(rY,"LogicalOrOperator",()=>rB);class rB extends t7{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rH={};t(rH,"ObjectOperator",()=>rk);class rk extends t7{apply(e,t){if(!e)throw new e0("Cannot apply array operator on a null value");if(!t)throw new e0("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e0(em.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var r$={};t(r$,"ArithmeticUnaryMinusOperator",()=>rX);var rj={};t(rj,"UnaryOperator",()=>rW);class rW{nullCheck(e,t){if(R(e))throw new e0(em.format("$ cannot be applied to a null value",t.getOperatorName()))}}class rX extends rW{apply(e){return this.nullCheck(e,tP.UNARY_MINUS),e1.findPrimitiveNumberType(e),-e}}var rJ={};t(rJ,"ArithmeticUnaryPlusOperator",()=>rq);class rq extends rW{apply(e){return this.nullCheck(e,tP.UNARY_PLUS),e1.findPrimitiveNumberType(e),e}}var rz={};t(rz,"BitwiseComplementOperator",()=>rK);class rK extends rW{apply(e){this.nullCheck(e,tP.UNARY_BITWISE_COMPLEMENT);let t=e1.findPrimitiveNumberType(e);if(t.getT1()!=o.INTEGER&&t.getT1()!=o.LONG)throw new e0(em.format("Unable to apply bitwise operator on $",e));return~e}}var rQ={};t(rQ,"LogicalNotOperator",()=>rZ);class rZ extends rW{apply(e){return!e&&""!==e}}var r0={};t(r0,"LiteralTokenValueExtractor",()=>r2);const r1=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class r2 extends tv{static{this.INSTANCE=new r2}getValueInternal(e){if(!ef.isNullOrBlank(e))return(e=e.trim(),r1.has(e))?r1.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tS(e,em.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tS(e,em.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var r9={},r4={};t(r4,"ConditionalTernaryOperator",()=>r6);class r3{nullCheck(e,t,r,n){if(R(e)||R(t)||R(r))throw new e0(em.format("$ cannot be applied to a null value",n.getOperatorName()))}}class r6 extends r3{apply(e,t,r){return e?t:r}}e(r9,r4);class r5 extends tv{static{this.PREFIX="_internal."}addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tv.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.values.get(r))}getPrefix(){return r5.PREFIX}getStore(){}constructor(...e){super(...e),this.values=new Map}}class r7{static{this.UNARY_OPERATORS_MAP=new Map([[tP.UNARY_BITWISE_COMPLEMENT,new rK],[tP.UNARY_LOGICAL_NOT,new rZ],[tP.UNARY_MINUS,new rX],[tP.UNARY_PLUS,new rq]])}static{this.TERNARY_OPERATORS_MAP=new Map([[tP.CONDITIONAL_TERNARY_OPERATOR,new r6]])}static{this.BINARY_OPERATORS_MAP=new Map([[tP.ADDITION,new rt],[tP.DIVISION,new rn],[tP.INTEGER_DIVISION,new ra],[tP.MOD,new ro],[tP.MULTIPLICATION,new ru],[tP.SUBTRACTION,new rl],[tP.BITWISE_AND,new rT],[tP.BITWISE_LEFT_SHIFT,new rp],[tP.BITWISE_OR,new rf],[tP.BITWISE_RIGHT_SHIFT,new r_],[tP.BITWISE_UNSIGNED_RIGHT_SHIFT,new rM],[tP.BITWISE_XOR,new rO],[tP.AND,new rI],[tP.EQUAL,new ry],[tP.GREATER_THAN,new rU],[tP.GREATER_THAN_EQUAL,new rv],[tP.LESS_THAN,new rG],[tP.LESS_THAN_EQUAL,new rV],[tP.OR,new rB],[tP.NOT_EQUAL,new rF],[tP.NULLISH_COALESCING_OPERATOR,new t8],[tP.ARRAY_OPERATOR,new rh],[tP.OBJECT_OPERATOR,new rk]])}static{this.UNARY_OPERATORS_MAP_KEY_SET=new Set(r7.UNARY_OPERATORS_MAP.keys())}constructor(e){this.internalTokenValueExtractor=new r5,e instanceof ty?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,n=0,s=new eT;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&s.push(new eS(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tS(e,"Expecting {{ nesting path operator to be started before closing");0==r&&s.push(s.pop().setT2(n)),n++}n++}let a=this.replaceNestingExpression(e,t,s);return new eS(a,new ty(a))}replaceNestingExpression(e,t,r){let n=e;for(let s of r.toArray()){if(-1==s.getT2())throw new tS(e,"Expecting }} nesting path operator to be closed");let r=new r7(n.substring(s.getT1(),s.getT2())).evaluate(t);n=n.substring(0,s.getT1()-2)+r+n.substring(s.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new ty(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),s=n.pop();if(r7.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,s)));else if(e==tP.OBJECT_OPERATOR||e==tP.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,s);else if(e==tP.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),a=n.pop(),i=this.getValueFromToken(t,a),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,s);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),a=this.getValueFromToken(t,r),i=this.getValueFromToken(t,s);n.push(this.applyBinaryOperation(e,a,i))}}if(n.isEmpty())throw new e0(em.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new e0(em.format("Expression : $ evaluated multiple values $",e,n));let s=n.get(0);if(s instanceof td)return s.getElement();if(!(s instanceof ty))return this.getValueFromToken(t,s);throw new e0(em.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,s){let a=new eT,i=new eT;if(!n||!s)return;do i.push(n),s instanceof ty?a.push(new td(s.toString(),this.evaluateExpression(s,e))):s&&a.push(s),s=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tP.OBJECT_OPERATOR||n==tP.ARRAY_OPERATOR)s&&(s instanceof ty?a.push(new td(s.toString(),this.evaluateExpression(s,e))):a.push(s)),n&&t.push(n);let o=a.pop();if(o instanceof td&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tw(r5.PREFIX+e)}let E=new tN(o instanceof td?o.getTokenValue():o.toString());for(;!a.isEmpty();)o=a.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof td?o.getTokenValue():o.toString()),n==tP.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),A=u.substring(0,u.indexOf(".")+1);if(A.length>2&&e.has(A))r.push(new td(u,this.getValue(u,e)));else{let e;try{e=r2.INSTANCE.getValue(u)}catch(t){e=u}r.push(new td(u,e))}}applyTernaryOperation(e,t,r,n){let s=r7.TERNARY_OPERATORS_MAP.get(e);if(!s)throw new tS(this.expression,em.format("No operator found to evaluate $",this.getExpression()));return new td(e.toString(),s.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,s=typeof r,a=r7.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===s)&&e!==tP.EQUAL&&e!==tP.NOT_EQUAL&&e!==tP.NULLISH_COALESCING_OPERATOR&&e!==tP.AND&&e!==tP.OR)throw new tS(this.expression,em.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!a)throw new tS(this.expression,em.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new td(e.toString(),a.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tP.NOT.getOperator()&&e.getOperator()!=tP.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tS(this.expression,em.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=r7.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tS(this.expression,em.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new td(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof ty?this.evaluateExpression(t,e):t instanceof td?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):r2.INSTANCE.getValueFromExtractors(e,t)}}const r8="name",ne="value",nt=new eE("Set").setNamespace(T.SYSTEM_CTX).setParameters(new Map([$.ofEntry(r8,new b().setName(r8).setType(P.of(o.STRING)).setMinLength(1),!1),$.ofEntry(ne,b.ofAny(ne))])).setEvents(new Map([et.outputEventMapEntry(new Map)])),nr="value",nn="eventName",ns="results",na=new eE("GenerateEvent").setNamespace(T.SYSTEM).setParameters(new Map([$.ofEntry(nn,b.ofString(nn).setDefaultValue("output")),$.ofEntry(ns,b.ofObject(ns).setProperties(new Map([["name",b.ofString("name")],[nr,$.EXPRESSION]])),!0)])).setEvents(new Map([et.outputEventMapEntry(new Map)]));class ni extends eW{static{this.CONDITION="condition"}static{this.SIGNATURE=new eE("If").setNamespace(T.SYSTEM).setParameters(new Map([$.ofEntry(ni.CONDITION,b.ofAny(ni.CONDITION))])).setEvents(new Map([et.eventMapEntry(et.TRUE,new Map),et.eventMapEntry(et.FALSE,new Map),et.outputEventMapEntry(new Map)]))}getSignature(){return ni.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(ni.CONDITION);return new ei([er.of(t||""===t?et.TRUE:et.FALSE,new Map),er.outputOf(new Map)])}}const no="stepName",nE=new eE("Break").setNamespace(T.SYSTEM_LOOP).setParameters(new Map([$.ofEntry(no,b.of(no,o.STRING))])).setEvents(new Map([et.outputEventMapEntry(new Map([]))])),nu="count",nA="value",nl="index",ng=new eE("CountLoop").setNamespace(T.SYSTEM_LOOP).setParameters(new Map([$.ofEntry(nu,b.of(nu,o.INTEGER))])).setEvents(new Map([et.eventMapEntry(et.ITERATION,new Map([[nl,b.of(nl,o.INTEGER)]])),et.outputEventMapEntry(new Map([[nA,b.of(nA,o.INTEGER)]]))])),nh="source",nm="each",nT="index",nc="value",np=new eE("ForEachLoop").setNamespace(T.SYSTEM_LOOP).setParameters(new Map([$.ofEntry(nh,b.ofArray(nh,b.ofAny(nh)))])).setEvents(new Map([et.eventMapEntry(et.ITERATION,new Map([[nT,b.of(nT,o.INTEGER)],[nm,b.ofAny(nm)]])),et.outputEventMapEntry(new Map([[nc,b.of(nc,o.INTEGER)]]))])),nR="from",nf="step",nN="value",n_="index",nS=new eE("RangeLoop").setNamespace(T.SYSTEM_LOOP).setParameters(new Map([$.ofEntry(nR,b.of(nR,o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE).setDefaultValue(0)),$.ofEntry("to",b.of("to",o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE).setDefaultValue(1)),$.ofEntry(nf,b.of(nf,o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE).setDefaultValue(1).setNot(new b().setConstant(0)))])).setEvents(new Map([et.eventMapEntry(et.ITERATION,new Map([[n_,b.of(n_,o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE)]])),et.outputEventMapEntry(new Map([[nN,b.of(nN,o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE)]]))])),nM="value",nw=new eE("Add").setNamespace(T.MATH).setParameters(new Map([[nM,new $(nM,b.ofNumber(nM)).setVariableArgument(!0)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[nM,b.ofNumber(nM)]]))])),nO="value",nd="value1",nI="value2",nP=[()=>new Map([[nO,new $(nO,b.ofNumber(nO))]]),()=>new Map([[nd,new $(nd,b.ofNumber(nd))],[nI,new $(nI,b.ofNumber(nI))]])];class ny extends eW{constructor(e,t,r=1,...n){super(),n&&n.length||(n=[o.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new eE(e).setNamespace(T.MATH).setParameters(nP[r-1]()).setEvents(new Map([et.outputEventMapEntry(new Map([[nO,new b().setType(P.of(...n)).setName(nO)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=e1.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nO:nd)).getT2();return 2==this.parametersNumber&&(t=e1.findPrimitiveNumberType(e.getArguments()?.get(nI)).getT2()),new ei([er.outputOf(new Map([[nO,this.mathFunction.call(this,r,t)]]))])}}const nx="value";class nv extends eW{static{this.SIGNATURE=new eE("Hypotenuse").setNamespace(T.MATH).setParameters(new Map([[nx,new $(nx,b.ofNumber(nx)).setVariableArgument(!0)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[nx,new b().setType(P.of(o.DOUBLE)).setName(nx)]]))]))}constructor(){super()}getSignature(){return nv.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nx);return new ei([er.outputOf(new Map([[nx,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const nL="value",nU=new eE("Maximum").setNamespace(T.MATH).setParameters(new Map([[nL,new $(nL,b.ofNumber(nL)).setVariableArgument(!0)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[nL,b.ofNumber(nL)]]))])),nC="value",nV=new eE("Minimum").setNamespace(T.MATH).setParameters(new Map([[nC,new $(nC,b.ofNumber(nC)).setVariableArgument(!0)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[nC,b.ofNumber(nC)]]))])),nD="value";class nG extends eW{static{this.SIGNATURE=new eE("Random").setNamespace(T.MATH).setEvents(new Map([et.outputEventMapEntry(K.of(nD,b.ofDouble(nD)))]))}getSignature(){return nG.SIGNATURE}async internalExecute(e){return new ei([er.outputOf(new Map([[nD,Math.random()]]))])}}class nb extends eW{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}static{this.SIGNATURE=new eE("RandomFloat").setParameters(K.of(nb.MIN_VALUE,$.of(nb.MIN_VALUE,b.ofFloat(nb.MIN_VALUE).setDefaultValue(0)),nb.MAX_VALUE,$.of(nb.MAX_VALUE,b.ofFloat(nb.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(T.MATH).setEvents(new Map([et.outputEventMapEntry(K.of(nb.VALUE,b.ofFloat(nb.VALUE)))]))}getSignature(){return nb.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nb.MIN_VALUE),r=Math.random()*(e.getArguments()?.get(nb.MAX_VALUE)-t)+t;return new ei([er.outputOf(new Map([[nb.VALUE,r]]))])}}class nF extends eW{static{this.MIN_VALUE="minValue"}static{this.MAX_VALUE="maxValue"}static{this.VALUE="value"}static{this.SIGNATURE=new eE("RandomInt").setParameters(K.of(nF.MIN_VALUE,$.of(nF.MIN_VALUE,b.ofInteger(nF.MIN_VALUE).setDefaultValue(0)),nF.MAX_VALUE,$.of(nF.MAX_VALUE,b.ofInteger(nF.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(T.MATH).setEvents(new Map([et.outputEventMapEntry(K.of(nF.VALUE,b.ofInteger(nF.VALUE)))]))}getSignature(){return nF.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nF.MIN_VALUE),r=Math.floor(Math.random()*(e.getArguments()?.get(nF.MAX_VALUE)-t)+t);return new ei([er.outputOf(new Map([[nF.VALUE,r]]))])}}const nY={Absolute:new ny("Absolute",e=>Math.abs(e),1,o.INTEGER,o.LONG,o.FLOAT,o.DOUBLE),ArcCosine:new ny("ArcCosine",e=>Math.acos(e)),ArcSine:new ny("ArcSine",e=>Math.asin(e)),ArcTangent:new ny("ArcTangent",e=>Math.atan(e)),Ceiling:new ny("Ceiling",e=>Math.ceil(e)),Cosine:new ny("Cosine",e=>Math.cos(e)),HyperbolicCosine:new ny("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new ny("CubeRoot",e=>Math.cbrt(e)),Exponential:new ny("Exponential",e=>Math.exp(e)),ExponentialMinus1:new ny("ExponentialMinus1",e=>Math.expm1(e)),Floor:new ny("Floor",e=>Math.floor(e)),LogNatural:new ny("LogNatural",e=>Math.log(e)),Log10:new ny("Log10",e=>Math.log10(e)),Round:new ny("Round",e=>Math.round(e),1,o.INTEGER,o.LONG),Sine:new ny("Sine",e=>Math.sin(e)),HyperbolicSine:new ny("HyperbolicSine",e=>Math.sinh(e)),Tangent:new ny("Tangent",e=>Math.tan(e)),HyperbolicTangent:new ny("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new ny("ToDegrees",e=>Math.PI/180*e),ToRadians:new ny("ToRadians",e=>180/Math.PI*e),SquareRoot:new ny("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new ny("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new ny("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends eW{getSignature(){return nw}async internalExecute(e){let t=e.getArguments()?.get(nM);return new ei([er.outputOf(new Map([[nM,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nv,Maximum:new class extends eW{getSignature(){return nU}async internalExecute(e){let t=e.getArguments()?.get(nL);return new ei([er.outputOf(new Map([[nL,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends eW{getSignature(){return nV}async internalExecute(e){let t=e.getArguments()?.get(nC);return new ei([er.outputOf(new Map([[nC,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nG,RandomFloat:new nb,RandomInt:new nF},nB=Object.values(nY).map(e=>e.getSignature().getFullName());class nH{async find(e,t){return e!=T.MATH?Promise.resolve(void 0):Promise.resolve(nY[t])}async filter(e){return Promise.resolve(nB.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}const nk="value",n$="source",nj="source";class nW extends eW{constructor(e,t){super(),this.signature=new eE(e).setNamespace(T.SYSTEM_OBJECT).setParameters(new Map([$.ofEntry(nj,b.ofAny(nj))])).setEvents(new Map([et.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const nX="value",nJ="value",nq="value",nz="source",nK="overwrite",nQ="deleteKeyOnNull",nZ="value",n0={ObjectValues:new class extends nW{constructor(){super("ObjectValues",b.ofArray(nZ,b.ofAny(nZ)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new ei([er.outputOf(new Map([[nZ,[]]]))]);let r=Object.entries(e5(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new ei([er.outputOf(new Map([[nZ,r]]))])}},ObjectKeys:new class extends nW{constructor(){super("ObjectKeys",b.ofArray(nJ,b.ofString(nJ)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new ei([er.outputOf(new Map([[nJ,[]]]))]);let r=Object.keys(e5(t)).sort((e,t)=>e.localeCompare(t));return new ei([er.outputOf(new Map([[nJ,r]]))])}},ObjectEntries:new class extends nW{constructor(){super("ObjectEntries",b.ofArray(nX,b.ofArray("tuple",b.ofString("key"),b.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(R(t))return new ei([er.outputOf(new Map([[nX,[]]]))]);let r=Object.entries(e5(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new ei([er.outputOf(new Map([[nX,r]]))])}},ObjectDeleteKey:new class extends eW{constructor(){super(),this.signature=new eE("ObjectDeleteKey").setNamespace(T.SYSTEM_OBJECT).setParameters(new Map([$.ofEntry(n$,b.ofAny(n$)),$.ofEntry("key",b.ofString("key"))])).setEvents(new Map([et.outputEventMapEntry(new Map([[nk,b.ofAny(nk)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n$),r=e.getArguments()?.get("key");return R(t)?new ei([er.outputOf(new Map([[nk,void 0]]))]):(t=e5(t),delete t[r],new ei([er.outputOf(new Map([[nk,t]]))]))}},ObjectPutValue:new class extends eW{constructor(){super(),this.signature=new eE("ObjectPutValue").setNamespace(T.SYSTEM_OBJECT).setParameters(new Map([$.ofEntry(nz,b.ofObject(nz)),$.ofEntry("key",b.ofString("key")),$.ofEntry(nq,b.ofAny(nq)),$.ofEntry(nK,b.ofBoolean(nK).setDefaultValue(!0)),$.ofEntry(nQ,b.ofBoolean(nQ).setDefaultValue(!1))])).setEvents(new Map([et.outputEventMapEntry(new Map([[nq,b.ofObject(nq)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nz),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(nq),s=e.getArguments()?.get(nK),a=e.getArguments()?.get(nQ),i=new tL(t,"Data.");return i.setValue(r,n,s,a),new ei([er.outputOf(new Map([[nq,i.getStore()]]))])}}},n1=Object.values(n0).map(e=>e.getSignature().getFullName());class n2{async find(e,t){return e!=T.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(n0[t])}async filter(e){return Promise.resolve(n1.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class n9 extends eW{static{this.VALUES="values"}static{this.SIGNATURE=new eE("Print").setNamespace(T.SYSTEM).setParameters(new Map([$.ofEntry(n9.VALUES,b.ofAny(n9.VALUES),!0)]))}getSignature(){return n9.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(n9.VALUES);return console?.log(...t),new ei([er.outputOf(new Map)])}}class n4 extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_SEARCH_STRING_NAME="searchString"}static{this.PARAMETER_SECOND_STRING_NAME="secondString"}static{this.PARAMETER_THIRD_STRING_NAME="thirdString"}static{this.PARAMETER_INDEX_NAME="index"}static{this.PARAMETER_SECOND_INDEX_NAME="secondIndex"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(n4.PARAMETER_STRING_NAME,b.ofString(n4.PARAMETER_STRING_NAME))}static{this.PARAMETER_SECOND_STRING=new $(n4.PARAMETER_SECOND_STRING_NAME,b.ofString(n4.PARAMETER_SECOND_STRING_NAME))}static{this.PARAMETER_THIRD_STRING=new $(n4.PARAMETER_THIRD_STRING_NAME,b.ofString(n4.PARAMETER_THIRD_STRING_NAME))}static{this.PARAMETER_INDEX=new $(n4.PARAMETER_INDEX_NAME,b.ofInteger(n4.PARAMETER_INDEX_NAME))}static{this.PARAMETER_SECOND_INDEX=new $(n4.PARAMETER_SECOND_INDEX_NAME,b.ofInteger(n4.PARAMETER_SECOND_INDEX_NAME))}static{this.PARAMETER_SEARCH_STRING=new $(n4.PARAMETER_SEARCH_STRING_NAME,b.ofString(n4.PARAMETER_STRING_NAME))}static{this.EVENT_STRING=new et(et.OUTPUT,K.of(n4.EVENT_RESULT_NAME,b.ofString(n4.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new et(et.OUTPUT,K.of(n4.EVENT_RESULT_NAME,b.ofBoolean(n4.EVENT_RESULT_NAME)))}static{this.EVENT_INT=new et(et.OUTPUT,K.of(n4.EVENT_RESULT_NAME,b.ofInteger(n4.EVENT_RESULT_NAME)))}static{this.EVENT_ARRAY=new et(et.OUTPUT,K.of(n4.EVENT_RESULT_NAME,b.ofArray(n4.EVENT_RESULT_NAME)))}constructor(e,t,r,...n){super();let s=new Map;n.forEach(e=>s.set(e.getParameterName(),e)),this.signature=new eE(t).setNamespace(e).setParameters(s).setEvents(K.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryAsStringBooleanOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_SEARCH_STRING_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n)))])}}(T.STRING,e,n4.EVENT_BOOLEAN,n4.PARAMETER_STRING,n4.PARAMETER_SEARCH_STRING)]}static ofEntryAsStringAndIntegerStringOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_INDEX_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n)))])}}(T.STRING,e,n4.EVENT_STRING,n4.PARAMETER_STRING,n4.PARAMETER_INDEX)]}static ofEntryAsStringIntegerOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_SEARCH_STRING_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n)))])}}(T.STRING,e,n4.EVENT_INT,n4.PARAMETER_STRING,n4.PARAMETER_SEARCH_STRING)]}static ofEntryString(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r)))])}}(T.STRING,e,n4.EVENT_STRING,n4.PARAMETER_STRING)]}static ofEntryStringBooleanOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r)))])}}(T.STRING,e,n4.EVENT_BOOLEAN,n4.PARAMETER_STRING)]}static ofEntryAsStringStringIntegerIntegerOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_SEARCH_STRING_NAME),s=e?.getArguments()?.get(n4.PARAMETER_INDEX_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n,s)))])}}(T.STRING,e,n4.EVENT_INT,n4.PARAMETER_STRING,n4.PARAMETER_SEARCH_STRING,n4.PARAMETER_INDEX)]}static ofEntryAsStringIntegerIntegerStringOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_INDEX_NAME),s=e?.getArguments()?.get(n4.PARAMETER_SECOND_INDEX_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n,s)))])}}(T.STRING,e,n4.EVENT_INT,n4.PARAMETER_STRING,n4.PARAMETER_INDEX,n4.PARAMETER_SECOND_INDEX)]}static ofEntryAsStringStringStringStringOutput(e,t){return[e,new class extends n4{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(n4.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(n4.PARAMETER_SECOND_STRING_NAME),s=e?.getArguments()?.get(n4.PARAMETER_THIRD_STRING_NAME);return new ei([er.outputOf(K.of(n4.EVENT_RESULT_NAME,t(r,n,s)))])}}(T.STRING,e,n4.EVENT_STRING,n4.PARAMETER_STRING,n4.PARAMETER_SECOND_STRING,n4.PARAMETER_THIRD_STRING)]}}class n3 extends eW{static{this.VALUE="value"}static{this.SCHEMA=new b().setName(n3.VALUE).setType(new I(o.STRING))}static{this.SIGNATURE=new eE("Concatenate").setNamespace(T.STRING).setParameters(new Map([[n3.VALUE,new $(n3.VALUE,n3.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[n3.VALUE,b.ofString(n3.VALUE)]]))]))}constructor(){super()}getSignature(){return n3.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(n3.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new ei([er.outputOf(new Map([[n3.VALUE,r]]))])}}class n6 extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_END_NAME="endPosition"}static{this.EVENT_RESULT_NAME="result"}constructor(){super(),this.PARAMETER_STRING=new $(n6.PARAMETER_STRING_NAME,b.ofString(n6.PARAMETER_STRING_NAME)),this.PARAMETER_AT_START=new $(n6.PARAMETER_AT_START_NAME,b.ofInteger(n6.PARAMETER_AT_START_NAME)),this.PARAMETER_AT_END=new $(n6.PARAMETER_AT_END_NAME,b.ofInteger(n6.PARAMETER_AT_END_NAME)),this.EVENT_STRING=new et(et.OUTPUT,new Map([[n6.EVENT_RESULT_NAME,b.ofString(n6.EVENT_RESULT_NAME)]])),this.signature=new eE("DeleteForGivenLength").setNamespace(T.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(n6.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(n6.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(n6.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new ei([er.outputOf(new Map([[n6.EVENT_RESULT_NAME,e.toString()]]))])}return new ei([er.outputOf(new Map([[n6.EVENT_RESULT_NAME,t]]))])}}class n5 extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_POSITION_NAME="position"}static{this.PARAMETER_INSERT_STRING_NAME="insertString"}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(n5.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(n5.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(n5.PARAMETER_INSERT_STRING_NAME),s="";return s+=t.substring(0,r)+n+t.substring(r),new ei([er.outputOf(new Map([[this.EVENT_RESULT_NAME,s]]))])}constructor(...e){super(...e),this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new $(n5.PARAMETER_STRING_NAME,b.ofString(n5.PARAMETER_STRING_NAME)),this.PARAMETER_AT_POSITION=new $(n5.PARAMETER_AT_POSITION_NAME,b.ofInteger(n5.PARAMETER_AT_POSITION_NAME)),this.PARAMETER_INSERT_STRING=new $(n5.PARAMETER_INSERT_STRING_NAME,b.ofString(n5.PARAMETER_INSERT_STRING_NAME)),this.EVENT_STRING=new et(et.OUTPUT,new Map([[this.EVENT_RESULT_NAME,b.ofString(this.EVENT_RESULT_NAME)]])),this.signature=new eE("InsertAtGivenPosition").setNamespace(T.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([et.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,b.ofString(this.EVENT_RESULT_NAME)]]))]))}}class n7 extends eW{static{this.PARAMETER_REGEX_NAME="regex"}static{this.PARAMETER_STRING_NAME="string"}static{this.EVENT_RESULT_NAME="result"}static{this.signature=new eE("Matches").setNamespace(T.STRING).setParameters(K.ofEntries(K.entry(...$.ofEntry(n7.PARAMETER_REGEX_NAME,b.ofString(n7.PARAMETER_REGEX_NAME))),K.entry(...$.ofEntry(n7.PARAMETER_STRING_NAME,b.ofString(n7.PARAMETER_STRING_NAME))))).setEvents(K.ofEntries(K.entry(...et.outputEventMapEntry(new Map([[n7.EVENT_RESULT_NAME,b.ofBoolean(n7.EVENT_RESULT_NAME)]])))))}getSignature(){return n7.signature}async internalExecute(e){let t=e.getArguments()?.get(n7.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(n7.PARAMETER_STRING_NAME);return new ei([er.outputOf(new Map([[n7.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class n8 extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_POSTPAD_STRING_NAME="postpadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(n8.PARAMETER_STRING_NAME,b.ofString(n8.PARAMETER_STRING_NAME))}static{this.PARAMETER_POSTPAD_STRING=new $(n8.PARAMETER_POSTPAD_STRING_NAME,b.ofString(n8.PARAMETER_POSTPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new $(n8.PARAMETER_LENGTH_NAME,b.ofInteger(n8.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new et(et.OUTPUT,new Map([[n8.EVENT_RESULT_NAME,b.ofString(n8.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eE("PostPad").setNamespace(T.STRING).setParameters(new Map([[n8.PARAMETER_STRING.getParameterName(),n8.PARAMETER_STRING],[n8.PARAMETER_POSTPAD_STRING.getParameterName(),n8.PARAMETER_POSTPAD_STRING],[n8.PARAMETER_LENGTH.getParameterName(),n8.PARAMETER_LENGTH]])).setEvents(new Map([[n8.EVENT_STRING.getName(),n8.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n8.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(n8.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(n8.PARAMETER_LENGTH_NAME),s="",a=r.length;for(s+=t;a<=n;)s+=r,a+=r.length;return s.length-t.length<n&&(s+=r.substring(0,n-(s.length-t.length))),new ei([er.outputOf(new Map([[n8.EVENT_RESULT_NAME,s.toString()]]))])}}class se extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_PREPAD_STRING_NAME="prepadString"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(se.PARAMETER_STRING_NAME,b.ofString(se.PARAMETER_STRING_NAME))}static{this.PARAMETER_PREPAD_STRING=new $(se.PARAMETER_PREPAD_STRING_NAME,b.ofString(se.PARAMETER_PREPAD_STRING_NAME))}static{this.PARAMETER_LENGTH=new $(se.PARAMETER_LENGTH_NAME,b.ofInteger(se.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new et(et.OUTPUT,new Map([[se.EVENT_RESULT_NAME,b.ofString(se.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eE("PrePad").setNamespace(T.STRING).setParameters(new Map([[se.PARAMETER_STRING.getParameterName(),se.PARAMETER_STRING],[se.PARAMETER_PREPAD_STRING.getParameterName(),se.PARAMETER_PREPAD_STRING],[se.PARAMETER_LENGTH.getParameterName(),se.PARAMETER_LENGTH]])).setEvents(new Map([[se.EVENT_STRING.getName(),se.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(se.PARAMETER_STRING_NAME),r=e.getArguments()?.get(se.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(se.PARAMETER_LENGTH_NAME),s="",a=r.length;for(;a<=n;)s+=r,a+=r.length;return s.length<n&&(s+=r.substring(0,n-s.length)),s+=t,new ei([er.outputOf(new Map([[se.EVENT_RESULT_NAME,s]]))])}}class st extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_BOOLEAN_NAME="boolean"}static{this.PARAMETER_FIRST_OFFSET_NAME="firstOffset"}static{this.PARAMETER_OTHER_STRING_NAME="otherString"}static{this.PARAMETER_SECOND_OFFSET_NAME="secondOffset"}static{this.PARAMETER_INTEGER_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(st.PARAMETER_STRING_NAME,b.ofString(st.PARAMETER_STRING_NAME))}static{this.PARAMETER_OTHER_STRING=new $(st.PARAMETER_OTHER_STRING_NAME,b.ofString(st.PARAMETER_OTHER_STRING_NAME))}static{this.PARAMETER_FIRST_OFFSET=new $(st.PARAMETER_FIRST_OFFSET_NAME,b.ofInteger(st.PARAMETER_FIRST_OFFSET_NAME))}static{this.PARAMETER_SECOND_OFFSET=new $(st.PARAMETER_SECOND_OFFSET_NAME,b.ofInteger(st.PARAMETER_SECOND_OFFSET_NAME))}static{this.PARAMETER_INTEGER=new $(st.PARAMETER_INTEGER_NAME,b.ofInteger(st.PARAMETER_INTEGER_NAME))}static{this.PARAMETER_BOOLEAN=new $(st.PARAMETER_BOOLEAN_NAME,b.ofBoolean(st.PARAMETER_BOOLEAN_NAME))}static{this.EVENT_BOOLEAN=new et(et.OUTPUT,new Map([[st.EVENT_RESULT_NAME,b.ofBoolean(st.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eE("RegionMatches").setNamespace(T.STRING).setParameters(new Map([[st.PARAMETER_STRING.getParameterName(),st.PARAMETER_STRING],[st.PARAMETER_BOOLEAN.getParameterName(),st.PARAMETER_BOOLEAN],[st.PARAMETER_FIRST_OFFSET.getParameterName(),st.PARAMETER_FIRST_OFFSET],[st.PARAMETER_OTHER_STRING.getParameterName(),st.PARAMETER_OTHER_STRING],[st.PARAMETER_SECOND_OFFSET.getParameterName(),st.PARAMETER_SECOND_OFFSET],[st.PARAMETER_INTEGER.getParameterName(),st.PARAMETER_INTEGER]])).setEvents(new Map([[st.EVENT_BOOLEAN.getName(),st.EVENT_BOOLEAN]]))}async internalExecute(e){let t=e.getArguments()?.get(st.PARAMETER_STRING_NAME),r=e.getArguments()?.get(st.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(st.PARAMETER_FIRST_OFFSET_NAME),s=e?.getArguments()?.get(st.PARAMETER_OTHER_STRING_NAME),a=e?.getArguments()?.get(st.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(st.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(a<0)&&!(n+i>t.length)&&!(a+i>s.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==s.substring(a,a+i).toUpperCase():(t=t.substring(n,n+i))==s.substring(a,i)),new ei([er.outputOf(new Map([[st.EVENT_RESULT_NAME,o]]))])}}class sr extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_AT_START_NAME="startPosition"}static{this.PARAMETER_AT_LENGTH_NAME="lengthPosition"}static{this.PARAMETER_REPLACE_STRING_NAME="replaceString"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(sr.PARAMETER_STRING_NAME,b.ofString(sr.PARAMETER_STRING_NAME))}static{this.PARAMETER_AT_START=new $(sr.PARAMETER_AT_START_NAME,b.ofInteger(sr.PARAMETER_AT_START_NAME))}static{this.PARAMETER_AT_LENGTH=new $(sr.PARAMETER_AT_LENGTH_NAME,b.ofInteger(sr.PARAMETER_AT_LENGTH_NAME))}static{this.PARAMETER_REPLACE_STRING=new $(sr.PARAMETER_REPLACE_STRING_NAME,b.ofString(sr.PARAMETER_REPLACE_STRING_NAME))}static{this.EVENT_STRING=new et(et.OUTPUT,new Map([[sr.EVENT_RESULT_NAME,b.ofString(sr.EVENT_RESULT_NAME)]]))}constructor(){super(),this.signature=new eE("ReplaceAtGivenPosition").setNamespace(T.STRING).setParameters(new Map([[sr.PARAMETER_STRING.getParameterName(),sr.PARAMETER_STRING],[sr.PARAMETER_AT_START.getParameterName(),sr.PARAMETER_AT_START],[sr.PARAMETER_AT_LENGTH.getParameterName(),sr.PARAMETER_AT_LENGTH],[sr.PARAMETER_REPLACE_STRING.getParameterName(),sr.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[sr.EVENT_STRING.getName(),sr.EVENT_STRING]]))}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(sr.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(sr.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(sr.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(sr.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new ei([er.outputOf(new Map([[sr.EVENT_RESULT_NAME,t]]))])}}class sn extends eW{constructor(){super(),this.VALUE="value",this.SIGNATURE=new eE("Reverse").setNamespace(T.STRING).setParameters(new Map([[this.VALUE,new $(this.VALUE,b.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([et.outputEventMapEntry(new Map([[this.VALUE,new b().setType(P.of(o.STRING)).setName(this.VALUE)]]))]))}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new ei([er.outputOf(K.of(this.VALUE,n))])}}class ss extends eW{getSignature(){return new eE("Split").setNamespace(T.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([et.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,b.ofArray(this.EVENT_RESULT_NAME)]]))]))}constructor(){super(),this.PARAMETER_STRING_NAME="string",this.PARAMETER_SPLIT_STRING_NAME="searchString",this.EVENT_RESULT_NAME="result",this.PARAMETER_STRING=new $(this.PARAMETER_STRING_NAME,b.ofString(this.PARAMETER_STRING_NAME)),this.PARAMETER_SPLIT_STRING=new $(this.PARAMETER_SPLIT_STRING_NAME,b.ofString(this.PARAMETER_SPLIT_STRING_NAME)),this.EVENT_ARRAY=new et(et.OUTPUT,K.of(this.EVENT_RESULT_NAME,b.ofArray(this.EVENT_RESULT_NAME)))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new ei([er.outputOf(K.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class sa extends eW{getSignature(){return new eE("ToString").setNamespace(T.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}constructor(){super(),this.PARAMETER_INPUT_ANYTYPE_NAME="anytype",this.EVENT_RESULT_NAME="result",this.PARAMETER_INPUT_ANYTYPE=new $(this.PARAMETER_INPUT_ANYTYPE_NAME,b.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME)),this.EVENT_STRING=new et(et.OUTPUT,new Map([[this.EVENT_RESULT_NAME,b.ofString(this.EVENT_RESULT_NAME)]]))}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new ei([er.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class si extends eW{static{this.PARAMETER_STRING_NAME="string"}static{this.PARAMETER_LENGTH_NAME="length"}static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_STRING=new $(si.PARAMETER_STRING_NAME,b.ofString(si.PARAMETER_STRING_NAME))}static{this.PARAMETER_LENGTH=new $(si.PARAMETER_LENGTH_NAME,b.ofInteger(si.PARAMETER_LENGTH_NAME))}static{this.EVENT_STRING=new et(et.OUTPUT,new Map([[si.EVENT_RESULT_NAME,b.ofString(si.EVENT_RESULT_NAME)]]))}getSignature(){return this.signature}constructor(){super(),this.signature=new eE("TrimTo").setNamespace(T.STRING).setParameters(new Map([[si.PARAMETER_STRING.getParameterName(),si.PARAMETER_STRING],[si.PARAMETER_LENGTH.getParameterName(),si.PARAMETER_LENGTH]])).setEvents(new Map([[si.EVENT_STRING.getName(),si.EVENT_STRING]]))}async internalExecute(e){let t=e.getArguments()?.get(si.PARAMETER_STRING_NAME),r=e.getArguments()?.get(si.PARAMETER_LENGTH_NAME);return new ei([er.outputOf(new Map([[si.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class so{static{this.repoMap=K.ofArrayEntries(n4.ofEntryString("Trim",e=>e.trim()),n4.ofEntryString("LowerCase",e=>e.toLocaleLowerCase()),n4.ofEntryString("UpperCase",e=>e.toUpperCase()),n4.ofEntryStringBooleanOutput("IsBlank",e=>""===e.trim()),n4.ofEntryStringBooleanOutput("IsEmpty",e=>""===e),n4.ofEntryAsStringBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),n4.ofEntryAsStringBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),n4.ofEntryAsStringBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),n4.ofEntryAsStringBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),n4.ofEntryAsStringBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),n4.ofEntryAsStringIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),n4.ofEntryAsStringIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),n4.ofEntryAsStringAndIntegerStringOutput("Repeat",(e,t)=>e.repeat(t)),n4.ofEntryAsStringStringIntegerIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),n4.ofEntryAsStringStringIntegerIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),n4.ofEntryAsStringStringStringStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),n4.ofEntryAsStringStringStringStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),n4.ofEntryAsStringIntegerIntegerStringOutput("SubString",(e,t,r)=>e.substring(t,r)),q(new n3),q(new n6),q(new n5),q(new n8),q(new se),q(new st),q(new sr),q(new sn),q(new ss),q(new sa),q(new si),q(new n7))}static{this.filterableNames=Array.from(so.repoMap.values()).map(e=>e.getSignature().getFullName())}async find(e,t){return e!=T.STRING?Promise.resolve(void 0):Promise.resolve(so.repoMap.get(t))}async filter(e){return Promise.resolve(so.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sE{constructor(){}static isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}static validYearRange(e){return e<275761&&e>-271821}static validMonthRange(e){return e<=12&&e>0}static validDate(e,t,r){if(r<=0||t<=0)return!1;switch(t){case 2:return sE.validYearRange(e)&&sE.validMonthRange(t)&&sE.isLeapYear(e)&&r<30||!sE.isLeapYear(e)&&r<29;case 4:case 6:case 9:case 11:return sE.validYearRange(e)&&sE.validMonthRange(t)&&r<=30;default:return sE.validYearRange(e)&&sE.validMonthRange(t)&&r<=31}}static validHourRange(e){return e<24&&e>=0}static validMinuteSecondRange(e){return e<60&&e>=0}static validMilliSecondRange(e){return e<1e3&&e>=0}static validateWithOptionalMillis(e){return sE.validMilliSecondRange(sE.convertToInt(e.substring(1,4)))&&sE.validateLocalTime(e.substring(4))}getYear(e){let t=e.charAt(0);if("+"==t||"-"==t){let r=sE.convertToInt(e.substring(1,7));return"-"==t?-1*r:r}return sE.convertToInt(e.substring(0,4))}static validateLocalTime(e){return"Z"==e.charAt(0)||6==e.length&&("+"==e.charAt(0)||"-"==e.charAt(0))&&sE.validHourRange(sE.convertToInt(e.substring(1,3)))&&":"==e.charAt(3)&&sE.validMinuteSecondRange(sE.convertToInt(e.substring(4,e.length-1)))}static validate(e){if(e.length<20||e.length>32)return!1;let t=e.charAt(0);return"+"==t||"-"==t?"-"==e.charAt(7)&&"-"==e.charAt(10)&&"T"==e.charAt(13)&&":"==e.charAt(16)&&":"==e.charAt(19)&&"."==e.charAt(22)&&sE.validDate(sE.convertToInt(e.substring(1,7)),sE.convertToInt(e.substring(8,10)),sE.convertToInt(e.substring(11,13)))&&sE.validHourRange(sE.convertToInt(e.substring(14,16)))&&sE.validMinuteSecondRange(sE.convertToInt(e.substring(17,19)))&&sE.validMinuteSecondRange(sE.convertToInt(e.substring(20,22)))&&sE.validateWithOptionalMillis(e.substring(22)):"-"==e.charAt(4)&&"-"==e.charAt(7)&&"T"==e.charAt(10)&&":"==e.charAt(13)&&":"==e.charAt(16)&&"."==e.charAt(19)&&sE.validDate(sE.convertToInt(e.substring(0,4)),sE.convertToInt(e.substring(5,7)),sE.convertToInt(e.substring(8,10)))&&sE.validHourRange(sE.convertToInt(e.substring(11,13)))&&sE.validMinuteSecondRange(sE.convertToInt(e.substring(14,16)))&&sE.validMinuteSecondRange(sE.convertToInt(e.substring(17,19)))&&sE.validateWithOptionalMillis(e.substring(19))}static convertToInt(e){var t=parseInt(e);return isNaN(t)?Number.MIN_VALUE:t}}class su extends eW{static{this.EVENT_RESULT_NAME="result"}static{this.PARAMETER_DATE_NAME="isoDate"}static{this.PARAMETER_FIELD_NAME="value"}static{this.PARAMETER_INT_NAME="intValue"}static{this.PARAMETER_UNIT_NAME="unit"}static{this.PARAMETER_DATE=new $(su.PARAMETER_DATE_NAME,b.ofString(this.PARAMETER_DATE_NAME).setRef(T.DATE+".timeStamp"))}static{this.PARAMETER_FIELD=new $(su.PARAMETER_FIELD_NAME,b.ofInteger(this.PARAMETER_FIELD_NAME))}static{this.PARAMETER_INT=new $(su.PARAMETER_INT_NAME,b.ofInteger(this.PARAMETER_INT_NAME))}static{this.PARAMETER_UNIT=new $(su.PARAMETER_UNIT_NAME,b.ofString(this.PARAMETER_UNIT_NAME).setEnums(["YEAR","MONTH","DAY","HOUR","MINUTE","SECOND","MILLISECOND"]))}static{this.EVENT_INT=new et(et.OUTPUT,K.of(su.EVENT_RESULT_NAME,b.ofInteger(su.EVENT_RESULT_NAME)))}static{this.EVENT_BOOLEAN=new et(et.OUTPUT,K.of(su.EVENT_RESULT_NAME,b.ofBoolean(su.EVENT_RESULT_NAME)))}static{this.EVENT_DATE=new et(et.OUTPUT,K.of(su.EVENT_RESULT_NAME,b.ofString(su.EVENT_RESULT_NAME).setRef(T.DATE+".timeStamp")))}getSignature(){return this.signature}constructor(e,t,r,...n){super();let s=new Map;n.forEach(e=>s.set(e.getParameterName(),e)),this.signature=new eE(t).setNamespace(e).setParameters(s).setEvents(K.of(r.getName(),r))}static ofEntryDateAndBooleanOutput(e,t){return[e,new class extends su{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(su.PARAMETER_DATE_NAME);if(R(r)||!sE.validate(r))throw new ea("Please provide a valid date.");return new ei([er.outputOf(K.of(su.EVENT_RESULT_NAME,t(r)))])}}(T.DATE,e,su.EVENT_BOOLEAN,su.PARAMETER_DATE)]}static ofEntryDateAndIntegerOutput(e,t){return[e,new class extends su{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(su.PARAMETER_DATE_NAME);if(R(r)||!sE.validate(r))throw new ea("Please provide a valid date object");return new ei([er.outputOf(K.of(su.EVENT_RESULT_NAME,t(r)))])}}(T.DATE,e,su.EVENT_INT,su.PARAMETER_DATE)]}static ofEntryDateWithIntegerUnitWithOutputName(e,t){return[e,new class extends su{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(su.PARAMETER_DATE_NAME);if(R(r)||!sE.validate(r))throw new ea("Please provide a valid date object");let n=e.getArguments()?.get(su.PARAMETER_INT_NAME),s=e.getArguments()?.get(su.PARAMETER_UNIT_NAME);return new ei([er.outputOf(K.of(su.EVENT_RESULT_NAME,t(r,n,s)))])}}(T.DATE,e,su.EVENT_DATE,su.PARAMETER_DATE,su.PARAMETER_INT,su.PARAMETER_UNIT)]}}const sA="result",sl="isoDate";class sg extends eW{getSignature(){return new eE("DateToEpoch").setNamespace(T.DATE).setParameters(K.of(sl,$.of(sl,b.ofRef(T.DATE+".timeStamp")))).setEvents(new Map([et.outputEventMapEntry(new Map([[sA,b.ofLong(sA)]]))]))}async internalExecute(e){var t=e.getArguments()?.get(sl);if(R(t)||!sE.validate(t))throw new ea("Please provide a valid date object");let r=new Date(t).getTime();return new ei([er.of(sA,K.of(sA,r))])}}const sh="isoDateOne",sm="isoDateTwo",sT=new eE("DifferenceOfTimestamps").setNamespace(T.DATE).setParameters(new Map([[sh,new $(sh,b.ofString(sh).setRef(T.DATE+".timeStamp"))],[sm,new $(sm,b.ofString(sm).setRef(T.DATE+".timeStamp"))]]));class sc extends eW{getSignature(){return sT}async internalExecute(e){let t=e?.getArguments()?.get(sh),r=e?.getArguments()?.get(sm);if(!sE.validate(t)||!sE.validate(r))throw new ea("Please provide valid ISO date for both the given dates.");let n=new Date(t),s=new Date(r);return new ei([er.outputOf(new Map([["result",(s.getTime()-n.getTime())/6e4]]))])}}const sp="epoch",sR="date",sf=new eE("EpochToDate").setNamespace(T.DATE).setParameters(new Map([[sp,new $(sp,new b().setAnyOf([b.ofInteger(sp),b.ofLong(sp),b.ofString(sp)]))]])).setEvents(new Map([et.outputEventMapEntry(new Map([[sR,b.ofRef(`${T.DATE}.timeStamp`)]]))]));class sN extends eW{getSignature(){return sf}async internalExecute(e){var t=e.getArguments()?.get(sp);if(R(t)||"boolean"==typeof t||("string"==typeof t&&(t=parseInt(t)),isNaN(t)))throw new ea("Please provide a valid value for epoch.");return t=t>0xe8d4a50fff?t:1e3*t,new ei([er.outputOf(new Map([[sR,new Date(t).toISOString()]]))])}}const s_="date",sS=new eE("GetCurrentTimeStamp").setNamespace(T.DATE).setParameters(new Map([])).setEvents(new Map([et.outputEventMapEntry(new Map([[s_,b.ofRef(`${T.DATE}.timeStamp`)]]))]));class sM extends eW{getSignature(){return sS}async internalExecute(e){let t=new Date(Date.now()).toISOString();return new ei([er.of(s_,new Map([[s_,t]]))])}}const sw="isoDate",sO="result",sd=new eE("GetTimeAsArray").setNamespace(T.DATE).setParameters(K.of(sw,$.of(sw,b.ofRef(T.DATE+".timeStamp")))).setEvents(new Map([et.outputEventMapEntry(new Map([[sO,b.ofArray(sO).setItems(f.of(b.ofNumber("number")))]]))]));class sI extends eW{getSignature(){return sd}async internalExecute(e){var t=e.getArguments()?.get(sw);if(R(t)||!sE.validate(t))throw new ea("Please provide a valid date object");let r=new Date(t),n=[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()];return new ei([er.outputOf(new Map([[sO,n]]))])}}const sP="isoDate",sy="result",sx=new eE("GetTimeAsObject").setNamespace(T.DATE).setParameters(K.of(sP,$.of(sP,b.ofRef(T.DATE+".timeStamp")))).setEvents(new Map([et.outputEventMapEntry(new Map([[sy,b.ofObject(sy).setProperties(new Map([["year",b.ofNumber("year")],["month",b.ofNumber("month")],["day",b.ofNumber("day")],["hours",b.ofNumber("hours")],["minutes",b.ofNumber("minutes")],["seconds",b.ofNumber("seconds")],["milliseconds",b.ofNumber("milliseconds")]]))]]))]));class sv extends eW{getSignature(){return sx}async internalExecute(e){var t=e.getArguments()?.get(sP);if(R(t)||!sE.validate(t))throw new ea("Please provide a valid date object");let r=new Date(t),n={year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hours:r.getUTCHours(),minutes:r.getUTCMinutes(),seconds:r.getUTCSeconds(),milliseconds:r.getUTCMilliseconds()};return new ei([er.outputOf(new Map([[sy,n]]))])}}const sL="isoDate",sU="output",sC=new eE("IsValidISODate").setNamespace(T.DATE).setParameters(K.of(sL,$.of(sL,b.ofRef(T.DATE+".timeStamp")))).setEvents(K.of(sU,new et(sU,K.of(sU,b.ofBoolean(sU)))));class sV extends eW{getSignature(){return sC}async internalExecute(e){var t=e.getArguments()?.get(sL);if(R(t))throw new ea("Please provide a valid date object");return new ei([er.of(sU,K.of(sU,sE.validate(t)))])}}const sD="isoDates",sG="result",sb="Please provide a valid date",sF=new eE("MaximumTimestamp").setNamespace(T.DATE).setParameters(new Map([[sD,$.of(sD,b.ofString(sD).setRef(T.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[sG,new et(sG,new Map([[sG,b.ofString(sG).setRef(T.DATE+".timeStamp")]]))]]));class sY extends eW{getSignature(){return sF}async internalExecute(e){let t=e?.getArguments()?.get(sD),r=t.length;if(0===r)throw new ea(sb);if(1==r){let e=t[0];if(!sE.validate(e))throw new ea(sb);return new ei([er.outputOf(new Map([[sG,e]]))])}let n=0,s=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!sE.validate(r))throw new ea(sb);let a=new Date(r).getTime();a>s&&(s=a,n=e)}return new ei([er.outputOf(new Map([[sG,t[n]]]))])}}const sB="isoDates",sH="result",sk="Please provide a valid date",s$=new eE("MinimumTimestamp").setNamespace(T.DATE).setParameters(new Map([[sB,$.of(sB,b.ofString(sB).setRef(T.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[sH,new et(sH,new Map([[sH,b.ofString(sH).setRef(T.DATE+".timeStamp")]]))]]));class sj extends eW{getSignature(){return s$}async internalExecute(e){let t=e?.getArguments()?.get(sB),r=t.length;if(0===r)throw new ea(sk);if(1==r){let e=t[0];if(!sE.validate(e))throw new ea(sk);return new ei([er.outputOf(new Map([[sH,e]]))])}let n=0,s=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!sE.validate(r))throw new ea(sk);let a=new Date(r).getTime();a<s&&(s=a,n=e)}return new ei([er.outputOf(new Map([[sH,t[n]]]))])}}class sW{static{this.repoMap=K.ofArrayEntries(q(new sg),q(new sN),q(new sM),q(new sc),q(new sV),q(new sI),q(new sv),q(new sY),q(new sj),su.ofEntryDateAndBooleanOutput("IsLeapYear",e=>{let t=new Date(e).getUTCFullYear();return t%4==0&&t%100!=0||t%400==0}),su.ofEntryDateAndIntegerOutput("GetDate",e=>new Date(e).getUTCDate()),su.ofEntryDateAndIntegerOutput("GetDay",e=>new Date(e).getUTCDay()),su.ofEntryDateAndIntegerOutput("GetFullYear",e=>new Date(e).getUTCFullYear()),su.ofEntryDateAndIntegerOutput("GetMonth",e=>new Date(e).getUTCMonth()),su.ofEntryDateAndIntegerOutput("GetHours",e=>new Date(e).getUTCHours()),su.ofEntryDateAndIntegerOutput("GetMinutes",e=>new Date(e).getUTCMinutes()),su.ofEntryDateAndIntegerOutput("GetSeconds",e=>new Date(e).getUTCSeconds()),su.ofEntryDateAndIntegerOutput("GetMilliSeconds",e=>new Date(e).getUTCMilliseconds()),su.ofEntryDateAndIntegerOutput("GetTime",e=>new Date(e).getTime()),su.ofEntryDateWithIntegerUnitWithOutputName("AddTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!0)),su.ofEntryDateWithIntegerUnitWithOutputName("SubtractTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!1)))}static{this.filterableNames=Array.from(sW.repoMap.values()).map(e=>e.getSignature().getFullName())}static changeAmountToUnit(e,t,r,n){let s=n?r:-1*r,a=this.getFullUTCDate(e),i=this.getTimezoneOffset(e);switch(t){case"MILLISECOND":a.setMilliseconds(a.getMilliseconds()+s);break;case"SECOND":a.setSeconds(a.getSeconds()+s);break;case"MINUTE":a.setMinutes(a.getMinutes()+s);break;case"HOUR":a.setHours(a.getHours()+s);break;case"DAY":a.setDate(a.getDate()+s);break;case"MONTH":a.setMonth(a.getMonth()+s);break;case"YEAR":a.setFullYear(a.getFullYear()+s);break;default:throw new ea("No such unit: "+t)}return this.formatDate(a,i)}static getTimezoneOffset(e){if("Z"===e.charAt(e.length-1))return"+00:00";let t=-1!==e.indexOf("+")?e.lastIndexOf("+"):e.lastIndexOf("-");if(-1===t)return"+00:00";let r=e.substring(t);return 3===r.length?r=r.substring(0,1)+"0"+r.substring(1)+":00":5===r.length&&(r=r.substring(0,3)+":"+r.substring(3)),r}static getFullUTCDate(e){-1!==e.lastIndexOf("+")?e=e.substring(0,e.lastIndexOf("+"))+"Z":-1!==e.lastIndexOf("-")&&(e=e.substring(0,e.lastIndexOf("-"))+"Z");let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()))}static formatDate(e,t){let r=e=>e.toString().padStart(2,"0"),n=0===e.getUTCMonth()?e.getUTCFullYear()-1:e.getUTCFullYear(),s=r(0===e.getUTCMonth()?12:e.getUTCMonth()),a=r(e.getUTCDate()),i=r(e.getUTCHours()),o=r(e.getUTCMinutes()),E=r(e.getUTCSeconds()),u=r(e.getUTCMilliseconds());return`${n}-${s}-${a}T${i}:${o}:${E}.${u}${t}`}find(e,t){return e!=T.DATE?Promise.resolve(void 0):Promise.resolve(sW.repoMap.get(t))}filter(e){return Promise.resolve(sW.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class sX extends eW{static{this.MILLIS="millis"}static{this.SIGNATURE=new eE("Wait").setNamespace(T.SYSTEM).setParameters(new Map([$.ofEntry(sX.MILLIS,b.ofNumber(sX.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([et.outputEventMapEntry(new Map)]))}getSignature(){return sX.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(sX.MILLIS);return await new Promise(e=>setTimeout(e,t)),new ei([er.outputOf(new Map)])}}var sJ={};t(sJ,"HybridRepository",()=>sq);class sq{constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}const sz=new Map([[T.SYSTEM_CTX,new Map([q(new class extends eW{getSignature(){return t1}async internalExecute(e){let t=e?.getArguments()?.get(tZ);if(e?.getContext()?.has(t))throw new ea(em.format("Context already has an element for '$' ",t));let r=b.from(e?.getArguments()?.get(t0));if(!r)throw new ea("Schema is not supplied.");return e.getContext().set(t,new tQ(r,R(r.getDefaultValue())?void 0:r.getDefaultValue())),new ei([er.outputOf(new Map)])}}),q(new class extends eW{getSignature(){return t4}async internalExecute(e){let t=e?.getArguments()?.get(t2);if(!e.getContext()?.has(t))throw new ea(em.format("Context don't have an element for '$' ",t));return new ei([er.outputOf(new Map([t9,e.getContext()?.get(t)?.getElement()]))])}}),q(new class extends eW{getSignature(){return nt}async internalExecute(e){let t=e?.getArguments()?.get(r8);if(ef.isNullOrBlank(t))throw new ea("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(ne),n=new ty(t),s=n.getTokens().peekLast();if(!s.getExpression().startsWith("Context")||s instanceof ty||s instanceof td&&!s.getElement().toString().startsWith("Context"))throw new e0(em.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tP.ARRAY_OPERATOR&&e!=tP.OBJECT_OPERATOR)throw new e0(em.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let s=n.getTokens().get(r);s instanceof ty&&n.getTokens().set(r,new td(t,new r7(s).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let s=n.getTokens();s.removeLast();let a=n.getOperations();a.removeLast();let i=e.getContext()?.get(s.removeLast().getExpression());if(R(i))throw new ea(em.format("Context doesn't have any element with name '$' ",t));if(a.isEmpty())return i.setElement(r),new ei([er.outputOf(new Map)]);let o=i.getElement(),E=a.removeLast(),u=s.removeLast(),A=u instanceof td?u.getElement():u.getExpression();for(R(o)&&(o=E==tP.OBJECT_OPERATOR?{}:[],i.setElement(o));!a.isEmpty();)o=E==tP.OBJECT_OPERATOR?this.getDataFromObject(o,A,a.peekLast()):this.getDataFromArray(o,A,a.peekLast()),E=a.removeLast(),A=(u=s.removeLast())instanceof td?u.getElement():u.getExpression();return E==tP.OBJECT_OPERATOR?this.putDataInObject(o,A,r):this.putDataInArray(o,A,r),new ei([er.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new ea(em.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new ea(em.format("Expected an array index but found $",t));if(n<0)throw new ea(em.format("Array index is out of bound - $",t));let s=e[n];return R(s)&&(s=r==tP.OBJECT_OPERATOR?{}:[],e[n]=s),s}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new ea(em.format("Expected an object but found $",e));let n=e[t];return R(n)&&(n=r==tP.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new ea(em.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new ea(em.format("Expected an array index but found $",t));if(n<0)throw new ea(em.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new ea(em.format("Expected an object but found $",e));e[t]=r}})])],[T.SYSTEM_LOOP,new Map([q(new class extends eW{getSignature(){return nS}async internalExecute(e){let t=e.getArguments()?.get(nR),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nf),s=n>0,a=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new ei({next(){if(i)return;if(s&&a>=r||!s&&a<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),er.outputOf(new Map([[nN,a]]));let t=er.of(et.ITERATION,new Map([[n_,a]]));return a+=n,t}})}}),q(new class extends eW{getSignature(){return ng}async internalExecute(e){let t=e.getArguments()?.get(nu),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new ei({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),er.outputOf(new Map([[nA,r]]));let s=er.of(et.ITERATION,new Map([[nl,r]]));return++r,s}})}}),q(new class extends eW{getSignature(){return nE}async internalExecute(e){let t=e.getArguments()?.get(no);return e.getExecutionContext().set(t,!0),new ei([er.outputOf(new Map)])}}),q(new class extends eW{getSignature(){return np}async internalExecute(e){let t=e.getArguments()?.get(nh),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new ei({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),er.outputOf(new Map([[nc,r]]));let s=er.of(et.ITERATION,new Map([[nT,r],[nm,t[r]]]));return++r,s}})}})])],[T.SYSTEM,new Map([q(new ni),q(new class extends eW{getSignature(){return na}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(nn),s=e?.getArguments()?.get(ns).map(t=>{let r=t[nr];if(R(r))throw new ea("Expect a value object");let n=r.value;return r.isExpression&&(n=new r7(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(s),new ei([er.outputOf(new Map)])}}),q(new n9),q(new sX),q(new tq)])]]),sK=Array.from(sz.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class sQ extends sq{constructor(){super({find:async(e,t)=>sz.get(e)?.get(t),filter:async e=>Array.from(sK).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nH,new so,new tz,new n2,new sW)}}var sZ={};t(sZ,"StatementExecution",()=>s2);var s0={};t(s0,"StatementMessage",()=>s1);class s1{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 s2{constructor(e){this.messages=[],this.dependencies=new Set,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 s1(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof s2&&e.statement.equals(this.statement)}}var s9={};t(s9,"ContextTokenValueExtractor",()=>s4);class s4 extends tv{static{this.PREFIX="Context."}constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tv.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.context.get(r)?.getElement())}getPrefix(){return s4.PREFIX}getStore(){return R(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(R(r)||(e[t]=r.getElement()),e),{})}}var s3={};t(s3,"OutputMapTokenValueExtractor",()=>s6);class s6 extends tv{static{this.PREFIX="Steps."}constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tv.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let s=n.get(t[r++]);if(!s||r>t.length)return;if(r===t.length)return s;let a=t[r].indexOf("[");if(-1===a){let n=s.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,a),o=s.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return s6.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var s5={};t(s5,"ArgumentsTokenValueExtractor",()=>s7);class s7 extends tv{static{this.PREFIX="Arguments."}constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tv.REGEX_DOT),r=t[1],n=r.indexOf("["),s=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),s=1),this.retrieveElementFrom(e,t,s,this.args.get(r))}getPrefix(){return s7.PREFIX}getStore(){return R(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var s8={};t(s8,"GraphVertex",()=>ar);var ae={};t(ae,"ExecutionGraph",()=>at);class at{constructor(e=!1){this.nodeMap=new Map,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 ar(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 eT(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(let 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 ar{constructor(e,t){this.outVertices=new Map,this.inVertices=new Set,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 eS(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new eS(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 at(!0);var r=new eT(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().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 ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var an={};t(an,"KIRuntime",()=>al);var as={};t(as,"JsonExpression",()=>aa);class aa{constructor(e){this.expression=e}getExpression(){return this.expression}}var ai={};t(ai,"ParameterReferenceType",()=>A),(a=A||(A={})).VALUE="VALUE",a.EXPRESSION="EXPRESSION";var ao={};function aE(){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(ao,"FunctionExecutionParameters",()=>au);class au{constructor(e,t,r){this.count=0,this.executionContext=new Map,this.valueExtractors=new Map,this.functionRepository=e,this.schemaRepository=t,this.executionId=r??aE()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new s4(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,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 s6(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(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var aA={};t(aA,"StatementMessageType",()=>l),(i=l||(l={})).ERROR="ERROR",i.WARNING="WARNING",i.MESSAGE="MESSAGE";class al extends eW{static{this.PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value'}static{this.STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g")}static{this.VERSION=1}static{this.MAX_EXECUTION_ITERATIONS=1e7}constructor(e,t=!1){if(super(),this.debugMode=!1,this.debugMode=t,this.fd=e,this.fd.getVersion()>al.VERSION)throw new ea("Runtime is at a lower version "+al.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new at;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(l.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new s7(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new ea("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new eT;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new eT;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(et.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==al.MAX_EXECUTION_ITERATIONS)throw new ea("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(et.OUTPUT)?.getParameters()?.size)throw new ea("No events raised")}let s=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>er.of(e[0],t)));return new ei(s.length||e.isSubGraph()?s:[er.of(et.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,s=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(s.getData().getStatement().getStatementName())||e.getSteps()?.set(s.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(s.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=s.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=et.OUTPUT)n?.getName()==et.OUTPUT&&s.getOutVertices().has(et.OUTPUT)&&(s?.getOutVertices()?.get(et.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,s){let a,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new r7(e).evaluate(t.getValuesMap())).every(e=>!R(e)&&!1!==e))return;let o=await s.find(i.getNamespace(),i.getName());if(!o)throw new ea(em.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let A=t.getContext();a=o instanceof al?new au(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==s7.PREFIX&&e.getPrefix()!==s6.PREFIX&&e.getPrefix()!==s4.PREFIX).map(e=>[e.getPrefix(),e]))):new au(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(A).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let l=await o.execute(a),g=l.next();if(!g)throw new ea(em.format("Executing $ returned no events",i.getStatementName()));let h=g.getName()==et.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(g.getName(),this.resolveInternalExpressions(g.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${g.getName()} : `,t.getSteps().get(i.getStatementName()).get(g.getName()))),h){let r=e.getOutVertices().get(et.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(g.getName()),n=this.makeEdges(t).getT1();r.push(new ew(t,n,l,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new eS(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(R(e)||"object"!=typeof e)return e;if(e instanceof aa)return new r7(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!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(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,s=Array.from(t[1]?.values()??[]);if(!s?.length)return new eS(t[0],n);let a=r.get(t[0]);return a?(n=a.isVariableArgument()?s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!R(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,s[0]),new eS(t[0],n)):new eS(t[0],void 0)}).filter(e=>!R(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==A.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=A.EXPRESSION||ef.isNullOrBlank(t.getExpression())||(r=new r7(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new s2(e),s=await t.find(e.getNamespace(),e.getName());if(!s)return n.addMessage(l.ERROR,em.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let a=new Map(s.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=a.get(t[0]);if(!e)continue;let s=Array.from(t[1]?.values()??[]);if(!s.length&&!e.isVariableArgument()){await eI.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(l.ERROR,em.format(al.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),a.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(s.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),s))this.parameterReferenceValidation(n,e,t,r);else if(s.length){let t=s[0];this.parameterReferenceValidation(n,e,t,r)}a.delete(e.getParameterName())}if(!R(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!R(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(a.size)for(let e of Array.from(a.values()))e.isVariableArgument()||await eI.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(l.ERROR,em.format(al.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==A.VALUE){if(R(r.getValue())&&!await eI.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(l.ERROR,em.format(al.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),R(r.getValue()))return;let s=new eT;for(s.push(new eS(t.getSchema(),r.getValue()));!s.isEmpty();){let t=s.pop();if(t.getT2() instanceof aa)this.addDependencies(e,t.getT2().getExpression());else{if(R(t.getT1())||R(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(o.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())s.push(new eS(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)s.push(new eS(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(o.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===$.EXPRESSION.getName()&&r.getNamespace()===$.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])&&s.push(new eS(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==A.EXPRESSION){if(ef.isNullOrBlank(r.getExpression()))R(eI.getDefaultValue(t.getSchema(),n))&&e.addMessage(l.ERROR,em.format(al.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(l.ERROR,em.format("Error evaluating $ : $",r.getExpression(),t))}}}else R(await eI.getDefaultValue(t.getSchema(),n))&&e.addMessage(l.ERROR,em.format(al.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(al.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let s of Array.from(t))for(let t of Array.from(s.getData().getDependencies())){let a=t.indexOf(".",6),i=t.substring(6,a),o=t.indexOf(".",a+1),E=-1==o?t.substring(a+1):t.substring(a+1,o);e.getNodeMap().has(i)?s.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new eS(i,E)),n.set(s.getData().getStatement().getStatementName(),em.format("Unable to find the step with name $",i)))}return new eS(r,n)}}var ag={};t(ag,"KIRunConstants",()=>ah);class ah{static{this.NAMESPACE="namespace"}static{this.NAME="name"}static{this.ID="id"}constructor(){}}var am={};t(am,"Position",()=>aT);class aT{static{this.SCHEMA_NAME="Position"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(aT.SCHEMA_NAME).setType(P.of(o.OBJECT)).setProperties(new Map([["left",b.ofFloat("left")],["top",b.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){if(e)return new aT(e.left,e.top)}}var ac={};t(ac,"FunctionDefinition",()=>ad);var ap={};t(ap,"Statement",()=>aS);var aR={};t(aR,"AbstractStatement",()=>af);class af{constructor(e){if(this.override=!1,!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new aT(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 aN={};t(aN,"ParameterReference",()=>a_);class a_{static{this.SCHEMA_NAME="ParameterReference"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(a_.SCHEMA_NAME).setType(P.of(o.OBJECT)).setProperties(new Map([["key",b.ofString("key")],["value",b.ofAny("value")],["expression",b.ofString("expression")],["type",b.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",b.ofInteger("order")]]))}constructor(e){e instanceof a_?(this.key=e.key,this.type=e.type,this.value=R(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=aE())}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}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new a_(A.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new a_(A.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new a_(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class aS extends af{static{this.SCHEMA_NAME="Statement"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(aS.SCHEMA_NAME).setType(P.of(o.OBJECT)).setProperties(new Map([["statementName",b.ofString("statementName")],["comment",b.ofString("comment")],["description",b.ofString("description")],["namespace",b.ofString("namespace")],["name",b.ofString("name")],["dependentStatements",b.ofObject("dependentstatement").setAdditionalProperties(new G().setSchemaValue(b.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",b.ofObject("executeIftrue").setAdditionalProperties(new G().setSchemaValue(b.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new b().setName("parameterMap").setAdditionalProperties(new G().setSchemaValue(b.ofObject("parameterReference").setAdditionalProperties(new G().setSchemaValue(a_.SCHEMA))))],["position",aT.SCHEMA]]))}constructor(e,t,r){if(super(e instanceof aS?e:void 0),e instanceof aS)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new a_(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw 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}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof aS&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new aS(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])=>a_.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(aT.from(e.position)).setComment(e.comment).setDescription(e.description)}}var aM={};t(aM,"StatementGroup",()=>aw);class aw extends af{static{this.SCHEMA_NAME="StatementGroup"}static{this.SCHEMA=new b().setNamespace(T.SYSTEM).setName(aw.SCHEMA_NAME).setType(P.of(o.OBJECT)).setProperties(new Map([["statementGroupName",b.ofString("statementGroupName")],["comment",b.ofString("comment")],["description",b.ofString("description")],["position",aT.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 aw(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(aT.from(e.position)).setComment(e.comment).setDescription(e.description)}}const aO=new b().setNamespace(T.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",b.ofString("name")],["namespace",b.ofString("namespace")],["parameters",b.ofArray("parameters",$.SCHEMA)],["events",b.ofObject("events").setAdditionalProperties(new G().setSchemaValue(et.SCHEMA))],["steps",b.ofObject("steps").setAdditionalProperties(new G().setSchemaValue(aS.SCHEMA))]]));aO.getProperties()?.set("parts",b.ofArray("parts",aO));class ad extends eE{static{this.SCHEMA=aO}constructor(e){super(e),this.version=1}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 ad(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,aS.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,aw.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>ad.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,et.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,$.from(e)]))).setNamespace(e.namespace):new ad("unknown")}}var aI={};t(aI,"Argument",()=>aP);class aP{constructor(e,t,r){this.argumentIndex=0,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 aP(0,e,t)}}var ay={};e(ay,r$),e(ay,rJ),e(ay,rz),e(ay,rQ),e(ay,rj);var ax={};e(ax,re),e(ax,rr),e(ax,rs),e(ax,ri),e(ax,rE),e(ax,rA),e(ax,rg),e(ax,t5),e(ax,rm),e(ax,rc),e(ax,rR),e(ax,rN),e(ax,rS),e(ax,rw),e(ax,rd),e(ax,rP),e(ax,rx),e(ax,rL),e(ax,rC),e(ax,rb),e(ax,rD),e(ax,rY),e(ax,rH),e(ax,t6),e(module.exports,g),e(module.exports,J),e(module.exports,{}),e(module.exports,eQ),e(module.exports,z),e(module.exports,p),e(module.exports,eg),e(module.exports,tf),e(module.exports,eh),e(module.exports,eR),e(module.exports,e_),e(module.exports,e9),e(module.exports,el),e(module.exports,e6),e(module.exports,sZ),e(module.exports,s0),e(module.exports,tK),e(module.exports,s9),e(module.exports,s3),e(module.exports,s5),e(module.exports,s8),e(module.exports,{}),e(module.exports,ae),e(module.exports,an),e(module.exports,aA),e(module.exports,ao),e(module.exports,tR),e(module.exports,tx),e(module.exports,r0),e(module.exports,tp),e(module.exports,t3),e(module.exports,tI),e(module.exports,tM),e(module.exports,t_),e(module.exports,tO),e(module.exports,{}),e(module.exports,eu),e(module.exports,m),e(module.exports,as),e(module.exports,h),e(module.exports,eG),e(module.exports,eU),e(module.exports,eV),e(module.exports,ev),e(module.exports,eP),e(module.exports,eB),e(module.exports,eF),e(module.exports,eA),e(module.exports,eO),e(module.exports,Y),e(module.exports,ex),e(module.exports,c),e(module.exports,d),e(module.exports,_),e(module.exports,S),e(module.exports,M),e(module.exports,N),e(module.exports,eN),e(module.exports,eH),e(module.exports,sJ),e(module.exports,ag),e(module.exports,F),e(module.exports,en),e(module.exports,am),e(module.exports,ac),e(module.exports,ai),e(module.exports,Z),e(module.exports,aR),e(module.exports,ap),e(module.exports,{}),e(module.exports,aM),e(module.exports,eo),e(module.exports,ee),e(module.exports,H),e(module.exports,aI),e(module.exports,aN),e(module.exports,eZ),e(module.exports,es),e(module.exports,ay),e(module.exports,ax),e(module.exports,r9);
|
|
1
|
+
function e(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}function t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var r,n,a,s,i,o,E,u,l,A,g,c,m={};t(m,"KIRunSchemaRepository",()=>q);var T={};t(T,"AdditionalType",()=>F),t(T,"Schema",()=>Y);var p={};t(p,"Namespaces",()=>R);class R{static SYSTEM="System";static SYSTEM_CTX="System.Context";static SYSTEM_LOOP="System.Loop";static SYSTEM_ARRAY="System.Array";static SYSTEM_OBJECT="System.Object";static MATH="System.Math";static STRING="System.String";static DATE="System.Date";constructor(){}}var h={};t(h,"ArraySchemaType",()=>_);var f={};function N(e){return null==e}t(f,"isNullValue",()=>N);class _{singleSchema;tupleSchema;constructor(e){if(!e)return;this.singleSchema=e.singleSchema?new Y(e.singleSchema):void 0,this.tupleSchema=e.tupleSchema?e.tupleSchema.map(e=>new Y(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!N(this.singleSchema)}static of(...e){return 1==e.length?new _().setSingleSchema(e[0]):new _().setTupleSchema(e)}static from(e){if(!e)return;if(Array.isArray(e))return new _().setTupleSchema(Y.fromListOfSchemas(e));let t=Object.keys(e);if(-1!=t.indexOf("singleSchema"))return new _().setSingleSchema(Y.from(e.singleSchema));if(-1!=t.indexOf("tupleSchema"))return new _().setTupleSchema(Y.fromListOfSchemas(e.tupleSchema));let r=Y.from(e);if(r)return new _().setSingleSchema(r)}}var S={};t(S,"SchemaType",()=>E),(r=E||(E={})).INTEGER="Integer",r.LONG="Long",r.FLOAT="Float",r.DOUBLE="Double",r.STRING="String",r.OBJECT="Object",r.ARRAY="Array",r.BOOLEAN="Boolean",r.NULL="Null";var M={};t(M,"TypeUtil",()=>x);var w={};t(w,"MultipleType",()=>I);var O={};t(O,"Type",()=>d);class d{}class I extends d{type;constructor(e){super(),e instanceof I?this.type=new Set(Array.from(e.type)):this.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 P={};t(P,"SingleType",()=>y);class y extends d{type;constructor(e){super(),e instanceof y?this.type=e.type:this.type=e}getType(){return this.type}getAllowedSchemaTypes(){return new Set([this.type])}contains(e){return this.type==e}}class x{static of(...e){return 1==e.length?new y(e[0]):new I(new Set(e))}static from(e){return"string"==typeof e?new y(E[x.fromJSONType(e)]):Array.isArray(e)?new I(new Set(e.map(x.fromJSONType).map(e=>e).map(e=>E[e]))):void 0}static fromJSONType(e){let t=e.toUpperCase();return"NUMBER"===t?"DOUBLE":t}}const v="additionalProperty",L="additionalItems",U="enums",C="items",V="System.Schema",D="required",b="version",G="namespace";class F{booleanValue;schemaValue;constructor(e){if(!e||(this.booleanValue=e.booleanValue,!e.schemaValue))return;this.schemaValue=new Y(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(N(e))return;let t=new F;if("boolean"==typeof e)t.booleanValue=e;else{let r=Object.keys(e);-1!=r.indexOf("booleanValue")?t.booleanValue=e.booleanValue:-1!=r.indexOf("schemaValue")?t.schemaValue=Y.from(e.schemaValue):t.schemaValue=Y.from(e)}return t}}class Y{static NULL=new Y().setNamespace(R.SYSTEM).setName("Null").setType(x.of(E.NULL)).setConstant(void 0);static TYPE_SCHEMA=new Y().setType(x.of(E.STRING)).setEnums(["INTEGER","LONG","FLOAT","DOUBLE","STRING","OBJECT","ARRAY","BOOLEAN","NULL"]);static SCHEMA=new Y().setNamespace(R.SYSTEM).setName("Schema").setType(x.of(E.OBJECT)).setProperties(new Map([[G,Y.of(G,E.STRING).setDefaultValue("_")],["name",Y.ofString("name")],[b,Y.of(b,E.INTEGER).setDefaultValue(1)],["ref",Y.ofString("ref")],["type",new Y().setAnyOf([Y.TYPE_SCHEMA,Y.ofArray("type",Y.TYPE_SCHEMA)])],["anyOf",Y.ofArray("anyOf",Y.ofRef(V))],["allOf",Y.ofArray("allOf",Y.ofRef(V))],["oneOf",Y.ofArray("oneOf",Y.ofRef(V))],["not",Y.ofRef(V)],["title",Y.ofString("title")],["description",Y.ofString("description")],["id",Y.ofString("id")],["examples",Y.ofAny("examples")],["defaultValue",Y.ofAny("defaultValue")],["comment",Y.ofString("comment")],[U,Y.ofArray(U,Y.ofString(U))],["constant",Y.ofAny("constant")],["pattern",Y.ofString("pattern")],["format",Y.of("format",E.STRING).setEnums(["DATETIME","TIME","DATE","EMAIL","REGEX"])],["minLength",Y.ofInteger("minLength")],["maxLength",Y.ofInteger("maxLength")],["multipleOf",Y.ofLong("multipleOf")],["minimum",Y.ofNumber("minimum")],["maximum",Y.ofNumber("maximum")],["exclusiveMinimum",Y.ofNumber("exclusiveMinimum")],["exclusiveMaximum",Y.ofNumber("exclusiveMaximum")],["properties",Y.of("properties",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],["additionalProperties",new Y().setName(v).setNamespace(R.SYSTEM).setAnyOf([Y.ofBoolean(v),Y.ofObject(v).setRef(V)]).setDefaultValue(!0)],[D,Y.ofArray(D,Y.ofString(D)).setDefaultValue([])],["propertyNames",Y.ofRef(V)],["minProperties",Y.ofInteger("minProperties")],["maxProperties",Y.ofInteger("maxProperties")],["patternProperties",Y.of("patternProperties",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],[C,new Y().setName(C).setAnyOf([Y.ofRef(V).setName("item"),Y.ofArray("tuple",Y.ofRef(V))])],["contains",Y.ofRef(V)],["minContains",Y.ofInteger("minContains")],["maxContains",Y.ofInteger("maxContains")],["minItems",Y.ofInteger("minItems")],["maxItems",Y.ofInteger("maxItems")],["uniqueItems",Y.ofBoolean("uniqueItems")],["additionalItems",new Y().setName(L).setNamespace(R.SYSTEM).setAnyOf([Y.ofBoolean(L),Y.ofObject(L).setRef(V)])],["$defs",Y.of("$defs",E.OBJECT).setAdditionalProperties(new F().setSchemaValue(Y.ofRef(V)))],["permission",Y.ofString("permission")]])).setRequired([]);static ofString(e){return new Y().setType(x.of(E.STRING)).setName(e)}static ofInteger(e){return new Y().setType(x.of(E.INTEGER)).setName(e)}static ofFloat(e){return new Y().setType(x.of(E.FLOAT)).setName(e)}static ofLong(e){return new Y().setType(x.of(E.LONG)).setName(e)}static ofDouble(e){return new Y().setType(x.of(E.DOUBLE)).setName(e)}static ofAny(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.NULL,E.OBJECT)).setName(e)}static ofAnyNotNull(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE,E.STRING,E.BOOLEAN,E.ARRAY,E.OBJECT)).setName(e)}static ofNumber(e){return new Y().setType(x.of(E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)).setName(e)}static ofBoolean(e){return new Y().setType(x.of(E.BOOLEAN)).setName(e)}static of(e,...t){return new Y().setType(x.of(...t)).setName(e)}static ofObject(e){return new Y().setType(x.of(E.OBJECT)).setName(e)}static ofRef(e){return new Y().setRef(e)}static ofArray(e,...t){return new Y().setType(x.of(E.ARRAY)).setName(e).setItems(_.of(...t))}static fromListOfSchemas(e){if(N(e)&&!Array.isArray(e))return;let t=[];for(let r of Array.from(e)){let e=Y.from(r);e&&t.push(e)}return t}static fromMapOfSchemas(e){if(N(e))return;let t=new Map;return Object.entries(e).forEach(([e,r])=>{let n=Y.from(r);n&&t.set(e,n)}),t}static from(e,t=!1){if(N(e))return;let r=new Y;return r.namespace=e.namespace??"_",r.name=e.name,r.version=e.version??1,r.ref=e.ref,t?r.type=new y(E.STRING):r.type=x.from(e.type),r.anyOf=Y.fromListOfSchemas(e.anyOf),r.allOf=Y.fromListOfSchemas(e.allOf),r.oneOf=Y.fromListOfSchemas(e.oneOf),r.not=Y.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=Y.fromMapOfSchemas(e.properties),r.additionalProperties=F.from(e.additionalProperties),r.required=e.required,r.propertyNames=Y.from(e.propertyNames,!0),r.minProperties=e.minProperties,r.maxProperties=e.maxProperties,r.patternProperties=Y.fromMapOfSchemas(e.patternProperties),r.items=_.from(e.items),r.additionalItems=F.from(e.additionalItems),r.contains=Y.from(e.contains),r.minContains=e.minContains,r.maxContains=e.maxContains,r.minItems=e.minItems,r.maxItems=e.maxItems,r.uniqueItems=e.uniqueItems,r.$defs=Y.fromMapOfSchemas(e.$defs),r.permission=e.permission,r}namespace="_";name;version=1;ref;type;anyOf;allOf;oneOf;not;description;examples;defaultValue;comment;enums;constant;pattern;format;minLength;maxLength;multipleOf;minimum;maximum;exclusiveMinimum;exclusiveMaximum;properties;additionalProperties;required;propertyNames;minProperties;maxProperties;patternProperties;items;additionalItems;contains;minContains;maxContains;minItems;maxItems;uniqueItems;$defs;permission;constructor(e){if(!e)return;this.namespace=e.namespace,this.name=e.name,this.version=e.version,this.ref=e.ref,N(e.type)||(this.type=e.type instanceof y?new y(e.type):new I(e.type)),this.anyOf=e.anyOf?.map(e=>new Y(e)),this.allOf=e.allOf?.map(e=>new Y(e)),this.oneOf=e.oneOf?.map(e=>new Y(e)),this.not=this.not?new Y(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 Y(e[1])])):void 0,this.additionalProperties=e.additionalProperties?new F(e.additionalProperties):void 0,this.required=e.required?[...e.required]:void 0,this.propertyNames=e.propertyNames?new Y(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 Y(e[1])])):void 0,this.items=e.items?new _(e.items):void 0,this.contains=e.contains?new Y(this.contains):void 0,this.minContains=e.minContains,this.maxContains=e.maxContains,this.minItems=e.minItems,this.maxItems=e.maxItems,this.uniqueItems=e.uniqueItems,this.additionalItems=e.additionalItems?new F(e.additionalItems):void 0,this.$defs=e.$defs?new Map(Array.from(e.$defs.entries()).map(e=>[e[0],new Y(e[1])])):void 0,this.permission=e.permission}getTitle(){return this.namespace&&"_"!=this.namespace?this.namespace+"."+this.name:this.name}getFullName(){return this.namespace+"."+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}getAdditionalItems(){return this.additionalItems}setAdditionalItems(e){return this.additionalItems=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 y(E.STRING),this}getMinProperties(){return this.minProperties}setMinProperties(e){return this.minProperties=e,this}getMaxProperties(){return this.maxProperties}setMaxProperties(e){return this.maxProperties=e,this}getPatternProperties(){return this.patternProperties}setPatternProperties(e){return this.patternProperties=e,this}getItems(){return this.items}setItems(e){return this.items=e,this}getContains(){return this.contains}setContains(e){return this.contains=e,this}getMinContains(){return this.minContains}setMinContains(e){return this.minContains=e,this}getMaxContains(){return this.maxContains}setMaxContains(e){return this.maxContains=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 B={};t(B,"Parameter",()=>W);var H={};t(H,"SchemaReferenceException",()=>k);class k extends Error{schemaPath;cause;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 $={};t($,"ParameterType",()=>u),(n=u||(u={})).CONSTANT="CONSTANT",n.EXPRESSION="EXPRESSION";const j="value";class W{static SCHEMA_NAME="Parameter";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(W.SCHEMA_NAME).setProperties(new Map([["schema",Y.SCHEMA],["parameterName",Y.ofString("parameterName")],["variableArgument",Y.of("variableArgument",E.BOOLEAN).setDefaultValue(!1)],["type",Y.ofString("type").setEnums(["EXPRESSION","CONSTANT"])]]));static EXPRESSION=new Y().setNamespace(R.SYSTEM).setName("ParameterExpression").setType(x.of(E.OBJECT)).setProperties(new Map([["isExpression",Y.ofBoolean("isExpression").setDefaultValue(!0)],[j,Y.ofAny(j)]]));schema;parameterName;variableArgument=!1;type=u.EXPRESSION;constructor(e,t){if(e instanceof W)this.schema=new Y(e.schema),this.parameterName=e.parameterName,this.variableArgument=e.variableArgument,this.type=e.type;else{if(!t)throw 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,n=u.EXPRESSION){return[e,new W(e,t).setType(n).setVariableArgument(r)]}static of(e,t,r=!1,n=u.EXPRESSION){return new W(e,t).setType(n).setVariableArgument(r)}static from(e){let t=Y.from(e.schema);if(!t)throw new k("","Parameter requires Schema");return new W(e.parameterName,t).setVariableArgument(!!e.variableArgument).setType(e.type??u.EXPRESSION)}}const X=new Map([["any",Y.ofAny("any").setNamespace(R.SYSTEM)],["boolean",Y.ofBoolean("boolean").setNamespace(R.SYSTEM)],["double",Y.ofDouble("double").setNamespace(R.SYSTEM)],["float",Y.ofFloat("float").setNamespace(R.SYSTEM)],["integer",Y.ofInteger("integer").setNamespace(R.SYSTEM)],["long",Y.ofLong("long").setNamespace(R.SYSTEM)],["number",Y.ofNumber("number").setNamespace(R.SYSTEM)],["string",Y.ofString("string").setNamespace(R.SYSTEM)],["Date.timeStamp",Y.ofString("timeStamp").setNamespace(R.DATE)],[W.EXPRESSION.getName(),W.EXPRESSION],[Y.NULL.getName(),Y.NULL],[Y.SCHEMA.getName(),Y.SCHEMA]]),J=Array.from(X.values()).map(e=>e.getFullName());class q{async find(e,t){return R.SYSTEM!=e?Promise.resolve(void 0):Promise.resolve(X.get(t))}async filter(e){return Promise.resolve(J.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var z={};function K(e){return[e.getSignature().getName(),e]}t(z,"KIRunFunctionRepository",()=>a5);var Q={};t(Q,"MapUtil",()=>Z),t(Q,"MapEntry",()=>ee);class Z{static of(e,t,r,n,a,s,i,o,E,u,l,A,g,c,m,T,p,R,h,f){let _=new Map;return N(e)||N(t)||_.set(e,t),N(r)||N(n)||_.set(r,n),N(a)||N(s)||_.set(a,s),N(i)||N(o)||_.set(i,o),N(E)||N(u)||_.set(E,u),N(l)||N(A)||_.set(l,A),N(g)||N(c)||_.set(g,c),N(m)||N(T)||_.set(m,T),N(p)||N(R)||_.set(p,R),N(h)||N(f)||_.set(h,f),_}static ofArrayEntries(...e){let t=new Map;for(let[r,n]of e)t.set(r,n);return t}static entry(e,t){return new ee(e,t)}static ofEntries(...e){let t=new Map;for(let r of e)t.set(r.k,r.v);return t}static ofEntriesArray(...e){let t=new Map;for(let r=0;r<e.length;r++)t.set(e[r][0],e[r][1]);return t}constructor(){}}class ee{k;v;constructor(e,t){this.k=e,this.v=t}}var et={};t(et,"EventResult",()=>ea);var er={};t(er,"Event",()=>en);class en{static OUTPUT="output";static ERROR="error";static ITERATION="iteration";static TRUE="true";static FALSE="false";static SCHEMA_NAME="Event";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(en.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["name",Y.ofString("name")],["parameters",Y.ofObject("parameter").setAdditionalProperties(new F().setSchemaValue(Y.SCHEMA))]]));name;parameters;constructor(e,t){if(e instanceof en)this.name=e.name,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new Y(e[1])]));else{if(this.name=e,!t)throw 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 en.eventMapEntry(en.OUTPUT,e)}static eventMapEntry(e,t){return[e,new en(e,t)]}static from(e){return new en(e.name,new Map(Object.entries(e.parameters??{}).map(e=>{let t=Y.from(e[1]);if(!t)throw new k("","Event expects a schema");return[e[0],t]})))}}class ea{name;result;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 ea.of(en.OUTPUT,e)}static of(e,t){return new ea(e,t)}}var es={};t(es,"FunctionOutput",()=>eE);var ei={};t(ei,"KIRuntimeException",()=>eo);class eo extends Error{cause;constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class eE{fo;index=0;generator;constructor(e){if(N(e))throw new eo("Function output is generating null");Array.isArray(e)&&e.length&&e[0]instanceof ea?this.fo=e:(this.fo=[],Array.isArray(e)||(this.generator=e))}next(){if(!this.generator)return this.index<this.fo.length?this.fo[this.index++]:void 0;let e=this.generator.next();return e&&this.fo.push(e),e}allResults(){return this.fo}}var eu={};t(eu,"FunctionSignature",()=>el);class el{static SCHEMA_NAME="FunctionSignature";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(el.SCHEMA_NAME).setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofObject("parameters").setAdditionalProperties(new F().setSchemaValue(W.SCHEMA))],["events",Y.ofObject("events").setAdditionalProperties(new F().setSchemaValue(en.SCHEMA))]]));namespace="_";name;parameters=new Map;events=new Map;constructor(e){e instanceof el?(this.name=e.name,this.namespace=e.namespace,this.parameters=new Map(Array.from(e.parameters.entries()).map(e=>[e[0],new W(e[1])])),this.events=new Map(Array.from(e.events.entries()).map(e=>[e[0],new en(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}getFullName(){return this.namespace+"."+this.name}}var eA={};t(eA,"AbstractFunction",()=>e1);var eg={};t(eg,"SchemaValidator",()=>e0);var ec={};t(ec,"deepEqual",()=>ef);var em={};t(em,"LinkedList",()=>eR);var eT={};t(eT,"StringFormatter",()=>ep);class ep{static format(e,...t){if(!t||0==t.length)return e;let r="",n=0,a="",s=a,i=e.length;for(let o=0;o<i;o++)"$"==(a=e.charAt(o))&&"\\"==s?r=r.substring(0,o-1)+a:"$"==a&&n<t.length?r+=t[n++]:r+=a,s=a;return r.toString()}constructor(){}}class eR{head=void 0;tail=void 0;length=0;constructor(e){if(e?.length){for(let t of e)if(this.head){let e=new eh(t,this.tail);this.tail.next=e,this.tail=e}else this.tail=this.head=new eh(t);this.length=e.length}}push(e){let t=new eh(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.");let e=this.head.value;if(this.length--,this.head==this.tail)return this.head=this.tail=void 0,e;let 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 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 eo(ep.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)&&(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 Error("List is empty so cannot peak");return this.head.value}peekLast(){if(!this.tail)throw Error("List is empty so cannot peak");return this.tail.value}getFirst(){if(!this.head)throw Error("List is empty so cannot get first");return this.head.value}removeFirst(){return this.pop()}removeLast(){if(!this.tail)throw Error("List is empty so cannot remove");--this.length;let e=this.tail.value;if(0==this.length)this.head=this.tail=void 0;else{let 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}add(e){return++this.length,this.tail||this.head?this.head===this.tail?(this.tail=new eh(e,this.head),this.head.next=this.tail):(this.tail=new eh(e,this.tail),this.tail.previous.next=this.tail):this.head=this.tail=new eh(e),this}map(e,t){let r=new eR,n=this.head,a=0;for(;n;)r.add(e(n.value,a)),n=n.next,++a;return r}indexOf(e){let t=this.head,r=0;for(;t;){if(ef(t.value,e))return r;t=t.next,++r}return -1}forEach(e,t){let r=this.head,n=0;for(;r;)e(r.value,n),r=r.next,++n}}class eh{value;next;previous;constructor(e,t,r){this.value=e,this.next=r,this.previous=t}toString(){return""+this.value}}function ef(e,t){let r=new eR;r.push(e);let n=new eR;for(n.push(t);!r.isEmpty()&&!n.isEmpty();){let e=r.pop(),t=n.pop();if(e===t)continue;let a=typeof e,s=typeof t;if("undefined"===a||"undefined"===s){if(!e&&!t)continue;return!1}if(a!==s)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!=t.length)return!1;for(let a=0;a<e.length;a++)r.push(e[a]),n.push(t[a]);continue}if("object"===a){if("object"!==s||null===e||null===t)return!1;let a=Object.entries(e),i=Object.entries(t);if(a.length!==i.length)return!1;for(let[e,s]of a)r.push(s),n.push(t[e]);continue}return!1}return!0}var eN={};t(eN,"StringUtil",()=>e_);class e_{constructor(){}static nthIndex(e,t,r=0,n){if(!e)throw new eo("String cannot be null");if(r<0||r>=e.length)throw new eo(ep.format("Cannot search from index : $",r));if(n<=0||n>e.length)throw new eo(ep.format("Cannot search for occurance : $",n));for(;r<e.length;){if(e.charAt(r)==t&&0==--n)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 eS={};t(eS,"SchemaUtil",()=>ey);var eM={};t(eM,"Tuple2",()=>ew),t(eM,"Tuple3",()=>eO),t(eM,"Tuple4",()=>ed);class ew{f;s;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 eO extends ew{t;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 ed extends eO{fr;constructor(e,t,r,n){super(e,t,r),this.fr=n}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 eI={};t(eI,"SchemaValidationException",()=>eP);class eP extends Error{schemaPath;cause;constructor(e,t,r=[],n){super(t+(r?r.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.cause=n}getSchemaPath(){return this.schemaPath}getCause(){return this.cause}}class ey{static UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH="Unable to retrive schema from referenced path";static CYCLIC_REFERENCE_LIMIT_COUNTER=20;static async getDefaultValue(e,t){if(e)return e.getConstant()?e.getConstant():N(e.getDefaultValue())?ey.getDefaultValue(await ey.getSchemaFromRef(e,t,e.getRef()),t):e.getDefaultValue()}static async hasDefaultValueOrNullSchemaType(e,t){return e?e.getConstant()||!N(e.getDefaultValue())?Promise.resolve(!0):N(e.getRef())?e.getType()?.getAllowedSchemaTypes().has(E.NULL)?Promise.resolve(!0):Promise.resolve(!1):this.hasDefaultValueOrNullSchemaType(await ey.getSchemaFromRef(e,t,e.getRef()),t):Promise.resolve(!1)}static async getSchemaFromRef(e,t,r,n=0){if(++n==ey.CYCLIC_REFERENCE_LIMIT_COUNTER)throw new eP(r??"","Schema has a cyclic reference");if(!e||!r||e_.isNullOrBlank(r))return Promise.resolve(void 0);if(!r.startsWith("#")){var a=await ey.resolveExternalSchema(e,t,r);a&&(e=a.getT1(),r=a.getT2())}let s=r.split("/");return 1===s.length?Promise.resolve(e):Promise.resolve(ey.resolveInternalSchema(e,t,r,n,s,1))}static async resolveInternalSchema(e,t,r,n,a,s){let i=e;if(s!==a.length){for(;s<a.length;){if("$defs"===a[s]){if(++s>=a.length||!i.get$defs())throw new k(r,ey.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);i=i.get$defs()?.get(a[s])}else{if(i&&(!i.getType()?.contains(E.OBJECT)||!i.getProperties()))throw new k(r,"Cannot retrievie schema from non Object type schemas");i=i.getProperties()?.get(a[s])}if(s++,!i||!e_.isNullOrBlank(i.getRef())&&!(i=await ey.getSchemaFromRef(i,t,i.getRef(),n)))throw new k(r,ey.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH)}return Promise.resolve(i)}}static async resolveExternalSchema(e,t,r){if(!t)return Promise.resolve(void 0);let n=e_.splitAtFirstOccurance(r??"","/");if(!n[0])return Promise.resolve(void 0);let a=e_.splitAtFirstOccurance(n[0],".");if(!a[0]||!a[1])return Promise.resolve(void 0);let s=await t.find(a[0],a[1]);if(!s)return Promise.resolve(void 0);if(!n[1]||""===n[1])return Promise.resolve(new ew(s,r));if(r="#/"+n[1],!s)throw new k(r,ey.UNABLE_TO_RETRIVE_SCHEMA_FROM_REFERENCED_PATH);return Promise.resolve(new ew(s,r))}constructor(){}}var ex={};t(ex,"AnyOfAllOfOneOfValidator",()=>ev);class ev{static async validate(e,t,r,n,a,s){let i=[];return t.getOneOf()&&!t.getOneOf()?await ev.oneOf(e,t,r,n,i,a,s):t.getAllOf()&&!t.getAllOf()?await ev.allOf(e,t,r,n,i,a,s):t.getAnyOf()&&!t.getAnyOf()?await ev.anyOf(e,t,r,n,i,a,s):n}static async anyOf(e,t,r,n,a,s,i){let o=!1;for(let E of t.getAnyOf()??[])try{await ev.validate(e,E,r,n,s,i),o=!0;break}catch(e){o=!1,a.push(e)}if(o)return n;throw new eP(e0.path(e),"The value don't satisfy any of the schemas.",a)}static async allOf(e,t,r,n,a,s,i){let o=0;for(let E of t.getAllOf()??[])try{await ev.validate(e,E,r,n,s,i),o++}catch(e){a.push(e)}if(o===t.getAllOf()?.length)return n;throw new eP(e0.path(e),"The value doesn't satisfy some of the schemas.",a)}static async oneOf(e,t,r,n,a,s,i){let o=0;for(let E of t.getOneOf()??[])try{await ev.validate(e,E,r,n,s,i),o++}catch(e){a.push(e)}if(1===o)return n;throw new eP(e0.path(e),0==o?"The value does not satisfy any schema":"The value satisfy more than one schema",a)}constructor(){}}var eL={};t(eL,"TypeValidator",()=>eZ);var eU={};t(eU,"ArrayValidator",()=>eC);class eC{static async validate(e,t,r,n,a,s){if(N(n))throw new eP(e0.path(e),"Expected an array but found null");if(!Array.isArray(n))throw new eP(e0.path(e),n.toString()+" is not an Array");return eC.checkMinMaxItems(e,t,n),await eC.checkItems(e,t,r,n,a,s),eC.checkUniqueItems(e,t,n),await eC.checkContains(t,e,r,n),n}static async checkContains(e,t,r,n){if(N(e.getContains()))return;let a=await eC.countContains(t,e,r,n,N(e.getMinContains())&&N(e.getMaxContains()));if(0===a)throw new eP(e0.path(t),"None of the items are of type contains schema");if(!N(e.getMinContains())&&e.getMinContains()>a)throw new eP(e0.path(t),"The minimum number of the items of type contains schema should be "+e.getMinContains()+" but found "+a);if(!N(e.getMaxContains())&&e.getMaxContains()<a)throw new eP(e0.path(t),"The maximum number of the items of type contains schema should be "+e.getMaxContains()+" but found "+a)}static async countContains(e,t,r,n,a){let s=0;for(let i=0;i<n.length;i++){let o=e?[...e]:[];try{if(await e0.validate(o,t.getContains(),r,n[i]),s++,a)break}catch(e){}}return s}static checkUniqueItems(e,t,r){if(t.getUniqueItems()&&t.getUniqueItems()&&new Set(r).size!==r.length)throw new eP(e0.path(e),"Items on the array are not unique")}static checkMinMaxItems(e,t,r){if(t.getMinItems()&&t.getMinItems()>r.length)throw new eP(e0.path(e),"Array should have minimum of "+t.getMinItems()+" elements");if(t.getMaxItems()&&t.getMaxItems()<r.length)throw new eP(e0.path(e),"Array can have maximum of "+t.getMaxItems()+" elements")}static async checkItems(e,t,r,n,a,s){if(!t.getItems())return;let i=t.getItems();if(i.getSingleSchema())for(let t=0;t<n.length;t++){let o=e?[...e]:[];n[t]=await e0.validate(o,i.getSingleSchema(),r,n[t],a,s)}if(i.getTupleSchema()){if(i.getTupleSchema().length!==n.length&&N(t?.getAdditionalItems()))throw new eP(e0.path(e),"Expected an array with only "+i.getTupleSchema().length+" but found "+n.length);await this.checkItemsInTupleSchema(e,r,n,i),await this.checkAdditionalItems(e,t,r,n,i)}}static async checkItemsInTupleSchema(e,t,r,n,a,s){for(let i=0;i<n.getTupleSchema()?.length;i++){let o=e?[...e]:[];r[i]=await e0.validate(o,n.getTupleSchema()[i],t,r[i],a,s)}}static async checkAdditionalItems(e,t,r,n,a){if(!N(t.getAdditionalItems())){let s=t.getAdditionalItems();if(s?.getBooleanValue()){let i=Y.ofAny("item");if(s?.getBooleanValue()===!1&&n.length>a.getTupleSchema()?.length)throw new eP(e0.path(e),"No Additional Items are defined");await this.checkEachItemInAdditionalItems(e,t,r,n,a,i)}else if(s?.getSchemaValue()){let i=s.getSchemaValue();await this.checkEachItemInAdditionalItems(e,t,r,n,a,i)}}}static async checkEachItemInAdditionalItems(e,t,r,n,a,s){for(let t=a.getTupleSchema()?.length;t<n.length;t++){let a=e?[...e]:[];n[t]=await e0.validate(a,s,r,n[t])}}constructor(){}}var eV={};t(eV,"BooleanValidator",()=>eD);class eD{static validate(e,t,r){if(N(r))throw new eP(e0.path(e),"Expected a boolean but found null");if("boolean"!=typeof r)throw new eP(e0.path(e),r.toString()+" is not a boolean");return r}constructor(){}}var eb={};t(eb,"NullValidator",()=>eG);class eG{static validate(e,t,r){if(N(r))return r;throw new eP(e0.path(e),"Expected a null but found "+r)}constructor(){}}var eF={};t(eF,"NumberValidator",()=>eY);class eY{static validate(e,t,r,n){if(N(n))throw new eP(e0.path(t),"Expected a number but found null");if("number"!=typeof n)throw new eP(e0.path(t),n.toString()+" is not a "+e);let a=eY.extractNumber(e,t,r,n);return eY.checkRange(t,r,n,a),eY.checkMultipleOf(t,r,n,a),n}static extractNumber(e,t,r,n){let a=n;try{(e==E.LONG||e==E.INTEGER)&&(a=Math.round(a))}catch(r){throw new eP(e0.path(t),n+" is not a number of type "+e,r)}if(N(a)||(e==E.LONG||e==E.INTEGER)&&a!=n)throw new eP(e0.path(t),n.toString()+" is not a number of type "+e);return a}static checkMultipleOf(e,t,r,n){if(t.getMultipleOf()&&n%t.getMultipleOf()!=0)throw new eP(e0.path(e),r.toString()+" is not multiple of "+t.getMultipleOf())}static checkRange(e,t,r,n){if(!N(t.getMinimum())&&0>eY.numberCompare(n,t.getMinimum()))throw new eP(e0.path(e),r.toString()+" should be greater than or equal to "+t.getMinimum());if(!N(t.getMaximum())&&eY.numberCompare(n,t.getMaximum())>0)throw new eP(e0.path(e),r.toString()+" should be less than or equal to "+t.getMaximum());if(!N(t.getExclusiveMinimum())&&0>=eY.numberCompare(n,t.getExclusiveMinimum()))throw new eP(e0.path(e),r.toString()+" should be greater than "+t.getExclusiveMinimum());if(!N(t.getExclusiveMaximum())&&eY.numberCompare(n,t.getExclusiveMaximum())>0)throw new eP(e0.path(e),r.toString()+" should be less than "+t.getExclusiveMaximum())}static numberCompare(e,t){return e-t}constructor(){}}var eB={};t(eB,"ObjectValidator",()=>eH);class eH{static async validate(e,t,r,n,a,s){if(N(n))throw new eP(e0.path(e),"Expected an object but found null");if("object"!=typeof n||Array.isArray(n))throw new eP(e0.path(e),n.toString()+" is not an Object");let i=new Set(Object.keys(n));return eH.checkMinMaxProperties(e,t,i),t.getPropertyNames()&&await eH.checkPropertyNameSchema(e,t,r,i),t.getRequired()&&eH.checkRequired(e,t,n),t.getProperties()&&await eH.checkProperties(e,t,r,n,i,a,s),t.getPatternProperties()&&await eH.checkPatternProperties(e,t,r,n,i),t.getAdditionalProperties()&&await eH.checkAdditionalProperties(e,t,r,n,i),n}static async checkPropertyNameSchema(e,t,r,n){for(let a of Array.from(n.values()))try{await e0.validate(e,t.getPropertyNames(),r,a)}catch(t){throw new eP(e0.path(e),"Property name '"+a+"' does not fit the property schema")}}static checkRequired(e,t,r){for(let n of t.getRequired()??[])if(N(r[n]))throw new eP(e0.path(e),n+" is mandatory")}static async checkAdditionalProperties(e,t,r,n,a){let s=t.getAdditionalProperties();if(s.getSchemaValue())for(let t of Array.from(a.values())){let a=e?[...e]:[];n[t]=await e0.validate(a,s.getSchemaValue(),r,n[t])}else if(!1===s.getBooleanValue()&&a.size)throw new eP(e0.path(e),Array.from(a)+" is/are additional properties which are not allowed.")}static async checkPatternProperties(e,t,r,n,a){let s=new Map;for(let e of Array.from(t.getPatternProperties().keys()))s.set(e,new RegExp(e));for(let i of Array.from(a.values())){let o=e?[...e]:[];for(let e of Array.from(s.entries()))if(e[1].test(i)){n[i]=await e0.validate(o,t.getPatternProperties().get(e[0]),r,n[i]),a.delete(i);break}}}static async checkProperties(e,t,r,n,a,s,i){for(let o of Array.from(t.getProperties())){let t=n[o[0]];if(!n.hasOwnProperty(o[0])&&N(t)&&N(await ey.getDefaultValue(o[1],r)))continue;let E=e?[...e]:[];n[o[0]]=await e0.validate(E,o[1],r,t,s,i),a.delete(o[0])}}static checkMinMaxProperties(e,t,r){if(t.getMinProperties()&&r.size<t.getMinProperties())throw new eP(e0.path(e),"Object should have minimum of "+t.getMinProperties()+" properties");if(t.getMaxProperties()&&r.size>t.getMaxProperties())throw new eP(e0.path(e),"Object can have maximum of "+t.getMaxProperties()+" properties")}constructor(){}}var ek={};t(ek,"StringValidator",()=>ej);var e$={};t(e$,"StringFormat",()=>l),(a=l||(l={})).DATETIME="DATETIME",a.TIME="TIME",a.DATE="DATE",a.EMAIL="EMAIL",a.REGEX="REGEX";class ej{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 EMAIL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;static validate(e,t,r){if(N(r))throw new eP(e0.path(e),"Expected a string but found "+r);if("string"!=typeof r)throw new eP(e0.path(e),r.toString()+" is not String");t.getFormat()==l.TIME?ej.patternMatcher(e,t,r,ej.TIME,"time pattern"):t.getFormat()==l.DATE?ej.patternMatcher(e,t,r,ej.DATE,"date pattern"):t.getFormat()==l.DATETIME?ej.patternMatcher(e,t,r,ej.DATETIME,"date time pattern"):t.getFormat()==l.EMAIL?ej.patternMatcher(e,t,r,ej.EMAIL,"email pattern"):t.getPattern()&&ej.patternMatcher(e,t,r,new RegExp(t.getPattern()),"pattern "+t.getPattern());let n=r.length;if(t.getMinLength()&&n<t.getMinLength())throw new eP(e0.path(e),"Expected a minimum of "+t.getMinLength()+" characters");if(t.getMaxLength()&&n>t.getMaxLength())throw new eP(e0.path(e),"Expected a maximum of "+t.getMaxLength()+" characters");return r}static patternMatcher(e,t,r,n,a){if(!n.test(r))throw new eP(e0.path(e),r.toString()+" is not matched with the "+a)}constructor(){}}(s=A||(A={})).STRICT="STRICT",s.LENIENT="LENIENT",s.USE_DEFAULT="USE_DEFAULT",s.SKIP="SKIP";class eW extends Error{schemaPath;source;mode;cause;constructor(e,t,r,n,a=[],s){super(r+(a?a.map(e=>e.message).reduce((e,t)=>e+"\n"+t,""):"")),this.schemaPath=e,this.source=t??null,this.mode=n??null,this.cause=s}getSchemaPath(){return this.schemaPath}getSource(){return this.source??null}getMode(){return this.mode??null}getCause(){return this.cause}}class eX{static handleUnConvertibleValue(e,t,r,n){return this.handleUnConvertibleValueWithDefault(e,t,r,null,n)}static handleUnConvertibleValueWithDefault(e,t,r,n,a){switch(null===t&&(t=A.STRICT),t){case A.STRICT:throw new eW(e0.path(e),r,a,t);case A.LENIENT:return null;case A.USE_DEFAULT:return n;case A.SKIP:return r;default:throw new eW(e0.path(e),r,"Invalid conversion mode")}}constructor(){}}class eJ{static convert(e,t,r,n){if(N(n))return eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a string but found null");let a=n??("object"==typeof n?JSON.stringify(n):String(n));return this.getConvertedString(a,r)}static getConvertedString(e,t){return t===A.STRICT?e.toString():e.trim()}static getDefault(e){return e.getDefaultValue()??null}constructor(){}}class eq{static convert(e,t,r,n,a){if(N(a))return eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),"Expected a number but found null");if("object"==typeof a||"boolean"==typeof a||Array.isArray(a)||"string"==typeof a&&isNaN(a=Number(a)))return eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),a+" is not a "+t);let s=this.extractNumber(t,a,n);return null===s?eX.handleUnConvertibleValueWithDefault(e,n,a,this.getDefault(r),a+" is not a "+t):s}static extractNumber(e,t,r){if("number"!=typeof t)return null;switch(e){case E.INTEGER:return this.isInteger(t,r)?Math.floor(t):null;case E.LONG:return this.isLong(t,r)?Math.floor(t):null;case E.DOUBLE:return t;case E.FLOAT:return this.isFloat(t,r)?t:null;default:return null}}static isInteger(e,t){return t!==A.STRICT?"number"==typeof e:Number.isInteger(e)}static isLong(e,t){return t!==A.STRICT?"number"==typeof e:Number.isInteger(e)&&e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER}static isFloat(e,t){return t!==A.STRICT?"number"==typeof e:e>=-Number.MAX_VALUE&&e<=Number.MAX_VALUE}static getDefault(e){return"number"==typeof e.getDefaultValue()?Number(e.getDefaultValue):null}}class ez{static BOOLEAN_MAP={true:!0,t:!0,yes:!0,y:!0,1:!0,false:!1,f:!1,no:!1,n:!1,0:!1};static convert(e,t,r,n){return null==n?eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Expected a boolean but found null"):this.getBooleanPrimitive(n)??eX.handleUnConvertibleValueWithDefault(e,r,n,this.getDefault(t),"Unable to convert to boolean")}static getBooleanPrimitive(e){return"boolean"==typeof e?e:"string"==typeof e?this.handleStringValue(e):"number"==typeof e?this.handleNumberValue(e):null}static handleStringValue(e){let t=e.toLowerCase().trim();return ez.BOOLEAN_MAP[t]??null}static handleNumberValue(e){return 0===e||1===e?1===e:null}static getDefault(e){return e.getDefaultValue()??!1}constructor(){}}class eK{static convert(e,t,r,n){return N(n)?n:"string"==typeof n&&"null"===n.toLowerCase()?null:eX.handleUnConvertibleValueWithDefault(e,r,n,null,"Unable to convert to null")}constructor(){}}class eQ{static handleValidationError(e,t,r,n,a){switch(t=t??A.STRICT){case A.STRICT:throw new eP(e0.path(e),a);case A.LENIENT:return null;case A.USE_DEFAULT:return n;case A.SKIP:return r}}constructor(){}}class eZ{static async validate(e,t,r,n,a,s,i){return t==E.OBJECT?await eH.validate(e,r,n,a,s,i):t==E.ARRAY?await eC.validate(e,r,n,a,s,i):this.handleTypeValidationAndConversion(e,t,r,a,s,i)}static async handleTypeValidationAndConversion(e,t,r,n,a,s){let i=a?this.convertElement(e,t,r,n,s??A.STRICT):n;return await this.validateElement(e,t,r,i,s??A.STRICT)}static convertElement(e,t,r,n,a){if(N(t))return eX.handleUnConvertibleValueWithDefault(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type for conversion.",t));switch(t){case E.STRING:return eJ.convert(e,r,a,n);case E.INTEGER:case E.LONG:case E.DOUBLE:case E.FLOAT:return eq.convert(e,t,r,a,n);case E.BOOLEAN:return ez.convert(e,r,a,n);case E.NULL:return eK.convert(e,r,a,n);default:return eX.handleUnConvertibleValueWithDefault(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type for conversion.",t))}}static validateElement(e,t,r,n,a){if(N(t))return eQ.handleValidationError(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type.",t));switch(t){case E.STRING:return ej.validate(e,r,n);case E.INTEGER:case E.LONG:case E.DOUBLE:case E.FLOAT:return eY.validate(t,e,r,n);case E.BOOLEAN:return eD.validate(e,r,n);case E.NULL:return eG.validate(e,r,n);default:return eQ.handleValidationError(e,a,n,r.getDefaultValue()??null,ep.format("$ is not a valid type.",t))}}constructor(){}}class e0{static ORDER={[E.OBJECT]:0,[E.ARRAY]:1,[E.DOUBLE]:2,[E.FLOAT]:3,[E.LONG]:4,[E.INTEGER]:5,[E.STRING]:6,[E.BOOLEAN]:7,[E.NULL]:8};static path(e){return e?e.map(e=>e.getTitle()??"").filter(e=>!!e).reduce((e,t,r)=>e+(0===r?"":".")+t,""):""}static async validate(e,t,r,n,a,s){if(!t)throw new eP(e0.path(e),"No schema found to validate");if(e||(e=[]),e.push(t),N(n)&&!N(t.getDefaultValue()))return JSON.parse(JSON.stringify(t.getDefaultValue()));if(!N(t.getConstant()))return e0.constantValidation(e,t,n);if(t.getEnums()&&!t.getEnums()?.length)return e0.enumCheck(e,t,n);if(t.getFormat()&&N(t.getType()))throw new eP(this.path(e),"Type is missing in schema for declared "+t.getFormat()?.toString()+" format.");if(!0===a&&N(t.getType()))throw new eP(this.path(e),"Type is missing in schema for declared "+s);if(t.getType()&&(n=await e0.typeValidation(e,t,r,n,a,s)),!e_.isNullOrBlank(t.getRef()))return await e0.validate(e,await ey.getSchemaFromRef(e[0],r,t.getRef()),r,n,a,s);if((t.getOneOf()||t.getAllOf()||t.getAnyOf())&&(n=await ev.validate(e,t,r,n,a,s)),t.getNot()){let i;try{await e0.validate(e,t.getNot(),r,n,a,s),i=!0}catch(e){i=!1}if(i)throw new eP(e0.path(e),"Schema validated value in not condition.")}return n}static constantValidation(e,t,r){if(!ef(t.getConstant(),r))throw new eP(e0.path(e),"Expecting a constant value : "+r);return r}static enumCheck(e,t,r){let n=!1;for(let e of t.getEnums()??[])if(e===r){n=!0;break}if(n)return r;throw new eP(e0.path(e),"Value is not one of "+t.getEnums())}static async typeValidation(e,t,r,n,a,s){let i=Array.from(t.getType()?.getAllowedSchemaTypes()?.values()??[]).sort((e,t)=>(this.ORDER[e]??1/0)-(this.ORDER[t]??1/0)),o=[];for(let E of i)try{return await eZ.validate(e,E,t,r,n,a,s)}catch(e){o.push(e)}throw new eP(e0.path(e),"Value "+JSON.stringify(n)+" is not of valid type(s)",o)}constructor(){}}class e1{async validateArguments(e,t,r){let n=new Map;for(let a of Array.from(this.getSignature().getParameters().entries())){let s=a[1];try{let r=await this.validateArgument(e,t,a,s);n.set(r.getT1(),r.getT2())}catch(t){let e=this.getSignature();throw new eo(`Error while executing the function ${e.getNamespace()}.${e.getName()}'s parameter ${s.getParameterName()} with step name '${r?.getStatement().getStatementName()??"Unknown Step"}' with error : ${t?.message}`)}}return n}async validateArgument(e,t,r,n){let a,s=r[0],i=e.get(r[0]);if(N(i)&&!n.isVariableArgument())return new ew(s,await e0.validate(void 0,n.getSchema(),t,void 0));if(!n?.isVariableArgument())return new ew(s,await e0.validate(void 0,n.getSchema(),t,i));Array.isArray(i)?a=i:(a=[],N(i)?N(n.getSchema().getDefaultValue())||a.push(n.getSchema().getDefaultValue()):a.push(i));for(let e=0;e<a.length;e++)a[e]=await e0.validate(void 0,n.getSchema(),t,a[e]);return new ew(s,a)}async execute(e){let t=await this.validateArguments(e.getArguments()??new Map,e.getSchemaRepository(),e.getStatementExecution());e.setArguments(t);try{return this.internalExecute(e)}catch(r){let t=this.getSignature();throw new eo(`Error while executing the function ${t.getNamespace()}.${t.getName()} with step name '${e.getStatementExecution()?.getStatement().getStatementName()??"Unknown Step"}' with error : ${r?.message}`)}}getProbableEventSignature(e){return this.getSignature().getEvents()}}class e2 extends e1{static EVENT_INDEX_NAME="index";static EVENT_RESULT_NAME="result";static EVENT_INDEX=new en(en.OUTPUT,Z.of(e2.EVENT_INDEX_NAME,Y.ofInteger(e2.EVENT_INDEX_NAME)));static EVENT_RESULT_INTEGER=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofInteger(e2.EVENT_RESULT_NAME)));static EVENT_RESULT_BOOLEAN=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofBoolean(e2.EVENT_RESULT_NAME)));static EVENT_RESULT_ARRAY=new en(en.OUTPUT,Z.of(e2.EVENT_RESULT_NAME,Y.ofArray(e2.EVENT_RESULT_NAME,Y.ofAny(e2.EVENT_RESULT_NAME))));static EVENT_RESULT_EMPTY=new en(en.OUTPUT,Z.of());static EVENT_RESULT_ANY=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofAny(this.EVENT_RESULT_NAME)));static EVENT_RESULT_OBJECT=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofObject(this.EVENT_RESULT_NAME)));static PARAMETER_INT_LENGTH=W.of("length",Y.ofInteger("length").setDefaultValue(-1));static PARAMETER_ARRAY_FIND=W.of("find",Y.ofArray("eachFind",Y.ofAny("eachFind")));static PARAMETER_INT_SOURCE_FROM=W.of("srcFrom",Y.ofInteger("srcFrom").setDefaultValue(0).setMinimum(0));static PARAMETER_INT_SECOND_SOURCE_FROM=W.of("secondSrcFrom",Y.ofInteger("secondSrcFrom").setDefaultValue(0));static PARAMETER_INT_FIND_FROM=W.of("findFrom",Y.ofInteger("findFrom").setDefaultValue(0));static PARAMETER_INT_OFFSET=W.of("offset",Y.ofInteger("offset").setDefaultValue(0));static PARAMETER_ROTATE_LENGTH=W.of("rotateLength",Y.ofInteger("rotateLength").setDefaultValue(1).setMinimum(1));static PARAMETER_BOOLEAN_ASCENDING=W.of("ascending",Y.ofBoolean("ascending").setDefaultValue(!0));static PARAMETER_KEY_PATH=W.of("keyPath",Y.ofString("keyPath").setDefaultValue(""));static PARAMETER_FIND_PRIMITIVE=W.of("findPrimitive",Y.of("findPrimitive",E.STRING,E.DOUBLE,E.FLOAT,E.INTEGER,E.LONG));static PARAMETER_ARRAY_SOURCE=W.of("source",Y.ofArray("eachSource",Y.ofAny("eachSource")));static PARAMETER_ARRAY_SECOND_SOURCE=W.of("secondSource",Y.ofArray("eachSecondSource",Y.ofAny("eachSecondSource")));static PARAMETER_ARRAY_SOURCE_PRIMITIVE=W.of("source",Y.ofArray("eachSource",new Y().setName("eachSource").setType(x.of(E.STRING,E.NULL,E.INTEGER,E.FLOAT,E.DOUBLE,E.LONG))));static PARAMETER_BOOLEAN_DEEP_COPY=W.of("deepCopy",Y.ofBoolean("deepCopy").setDefaultValue(!0));static PARAMETER_ANY=W.of("element",Y.ofAny("element"));static PARAMETER_ANY_NOT_NULL=W.of("elementObject",Y.ofAnyNotNull("elementObject"));static PARAMETER_ANY_VAR_ARGS=W.of("element",Y.ofAny("element")).setVariableArgument(!0);static PARAMETER_ARRAY_RESULT=W.of(e2.EVENT_RESULT_NAME,Y.ofArray("eachResult",Y.ofAny("eachResult")));signature;constructor(e,t,r){super();let n=new Map;for(let e of t)n.set(e.getParameterName(),e);this.signature=new el(e).setNamespace(R.SYSTEM_ARRAY).setParameters(n).setEvents(Z.of(r.getName(),r))}getSignature(){return this.signature}}class e9 extends e2{constructor(){super("Concatenate",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ARRAY_SECOND_SOURCE],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName());return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,[...t,...r]]]))])}}class e4 extends e2{constructor(){super("AddFirst",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ANY],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e2.PARAMETER_ANY.getParameterName());if(0==(t=[...t]).length)return t.push(r),new eE([ea.outputOf(new Map([]))]);t.push(r);let n=t.length-1;for(;n>0;){let e=t[n-1];t[n-1]=t[n],t[n--]=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}const e3="keyName";class e6 extends e2{constructor(){super("ArrayToArrayOfObjects",[e2.PARAMETER_ARRAY_SOURCE,W.of(e3,Y.ofString(e3),!0)],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(e6.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(e3);if(!t?.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,[]]]))]);let n=t.map(e=>{let t={};if(Array.isArray(e)){if(r.length)r.forEach((r,n)=>{t[r]=e[n]});else for(let r=0;r<e.length;r++)t[`value${r+1}`]=e[r]}else t[r.length?r[0]:"value"]=e;return t});return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,n]]))])}}var e5={};t(e5,"PrimitiveUtil",()=>te);var e7={};t(e7,"ExecutionException",()=>e8);class e8 extends Error{cause;constructor(e,t){super(e),this.cause=t}getCause(){return this.cause}}class te{static findPrimitiveNullAsBoolean(e){if(N(e))return new ew(E.BOOLEAN,!1);let t=typeof e;if("object"===t)throw new e8(ep.format("$ is not a primitive type",e));return"boolean"===t?new ew(E.BOOLEAN,e):"string"===t?new ew(E.STRING,e):te.findPrimitiveNumberType(e)}static findPrimitive(e){if(N(e))return new ew(E.NULL,void 0);let t=typeof e;if("object"===t)throw new e8(ep.format("$ is not a primitive type",e));return"boolean"===t?new ew(E.BOOLEAN,e):"string"===t?new ew(E.STRING,e):te.findPrimitiveNumberType(e)}static findPrimitiveNumberType(e){if(N(e)||Array.isArray(e)||"object"==typeof e)throw new e8(ep.format("Unable to convert $ to a number.",e));try{if(Number.isInteger(e))return new ew(E.LONG,e);return new ew(E.DOUBLE,e)}catch(t){throw new e8(ep.format("Unable to convert $ to a number.",e),t)}}static compare(e,t){if(e==t)return 0;if(N(e)||N(t))return N(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 n=this.compare(e[r],t[r]);if(0!=n)return n}return 0}return Array.isArray(e)?-1:1}let r=typeof e,n=typeof t;return"object"===r||"object"===n?("object"===r&&"object"===n&&Object.keys(e).forEach(r=>{let n=this.compare(e[r],t[r]);if(0!=n)return n}),"object"===r?-1:1):this.comparePrimitive(e,t)}static comparePrimitive(e,t){return N(e)||N(t)?N(e)&&N(t)?0:N(e)?-1:1:e==t?0:"boolean"==typeof e||"boolean"==typeof t?e?-1:1:"string"==typeof e||"string"==typeof t?e+""<t+""?-1:1:"number"==typeof e||"number"==typeof t?e-t:0}static baseNumberType(e){return Number.isInteger(e)?E.LONG:E.DOUBLE}static toPrimitiveType(e){return e}constructor(){}}class tt extends e2{constructor(){super("BinarySearch",[tt.PARAMETER_ARRAY_SOURCE_PRIMITIVE,tt.PARAMETER_INT_SOURCE_FROM,tt.PARAMETER_FIND_PRIMITIVE,tt.PARAMETER_INT_LENGTH],tt.EVENT_INDEX)}async internalExecute(e){let t=e?.getArguments()?.get(tt.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tt.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tt.PARAMETER_FIND_PRIMITIVE.getParameterName()),a=e?.getArguments()?.get(tt.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length||r<0||r>t.length)throw new eo("Search source array cannot be empty");if(-1==a&&(a=t.length-r),(a=r+a)>t.length)throw new eo("End point for array cannot be more than the size of the source array");let s=-1;for(;r<=a;){let e=Math.floor((r+a)/2);if(0==te.compare(t[e],n)){s=e;break}te.compare(t[e],n)>0?a=e-1:r=e+1}return new eE([ea.outputOf(new Map([[tt.EVENT_INDEX_NAME,s]]))])}}var tr={};t(tr,"ArrayUtil",()=>tn);class tn{static removeAListFrom(e,t){if(!t||!e||!e.length||!t.length)return;let r=new Set(t);for(let t=0;t<e.length;t++)r.has(e[t])&&(e.splice(t,1),t--)}static of(...e){let t=Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r];return t}constructor(){}}class ta extends e2{constructor(){super("Compare",tn.of(ta.PARAMETER_ARRAY_SOURCE,ta.PARAMETER_INT_SOURCE_FROM,ta.PARAMETER_ARRAY_FIND,ta.PARAMETER_INT_FIND_FROM,ta.PARAMETER_INT_LENGTH),ta.EVENT_RESULT_INTEGER)}async internalExecute(e){var t=e?.getArguments()?.get(ta.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(ta.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(ta.PARAMETER_ARRAY_FIND.getParameterName()),a=e?.getArguments()?.get(ta.PARAMETER_INT_FIND_FROM.getParameterName()),s=e?.getArguments()?.get(ta.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eo("Compare source array cannot be empty");if(0==n.length)throw new eo("Compare find array cannot be empty");if(-1==s&&(s=t.length-r),r+s>t.length)throw new eo(ep.format("Source array size $ is less than comparing size $",t.length,r+s));if(a+s>n.length)throw new eo(ep.format("Find array size $ is less than comparing size $",n.length,a+s));return new eE(tn.of(ea.outputOf(Z.of(ta.EVENT_RESULT_NAME,this.compare(t,r,r+s,n,a,a+s)))))}compare(e,t,r,n,a,s){if(r<t){let e=t;t=r,r=e}if(s<a){let e=a;a=s,s=e}if(r-t!=s-a)throw new eo(ep.format("Cannot compare uneven arrays from $ to $ in source array with $ to $ in find array",r,t,s,a));for(let s=t,i=a;s<r;s++,i++){let t=1;if(N(e[s])||N(n[i])){let r=N(e[s]);r==N(n[i])?t=0:r&&(t=-1)}else{let r=typeof e[s],a=typeof n[i];if("object"===r||"object"===a)t=1;else if("string"===r||"string"===a){let r=""+e[s],a=""+n[i];r===a?t=0:r<a&&(t=-1)}else"boolean"===r||"boolean"===a?t=r==a?0:1:"number"===r&&"number"===a&&(t=e[s]-n[i])}if(0!=t)return t}return 0}}var ts={};function ti(e){return e?globalThis.structuredClone?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)):e}t(ts,"duplicate",()=>ti);class to extends e2{constructor(){super("Copy",[to.PARAMETER_ARRAY_SOURCE,to.PARAMETER_INT_SOURCE_FROM,to.PARAMETER_INT_LENGTH,to.PARAMETER_BOOLEAN_DEEP_COPY],to.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(to.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(to.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(to.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo(ep.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));var a=e?.getArguments()?.get(to.PARAMETER_BOOLEAN_DEEP_COPY.getParameterName());let s=Array(n);for(let e=r;e<r+n;e++)N(t[e])||(s[e-r]=a?ti(t[e]):t[e]);return new eE([ea.outputOf(Z.of(to.EVENT_RESULT_NAME,s))])}}class tE extends e2{constructor(){super("Delete",[e2.PARAMETER_ARRAY_SOURCE,e2.PARAMETER_ANY_VAR_ARGS],e2.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tE.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tE.PARAMETER_ANY_VAR_ARGS.getParameterName());if(null==r)throw new eo("The deletable var args are empty. So cannot be proceeded further.");if(0==t.length||0==r.length)throw new eo("Expected a source or deletable for an array but not found any");let n=new Set;for(let e=t.length-1;e>=0;e--)for(let a=0;a<r.length;a++)n.has(e)||0!=te.compare(t[e],r[a])||n.add(t[e]);return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t.filter(e=>!n.has(e))]]))])}}class tu extends e2{constructor(){super("DeleteFirst",[tu.PARAMETER_ARRAY_SOURCE],tu.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tu.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eo("Given source array is empty");return(t=[...t]).shift(),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tl extends e2{constructor(){super("DeleteFrom",[tl.PARAMETER_ARRAY_SOURCE,tl.PARAMETER_INT_SOURCE_FROM,tl.PARAMETER_INT_LENGTH],tl.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tl.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tl.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tl.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)throw new eo("There are no elements to be deleted");if(r>=(t=[...t]).length||r<0)throw new eo("The int source for the array should be in between 0 and length of the array ");if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo("Requested length to be deleted is more than the size of array ");return t.splice(r,n),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tA extends e2{constructor(){super("DeleteLast",[tA.PARAMETER_ARRAY_SOURCE],tA.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tA.PARAMETER_ARRAY_SOURCE.getParameterName());if(0==t.length)throw new eo("Given source array is empty");return(t=[...t]).pop(),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tg extends e2{constructor(){super("Disjoint",[tg.PARAMETER_ARRAY_SOURCE,tg.PARAMETER_INT_SOURCE_FROM,tg.PARAMETER_ARRAY_SECOND_SOURCE,tg.PARAMETER_INT_SECOND_SOURCE_FROM,tg.PARAMETER_INT_LENGTH],tg.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tg.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tg.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),a=e?.getArguments()?.get(tg.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tg.PARAMETER_INT_LENGTH.getParameterName());if(-1==s&&(s=t.length<=n.length?t.length-r:n.length-a),s>t.length||s>n.length||r+s>t.length||a+s>n.length)throw new eo("The length which was being requested is more than than the size either source array or second source array");let i=new Set,o=new Set;for(let e=0;e<s;e++)i.add(t[e+r]);for(let e=0;e<s;e++)o.add(n[e+a]);let E=new Set;return i.forEach(e=>{o.has(e)?o.delete(e):E.add(e)}),o.forEach(e=>{i.has(e)||E.add(e)}),new eE([ea.outputOf(new Map([[tg.EVENT_RESULT_NAME,[...E]]]))])}}class tc extends e2{constructor(){super("Equals",[tc.PARAMETER_ARRAY_SOURCE,tc.PARAMETER_INT_SOURCE_FROM,tc.PARAMETER_ARRAY_FIND,tc.PARAMETER_INT_FIND_FROM,tc.PARAMETER_INT_LENGTH],tc.EVENT_RESULT_BOOLEAN)}async internalExecute(e){let t=new ta,r=(await t.execute(e)).allResults()[0].getResult().get(tc.EVENT_RESULT_NAME);return new eE([ea.outputOf(Z.of(tc.EVENT_RESULT_NAME,0==r))])}}class tm extends e2{constructor(){super("Fill",[tm.PARAMETER_ARRAY_SOURCE,tm.PARAMETER_INT_SOURCE_FROM,tm.PARAMETER_INT_LENGTH,tm.PARAMETER_ANY],tm.EVENT_RESULT_EMPTY)}async internalExecute(e){var t=e?.getArguments()?.get(tm.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tm.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tm.PARAMETER_INT_LENGTH.getParameterName()),a=e?.getArguments()?.get(tm.PARAMETER_ANY.getParameterName());if(r<0)throw new eo(ep.format("Arrays out of bound trying to access $ index",r));-1==n&&(n=t.length-r);let s=r+n-t.length;if(t=[...t],s>0)for(let e=0;e<s;e++)t.push();for(let e=r;e<r+n;e++)t[e]=N(a)?a:ti(a);return new eE([ea.outputOf(Z.of(e2.EVENT_RESULT_NAME,t))])}}class tT extends e2{FunctionOutput;constructor(){super("Frequency",[tT.PARAMETER_ARRAY_SOURCE,tT.PARAMETER_ANY,tT.PARAMETER_INT_SOURCE_FROM,tT.PARAMETER_INT_LENGTH],tT.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tT.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tT.PARAMETER_ANY.getParameterName()),n=e?.getArguments()?.get(tT.PARAMETER_INT_SOURCE_FROM.getParameterName()),a=e?.getArguments()?.get(tT.PARAMETER_INT_LENGTH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tT.EVENT_RESULT_NAME,0]]))]);if(n>t.length)throw new eo("Given start point is more than the size of source");let s=n+a;if(-1==a&&(s=t.length-n),s>t.length)throw new eo("Given length is more than the size of source");let i=0;for(let e=n;e<s&&e<t.length;e++)0==te.compare(t[e],r)&&i++;return new eE([ea.outputOf(new Map([[tT.EVENT_RESULT_NAME,i]]))])}}class tp extends e2{constructor(){super("IndexOf",[tp.PARAMETER_ARRAY_SOURCE,tp.PARAMETER_ANY_NOT_NULL,tp.PARAMETER_INT_FIND_FROM],tp.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tp.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tp.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(tp.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eo("The size of the search index of the array is greater than the size of the array");let a=-1;for(let e=n;e<t.length;e++)if(0==te.compare(t[e],r)){a=e;break}return new eE([ea.outputOf(new Map([[tp.EVENT_RESULT_NAME,a]]))])}}class tR extends e2{constructor(){super("IndexOfArray",[tR.PARAMETER_ARRAY_SOURCE,tR.PARAMETER_ARRAY_SECOND_SOURCE,tR.PARAMETER_INT_FIND_FROM],tR.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tR.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tR.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length||0==r.length)return new eE([ea.outputOf(new Map([[tR.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||t.length<r.length)throw new eo("Given from second source is more than the size of the source array");let a=r.length,s=-1;for(let e=n;e<t.length;e++){let n=0;if(0==te.compare(t[e],r[n])){for(;n<a&&0==te.compare(t[e+n],r[n]);)n++;if(n==a){s=e;break}}}return new eE([ea.outputOf(new Map([[tR.EVENT_RESULT_NAME,s]]))])}}class th extends e2{constructor(){super("LastIndexOf",[th.PARAMETER_ARRAY_SOURCE,th.PARAMETER_ANY_NOT_NULL,th.PARAMETER_INT_FIND_FROM],th.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(th.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(th.PARAMETER_ANY_NOT_NULL.getParameterName());let n=e?.getArguments()?.get(th.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[th.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length)throw new eo("The value of length shouldn't the exceed the size of the array or shouldn't be in terms");let a=-1;for(let e=t.length-1;e>=n;e--)if(0==te.compare(t[e],r)){a=e;break}return new eE([ea.outputOf(new Map([[th.EVENT_RESULT_NAME,a]]))])}}class tf extends e2{constructor(){super("LastIndexOfArray",[tf.PARAMETER_ARRAY_SOURCE,tf.PARAMETER_ARRAY_SECOND_SOURCE,tf.PARAMETER_INT_FIND_FROM],tf.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tf.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),n=e?.getArguments()?.get(tf.PARAMETER_INT_FIND_FROM.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,-1]]))]);if(n<0||n>t.length||r.length>t.length)throw new eo("Given from index is more than the size of the source array");let a=r.length,s=-1;for(let e=n;e<t.length;e++){let n=0;if(0==te.compare(t[e],r[n])){for(;n<a&&0==te.compare(t[e+n],r[n]);)n++;n==a&&(s=e)}}return new eE([ea.outputOf(new Map([[tf.EVENT_RESULT_NAME,s]]))])}}class tN extends e2{constructor(){super("Max",[tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE],tN.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tN.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==t.length)throw new eo("Search source array cannot be empty");let r=t[0];for(let e=1;e<t.length;e++){let n=t[e];te.comparePrimitive(r,n)>=0||(r=n)}return new eE([ea.outputOf(new Map([[tN.EVENT_RESULT_NAME,r]]))])}}class t_ extends e2{constructor(){super("Min",[t_.PARAMETER_ARRAY_SOURCE_PRIMITIVE],t_.EVENT_RESULT_ANY)}async internalExecute(e){let t,r=e?.getArguments()?.get(t_.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName());if(0==r.length)throw new eo("Search source array cannot be empty");for(let e=0;e<r.length;e++)!N(r[e])&&(void 0===t||0>te.comparePrimitive(r[e],t))&&(t=r[e]);return new eE([ea.outputOf(new Map([[t_.EVENT_RESULT_NAME,t]]))])}}class tS extends e2{constructor(){super("MisMatch",[tS.PARAMETER_ARRAY_SOURCE,tS.PARAMETER_INT_FIND_FROM,tS.PARAMETER_ARRAY_SECOND_SOURCE,tS.PARAMETER_INT_SECOND_SOURCE_FROM,tS.PARAMETER_INT_LENGTH],tS.EVENT_RESULT_INTEGER)}async internalExecute(e){let t=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tS.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tS.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName()),a=e?.getArguments()?.get(tS.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName()),s=e?.getArguments()?.get(tS.PARAMETER_INT_LENGTH.getParameterName()),i=r<t.length&&r>0?r:0,o=a<n.length&&a>0?a:0;if(i+s>=t.length||o+s>n.length)throw new eo("The size of the array for first and second which was being requested is more than size of the given array");let E=-1;for(let e=0;e<s;e++)if(t[i+e]!=n[o+e]){E=e;break}return new eE([ea.outputOf(new Map([[tS.EVENT_RESULT_NAME,E]]))])}}class tM extends e2{constructor(){super("Reverse",[tM.PARAMETER_ARRAY_SOURCE,tM.PARAMETER_INT_SOURCE_FROM,tM.PARAMETER_INT_LENGTH],tM.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tM.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tM.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tM.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n>=t.length||n<0||r<0)throw new eo("Please provide start point between the start and end indexes or provide the length which was less than the source size ");t=[...t];let a=r+n-1;for(;r<=a;){let e=t[r],n=t[a];t[r++]=n,t[a--]=e}return new eE([ea.outputOf(new Map([[tM.EVENT_RESULT_NAME,t]]))])}}class tw extends e2{constructor(){super("Rotate",[tw.PARAMETER_ARRAY_SOURCE,tw.PARAMETER_ROTATE_LENGTH],tw.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tw.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tw.PARAMETER_ROTATE_LENGTH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);let n=(t=[...t]).length;return r%=n,this.rotate(t,0,r-1),this.rotate(t,r,n-1),this.rotate(t,0,n-1),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}rotate(e,t,r){for(;t<r;){let n=e[t];e[t++]=e[r],e[r--]=n}}}class tO extends e2{constructor(){super("Shuffle",[tO.PARAMETER_ARRAY_SOURCE],tO.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tO.PARAMETER_ARRAY_SOURCE.getParameterName());if(t.length<=1)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);let r=0,n=(t=[...t]).length;for(let e=0;e<n;e++){let e=Math.floor(Math.random()*n)%n,a=t[r];t[r]=t[e],t[e]=a,r=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}var td={};t(td,"ObjectValueSetterExtractor",()=>tB);var tI={};t(tI,"Expression",()=>tG);var tP={};t(tP,"StringBuilder",()=>ty);class ty{str;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 eo(`Index ${e} is greater than or equal to ${this.str.length}`)}substring(e,t){return this.str.substring(e,t)}}var tx={};t(tx,"ExpressionEvaluationException",()=>tv);class tv extends Error{cause;constructor(e,t,r){super(ep.format("$ : $",e,t)),this.cause=r}getCause(){return this.cause}}var tL={};t(tL,"ExpressionToken",()=>tU);class tU{expression;constructor(e){this.expression=e}getExpression(){return this.expression}toString(){return this.expression}}var tC={};t(tC,"ExpressionTokenValue",()=>tV);class tV extends tU{element;constructor(e,t){super(e),this.element=t}getTokenValue(){return this.element}getElement(){return this.element}toString(){return ep.format("$: $",this.expression,this.element)}}var tD={};t(tD,"Operation",()=>tb);class tb{static MULTIPLICATION=new tb("*");static DIVISION=new tb("/");static INTEGER_DIVISION=new tb("//");static MOD=new tb("%");static ADDITION=new tb("+");static SUBTRACTION=new tb("-");static NOT=new tb("not",void 0,!0);static AND=new tb("and",void 0,!0);static OR=new tb("or",void 0,!0);static LESS_THAN=new tb("<");static LESS_THAN_EQUAL=new tb("<=");static GREATER_THAN=new tb(">");static GREATER_THAN_EQUAL=new tb(">=");static EQUAL=new tb("=");static NOT_EQUAL=new tb("!=");static BITWISE_AND=new tb("&");static BITWISE_OR=new tb("|");static BITWISE_XOR=new tb("^");static BITWISE_COMPLEMENT=new tb("~");static BITWISE_LEFT_SHIFT=new tb("<<");static BITWISE_RIGHT_SHIFT=new tb(">>");static BITWISE_UNSIGNED_RIGHT_SHIFT=new tb(">>>");static UNARY_PLUS=new tb("UN: +","+");static UNARY_MINUS=new tb("UN: -","-");static UNARY_LOGICAL_NOT=new tb("UN: not","not");static UNARY_BITWISE_COMPLEMENT=new tb("UN: ~","~");static ARRAY_OPERATOR=new tb("[");static OBJECT_OPERATOR=new tb(".");static NULLISH_COALESCING_OPERATOR=new tb("??");static CONDITIONAL_TERNARY_OPERATOR=new tb("?");static VALUE_OF=new Map([["MULTIPLICATION",tb.MULTIPLICATION],["DIVISION",tb.DIVISION],["INTEGER_DIVISON",tb.INTEGER_DIVISION],["MOD",tb.MOD],["ADDITION",tb.ADDITION],["SUBTRACTION",tb.SUBTRACTION],["NOT",tb.NOT],["AND",tb.AND],["OR",tb.OR],["LESS_THAN",tb.LESS_THAN],["LESS_THAN_EQUAL",tb.LESS_THAN_EQUAL],["GREATER_THAN",tb.GREATER_THAN],["GREATER_THAN_EQUAL",tb.GREATER_THAN_EQUAL],["EQUAL",tb.EQUAL],["NOT_EQUAL",tb.NOT_EQUAL],["BITWISE_AND",tb.BITWISE_AND],["BITWISE_OR",tb.BITWISE_OR],["BITWISE_XOR",tb.BITWISE_XOR],["BITWISE_COMPLEMENT",tb.BITWISE_COMPLEMENT],["BITWISE_LEFT_SHIFT",tb.BITWISE_LEFT_SHIFT],["BITWISE_RIGHT_SHIFT",tb.BITWISE_RIGHT_SHIFT],["BITWISE_UNSIGNED_RIGHT_SHIFT",tb.BITWISE_UNSIGNED_RIGHT_SHIFT],["UNARY_PLUS",tb.UNARY_PLUS],["UNARY_MINUS",tb.UNARY_MINUS],["UNARY_LOGICAL_NOT",tb.UNARY_LOGICAL_NOT],["UNARY_BITWISE_COMPLEMENT",tb.UNARY_BITWISE_COMPLEMENT],["ARRAY_OPERATOR",tb.ARRAY_OPERATOR],["OBJECT_OPERATOR",tb.OBJECT_OPERATOR],["NULLISH_COALESCING_OPERATOR",tb.NULLISH_COALESCING_OPERATOR],["CONDITIONAL_TERNARY_OPERATOR",tb.CONDITIONAL_TERNARY_OPERATOR]]);static UNARY_OPERATORS=new Set([tb.ADDITION,tb.SUBTRACTION,tb.NOT,tb.BITWISE_COMPLEMENT,tb.UNARY_PLUS,tb.UNARY_MINUS,tb.UNARY_LOGICAL_NOT,tb.UNARY_BITWISE_COMPLEMENT]);static ARITHMETIC_OPERATORS=new Set([tb.MULTIPLICATION,tb.DIVISION,tb.INTEGER_DIVISION,tb.MOD,tb.ADDITION,tb.SUBTRACTION]);static LOGICAL_OPERATORS=new Set([tb.NOT,tb.AND,tb.OR,tb.LESS_THAN,tb.LESS_THAN_EQUAL,tb.GREATER_THAN,tb.GREATER_THAN_EQUAL,tb.EQUAL,tb.NOT_EQUAL,tb.NULLISH_COALESCING_OPERATOR]);static BITWISE_OPERATORS=new Set([tb.BITWISE_AND,tb.BITWISE_COMPLEMENT,tb.BITWISE_LEFT_SHIFT,tb.BITWISE_OR,tb.BITWISE_RIGHT_SHIFT,tb.BITWISE_UNSIGNED_RIGHT_SHIFT,tb.BITWISE_XOR]);static CONDITIONAL_OPERATORS=new Set([tb.CONDITIONAL_TERNARY_OPERATOR]);static OPERATOR_PRIORITY=new Map([[tb.UNARY_PLUS,1],[tb.UNARY_MINUS,1],[tb.UNARY_LOGICAL_NOT,1],[tb.UNARY_BITWISE_COMPLEMENT,1],[tb.ARRAY_OPERATOR,1],[tb.OBJECT_OPERATOR,1],[tb.MULTIPLICATION,2],[tb.DIVISION,2],[tb.INTEGER_DIVISION,2],[tb.MOD,2],[tb.ADDITION,3],[tb.SUBTRACTION,3],[tb.BITWISE_LEFT_SHIFT,4],[tb.BITWISE_RIGHT_SHIFT,4],[tb.BITWISE_UNSIGNED_RIGHT_SHIFT,4],[tb.LESS_THAN,5],[tb.LESS_THAN_EQUAL,5],[tb.GREATER_THAN,5],[tb.GREATER_THAN_EQUAL,5],[tb.EQUAL,6],[tb.NOT_EQUAL,6],[tb.BITWISE_AND,7],[tb.BITWISE_XOR,8],[tb.BITWISE_OR,9],[tb.AND,10],[tb.OR,11],[tb.NULLISH_COALESCING_OPERATOR,11],[tb.CONDITIONAL_TERNARY_OPERATOR,12]]);static OPERATORS=new Set([...Array.from(tb.ARITHMETIC_OPERATORS),...Array.from(tb.LOGICAL_OPERATORS),...Array.from(tb.BITWISE_OPERATORS),tb.ARRAY_OPERATOR,tb.OBJECT_OPERATOR,...Array.from(tb.CONDITIONAL_OPERATORS)].map(e=>e.getOperator()));static OPERATORS_WITHOUT_SPACE_WRAP=new Set([...Array.from(tb.ARITHMETIC_OPERATORS),...Array.from(tb.LOGICAL_OPERATORS),...Array.from(tb.BITWISE_OPERATORS),tb.ARRAY_OPERATOR,tb.OBJECT_OPERATOR,...Array.from(tb.CONDITIONAL_OPERATORS)].filter(e=>!e.shouldBeWrappedInSpace()).map(e=>e.getOperator()));static OPERATION_VALUE_OF=new Map(Array.from(tb.VALUE_OF.entries()).map(([e,t])=>[t.getOperator(),t]));static UNARY_MAP=new Map([[tb.ADDITION,tb.UNARY_PLUS],[tb.SUBTRACTION,tb.UNARY_MINUS],[tb.NOT,tb.UNARY_LOGICAL_NOT],[tb.BITWISE_COMPLEMENT,tb.UNARY_BITWISE_COMPLEMENT],[tb.UNARY_PLUS,tb.UNARY_PLUS],[tb.UNARY_MINUS,tb.UNARY_MINUS],[tb.UNARY_LOGICAL_NOT,tb.UNARY_LOGICAL_NOT],[tb.UNARY_BITWISE_COMPLEMENT,tb.UNARY_BITWISE_COMPLEMENT]]);static BIGGEST_OPERATOR_SIZE=Array.from(tb.VALUE_OF.values()).map(e=>e.getOperator()).filter(e=>!e.startsWith("UN: ")).map(e=>e.length).reduce((e,t)=>e>t?e:t,0);operator;operatorName;_shouldBeWrappedInSpace;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 tb.VALUE_OF.get(e)}toString(){return this.operator}}class tG extends tU{tokens=new eR;ops=new eR;constructor(e,t,r,n){super(e||""),t&&this.tokens.push(t),r&&this.tokens.push(r),n&&this.ops.push(n),this.evaluate()}getTokens(){return this.tokens}getOperations(){return this.ops}evaluate(){let e;let t=this.expression.length,r="",n=new ty(""),a=0,s=!1;for(;a<t;){switch(r=this.expression[a],e=n.toString(),r){case" ":s=this.processTokenSepearator(n,e,s);break;case"(":a=this.processSubExpression(t,n,e,a,s),s=!1;break;case")":throw new tv(this.expression,"Extra closing parenthesis found");case"]":throw new tv(this.expression,"Extra closing square bracket found");case"'":case'"':{let e=this.processStringLiteral(t,r,a);a=e.getT1(),s=e.getT2();break}case"?":if(a+1<t&&"?"!=this.expression.charAt(a+1)&&0!=a&&"?"!=this.expression.charAt(a-1))a=this.processTernaryOperator(t,n,e,a,s);else{let i=this.processOthers(r,t,n,e,a,s);a=i.getT1(),(s=i.getT2())&&this.ops.peek()==tb.ARRAY_OPERATOR&&(a=(i=this.process(t,n,a)).getT1(),s=i.getT2())}break;default:let i=this.processOthers(r,t,n,e,a,s);a=i.getT1(),(s=i.getT2())&&this.ops.peek()==tb.ARRAY_OPERATOR&&(a=(i=this.process(t,n,a)).getT1(),s=i.getT2())}++a}if(e=n.toString(),!e_.isNullOrBlank(e)){if(tb.OPERATORS.has(e))throw new tv(this.expression,"Expression is ending with an operator");this.tokens.push(new tU(e))}}processStringLiteral(e,t,r){let n="",a=r+1;for(;a<e;a++){let e=this.expression.charAt(a);if(e==t&&"\\"!=this.expression.charAt(a-1))break;n+=e}if(a==e&&this.expression.charAt(a-1)!=t)throw new tv(this.expression,"Missing string ending marker "+t);let s=new ew(a,!1);return this.tokens.push(new tV(n,n)),s}process(e,t,r){let n=1;for(++r;r<e&&0!=n;){let e=this.expression.charAt(r);"]"==e?--n:"["==e&&++n,0!=n&&(t.append(e),r++)}return this.tokens.push(new tG(t.toString())),t.setLength(0),new ew(r,!1)}processOthers(e,t,r,n,a,s){let i=t-a;i=i<tb.BIGGEST_OPERATOR_SIZE?i:tb.BIGGEST_OPERATOR_SIZE;for(let e=i;e>0;e--){let t=this.expression.substring(a,a+e);if(tb.OPERATORS_WITHOUT_SPACE_WRAP.has(t))return e_.isNullOrBlank(n)||(this.tokens.push(new tU(n)),s=!1),this.checkUnaryOperator(this.tokens,this.ops,tb.OPERATION_VALUE_OF.get(t),s),s=!0,r.setLength(0),new ew(a+e-1,s)}return r.append(e),new ew(a,!1)}processTernaryOperator(e,t,r,n,a){if(a)throw new tv(this.expression,"Ternary operator is followed by an operator");""!=r.trim()&&(this.tokens.push(new tG(r)),t.setLength(0));let s=1,i="",o=++n;for(;n<e&&s>0;)"?"==(i=this.expression.charAt(n))?++s:":"==i&&--s,++n;if(":"!=i)throw new tv(this.expression,"':' operater is missing");if(n>=e)throw new tv(this.expression,"Third part of the ternary expression is missing");for(;!this.ops.isEmpty()&&this.hasPrecedence(tb.CONDITIONAL_TERNARY_OPERATOR,this.ops.peek());){let e=this.ops.pop();if(tb.UNARY_OPERATORS.has(e)){let t=this.tokens.pop();this.tokens.push(new tG("",t,void 0,e))}else{let t=this.tokens.pop(),r=this.tokens.pop();this.tokens.push(new tG("",r,t,e))}}this.ops.push(tb.CONDITIONAL_TERNARY_OPERATOR),this.tokens.push(new tG(this.expression.substring(o,n-1)));let E=this.expression.substring(n);if(""===E.trim())throw new tv(this.expression,"Third part of the ternary expression is missing");return this.tokens.push(new tG(E)),e-1}processSubExpression(e,t,r,n,a){if(tb.OPERATORS.has(r))this.checkUnaryOperator(this.tokens,this.ops,tb.OPERATION_VALUE_OF.get(r),a),t.setLength(0);else if(!e_.isNullOrBlank(r))throw new tv(this.expression,ep.format("Unkown token : $ found.",r));let s=1,i=new ty,o=this.expression.charAt(n);for(n++;n<e&&s>0;)"("==(o=this.expression.charAt(n))?s++:")"==o&&s--,0!=s&&(i.append(o),n++);if(")"!=o)throw new tv(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 tG(i.toString().trim())),n}processTokenSepearator(e,t,r){return e_.isNullOrBlank(t)||(tb.OPERATORS.has(t)?(this.checkUnaryOperator(this.tokens,this.ops,tb.OPERATION_VALUE_OF.get(t),r),r=!0):(this.tokens.push(new tU(t)),r=!1)),e.setLength(0),r}checkUnaryOperator(e,t,r,n){if(r){if(n||e.isEmpty()){if(tb.UNARY_OPERATORS.has(r)){let e=tb.UNARY_MAP.get(r);e&&t.push(e)}else throw new tv(this.expression,ep.format("Extra operator $ found.",r))}else{for(;!t.isEmpty()&&this.hasPrecedence(r,t.peek());){let r=t.pop();if(tb.UNARY_OPERATORS.has(r)){let t=e.pop();e.push(new tG("",t,void 0,r))}else{let t=e.pop(),n=e.pop();e.push(new tG("",n,t,r))}}t.push(r)}}}hasPrecedence(e,t){let r=tb.OPERATOR_PRIORITY.get(e),n=tb.OPERATOR_PRIORITY.get(t);if(!r||!n)throw Error("Unknown operators provided");return n<r}toString(){if(this.ops.isEmpty())return 1==this.tokens.size()?this.tokens.get(0).toString():"Error: No tokens";let e=new ty,t=0,r=this.ops.toArray(),n=this.tokens.toArray();for(let a=0;a<r.length;a++)if(r[a].getOperator().startsWith("UN: "))e.append("(").append(r[a].getOperator().substring(4)).append(n[t]instanceof tG?n[t].toString():n[t]).append(")"),t++;else if(r[a]==tb.CONDITIONAL_TERNARY_OPERATOR){let r=n[t++];e.insert(0,r.toString()),e.insert(0,":"),r=n[t++],e.insert(0,r.toString()),e.insert(0,"?"),r=n[t++],e.insert(0,r.toString()).append(")"),e.insert(0,"(")}else{if(0==t){let r=n[t++];e.insert(0,r.toString())}let s=n[t++];e.insert(0,r[a].getOperator()).insert(0,s.toString()).insert(0,"(").append(")")}return e.toString()}equals(e){return this.expression==e.expression}}var tF={};t(tF,"TokenValueExtractor",()=>tY);class tY{static REGEX_SQUARE_BRACKETS=/[\[\]]/;static REGEX_DOT=/\./;getValue(e){let t=this.getPrefix();if(!e.startsWith(t))throw new eo(ep.format("Token $ doesn't start with $",e,t));if(e.endsWith(".__index")){let t=e.substring(0,e.length-8),r=this.getValueInternal(t);if(!N(r?.__index))return r.__index;if(!t.endsWith("]"))return t.substring(t.lastIndexOf(".")+1);{let e=t.substring(t.lastIndexOf("[")+1,t.length-1),r=parseInt(e);return isNaN(r)?e:r}}return this.getValueInternal(e)}retrieveElementFrom(e,t,r,n){if(N(n))return;if(t.length==r)return n;let a=t[r].split(tY.REGEX_SQUARE_BRACKETS).map(e=>e.trim()).filter(e=>!e_.isNullOrBlank(e)).reduce((n,a)=>this.resolveForEachPartOfTokenWithBrackets(e,t,r,a,n),n);return this.retrieveElementFrom(e,t,r+1,a)}resolveForEachPartOfTokenWithBrackets(e,t,r,n,a){if(!N(a))return"length"===n?this.getLength(e,a):Array.isArray(a)?this.handleArrayAccess(e,n,a):this.handleObjectAccess(e,t,r,n,a)}getLength(e,t){let r=typeof t;if("string"===r||Array.isArray(t))return t.length;if("object"===r)return"length"in t?t.length:Object.keys(t).length;throw new tv(e,ep.format("Length can't be found in token $",e))}handleArrayAccess(e,t,r){let n=parseInt(t);if(isNaN(n))throw new tv(e,ep.format("$ is not a number",t));if(n<0||n>=r.length)throw new tv(e,ep.format("Index $ is out of bounds for array of length $",n,r.length));return r[n]}handleObjectAccess(e,t,r,n,a){if(n.startsWith('"')){if(!n.endsWith('"')||1==n.length||2==n.length)throw new tv(e,ep.format("$ is missing a double quote or empty key found",e));n=n.substring(1,t.length-2)}return this.checkIfObject(e,t,r,a),a[n]}checkIfObject(e,t,r,n){if("object"!=typeof n||Array.isArray(n))throw new tv(e,ep.format("Unable to retrieve $ from $ in the path $",t[r],n.toString(),e))}}class tB extends tY{store;prefix;constructor(e,t){super(),this.store=e,this.prefix=t}getValueInternal(e){let t=e.split(tY.REGEX_DOT);return this.retrieveElementFrom(e,t,1,this.store)}getStore(){return this.store}setStore(e){return this.store=e,this}setValue(e,t,r=!0,n=!1){this.store=ti(this.store),this.modifyStore(e,t,r,n)}modifyStore(e,t,r,n){let a=new tG(e),s=a.getTokens();s.removeLast();let i=a.getOperations(),o=i.removeLast(),E=s.removeLast(),u=E instanceof tV?E.getElement():E.getExpression(),l=this.store;for(;!i.isEmpty();)l=o==tb.OBJECT_OPERATOR?this.getDataFromObject(l,u,i.peekLast()):this.getDataFromArray(l,u,i.peekLast()),o=i.removeLast(),u=(E=s.removeLast())instanceof tV?E.getElement():E.getExpression();o==tb.OBJECT_OPERATOR?this.putDataInObject(l,u,t,r,n):this.putDataInArray(l,u,t,r,n)}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));let a=e[n];return N(a)&&(a=r==tb.OBJECT_OPERATOR?{}:[],e[n]=a),a}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));let n=e[t];return N(n)&&(n=r==tb.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r,n,a){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let s=parseInt(t);if(isNaN(s))throw new eo(ep.format("Expected an array index but found $",t));if(s<0)throw new eo(ep.format("Array index is out of bound - $",t));(n||N(e[s]))&&(a&&N(r)?e.splice(s,1):e[s]=r)}putDataInObject(e,t,r,n,a){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));(n||N(e[t]))&&(a&&N(r)?delete e[t]:e[t]=r)}getPrefix(){return this.prefix}}class tH extends e2{constructor(){super("Sort",[tH.PARAMETER_ARRAY_SOURCE,tH.PARAMETER_INT_FIND_FROM,tH.PARAMETER_INT_LENGTH,tH.PARAMETER_BOOLEAN_ASCENDING,tH.PARAMETER_KEY_PATH],tH.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(tH.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tH.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(tH.PARAMETER_INT_LENGTH.getParameterName()),a=e?.getArguments()?.get(tH.PARAMETER_BOOLEAN_ASCENDING.getParameterName()),s=e?.getArguments()?.get(tH.PARAMETER_KEY_PATH.getParameterName());if(0==t.length)return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);if(t=[...t],-1==n&&(n=t.length-r),r<0||r>=t.length||r+n>t.length)throw new eo("Given start point is more than the size of the array or not available at that point");let i=t.slice(r,r+n+1),o=new tB({},"Data.");return i.sort((e,t)=>"object"==typeof e&&"object"==typeof t&&s.length?(o.setStore({a:e,b:t}),tk(o.getValue("Data.a."+s),o.getValue("Data.b."+s),a)):tk(e,t,a)),t.splice(r,n,...i),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}function tk(e,t,r){return e===t?0:null===e?1:null===t?-1:r?e<t?-1:1:e<t?1:-1}class t$ extends e2{constructor(){super("SubArray",[t$.PARAMETER_ARRAY_SOURCE,t$.PARAMETER_INT_FIND_FROM,t$.PARAMETER_INT_LENGTH],t$.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(t$.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(t$.PARAMETER_INT_FIND_FROM.getParameterName()),n=e?.getArguments()?.get(t$.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),n<=0)return new eE([ea.outputOf(new Map([]))]);if(!(r>=0&&r<t.length)||r+n>t.length)throw new eo("Given find from point is more than the source size array or the Requested length for the subarray was more than the source size");let a=t.slice(r,r+n);return new eE([ea.outputOf(new Map([[t$.EVENT_RESULT_NAME,a]]))])}}class tj extends e2{constructor(){super("Insert",[tj.PARAMETER_ARRAY_SOURCE,tj.PARAMETER_INT_OFFSET,tj.PARAMETER_ANY],tj.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tj.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tj.PARAMETER_INT_OFFSET.getParameterName());var n=e?.getArguments()?.get(tj.PARAMETER_ANY.getParameterName());if(N(n)||N(r)||r>t.length)throw new eo("Please valid resouces to insert at the correct location");if(0==(t=[...t]).length)return 0==r&&t.push(n),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))]);t.push(n);let a=t.length-1;for(r++;a>=r;){let e=t[a-1];t[a-1]=t[a],t[a--]=e}return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tW extends e2{constructor(){super("InsertLast",[tW.PARAMETER_ARRAY_SOURCE,tW.PARAMETER_ANY],tW.EVENT_RESULT_ARRAY)}async internalExecute(e){let t=e?.getArguments()?.get(tW.PARAMETER_ARRAY_SOURCE.getParameterName());var r=e?.getArguments()?.get(tW.PARAMETER_ANY.getParameterName());return(t=[...t]).push(r),new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,t]]))])}}class tX extends e2{constructor(){super("RemoveDuplicates",[tX.PARAMETER_ARRAY_SOURCE,tX.PARAMETER_INT_SOURCE_FROM,tX.PARAMETER_INT_LENGTH],tX.EVENT_RESULT_ARRAY)}async internalExecute(e){var t=e?.getArguments()?.get(tX.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tX.PARAMETER_INT_SOURCE_FROM.getParameterName()),n=e?.getArguments()?.get(tX.PARAMETER_INT_LENGTH.getParameterName());if(-1==n&&(n=t.length-r),r+n>t.length)throw new eo(ep.format("Array has no elements from $ to $ as the array size is $",r,r+n,t.length));let a=[...t],s=r+n;for(let e=s-1;e>=r;e--)for(let t=e-1;t>=r;t--)if(ef(a[e],a[t])){a.splice(e,1);break}return new eE([ea.outputOf(Z.of(tX.EVENT_RESULT_NAME,a))])}}const tJ="keyPath",tq="valuePath",tz="ignoreNullValues",tK="ignoreNullKeys",tQ="ignoreDuplicateKeys";class tZ extends e2{constructor(){super("ArrayToObjects",[e2.PARAMETER_ARRAY_SOURCE,W.of(tJ,Y.ofString(tJ)),W.of(tq,Y.of(tq,E.STRING,E.NULL)),W.of(tz,Y.ofBoolean(tz).setDefaultValue(!1)),W.of(tK,Y.ofBoolean(tK).setDefaultValue(!0)),W.of(tQ,Y.ofBoolean(tQ).setDefaultValue(!1))],e2.EVENT_RESULT_ANY)}async internalExecute(e){let t=e?.getArguments()?.get(e2.PARAMETER_ARRAY_SOURCE.getParameterName()),r=e?.getArguments()?.get(tJ),n=e?.getArguments()?.get(tq)??"",a=e?.getArguments()?.get(tz),s=e?.getArguments()?.get(tK),i=e?.getArguments()?.get(tQ),o=new tB({},"Data."),E=t.filter(e=>!N(e)).reduce((e,t)=>{o.setStore(t);let E=o.getValue("Data."+r);if(s&&N(E))return e;let u=n?o.getValue("Data."+n):t;return a&&N(u)||i&&e.hasOwnProperty(E)||(e[E]=u),e},{});return new eE([ea.outputOf(new Map([[e2.EVENT_RESULT_NAME,E]]))])}}const t0="source",t1="delimiter",t2="result",t9=new el("Join").setNamespace(R.SYSTEM_ARRAY).setParameters(new Map([[t0,new W(t0,Y.ofArray(t0,Y.of("each",E.STRING,E.INTEGER,E.LONG,E.DOUBLE,E.FLOAT,E.NULL)))],[t1,new W(t1,Y.ofString(t1).setDefaultValue(""))]])).setEvents(new Map([en.outputEventMapEntry(new Map([[t2,Y.ofString(t2)]]))]));class t4 extends e1{getSignature(){return t9}async internalExecute(e){let t=e?.getArguments()?.get(t0),r=e?.getArguments()?.get(t1);return new eE([ea.outputOf(new Map([[t2,t.join(r)]]))])}}class t3{static repoMap=Z.ofArrayEntries(K(new e9),K(new e4),K(new tt),K(new ta),K(new to),K(new tE),K(new tu),K(new tl),K(new tA),K(new tg),K(new tc),K(new tm),K(new tT),K(new tp),K(new tR),K(new th),K(new tf),K(new tN),K(new t_),K(new tS),K(new tM),K(new tw),K(new tO),K(new tH),K(new t$),K(new e6),K(new tj),K(new tW),K(new tX),K(new tZ),K(new t4));static filterableNames=Array.from(t3.repoMap.values()).map(e=>e.getSignature().getFullName());async find(e,t){return e!=R.SYSTEM_ARRAY?Promise.resolve(void 0):Promise.resolve(t3.repoMap.get(t))}async filter(e){return Promise.resolve(t3.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}var t6={};t(t6,"ContextElement",()=>t5);class t5{static NULL=new t5(Y.NULL,void 0);schema;element;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}}const t7="name",t8="schema",re=new el("Create").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(t7,new Y().setName(t7).setType(x.of(E.STRING)).setMinLength(1).setFormat(l.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,u.CONSTANT),W.ofEntry(t8,Y.SCHEMA,!1,u.CONSTANT)])).setEvents(new Map([en.outputEventMapEntry(new Map)])),rt="name",rr="value",rn=new el("Get").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(rt,new Y().setName(rt).setType(x.of(E.STRING)).setMinLength(1).setFormat(l.REGEX).setPattern("^[a-zA-Z_$][a-zA-Z_$0-9]*$"),!1,u.CONSTANT)])).setEvents(new Map([en.outputEventMapEntry(new Map([[rr,Y.ofAny(rr)]]))]));var ra={};t(ra,"ExpressionEvaluator",()=>no);var rs={};t(rs,"LogicalNullishCoalescingOperator",()=>rE);var ri={};t(ri,"BinaryOperator",()=>ro);class ro{nullCheck(e,t,r){if(N(e)||N(t))throw new e8(ep.format("$ cannot be applied to a null value",r.getOperatorName()))}}class rE extends ro{apply(e,t){return N(e)?t:e}}var ru={};t(ru,"ArithmeticAdditionOperator",()=>rl);class rl extends ro{apply(e,t){return N(e)?t:N(t)?e:e+t}}var rA={};t(rA,"ArithmeticDivisionOperator",()=>rg);class rg extends ro{apply(e,t){return this.nullCheck(e,t,tb.DIVISION),e/t}}var rc={};t(rc,"ArithmeticIntegerDivisionOperator",()=>rm);class rm extends ro{apply(e,t){return this.nullCheck(e,t,tb.DIVISION),Math.floor(e/t)}}var rT={};t(rT,"ArithmeticModulusOperator",()=>rp);class rp extends ro{apply(e,t){return this.nullCheck(e,t,tb.MOD),e%t}}var rR={};t(rR,"ArithmeticMultiplicationOperator",()=>rh);class rh extends ro{apply(e,t){this.nullCheck(e,t,tb.MULTIPLICATION);let r="string"==typeof e,n=typeof t;if(r||"string"===n){let n=r?e:t,a=r?t:e,s="",i=a<0,o=Math.floor(a=Math.abs(a));for(;o-- >0;)s+=n;let E=Math.floor(n.length*(a-Math.floor(a)));if(E<0&&(E=-E),0!=E&&(s+=n.substring(0,E)),i){let e="";for(let t=s.length-1;t>=0;t--)e+=s[t];return e}return s}return e*t}}var rf={};t(rf,"ArithmeticSubtractionOperator",()=>rN);class rN extends ro{apply(e,t){return this.nullCheck(e,t,tb.SUBTRACTION),e-t}}var r_={};t(r_,"ArrayOperator",()=>rS);class rS extends ro{apply(e,t){if(!e)throw new e8("Cannot apply array operator on a null value");if(!t)throw new e8("Cannot retrive null index value");if(!Array.isArray(e)&&"string"!=typeof e)throw new e8(ep.format("Cannot retrieve value from a primitive value $",e));if(t>=e.length)throw new e8(ep.format("Cannot retrieve index $ from the array of length $",t,e.length));return e[t]}}var rM={};t(rM,"BitwiseAndOperator",()=>rw);class rw extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_AND),e&t}}var rO={};t(rO,"BitwiseLeftShiftOperator",()=>rd);class rd extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_LEFT_SHIFT),e<<t}}var rI={};t(rI,"BitwiseOrOperator",()=>rP);class rP extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_OR),e|t}}var ry={};t(ry,"BitwiseRightShiftOperator",()=>rx);class rx extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_RIGHT_SHIFT),e>>t}}var rv={};t(rv,"BitwiseUnsignedRightShiftOperator",()=>rL);class rL extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_UNSIGNED_RIGHT_SHIFT),e>>>t}}var rU={};t(rU,"BitwiseXorOperator",()=>rC);class rC extends ro{apply(e,t){return this.nullCheck(e,t,tb.BITWISE_XOR),e^t}}var rV={};t(rV,"LogicalAndOperator",()=>rD);class rD extends ro{apply(e,t){return!!e&&""!==e&&!!t&&""!==t}}var rb={};t(rb,"LogicalEqualOperator",()=>rG);class rG extends ro{apply(e,t){return ef(e,t)}}var rF={};t(rF,"LogicalGreaterThanEqualOperator",()=>rY);class rY extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare >= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>=n.getT2()}}var rB={};t(rB,"LogicalGreaterThanOperator",()=>rH);class rH extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare > with the values $ and $",r.getT2(),n.getT2()));return r.getT2()>n.getT2()}}var rk={};t(rk,"LogicalLessThanEqualOperator",()=>r$);class r$ extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare <= with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<=n.getT2()}}var rj={};t(rj,"LogicalLessThanOperator",()=>rW);class rW extends ro{apply(e,t){let r=te.findPrimitiveNullAsBoolean(e),n=te.findPrimitiveNullAsBoolean(t);if(r.getT1()==E.BOOLEAN||n.getT1()==E.BOOLEAN)throw new e8(ep.format("Cannot compare < with the values $ and $",r.getT2(),n.getT2()));return r.getT2()<n.getT2()}}var rX={};t(rX,"LogicalNotEqualOperator",()=>rJ);class rJ extends ro{apply(e,t){return!ef(e,t)}}var rq={};t(rq,"LogicalOrOperator",()=>rz);class rz extends ro{apply(e,t){return!!e&&""!==e||!!t&&""!==t}}var rK={};t(rK,"ObjectOperator",()=>rQ);class rQ extends ro{apply(e,t){if(!e)throw new e8("Cannot apply array operator on a null value");if(!t)throw new e8("Cannot retrive null property value");let r=typeof e;if(!Array.isArray(e)&&"string"!=r&&"object"!=r)throw new e8(ep.format("Cannot retrieve value from a primitive value $",e));return e[t]}}var rZ={};t(rZ,"ArithmeticUnaryMinusOperator",()=>r2);var r0={};t(r0,"UnaryOperator",()=>r1);class r1{nullCheck(e,t){if(N(e))throw new e8(ep.format("$ cannot be applied to a null value",t.getOperatorName()))}}class r2 extends r1{apply(e){return this.nullCheck(e,tb.UNARY_MINUS),te.findPrimitiveNumberType(e),-e}}var r9={};t(r9,"ArithmeticUnaryPlusOperator",()=>r4);class r4 extends r1{apply(e){return this.nullCheck(e,tb.UNARY_PLUS),te.findPrimitiveNumberType(e),e}}var r3={};t(r3,"BitwiseComplementOperator",()=>r6);class r6 extends r1{apply(e){this.nullCheck(e,tb.UNARY_BITWISE_COMPLEMENT);let t=te.findPrimitiveNumberType(e);if(t.getT1()!=E.INTEGER&&t.getT1()!=E.LONG)throw new e8(ep.format("Unable to apply bitwise operator on $",e));return~e}}var r5={};t(r5,"LogicalNotOperator",()=>r7);class r7 extends r1{apply(e){return!e&&""!==e}}var r8={};t(r8,"LiteralTokenValueExtractor",()=>nt);const ne=new Map([["true",!0],["false",!1],["null",void 0],["undefined",void 0]]);class nt extends tY{static INSTANCE=new nt;getValueInternal(e){if(!e_.isNullOrBlank(e))return(e=e.trim(),ne.has(e))?ne.get(e):e.startsWith('"')?this.processString(e):this.processNumbers(e)}processNumbers(e){try{let t=Number(e);if(isNaN(t))throw Error("Parse number error");return t}catch(t){throw new tv(e,ep.format("Unable to parse the literal or expression $",e),t)}}processString(e){if(!e.endsWith('"'))throw new tv(e,ep.format("String literal $ is not closed properly",e));return e.substring(1,e.length-1)}getPrefix(){return""}getStore(){}getValueFromExtractors(e,t){return t.has(e+".")?t.get(e+".")?.getStore():this.getValue(e)}}var nr={},nn={};t(nn,"ConditionalTernaryOperator",()=>ns);class na{nullCheck(e,t,r,n){if(N(e)||N(t)||N(r))throw new e8(ep.format("$ cannot be applied to a null value",n.getOperatorName()))}}class ns extends na{apply(e,t,r){return e?t:r}}e(nr,nn);class ni extends tY{static PREFIX="_internal.";values=new Map;addValue(e,t){this.values.set(e,t)}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.values.get(r))}getPrefix(){return ni.PREFIX}getStore(){}}class no{static UNARY_OPERATORS_MAP=new Map([[tb.UNARY_BITWISE_COMPLEMENT,new r6],[tb.UNARY_LOGICAL_NOT,new r7],[tb.UNARY_MINUS,new r2],[tb.UNARY_PLUS,new r4]]);static TERNARY_OPERATORS_MAP=new Map([[tb.CONDITIONAL_TERNARY_OPERATOR,new ns]]);static BINARY_OPERATORS_MAP=new Map([[tb.ADDITION,new rl],[tb.DIVISION,new rg],[tb.INTEGER_DIVISION,new rm],[tb.MOD,new rp],[tb.MULTIPLICATION,new rh],[tb.SUBTRACTION,new rN],[tb.BITWISE_AND,new rw],[tb.BITWISE_LEFT_SHIFT,new rd],[tb.BITWISE_OR,new rP],[tb.BITWISE_RIGHT_SHIFT,new rx],[tb.BITWISE_UNSIGNED_RIGHT_SHIFT,new rL],[tb.BITWISE_XOR,new rC],[tb.AND,new rD],[tb.EQUAL,new rG],[tb.GREATER_THAN,new rH],[tb.GREATER_THAN_EQUAL,new rY],[tb.LESS_THAN,new rW],[tb.LESS_THAN_EQUAL,new r$],[tb.OR,new rz],[tb.NOT_EQUAL,new rJ],[tb.NULLISH_COALESCING_OPERATOR,new rE],[tb.ARRAY_OPERATOR,new rS],[tb.OBJECT_OPERATOR,new rQ]]);static UNARY_OPERATORS_MAP_KEY_SET=new Set(no.UNARY_OPERATORS_MAP.keys());expression;exp;internalTokenValueExtractor=new ni;constructor(e){e instanceof tG?(this.exp=e,this.expression=this.exp.getExpression()):this.expression=e}evaluate(e){let t=this.processNestingExpression(this.expression,e);return this.expression=t.getT1(),this.exp=t.getT2(),(e=new Map(e.entries())).set(this.internalTokenValueExtractor.getPrefix(),this.internalTokenValueExtractor),this.evaluateExpression(this.exp,e)}processNestingExpression(e,t){let r=0,n=0,a=new eR;for(;n<e.length-1;){if("{"==e.charAt(n)&&"{"==e.charAt(n+1))0==r&&a.push(new ew(n+2,-1)),r++,n++;else if("}"==e.charAt(n)&&"}"==e.charAt(n+1)){if(--r<0)throw new tv(e,"Expecting {{ nesting path operator to be started before closing");0==r&&a.push(a.pop().setT2(n)),n++}n++}let s=this.replaceNestingExpression(e,t,a);return new ew(s,new tG(s))}replaceNestingExpression(e,t,r){let n=e;for(let a of r.toArray()){if(-1==a.getT2())throw new tv(e,"Expecting }} nesting path operator to be closed");let r=new no(n.substring(a.getT1(),a.getT2())).evaluate(t);n=n.substring(0,a.getT1()-2)+r+n.substring(a.getT2()+2)}return n}getExpression(){return this.exp||(this.exp=new tG(this.expression)),this.exp}getExpressionString(){return this.expression}evaluateExpression(e,t){let r=e.getOperations(),n=e.getTokens();for(;!r.isEmpty();){let e=r.pop(),a=n.pop();if(no.UNARY_OPERATORS_MAP_KEY_SET.has(e))n.push(this.applyUnaryOperation(e,this.getValueFromToken(t,a)));else if(e==tb.OBJECT_OPERATOR||e==tb.ARRAY_OPERATOR)this.processObjectOrArrayOperator(t,r,n,e,a);else if(e==tb.CONDITIONAL_TERNARY_OPERATOR){let r=n.pop(),s=n.pop(),i=this.getValueFromToken(t,s),o=this.getValueFromToken(t,r),E=this.getValueFromToken(t,a);n.push(this.applyTernaryOperation(e,i,o,E))}else{let r=n.pop(),s=this.getValueFromToken(t,r),i=this.getValueFromToken(t,a);n.push(this.applyBinaryOperation(e,s,i))}}if(n.isEmpty())throw new e8(ep.format("Expression : $ evaluated to null",e));if(1!=n.size())throw new e8(ep.format("Expression : $ evaluated multiple values $",e,n));let a=n.get(0);if(a instanceof tV)return a.getElement();if(!(a instanceof tG))return this.getValueFromToken(t,a);throw new e8(ep.format("Expression : $ evaluated to $",e,n.get(0)))}processObjectOrArrayOperator(e,t,r,n,a){let s=new eR,i=new eR;if(!n||!a)return;do i.push(n),a instanceof tG?s.push(new tV(a.toString(),this.evaluateExpression(a,e))):a&&s.push(a),a=r.isEmpty()?void 0:r.pop(),n=t.isEmpty()?void 0:t.pop();while(n==tb.OBJECT_OPERATOR||n==tb.ARRAY_OPERATOR)a&&(a instanceof tG?s.push(new tV(a.toString(),this.evaluateExpression(a,e))):s.push(a)),n&&t.push(n);let o=s.pop();if(o instanceof tV&&"object"==typeof o.getTokenValue()){let e=new Date().getTime()+""+Math.round(1e3*Math.random());this.internalTokenValueExtractor.addValue(e,o.getTokenValue()),o=new tU(ni.PREFIX+e)}let E=new ty(o instanceof tV?o.getTokenValue():o.toString());for(;!s.isEmpty();)o=s.pop(),n=i.pop(),E.append(n.getOperator()).append(o instanceof tV?o.getTokenValue():o.toString()),n==tb.ARRAY_OPERATOR&&E.append("]");let u=E.toString(),l=u.substring(0,u.indexOf(".")+1);if(l.length>2&&e.has(l))r.push(new tV(u,this.getValue(u,e)));else{let e;try{e=nt.INSTANCE.getValue(u)}catch(t){e=u}r.push(new tV(u,e))}}applyTernaryOperation(e,t,r,n){let a=no.TERNARY_OPERATORS_MAP.get(e);if(!a)throw new tv(this.expression,ep.format("No operator found to evaluate $",this.getExpression()));return new tV(e.toString(),a.apply(t,r,n))}applyBinaryOperation(e,t,r){let n=typeof t,a=typeof r,s=no.BINARY_OPERATORS_MAP.get(e);if(("object"===n||"object"===a)&&e!==tb.EQUAL&&e!==tb.NOT_EQUAL&&e!==tb.NULLISH_COALESCING_OPERATOR&&e!==tb.AND&&e!==tb.OR)throw new tv(this.expression,ep.format("Cannot evaluate expression $ $ $",t,e.getOperator(),r));if(!s)throw new tv(this.expression,ep.format("No operator found to evaluate $ $ $",t,e.getOperator(),r));return new tV(e.toString(),s.apply(t,r))}applyUnaryOperation(e,t){let r=typeof t;if(e.getOperator()!=tb.NOT.getOperator()&&e.getOperator()!=tb.UNARY_LOGICAL_NOT.getOperator()&&("object"===r||Array.isArray(t)))throw new tv(this.expression,ep.format("The operator $ cannot be applied to $",e.getOperator(),t));let n=no.UNARY_OPERATORS_MAP.get(e);if(!n)throw new tv(this.expression,ep.format("No Unary operator $ is found to apply on $",e.getOperator(),t));return new tV(e.toString(),n.apply(t))}getValueFromToken(e,t){return t instanceof tG?this.evaluateExpression(t,e):t instanceof tV?t.getElement():this.getValue(t.getExpression(),e)}getValue(e,t){let r=e.substring(0,e.indexOf(".")+1);return t.has(r)?t.get(r).getValue(e):nt.INSTANCE.getValueFromExtractors(e,t)}}const nE="name",nu="value",nl=new el("Set").setNamespace(R.SYSTEM_CTX).setParameters(new Map([W.ofEntry(nE,new Y().setName(nE).setType(x.of(E.STRING)).setMinLength(1),!1),W.ofEntry(nu,Y.ofAny(nu))])).setEvents(new Map([en.outputEventMapEntry(new Map)])),nA="value",ng="eventName",nc="results",nm=new el("GenerateEvent").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(ng,Y.ofString(ng).setDefaultValue("output")),W.ofEntry(nc,Y.ofObject(nc).setProperties(new Map([["name",Y.ofString("name")],[nA,W.EXPRESSION]])),!0)])).setEvents(new Map([en.outputEventMapEntry(new Map)]));class nT extends e1{static CONDITION="condition";static SIGNATURE=new el("If").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(nT.CONDITION,Y.ofAny(nT.CONDITION))])).setEvents(new Map([en.eventMapEntry(en.TRUE,new Map),en.eventMapEntry(en.FALSE,new Map),en.outputEventMapEntry(new Map)]));getSignature(){return nT.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nT.CONDITION);return new eE([ea.of(t||""===t?en.TRUE:en.FALSE,new Map),ea.outputOf(new Map)])}}const np="stepName",nR=new el("Break").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(np,Y.of(np,E.STRING))])).setEvents(new Map([en.outputEventMapEntry(new Map([]))])),nh="count",nf="value",nN="index",n_=new el("CountLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nh,Y.of(nh,E.INTEGER))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nN,Y.of(nN,E.INTEGER)]])),en.outputEventMapEntry(new Map([[nf,Y.of(nf,E.INTEGER)]]))])),nS="source",nM="each",nw="index",nO="value",nd=new el("ForEachLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nS,Y.ofArray(nS,Y.ofAny(nS)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nw,Y.of(nw,E.INTEGER)],[nM,Y.ofAny(nM)]])),en.outputEventMapEntry(new Map([[nO,Y.of(nO,E.INTEGER)]]))])),nI="from",nP="step",ny="value",nx="index",nv=new el("RangeLoop").setNamespace(R.SYSTEM_LOOP).setParameters(new Map([W.ofEntry(nI,Y.of(nI,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(0)),W.ofEntry("to",Y.of("to",E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(1)),W.ofEntry(nP,Y.of(nP,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE).setDefaultValue(1).setNot(new Y().setConstant(0)))])).setEvents(new Map([en.eventMapEntry(en.ITERATION,new Map([[nx,Y.of(nx,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)]])),en.outputEventMapEntry(new Map([[ny,Y.of(ny,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE)]]))])),nL="value",nU=new el("Add").setNamespace(R.MATH).setParameters(new Map([[nL,new W(nL,Y.ofNumber(nL)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nL,Y.ofNumber(nL)]]))])),nC="value",nV="value1",nD="value2",nb=[()=>new Map([[nC,new W(nC,Y.ofNumber(nC))]]),()=>new Map([[nV,new W(nV,Y.ofNumber(nV))],[nD,new W(nD,Y.ofNumber(nD))]])];class nG extends e1{signature;parametersNumber;mathFunction;constructor(e,t,r=1,...n){super(),n&&n.length||(n=[E.DOUBLE]),this.parametersNumber=r,this.mathFunction=t,this.signature=new el(e).setNamespace(R.MATH).setParameters(nb[r-1]()).setEvents(new Map([en.outputEventMapEntry(new Map([[nC,new Y().setType(x.of(...n)).setName(nC)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t,r=te.findPrimitiveNumberType(e.getArguments()?.get(1==this.parametersNumber?nC:nV)).getT2();return 2==this.parametersNumber&&(t=te.findPrimitiveNumberType(e.getArguments()?.get(nD)).getT2()),new eE([ea.outputOf(new Map([[nC,this.mathFunction.call(this,r,t)]]))])}}const nF="value";class nY extends e1{static SIGNATURE=new el("Hypotenuse").setNamespace(R.MATH).setParameters(new Map([[nF,new W(nF,Y.ofNumber(nF)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nF,new Y().setType(x.of(E.DOUBLE)).setName(nF)]]))]));constructor(){super()}getSignature(){return nY.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nF);return new eE([ea.outputOf(new Map([[nF,Math.sqrt(t.reduce((e,t)=>e+=t*t,0))]]))])}}const nB="value",nH=new el("Maximum").setNamespace(R.MATH).setParameters(new Map([[nB,new W(nB,Y.ofNumber(nB)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nB,Y.ofNumber(nB)]]))])),nk="value",n$=new el("Minimum").setNamespace(R.MATH).setParameters(new Map([[nk,new W(nk,Y.ofNumber(nk)).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[nk,Y.ofNumber(nk)]]))])),nj="value";class nW extends e1{static SIGNATURE=new el("Random").setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nj,Y.ofDouble(nj)))]));getSignature(){return nW.SIGNATURE}async internalExecute(e){return new eE([ea.outputOf(new Map([[nj,Math.random()]]))])}}class nX extends e1{static MIN_VALUE="minValue";static MAX_VALUE="maxValue";static VALUE="value";static SIGNATURE=new el("RandomFloat").setParameters(Z.of(nX.MIN_VALUE,W.of(nX.MIN_VALUE,Y.ofFloat(nX.MIN_VALUE).setDefaultValue(0)),nX.MAX_VALUE,W.of(nX.MAX_VALUE,Y.ofFloat(nX.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nX.VALUE,Y.ofFloat(nX.VALUE)))]));getSignature(){return nX.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nX.MIN_VALUE),r=Math.random()*(e.getArguments()?.get(nX.MAX_VALUE)-t)+t;return new eE([ea.outputOf(new Map([[nX.VALUE,r]]))])}}class nJ extends e1{static MIN_VALUE="minValue";static MAX_VALUE="maxValue";static VALUE="value";static SIGNATURE=new el("RandomInt").setParameters(Z.of(nJ.MIN_VALUE,W.of(nJ.MIN_VALUE,Y.ofInteger(nJ.MIN_VALUE).setDefaultValue(0)),nJ.MAX_VALUE,W.of(nJ.MAX_VALUE,Y.ofInteger(nJ.MAX_VALUE).setDefaultValue(0x7fffffff)))).setNamespace(R.MATH).setEvents(new Map([en.outputEventMapEntry(Z.of(nJ.VALUE,Y.ofInteger(nJ.VALUE)))]));getSignature(){return nJ.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(nJ.MIN_VALUE),r=Math.floor(Math.random()*(e.getArguments()?.get(nJ.MAX_VALUE)-t)+t);return new eE([ea.outputOf(new Map([[nJ.VALUE,r]]))])}}const nq={Absolute:new nG("Absolute",e=>Math.abs(e),1,E.INTEGER,E.LONG,E.FLOAT,E.DOUBLE),ArcCosine:new nG("ArcCosine",e=>Math.acos(e)),ArcSine:new nG("ArcSine",e=>Math.asin(e)),ArcTangent:new nG("ArcTangent",e=>Math.atan(e)),Ceiling:new nG("Ceiling",e=>Math.ceil(e)),Cosine:new nG("Cosine",e=>Math.cos(e)),HyperbolicCosine:new nG("HyperbolicCosine",e=>Math.cosh(e)),CubeRoot:new nG("CubeRoot",e=>Math.cbrt(e)),Exponential:new nG("Exponential",e=>Math.exp(e)),ExponentialMinus1:new nG("ExponentialMinus1",e=>Math.expm1(e)),Floor:new nG("Floor",e=>Math.floor(e)),LogNatural:new nG("LogNatural",e=>Math.log(e)),Log10:new nG("Log10",e=>Math.log10(e)),Round:new nG("Round",e=>Math.round(e),1,E.INTEGER,E.LONG),Sine:new nG("Sine",e=>Math.sin(e)),HyperbolicSine:new nG("HyperbolicSine",e=>Math.sinh(e)),Tangent:new nG("Tangent",e=>Math.tan(e)),HyperbolicTangent:new nG("HyperbolicTangent",e=>Math.tanh(e)),ToDegrees:new nG("ToDegrees",e=>Math.PI/180*e),ToRadians:new nG("ToRadians",e=>180/Math.PI*e),SquareRoot:new nG("SquareRoot",e=>Math.sqrt(e)),ArcTangent2:new nG("ArcTangent2",(e,t)=>Math.atan2(e,t),2),Power:new nG("Power",(e,t)=>Math.pow(e,t),2),Add:new class extends e1{getSignature(){return nU}async internalExecute(e){let t=e.getArguments()?.get(nL);return new eE([ea.outputOf(new Map([[nL,t.reduce((e,t)=>e+=t,0)]]))])}},Hypotenuse:new nY,Maximum:new class extends e1{getSignature(){return nH}async internalExecute(e){let t=e.getArguments()?.get(nB);return new eE([ea.outputOf(new Map([[nB,t.reduce((e,t)=>!e&&0!==e||t>e?t:e)]]))])}},Minimum:new class extends e1{getSignature(){return n$}async internalExecute(e){let t=e.getArguments()?.get(nk);return new eE([ea.outputOf(new Map([[nk,t.reduce((e,t)=>!e&&0!==e||t<e?t:e)]]))])}},Random:new nW,RandomFloat:new nX,RandomInt:new nJ},nz=Object.values(nq).map(e=>e.getSignature().getFullName());class nK{async find(e,t){return e!=R.MATH?Promise.resolve(void 0):Promise.resolve(nq[t])}async filter(e){return Promise.resolve(nz.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}const nQ="value",nZ="source",n0="source";class n1 extends e1{signature;constructor(e,t){super(),this.signature=new el(e).setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(n0,Y.ofAny(n0))])).setEvents(new Map([en.outputEventMapEntry(new Map([["value",t]]))]))}getSignature(){return this.signature}}const n2="value",n9="value",n4="value",n3="source",n6="overwrite",n5="deleteKeyOnNull",n7="value",n8={ObjectValues:new class extends n1{constructor(){super("ObjectValues",Y.ofArray(n7,Y.ofAny(n7)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n7,[]]]))]);let r=Object.entries(ti(t)).sort((e,t)=>e[0].localeCompare(t[0])).map(e=>e[1]);return new eE([ea.outputOf(new Map([[n7,r]]))])}},ObjectKeys:new class extends n1{constructor(){super("ObjectKeys",Y.ofArray(n9,Y.ofString(n9)))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n9,[]]]))]);let r=Object.keys(ti(t)).sort((e,t)=>e.localeCompare(t));return new eE([ea.outputOf(new Map([[n9,r]]))])}},ObjectEntries:new class extends n1{constructor(){super("ObjectEntries",Y.ofArray(n2,Y.ofArray("tuple",Y.ofString("key"),Y.ofAny("value"))))}async internalExecute(e){var t=e.getArguments()?.get("source");if(N(t))return new eE([ea.outputOf(new Map([[n2,[]]]))]);let r=Object.entries(ti(t)).sort((e,t)=>e[0].localeCompare(t[0]));return new eE([ea.outputOf(new Map([[n2,r]]))])}},ObjectDeleteKey:new class extends e1{signature;constructor(){super(),this.signature=new el("ObjectDeleteKey").setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(nZ,Y.ofAny(nZ)),W.ofEntry("key",Y.ofString("key"))])).setEvents(new Map([en.outputEventMapEntry(new Map([[nQ,Y.ofAny(nQ)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(nZ),r=e.getArguments()?.get("key");return N(t)?new eE([ea.outputOf(new Map([[nQ,void 0]]))]):(t=ti(t),delete t[r],new eE([ea.outputOf(new Map([[nQ,t]]))]))}},ObjectPutValue:new class extends e1{signature;constructor(){super(),this.signature=new el("ObjectPutValue").setNamespace(R.SYSTEM_OBJECT).setParameters(new Map([W.ofEntry(n3,Y.ofObject(n3)),W.ofEntry("key",Y.ofString("key")),W.ofEntry(n4,Y.ofAny(n4)),W.ofEntry(n6,Y.ofBoolean(n6).setDefaultValue(!0)),W.ofEntry(n5,Y.ofBoolean(n5).setDefaultValue(!1))])).setEvents(new Map([en.outputEventMapEntry(new Map([[n4,Y.ofObject(n4)]]))]))}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(n3),r=e.getArguments()?.get("key"),n=e.getArguments()?.get(n4),a=e.getArguments()?.get(n6),s=e.getArguments()?.get(n5),i=new tB(t,"Data.");return i.setValue(r,n,a,s),new eE([ea.outputOf(new Map([[n4,i.getStore()]]))])}}},ae=Object.values(n8).map(e=>e.getSignature().getFullName());class at{async find(e,t){return e!=R.SYSTEM_OBJECT?Promise.resolve(void 0):Promise.resolve(n8[t])}async filter(e){return Promise.resolve(ae.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class ar extends e1{static VALUES="values";static SIGNATURE=new el("Print").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(ar.VALUES,Y.ofAny(ar.VALUES),!0)]));getSignature(){return ar.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(ar.VALUES);return console?.log(...t),new eE([ea.outputOf(new Map)])}}class an extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_SEARCH_STRING_NAME="searchString";static PARAMETER_SECOND_STRING_NAME="secondString";static PARAMETER_THIRD_STRING_NAME="thirdString";static PARAMETER_INDEX_NAME="index";static PARAMETER_SECOND_INDEX_NAME="secondIndex";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(an.PARAMETER_STRING_NAME,Y.ofString(an.PARAMETER_STRING_NAME));static PARAMETER_SECOND_STRING=new W(an.PARAMETER_SECOND_STRING_NAME,Y.ofString(an.PARAMETER_SECOND_STRING_NAME));static PARAMETER_THIRD_STRING=new W(an.PARAMETER_THIRD_STRING_NAME,Y.ofString(an.PARAMETER_THIRD_STRING_NAME));static PARAMETER_INDEX=new W(an.PARAMETER_INDEX_NAME,Y.ofInteger(an.PARAMETER_INDEX_NAME));static PARAMETER_SECOND_INDEX=new W(an.PARAMETER_SECOND_INDEX_NAME,Y.ofInteger(an.PARAMETER_SECOND_INDEX_NAME));static PARAMETER_SEARCH_STRING=new W(an.PARAMETER_SEARCH_STRING_NAME,Y.ofString(an.PARAMETER_STRING_NAME));static EVENT_STRING=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofString(an.EVENT_RESULT_NAME)));static EVENT_BOOLEAN=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofBoolean(an.EVENT_RESULT_NAME)));static EVENT_INT=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofInteger(an.EVENT_RESULT_NAME)));static EVENT_ARRAY=new en(en.OUTPUT,Z.of(an.EVENT_RESULT_NAME,Y.ofArray(an.EVENT_RESULT_NAME)));signature;constructor(e,t,r,...n){super();let a=new Map;n.forEach(e=>a.set(e.getParameterName(),e)),this.signature=new el(t).setNamespace(e).setParameters(a).setEvents(Z.of(r.getName(),r))}getSignature(){return this.signature}static ofEntryAsStringBooleanOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_BOOLEAN,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING)]}static ofEntryAsStringAndIntegerStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING,an.PARAMETER_INDEX)]}static ofEntryAsStringIntegerOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING)]}static ofEntryString(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING)]}static ofEntryStringBooleanOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r)))])}}(R.STRING,e,an.EVENT_BOOLEAN,an.PARAMETER_STRING)]}static ofEntryAsStringStringIntegerIntegerOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SEARCH_STRING_NAME),a=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_SEARCH_STRING,an.PARAMETER_INDEX)]}static ofEntryAsStringIntegerIntegerStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_INDEX_NAME),a=e?.getArguments()?.get(an.PARAMETER_SECOND_INDEX_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_INT,an.PARAMETER_STRING,an.PARAMETER_INDEX,an.PARAMETER_SECOND_INDEX)]}static ofEntryAsStringStringStringStringOutput(e,t){return[e,new class extends an{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e?.getArguments()?.get(an.PARAMETER_STRING_NAME),n=e?.getArguments()?.get(an.PARAMETER_SECOND_STRING_NAME),a=e?.getArguments()?.get(an.PARAMETER_THIRD_STRING_NAME);return new eE([ea.outputOf(Z.of(an.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.STRING,e,an.EVENT_STRING,an.PARAMETER_STRING,an.PARAMETER_SECOND_STRING,an.PARAMETER_THIRD_STRING)]}}class aa extends e1{static VALUE="value";static SCHEMA=new Y().setName(aa.VALUE).setType(new y(E.STRING));static SIGNATURE=new el("Concatenate").setNamespace(R.STRING).setParameters(new Map([[aa.VALUE,new W(aa.VALUE,aa.SCHEMA).setVariableArgument(!0)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[aa.VALUE,Y.ofString(aa.VALUE)]]))]));constructor(){super()}getSignature(){return aa.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(aa.VALUE),r="";return t.reduce((e,t)=>r=e+t,r),new eE([ea.outputOf(new Map([[aa.VALUE,r]]))])}}class as extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_START_NAME="startPosition";static PARAMETER_AT_END_NAME="endPosition";static EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(as.PARAMETER_STRING_NAME,Y.ofString(as.PARAMETER_STRING_NAME));PARAMETER_AT_START=new W(as.PARAMETER_AT_START_NAME,Y.ofInteger(as.PARAMETER_AT_START_NAME));PARAMETER_AT_END=new W(as.PARAMETER_AT_END_NAME,Y.ofInteger(as.PARAMETER_AT_END_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[as.EVENT_RESULT_NAME,Y.ofString(as.EVENT_RESULT_NAME)]]));signature=new el("DeleteForGivenLength").setNamespace(R.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_START.getParameterName(),this.PARAMETER_AT_START],[this.PARAMETER_AT_END.getParameterName(),this.PARAMETER_AT_END]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]));constructor(){super()}getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(as.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(as.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(as.PARAMETER_AT_END_NAME);if(n>=r){let e="";return e+=t.substring(0,r)+t.substring(n),new eE([ea.outputOf(new Map([[as.EVENT_RESULT_NAME,e.toString()]]))])}return new eE([ea.outputOf(new Map([[as.EVENT_RESULT_NAME,t]]))])}}class ai extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_POSITION_NAME="position";static PARAMETER_INSERT_STRING_NAME="insertString";EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(ai.PARAMETER_STRING_NAME,Y.ofString(ai.PARAMETER_STRING_NAME));PARAMETER_AT_POSITION=new W(ai.PARAMETER_AT_POSITION_NAME,Y.ofInteger(ai.PARAMETER_AT_POSITION_NAME));PARAMETER_INSERT_STRING=new W(ai.PARAMETER_INSERT_STRING_NAME,Y.ofString(ai.PARAMETER_INSERT_STRING_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]));signature=new el("InsertAtGivenPosition").setNamespace(R.STRING).setParameters(new Map([[this.PARAMETER_STRING.getParameterName(),this.PARAMETER_STRING],[this.PARAMETER_AT_POSITION.getParameterName(),this.PARAMETER_AT_POSITION],[this.PARAMETER_INSERT_STRING.getParameterName(),this.PARAMETER_INSERT_STRING]])).setEvents(new Map([en.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]))]));getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(ai.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(ai.PARAMETER_AT_POSITION_NAME),n=e?.getArguments()?.get(ai.PARAMETER_INSERT_STRING_NAME),a="";return a+=t.substring(0,r)+n+t.substring(r),new eE([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,a]]))])}}class ao extends e1{static PARAMETER_REGEX_NAME="regex";static PARAMETER_STRING_NAME="string";static EVENT_RESULT_NAME="result";static signature=new el("Matches").setNamespace(R.STRING).setParameters(Z.ofEntries(Z.entry(...W.ofEntry(ao.PARAMETER_REGEX_NAME,Y.ofString(ao.PARAMETER_REGEX_NAME))),Z.entry(...W.ofEntry(ao.PARAMETER_STRING_NAME,Y.ofString(ao.PARAMETER_STRING_NAME))))).setEvents(Z.ofEntries(Z.entry(...en.outputEventMapEntry(new Map([[ao.EVENT_RESULT_NAME,Y.ofBoolean(ao.EVENT_RESULT_NAME)]])))));getSignature(){return ao.signature}async internalExecute(e){let t=e.getArguments()?.get(ao.PARAMETER_REGEX_NAME),r=e.getArguments()?.get(ao.PARAMETER_STRING_NAME);return new eE([ea.outputOf(new Map([[ao.EVENT_RESULT_NAME,!!r.match(t)?.length]]))])}}class aE extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_POSTPAD_STRING_NAME="postpadString";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aE.PARAMETER_STRING_NAME,Y.ofString(aE.PARAMETER_STRING_NAME));static PARAMETER_POSTPAD_STRING=new W(aE.PARAMETER_POSTPAD_STRING_NAME,Y.ofString(aE.PARAMETER_POSTPAD_STRING_NAME));static PARAMETER_LENGTH=new W(aE.PARAMETER_LENGTH_NAME,Y.ofInteger(aE.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aE.EVENT_RESULT_NAME,Y.ofString(aE.EVENT_RESULT_NAME)]]));signature=new el("PostPad").setNamespace(R.STRING).setParameters(new Map([[aE.PARAMETER_STRING.getParameterName(),aE.PARAMETER_STRING],[aE.PARAMETER_POSTPAD_STRING.getParameterName(),aE.PARAMETER_POSTPAD_STRING],[aE.PARAMETER_LENGTH.getParameterName(),aE.PARAMETER_LENGTH]])).setEvents(new Map([[aE.EVENT_STRING.getName(),aE.EVENT_STRING]]));constructor(){super()}getSignature(){return this.signature}async internalExecute(e){let t=e.getArguments()?.get(aE.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(aE.PARAMETER_POSTPAD_STRING_NAME),n=e.getArguments()?.get(aE.PARAMETER_LENGTH_NAME),a="",s=r.length;for(a+=t;s<=n;)a+=r,s+=r.length;return a.length-t.length<n&&(a+=r.substring(0,n-(a.length-t.length))),new eE([ea.outputOf(new Map([[aE.EVENT_RESULT_NAME,a.toString()]]))])}}class au extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_PREPAD_STRING_NAME="prepadString";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(au.PARAMETER_STRING_NAME,Y.ofString(au.PARAMETER_STRING_NAME));static PARAMETER_PREPAD_STRING=new W(au.PARAMETER_PREPAD_STRING_NAME,Y.ofString(au.PARAMETER_PREPAD_STRING_NAME));static PARAMETER_LENGTH=new W(au.PARAMETER_LENGTH_NAME,Y.ofInteger(au.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[au.EVENT_RESULT_NAME,Y.ofString(au.EVENT_RESULT_NAME)]]));signature=new el("PrePad").setNamespace(R.STRING).setParameters(new Map([[au.PARAMETER_STRING.getParameterName(),au.PARAMETER_STRING],[au.PARAMETER_PREPAD_STRING.getParameterName(),au.PARAMETER_PREPAD_STRING],[au.PARAMETER_LENGTH.getParameterName(),au.PARAMETER_LENGTH]])).setEvents(new Map([[au.EVENT_STRING.getName(),au.EVENT_STRING]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(au.PARAMETER_STRING_NAME),r=e.getArguments()?.get(au.PARAMETER_PREPAD_STRING_NAME),n=e.getArguments()?.get(au.PARAMETER_LENGTH_NAME),a="",s=r.length;for(;s<=n;)a+=r,s+=r.length;return a.length<n&&(a+=r.substring(0,n-a.length)),a+=t,new eE([ea.outputOf(new Map([[au.EVENT_RESULT_NAME,a]]))])}}class al extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_BOOLEAN_NAME="boolean";static PARAMETER_FIRST_OFFSET_NAME="firstOffset";static PARAMETER_OTHER_STRING_NAME="otherString";static PARAMETER_SECOND_OFFSET_NAME="secondOffset";static PARAMETER_INTEGER_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(al.PARAMETER_STRING_NAME,Y.ofString(al.PARAMETER_STRING_NAME));static PARAMETER_OTHER_STRING=new W(al.PARAMETER_OTHER_STRING_NAME,Y.ofString(al.PARAMETER_OTHER_STRING_NAME));static PARAMETER_FIRST_OFFSET=new W(al.PARAMETER_FIRST_OFFSET_NAME,Y.ofInteger(al.PARAMETER_FIRST_OFFSET_NAME));static PARAMETER_SECOND_OFFSET=new W(al.PARAMETER_SECOND_OFFSET_NAME,Y.ofInteger(al.PARAMETER_SECOND_OFFSET_NAME));static PARAMETER_INTEGER=new W(al.PARAMETER_INTEGER_NAME,Y.ofInteger(al.PARAMETER_INTEGER_NAME));static PARAMETER_BOOLEAN=new W(al.PARAMETER_BOOLEAN_NAME,Y.ofBoolean(al.PARAMETER_BOOLEAN_NAME));static EVENT_BOOLEAN=new en(en.OUTPUT,new Map([[al.EVENT_RESULT_NAME,Y.ofBoolean(al.EVENT_RESULT_NAME)]]));signature=new el("RegionMatches").setNamespace(R.STRING).setParameters(new Map([[al.PARAMETER_STRING.getParameterName(),al.PARAMETER_STRING],[al.PARAMETER_BOOLEAN.getParameterName(),al.PARAMETER_BOOLEAN],[al.PARAMETER_FIRST_OFFSET.getParameterName(),al.PARAMETER_FIRST_OFFSET],[al.PARAMETER_OTHER_STRING.getParameterName(),al.PARAMETER_OTHER_STRING],[al.PARAMETER_SECOND_OFFSET.getParameterName(),al.PARAMETER_SECOND_OFFSET],[al.PARAMETER_INTEGER.getParameterName(),al.PARAMETER_INTEGER]])).setEvents(new Map([[al.EVENT_BOOLEAN.getName(),al.EVENT_BOOLEAN]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(al.PARAMETER_STRING_NAME),r=e.getArguments()?.get(al.PARAMETER_BOOLEAN_NAME),n=e.getArguments()?.get(al.PARAMETER_FIRST_OFFSET_NAME),a=e?.getArguments()?.get(al.PARAMETER_OTHER_STRING_NAME),s=e?.getArguments()?.get(al.PARAMETER_SECOND_OFFSET_NAME),i=e.getArguments()?.get(al.PARAMETER_INTEGER_NAME),o=!1;return o=!(n<0)&&!(s<0)&&!(n+i>t.length)&&!(s+i>a.length)&&(r?(t=t.substring(n,n+i).toUpperCase())==a.substring(s,s+i).toUpperCase():(t=t.substring(n,n+i))==a.substring(s,i)),new eE([ea.outputOf(new Map([[al.EVENT_RESULT_NAME,o]]))])}}class aA extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_AT_START_NAME="startPosition";static PARAMETER_AT_LENGTH_NAME="lengthPosition";static PARAMETER_REPLACE_STRING_NAME="replaceString";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aA.PARAMETER_STRING_NAME,Y.ofString(aA.PARAMETER_STRING_NAME));static PARAMETER_AT_START=new W(aA.PARAMETER_AT_START_NAME,Y.ofInteger(aA.PARAMETER_AT_START_NAME));static PARAMETER_AT_LENGTH=new W(aA.PARAMETER_AT_LENGTH_NAME,Y.ofInteger(aA.PARAMETER_AT_LENGTH_NAME));static PARAMETER_REPLACE_STRING=new W(aA.PARAMETER_REPLACE_STRING_NAME,Y.ofString(aA.PARAMETER_REPLACE_STRING_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aA.EVENT_RESULT_NAME,Y.ofString(aA.EVENT_RESULT_NAME)]]));constructor(){super()}signature=new el("ReplaceAtGivenPosition").setNamespace(R.STRING).setParameters(new Map([[aA.PARAMETER_STRING.getParameterName(),aA.PARAMETER_STRING],[aA.PARAMETER_AT_START.getParameterName(),aA.PARAMETER_AT_START],[aA.PARAMETER_AT_LENGTH.getParameterName(),aA.PARAMETER_AT_LENGTH],[aA.PARAMETER_REPLACE_STRING.getParameterName(),aA.PARAMETER_REPLACE_STRING]])).setEvents(new Map([[aA.EVENT_STRING.getName(),aA.EVENT_STRING]]));getSignature(){return this.signature}async internalExecute(e){let t=e?.getArguments()?.get(aA.PARAMETER_STRING_NAME),r=e?.getArguments()?.get(aA.PARAMETER_AT_START_NAME),n=e?.getArguments()?.get(aA.PARAMETER_AT_LENGTH_NAME);return e?.getArguments()?.get(aA.PARAMETER_REPLACE_STRING_NAME),t.length,r<n&&(t.substring(0,r),t.substring(r+n)),new eE([ea.outputOf(new Map([[aA.EVENT_RESULT_NAME,t]]))])}}class ag extends e1{VALUE="value";SIGNATURE=new el("Reverse").setNamespace(R.STRING).setParameters(new Map([[this.VALUE,new W(this.VALUE,Y.ofString(this.VALUE)).setVariableArgument(!1)]])).setEvents(new Map([en.outputEventMapEntry(new Map([[this.VALUE,new Y().setType(x.of(E.STRING)).setName(this.VALUE)]]))]));constructor(){super()}getSignature(){return this.SIGNATURE}async internalExecute(e){let t=e.getArguments()?.get(this.VALUE),r=t.length-1,n="";for(;r>=0;)n+=t.charAt(r--);return new eE([ea.outputOf(Z.of(this.VALUE,n))])}}class ac extends e1{PARAMETER_STRING_NAME="string";PARAMETER_SPLIT_STRING_NAME="searchString";EVENT_RESULT_NAME="result";PARAMETER_STRING=new W(this.PARAMETER_STRING_NAME,Y.ofString(this.PARAMETER_STRING_NAME));PARAMETER_SPLIT_STRING=new W(this.PARAMETER_SPLIT_STRING_NAME,Y.ofString(this.PARAMETER_SPLIT_STRING_NAME));EVENT_ARRAY=new en(en.OUTPUT,Z.of(this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)));getSignature(){return new el("Split").setNamespace(R.STRING).setParameters(new Map([[this.PARAMETER_STRING_NAME,this.PARAMETER_STRING],[this.PARAMETER_SPLIT_STRING_NAME,this.PARAMETER_SPLIT_STRING]])).setEvents(new Map([en.outputEventMapEntry(new Map([[this.EVENT_RESULT_NAME,Y.ofArray(this.EVENT_RESULT_NAME)]]))]))}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_STRING_NAME),r=e.getArguments()?.get(this.PARAMETER_SPLIT_STRING_NAME);return new eE([ea.outputOf(Z.of(this.EVENT_RESULT_NAME,t.split(r)))])}}class am extends e1{PARAMETER_INPUT_ANYTYPE_NAME="anytype";EVENT_RESULT_NAME="result";PARAMETER_INPUT_ANYTYPE=new W(this.PARAMETER_INPUT_ANYTYPE_NAME,Y.ofAny(this.PARAMETER_INPUT_ANYTYPE_NAME));EVENT_STRING=new en(en.OUTPUT,new Map([[this.EVENT_RESULT_NAME,Y.ofString(this.EVENT_RESULT_NAME)]]));getSignature(){return new el("ToString").setNamespace(R.STRING).setParameters(new Map([[this.PARAMETER_INPUT_ANYTYPE.getParameterName(),this.PARAMETER_INPUT_ANYTYPE]])).setEvents(new Map([[this.EVENT_STRING.getName(),this.EVENT_STRING]]))}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(this.PARAMETER_INPUT_ANYTYPE_NAME),r="";return r="object"==typeof t?JSON.stringify(t,void 0,2):""+t,new eE([ea.outputOf(new Map([[this.EVENT_RESULT_NAME,r]]))])}}class aT extends e1{static PARAMETER_STRING_NAME="string";static PARAMETER_LENGTH_NAME="length";static EVENT_RESULT_NAME="result";static PARAMETER_STRING=new W(aT.PARAMETER_STRING_NAME,Y.ofString(aT.PARAMETER_STRING_NAME));static PARAMETER_LENGTH=new W(aT.PARAMETER_LENGTH_NAME,Y.ofInteger(aT.PARAMETER_LENGTH_NAME));static EVENT_STRING=new en(en.OUTPUT,new Map([[aT.EVENT_RESULT_NAME,Y.ofString(aT.EVENT_RESULT_NAME)]]));signature=new el("TrimTo").setNamespace(R.STRING).setParameters(new Map([[aT.PARAMETER_STRING.getParameterName(),aT.PARAMETER_STRING],[aT.PARAMETER_LENGTH.getParameterName(),aT.PARAMETER_LENGTH]])).setEvents(new Map([[aT.EVENT_STRING.getName(),aT.EVENT_STRING]]));getSignature(){return this.signature}constructor(){super()}async internalExecute(e){let t=e.getArguments()?.get(aT.PARAMETER_STRING_NAME),r=e.getArguments()?.get(aT.PARAMETER_LENGTH_NAME);return new eE([ea.outputOf(new Map([[aT.EVENT_RESULT_NAME,t.substring(0,r)]]))])}}class ap{static repoMap=Z.ofArrayEntries(an.ofEntryString("Trim",e=>e.trim()),an.ofEntryString("LowerCase",e=>e.toLocaleLowerCase()),an.ofEntryString("UpperCase",e=>e.toUpperCase()),an.ofEntryStringBooleanOutput("IsBlank",e=>""===e.trim()),an.ofEntryStringBooleanOutput("IsEmpty",e=>""===e),an.ofEntryAsStringBooleanOutput("Contains",(e,t)=>-1!=e.indexOf(t)),an.ofEntryAsStringBooleanOutput("EndsWith",(e,t)=>e.endsWith(t)),an.ofEntryAsStringBooleanOutput("StartsWith",(e,t)=>e.startsWith(t)),an.ofEntryAsStringBooleanOutput("EqualsIgnoreCase",(e,t)=>e.toUpperCase()==t.toUpperCase()),an.ofEntryAsStringBooleanOutput("Matches",(e,t)=>new RegExp(t).test(e)),an.ofEntryAsStringIntegerOutput("IndexOf",(e,t)=>e.indexOf(t)),an.ofEntryAsStringIntegerOutput("LastIndexOf",(e,t)=>e.lastIndexOf(t)),an.ofEntryAsStringAndIntegerStringOutput("Repeat",(e,t)=>e.repeat(t)),an.ofEntryAsStringStringIntegerIntegerOutput("IndexOfWithStartPoint",(e,t,r)=>e.indexOf(t,r)),an.ofEntryAsStringStringIntegerIntegerOutput("LastIndexOfWithStartPoint",(e,t,r)=>e.lastIndexOf(t,r)),an.ofEntryAsStringStringStringStringOutput("Replace",(e,t,r)=>e.replaceAll(t,r)),an.ofEntryAsStringStringStringStringOutput("ReplaceFirst",(e,t,r)=>e.replace(t,r)),an.ofEntryAsStringIntegerIntegerStringOutput("SubString",(e,t,r)=>e.substring(t,r)),K(new aa),K(new as),K(new ai),K(new aE),K(new au),K(new al),K(new aA),K(new ag),K(new ac),K(new am),K(new aT),K(new ao));static filterableNames=Array.from(ap.repoMap.values()).map(e=>e.getSignature().getFullName());async find(e,t){return e!=R.STRING?Promise.resolve(void 0):Promise.resolve(ap.repoMap.get(t))}async filter(e){return Promise.resolve(ap.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class aR{constructor(){}static isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}static validYearRange(e){return e<275761&&e>-271821}static validMonthRange(e){return e<=12&&e>0}static validDate(e,t,r){if(r<=0||t<=0)return!1;switch(t){case 2:return aR.validYearRange(e)&&aR.validMonthRange(t)&&aR.isLeapYear(e)&&r<30||!aR.isLeapYear(e)&&r<29;case 4:case 6:case 9:case 11:return aR.validYearRange(e)&&aR.validMonthRange(t)&&r<=30;default:return aR.validYearRange(e)&&aR.validMonthRange(t)&&r<=31}}static validHourRange(e){return e<24&&e>=0}static validMinuteSecondRange(e){return e<60&&e>=0}static validMilliSecondRange(e){return e<1e3&&e>=0}static validateWithOptionalMillis(e){return aR.validMilliSecondRange(aR.convertToInt(e.substring(1,4)))&&aR.validateLocalTime(e.substring(4))}getYear(e){let t=e.charAt(0);if("+"==t||"-"==t){let r=aR.convertToInt(e.substring(1,7));return"-"==t?-1*r:r}return aR.convertToInt(e.substring(0,4))}static validateLocalTime(e){return"Z"==e.charAt(0)||6==e.length&&("+"==e.charAt(0)||"-"==e.charAt(0))&&aR.validHourRange(aR.convertToInt(e.substring(1,3)))&&":"==e.charAt(3)&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(4,e.length-1)))}static validate(e){if(e.length<20||e.length>32)return!1;let t=e.charAt(0);return"+"==t||"-"==t?"-"==e.charAt(7)&&"-"==e.charAt(10)&&"T"==e.charAt(13)&&":"==e.charAt(16)&&":"==e.charAt(19)&&"."==e.charAt(22)&&aR.validDate(aR.convertToInt(e.substring(1,7)),aR.convertToInt(e.substring(8,10)),aR.convertToInt(e.substring(11,13)))&&aR.validHourRange(aR.convertToInt(e.substring(14,16)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(17,19)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(20,22)))&&aR.validateWithOptionalMillis(e.substring(22)):"-"==e.charAt(4)&&"-"==e.charAt(7)&&"T"==e.charAt(10)&&":"==e.charAt(13)&&":"==e.charAt(16)&&"."==e.charAt(19)&&aR.validDate(aR.convertToInt(e.substring(0,4)),aR.convertToInt(e.substring(5,7)),aR.convertToInt(e.substring(8,10)))&&aR.validHourRange(aR.convertToInt(e.substring(11,13)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(14,16)))&&aR.validMinuteSecondRange(aR.convertToInt(e.substring(17,19)))&&aR.validateWithOptionalMillis(e.substring(19))}static convertToInt(e){var t=parseInt(e);return isNaN(t)?Number.MIN_VALUE:t}}class ah extends e1{signature;static EVENT_RESULT_NAME="result";static PARAMETER_DATE_NAME="isoDate";static PARAMETER_FIELD_NAME="value";static PARAMETER_INT_NAME="intValue";static PARAMETER_UNIT_NAME="unit";static PARAMETER_DATE=new W(ah.PARAMETER_DATE_NAME,Y.ofString(this.PARAMETER_DATE_NAME).setRef(R.DATE+".timeStamp"));static PARAMETER_FIELD=new W(ah.PARAMETER_FIELD_NAME,Y.ofInteger(this.PARAMETER_FIELD_NAME));static PARAMETER_INT=new W(ah.PARAMETER_INT_NAME,Y.ofInteger(this.PARAMETER_INT_NAME));static PARAMETER_UNIT=new W(ah.PARAMETER_UNIT_NAME,Y.ofString(this.PARAMETER_UNIT_NAME).setEnums(["YEAR","MONTH","DAY","HOUR","MINUTE","SECOND","MILLISECOND"]));static EVENT_INT=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofInteger(ah.EVENT_RESULT_NAME)));static EVENT_BOOLEAN=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofBoolean(ah.EVENT_RESULT_NAME)));static EVENT_DATE=new en(en.OUTPUT,Z.of(ah.EVENT_RESULT_NAME,Y.ofString(ah.EVENT_RESULT_NAME).setRef(R.DATE+".timeStamp")));getSignature(){return this.signature}constructor(e,t,r,...n){super();let a=new Map;n.forEach(e=>a.set(e.getParameterName(),e)),this.signature=new el(t).setNamespace(e).setParameters(a).setEvents(Z.of(r.getName(),r))}static ofEntryDateAndBooleanOutput(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date.");return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r)))])}}(R.DATE,e,ah.EVENT_BOOLEAN,ah.PARAMETER_DATE)]}static ofEntryDateAndIntegerOutput(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date object");return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r)))])}}(R.DATE,e,ah.EVENT_INT,ah.PARAMETER_DATE)]}static ofEntryDateWithIntegerUnitWithOutputName(e,t){return[e,new class extends ah{constructor(e,t,r,...n){super(e,t,r,...n)}async internalExecute(e){let r=e.getArguments()?.get(ah.PARAMETER_DATE_NAME);if(N(r)||!aR.validate(r))throw new eo("Please provide a valid date object");let n=e.getArguments()?.get(ah.PARAMETER_INT_NAME),a=e.getArguments()?.get(ah.PARAMETER_UNIT_NAME);return new eE([ea.outputOf(Z.of(ah.EVENT_RESULT_NAME,t(r,n,a)))])}}(R.DATE,e,ah.EVENT_DATE,ah.PARAMETER_DATE,ah.PARAMETER_INT,ah.PARAMETER_UNIT)]}}const af="result",aN="isoDate";class a_ extends e1{getSignature(){return new el("DateToEpoch").setNamespace(R.DATE).setParameters(Z.of(aN,W.of(aN,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[af,Y.ofLong(af)]]))]))}async internalExecute(e){var t=e.getArguments()?.get(aN);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t).getTime();return new eE([ea.of(af,Z.of(af,r))])}}const aS="isoDateOne",aM="isoDateTwo",aw=new el("DifferenceOfTimestamps").setNamespace(R.DATE).setParameters(new Map([[aS,new W(aS,Y.ofString(aS).setRef(R.DATE+".timeStamp"))],[aM,new W(aM,Y.ofString(aM).setRef(R.DATE+".timeStamp"))]]));class aO extends e1{getSignature(){return aw}async internalExecute(e){let t=e?.getArguments()?.get(aS),r=e?.getArguments()?.get(aM);if(!aR.validate(t)||!aR.validate(r))throw new eo("Please provide valid ISO date for both the given dates.");let n=new Date(t),a=new Date(r);return new eE([ea.outputOf(new Map([["result",(a.getTime()-n.getTime())/6e4]]))])}}const ad="epoch",aI="date",aP=new el("EpochToDate").setNamespace(R.DATE).setParameters(new Map([[ad,new W(ad,new Y().setAnyOf([Y.ofInteger(ad),Y.ofLong(ad),Y.ofString(ad)]))]])).setEvents(new Map([en.outputEventMapEntry(new Map([[aI,Y.ofRef(`${R.DATE}.timeStamp`)]]))]));class ay extends e1{getSignature(){return aP}async internalExecute(e){var t=e.getArguments()?.get(ad);if(N(t)||"boolean"==typeof t||("string"==typeof t&&(t=parseInt(t)),isNaN(t)))throw new eo("Please provide a valid value for epoch.");return t=t>0xe8d4a50fff?t:1e3*t,new eE([ea.outputOf(new Map([[aI,new Date(t).toISOString()]]))])}}const ax="date",av=new el("GetCurrentTimeStamp").setNamespace(R.DATE).setParameters(new Map([])).setEvents(new Map([en.outputEventMapEntry(new Map([[ax,Y.ofRef(`${R.DATE}.timeStamp`)]]))]));class aL extends e1{getSignature(){return av}async internalExecute(e){let t=new Date(Date.now()).toISOString();return new eE([ea.of(ax,new Map([[ax,t]]))])}}const aU="isoDate",aC="result",aV=new el("GetTimeAsArray").setNamespace(R.DATE).setParameters(Z.of(aU,W.of(aU,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[aC,Y.ofArray(aC).setItems(_.of(Y.ofNumber("number")))]]))]));class aD extends e1{getSignature(){return aV}async internalExecute(e){var t=e.getArguments()?.get(aU);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t),n=[r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()];return new eE([ea.outputOf(new Map([[aC,n]]))])}}const ab="isoDate",aG="result",aF=new el("GetTimeAsObject").setNamespace(R.DATE).setParameters(Z.of(ab,W.of(ab,Y.ofRef(R.DATE+".timeStamp")))).setEvents(new Map([en.outputEventMapEntry(new Map([[aG,Y.ofObject(aG).setProperties(new Map([["year",Y.ofNumber("year")],["month",Y.ofNumber("month")],["day",Y.ofNumber("day")],["hours",Y.ofNumber("hours")],["minutes",Y.ofNumber("minutes")],["seconds",Y.ofNumber("seconds")],["milliseconds",Y.ofNumber("milliseconds")]]))]]))]));class aY extends e1{getSignature(){return aF}async internalExecute(e){var t=e.getArguments()?.get(ab);if(N(t)||!aR.validate(t))throw new eo("Please provide a valid date object");let r=new Date(t),n={year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hours:r.getUTCHours(),minutes:r.getUTCMinutes(),seconds:r.getUTCSeconds(),milliseconds:r.getUTCMilliseconds()};return new eE([ea.outputOf(new Map([[aG,n]]))])}}const aB="isoDate",aH="output",ak=new el("IsValidISODate").setNamespace(R.DATE).setParameters(Z.of(aB,W.of(aB,Y.ofRef(R.DATE+".timeStamp")))).setEvents(Z.of(aH,new en(aH,Z.of(aH,Y.ofBoolean(aH)))));class a$ extends e1{getSignature(){return ak}async internalExecute(e){var t=e.getArguments()?.get(aB);if(N(t))throw new eo("Please provide a valid date object");return new eE([ea.of(aH,Z.of(aH,aR.validate(t)))])}}const aj="isoDates",aW="result",aX="Please provide a valid date",aJ=new el("MaximumTimestamp").setNamespace(R.DATE).setParameters(new Map([[aj,W.of(aj,Y.ofString(aj).setRef(R.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[aW,new en(aW,new Map([[aW,Y.ofString(aW).setRef(R.DATE+".timeStamp")]]))]]));class aq extends e1{getSignature(){return aJ}async internalExecute(e){let t=e?.getArguments()?.get(aj),r=t.length;if(0===r)throw new eo(aX);if(1==r){let e=t[0];if(!aR.validate(e))throw new eo(aX);return new eE([ea.outputOf(new Map([[aW,e]]))])}let n=0,a=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!aR.validate(r))throw new eo(aX);let s=new Date(r).getTime();s>a&&(a=s,n=e)}return new eE([ea.outputOf(new Map([[aW,t[n]]]))])}}const az="isoDates",aK="result",aQ="Please provide a valid date",aZ=new el("MinimumTimestamp").setNamespace(R.DATE).setParameters(new Map([[az,W.of(az,Y.ofString(az).setRef(R.DATE+".timeStamp")).setVariableArgument(!0)]])).setEvents(new Map([[aK,new en(aK,new Map([[aK,Y.ofString(aK).setRef(R.DATE+".timeStamp")]]))]]));class a0 extends e1{getSignature(){return aZ}async internalExecute(e){let t=e?.getArguments()?.get(az),r=t.length;if(0===r)throw new eo(aQ);if(1==r){let e=t[0];if(!aR.validate(e))throw new eo(aQ);return new eE([ea.outputOf(new Map([[aK,e]]))])}let n=0,a=new Date(t[0]).getTime();for(let e=1;e<r;e++){let r=t[e];if(!aR.validate(r))throw new eo(aQ);let s=new Date(r).getTime();s<a&&(a=s,n=e)}return new eE([ea.outputOf(new Map([[aK,t[n]]]))])}}class a1{static repoMap=Z.ofArrayEntries(K(new a_),K(new ay),K(new aL),K(new aO),K(new a$),K(new aD),K(new aY),K(new aq),K(new a0),ah.ofEntryDateAndBooleanOutput("IsLeapYear",e=>{let t=new Date(e).getUTCFullYear();return t%4==0&&t%100!=0||t%400==0}),ah.ofEntryDateAndIntegerOutput("GetDate",e=>new Date(e).getUTCDate()),ah.ofEntryDateAndIntegerOutput("GetDay",e=>new Date(e).getUTCDay()),ah.ofEntryDateAndIntegerOutput("GetFullYear",e=>new Date(e).getUTCFullYear()),ah.ofEntryDateAndIntegerOutput("GetMonth",e=>new Date(e).getUTCMonth()),ah.ofEntryDateAndIntegerOutput("GetHours",e=>new Date(e).getUTCHours()),ah.ofEntryDateAndIntegerOutput("GetMinutes",e=>new Date(e).getUTCMinutes()),ah.ofEntryDateAndIntegerOutput("GetSeconds",e=>new Date(e).getUTCSeconds()),ah.ofEntryDateAndIntegerOutput("GetMilliSeconds",e=>new Date(e).getUTCMilliseconds()),ah.ofEntryDateAndIntegerOutput("GetTime",e=>new Date(e).getTime()),ah.ofEntryDateWithIntegerUnitWithOutputName("AddTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!0)),ah.ofEntryDateWithIntegerUnitWithOutputName("SubtractTime",(e,t,r)=>this.changeAmountToUnit(e,r,t,!1)));static filterableNames=Array.from(a1.repoMap.values()).map(e=>e.getSignature().getFullName());static changeAmountToUnit(e,t,r,n){let a=n?r:-1*r,s=this.getFullUTCDate(e),i=this.getTimezoneOffset(e);switch(t){case"MILLISECOND":s.setMilliseconds(s.getMilliseconds()+a);break;case"SECOND":s.setSeconds(s.getSeconds()+a);break;case"MINUTE":s.setMinutes(s.getMinutes()+a);break;case"HOUR":s.setHours(s.getHours()+a);break;case"DAY":s.setDate(s.getDate()+a);break;case"MONTH":s.setMonth(s.getMonth()+a);break;case"YEAR":s.setFullYear(s.getFullYear()+a);break;default:throw new eo("No such unit: "+t)}return this.formatDate(s,i)}static getTimezoneOffset(e){if("Z"===e.charAt(e.length-1))return"+00:00";let t=-1!==e.indexOf("+")?e.lastIndexOf("+"):e.lastIndexOf("-");if(-1===t)return"+00:00";let r=e.substring(t);return 3===r.length?r=r.substring(0,1)+"0"+r.substring(1)+":00":5===r.length&&(r=r.substring(0,3)+":"+r.substring(3)),r}static getFullUTCDate(e){-1!==e.lastIndexOf("+")?e=e.substring(0,e.lastIndexOf("+"))+"Z":-1!==e.lastIndexOf("-")&&(e=e.substring(0,e.lastIndexOf("-"))+"Z");let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()))}static formatDate(e,t){let r=e=>e.toString().padStart(2,"0"),n=0===e.getUTCMonth()?e.getUTCFullYear()-1:e.getUTCFullYear(),a=r(0===e.getUTCMonth()?12:e.getUTCMonth()),s=r(e.getUTCDate()),i=r(e.getUTCHours()),o=r(e.getUTCMinutes()),E=r(e.getUTCSeconds()),u=r(e.getUTCMilliseconds());return`${n}-${a}-${s}T${i}:${o}:${E}.${u}${t}`}find(e,t){return e!=R.DATE?Promise.resolve(void 0):Promise.resolve(a1.repoMap.get(t))}filter(e){return Promise.resolve(a1.filterableNames.filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase())))}}class a2 extends e1{static MILLIS="millis";static SIGNATURE=new el("Wait").setNamespace(R.SYSTEM).setParameters(new Map([W.ofEntry(a2.MILLIS,Y.ofNumber(a2.MILLIS).setMinimum(0).setDefaultValue(0))])).setEvents(new Map([en.outputEventMapEntry(new Map)]));getSignature(){return a2.SIGNATURE}async internalExecute(e){var t=e.getArguments()?.get(a2.MILLIS);return await new Promise(e=>setTimeout(e,t)),new eE([ea.outputOf(new Map)])}}var a9={};t(a9,"HybridRepository",()=>a4);class a4{repos;constructor(...e){this.repos=e}async find(e,t){for(let r of this.repos){let n=await r.find(e,t);if(n)return n}}async filter(e){let t=new Set;for(let r of this.repos)(await r.filter(e)).forEach(e=>t.add(e));return Array.from(t)}}const a3=new Map([[R.SYSTEM_CTX,new Map([K(new class extends e1{getSignature(){return re}async internalExecute(e){let t=e?.getArguments()?.get(t7);if(e?.getContext()?.has(t))throw new eo(ep.format("Context already has an element for '$' ",t));let r=Y.from(e?.getArguments()?.get(t8));if(!r)throw new eo("Schema is not supplied.");return e.getContext().set(t,new t5(r,N(r.getDefaultValue())?void 0:r.getDefaultValue())),new eE([ea.outputOf(new Map)])}}),K(new class extends e1{getSignature(){return rn}async internalExecute(e){let t=e?.getArguments()?.get(rt);if(!e.getContext()?.has(t))throw new eo(ep.format("Context don't have an element for '$' ",t));return new eE([ea.outputOf(new Map([rr,e.getContext()?.get(t)?.getElement()]))])}}),K(new class extends e1{getSignature(){return nl}async internalExecute(e){let t=e?.getArguments()?.get(nE);if(e_.isNullOrBlank(t))throw new eo("Empty string is not a valid name for the context element");let r=e?.getArguments()?.get(nu),n=new tG(t),a=n.getTokens().peekLast();if(!a.getExpression().startsWith("Context")||a instanceof tG||a instanceof tV&&!a.getElement().toString().startsWith("Context"))throw new e8(ep.format("The context path $ is not a valid path in context",t));for(let e of n.getOperations().toArray())if(e!=tb.ARRAY_OPERATOR&&e!=tb.OBJECT_OPERATOR)throw new e8(ep.format("Expected a reference to the context location, but found an expression $",t));for(let r=0;r<n.getTokens().size();r++){let a=n.getTokens().get(r);a instanceof tG&&n.getTokens().set(r,new tV(t,new no(a).evaluate(e.getValuesMap())))}return this.modifyContext(e,t,r,n)}modifyContext(e,t,r,n){let a=n.getTokens();a.removeLast();let s=n.getOperations();s.removeLast();let i=e.getContext()?.get(a.removeLast().getExpression());if(N(i))throw new eo(ep.format("Context doesn't have any element with name '$' ",t));if(s.isEmpty())return i.setElement(r),new eE([ea.outputOf(new Map)]);let o=i.getElement(),E=s.removeLast(),u=a.removeLast(),l=u instanceof tV?u.getElement():u.getExpression();for(N(o)&&(o=E==tb.OBJECT_OPERATOR?{}:[],i.setElement(o));!s.isEmpty();)o=E==tb.OBJECT_OPERATOR?this.getDataFromObject(o,l,s.peekLast()):this.getDataFromArray(o,l,s.peekLast()),E=s.removeLast(),l=(u=a.removeLast())instanceof tV?u.getElement():u.getExpression();return E==tb.OBJECT_OPERATOR?this.putDataInObject(o,l,r):this.putDataInArray(o,l,r),new eE([ea.outputOf(new Map)])}getDataFromArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));let a=e[n];return N(a)&&(a=r==tb.OBJECT_OPERATOR?{}:[],e[n]=a),a}getDataFromObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));let n=e[t];return N(n)&&(n=r==tb.OBJECT_OPERATOR?{}:[],e[t]=n),n}putDataInArray(e,t,r){if(!Array.isArray(e))throw new eo(ep.format("Expected an array but found $",e));let n=parseInt(t);if(isNaN(n))throw new eo(ep.format("Expected an array index but found $",t));if(n<0)throw new eo(ep.format("Array index is out of bound - $",t));e[n]=r}putDataInObject(e,t,r){if(Array.isArray(e)||"object"!=typeof e)throw new eo(ep.format("Expected an object but found $",e));e[t]=r}})])],[R.SYSTEM_LOOP,new Map([K(new class extends e1{getSignature(){return nv}async internalExecute(e){let t=e.getArguments()?.get(nI),r=e.getArguments()?.get("to"),n=e.getArguments()?.get(nP),a=n>0,s=t,i=!1,o=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(i)return;if(a&&s>=r||!a&&s<=r||o&&e.getExecutionContext()?.get(o))return i=!0,o&&e.getExecutionContext()?.delete(o),ea.outputOf(new Map([[ny,s]]));let t=ea.of(en.ITERATION,new Map([[nx,s]]));return s+=n,t}})}}),K(new class extends e1{getSignature(){return n_}async internalExecute(e){let t=e.getArguments()?.get(nh),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(r>=t||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nf,r]]));let a=ea.of(en.ITERATION,new Map([[nN,r]]));return++r,a}})}}),K(new class extends e1{getSignature(){return nR}async internalExecute(e){let t=e.getArguments()?.get(np);return e.getExecutionContext().set(t,!0),new eE([ea.outputOf(new Map)])}}),K(new class extends e1{getSignature(){return nd}async internalExecute(e){let t=e.getArguments()?.get(nS),r=0,n=e.getStatementExecution()?.getStatement()?.getStatementName();return new eE({next(){if(r>=t.length||n&&e.getExecutionContext()?.get(n))return n&&e.getExecutionContext()?.delete(n),ea.outputOf(new Map([[nO,r]]));let a=ea.of(en.ITERATION,new Map([[nw,r],[nM,t[r]]]));return++r,a}})}})])],[R.SYSTEM,new Map([K(new nT),K(new class extends e1{getSignature(){return nm}async internalExecute(e){let t=e.getEvents(),r=e.getArguments(),n=r?.get(ng),a=e?.getArguments()?.get(nc).map(t=>{let r=t[nA];if(N(r))throw new eo("Expect a value object");let n=r.value;return r.isExpression&&(n=new no(n).evaluate(e.getValuesMap())),[t.name,n]}).reduce((e,t)=>(e.set(t[0],t[1]),e),new Map);return t?.has(n)||t?.set(n,[]),t?.get(n)?.push(a),new eE([ea.outputOf(new Map)])}}),K(new ar),K(new a2),K(new t4)])]]),a6=Array.from(a3.values()).flatMap(e=>Array.from(e.values())).map(e=>e.getSignature().getFullName());class a5 extends a4{constructor(){super({find:async(e,t)=>a3.get(e)?.get(t),filter:async e=>Array.from(a6).filter(t=>-1!==t.toLowerCase().indexOf(e.toLowerCase()))},new nK,new ap,new t3,new at,new a1)}}var a7={};t(a7,"StatementExecution",()=>st);var a8={};t(a8,"StatementMessage",()=>se);class se{messageType;message;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 st{statement;messages=[];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 se(e,t))}addDependency(e){this.dependencies.add(e)}getDepenedencies(){return this.dependencies}equals(e){return e instanceof st&&e.statement.equals(this.statement)}}var sr={};t(sr,"ContextTokenValueExtractor",()=>sn);class sn extends tY{static PREFIX="Context.";context;constructor(e){super(),this.context=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.context.get(r)?.getElement())}getPrefix(){return sn.PREFIX}getStore(){return N(this.context)?this.context:Array.from(this.context.entries()).reduce((e,[t,r])=>(N(r)||(e[t]=r.getElement()),e),{})}}var sa={};t(sa,"OutputMapTokenValueExtractor",()=>ss);class ss extends tY{static PREFIX="Steps.";output;constructor(e){super(),this.output=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=1,n=this.output.get(t[r++]);if(!n||r>=t.length)return;let a=n.get(t[r++]);if(!a||r>t.length)return;if(r===t.length)return a;let s=t[r].indexOf("[");if(-1===s){let n=a.get(t[r++]);return this.retrieveElementFrom(e,t,r,n)}let i=t[r].substring(0,s),o=a.get(i);return this.retrieveElementFrom(e,t,r,{[i]:o})}getPrefix(){return ss.PREFIX}getStore(){return this.convertMapToObj(this.output)}convertMapToObj(e){return 0===e.size?{}:Array.from(e.entries()).reduce((e,[t,r])=>(e[t]=r instanceof Map?this.convertMapToObj(r):r,e),{})}}var si={};t(si,"ArgumentsTokenValueExtractor",()=>so);class so extends tY{static PREFIX="Arguments.";args;constructor(e){super(),this.args=e}getValueInternal(e){let t=e.split(tY.REGEX_DOT),r=t[1],n=r.indexOf("["),a=2;return -1!=n&&(r=t[1].substring(0,n),t[1]=t[1].substring(n),a=1),this.retrieveElementFrom(e,t,a,this.args.get(r))}getPrefix(){return so.PREFIX}getStore(){return N(this.args)?this.args:Array.from(this.args.entries()).reduce((e,[t,r])=>(e[t]=r,e),{})}}var sE={};t(sE,"GraphVertex",()=>sA);var su={};t(su,"ExecutionGraph",()=>sl);class sl{nodeMap=new Map;isSubGrph;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 sA(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 eR(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(let 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 sA{data;outVertices=new Map;inVertices=new Set;graph;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 ew(this,e)),t}addInEdgeTo(e,t){return this.inVertices.add(new ew(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 sl(!0);var r=new eR(Array.from(this.outVertices.get(e)??[]));for(r.map(e=>e.getData()).forEach(e=>t.addVertex(e));!r.isEmpty();)Array.from(r.pop().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 ");return this.getKey()+":\n In: "+e+"\n Out: \n "+t}}var sg={};t(sg,"KIRuntime",()=>sN);var sc={};t(sc,"JsonExpression",()=>sm);class sm{expression;constructor(e){this.expression=e}getExpression(){return this.expression}}var sT={};t(sT,"ParameterReferenceType",()=>g),(i=g||(g={})).VALUE="VALUE",i.EXPRESSION="EXPRESSION";var sp={};function sR(){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(sp,"FunctionExecutionParameters",()=>sh);class sh{context;args;events;statementExecution;steps;count=0;functionRepository;schemaRepository;executionId;executionContext=new Map;valueExtractors=new Map;constructor(e,t,r){this.functionRepository=e,this.schemaRepository=t,this.executionId=r??sR()}getExecutionId(){return this.executionId}getContext(){return this.context}setContext(e){this.context=e;let t=new sn(e);return this.valueExtractors.set(t.getPrefix(),t),this}getArguments(){return this.args}setArguments(e){return this.args=e,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 ss(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(let t of e)this.valueExtractors.set(t.getPrefix(),t);return this}setValuesMap(e){for(let[t,r]of e.entries())this.valueExtractors.set(t,r);return this}setExecutionContext(e){return this.executionContext=e,this}getExecutionContext(){return this.executionContext}}var sf={};t(sf,"StatementMessageType",()=>c),(o=c||(c={})).ERROR="ERROR",o.WARNING="WARNING",o.MESSAGE="MESSAGE";class sN extends e1{static PARAMETER_NEEDS_A_VALUE='Parameter "$" needs a value';static STEP_REGEX_PATTERN=RegExp("Steps\\.([a-zA-Z0-9\\\\-]{1,})\\.([a-zA-Z0-9\\\\-]{1,})","g");static VERSION=1;static MAX_EXECUTION_ITERATIONS=1e7;fd;debugMode=!1;constructor(e,t=!1){if(super(),this.debugMode=t,this.fd=e,this.fd.getVersion()>sN.VERSION)throw new eo("Runtime is at a lower version "+sN.VERSION+" and trying to run code from version "+this.fd.getVersion()+".")}getSignature(){return this.fd}async getExecutionPlan(e,t){let r=new sl;for(let n of Array.from(this.fd.getSteps().values()))r.addVertex(await this.prepareStatementExecution(n,e,t));return Array.from(this.makeEdges(r).getT2().entries()).forEach(e=>{let t=r.getNodeMap().get(e[0])?.getData();t&&t.addMessage(c.ERROR,e[1])}),r}async internalExecute(e){e.getContext()||e.setContext(new Map),e.getEvents()||e.setEvents(new Map),e.getSteps()||e.setSteps(new Map),e.getArguments()&&e.addTokenValueExtractor(new so(e.getArguments())),this.debugMode&&(console.log(`EID: ${e.getExecutionId()} Executing: ${this.fd.getNamespace()}.${this.fd.getName()}`),console.log(`EID: ${e.getExecutionId()} Parameters: `,e));let t=await this.getExecutionPlan(e.getFunctionRepository(),e.getSchemaRepository());this.debugMode&&console.log(`EID: ${e.getExecutionId()} ${t?.toString()}`);let r=t.getVerticesData().filter(e=>e.getMessages().length).map(e=>e.getStatement().getStatementName()+": \n"+e.getMessages().join(","));if(r?.length)throw new eo("Please fix the errors in the function definition before execution : \n"+r.join(",\n"));return await this.executeGraph(t,e)}async executeGraph(e,t){let r=new eR;r.addAll(e.getVerticesWithNoIncomingEdges());let n=new eR;for(;(!r.isEmpty()||!n.isEmpty())&&!t.getEvents()?.has(en.OUTPUT);)if(await this.processBranchQue(t,r,n),await this.processExecutionQue(t,r,n),t.setCount(t.getCount()+1),t.getCount()==sN.MAX_EXECUTION_ITERATIONS)throw new eo("Execution locked in an infinite loop");if(!e.isSubGraph()&&!t.getEvents()?.size){let e=this.getSignature().getEvents();if(e.size&&e.get(en.OUTPUT)?.getParameters()?.size)throw new eo("No events raised")}let a=Array.from(t.getEvents()?.entries()??[]).flatMap(e=>e[1].map(t=>ea.of(e[0],t)));return new eE(a.length||e.isSubGraph()?a:[ea.of(en.OUTPUT,new Map)])}async processExecutionQue(e,t,r){if(!t.isEmpty()){let n=t.pop();await this.allDependenciesResolvedVertex(n,e.getSteps())?await this.executeVertex(n,e,r,t,e.getFunctionRepository()):t.add(n)}}async processBranchQue(e,t,r){if(r.length){let n=r.pop();await this.allDependenciesResolvedTuples(n.getT2(),e.getSteps())?await this.executeBranch(e,t,n):r.add(n)}}async executeBranch(e,t,r){let n,a=r.getT4();do if(r.getT1().getVerticesData().map(e=>e.getStatement().getStatementName()).forEach(t=>e.getSteps()?.delete(t)),await this.executeGraph(r.getT1(),e),(n=r.getT3().next())&&(e.getSteps()?.has(a.getData().getStatement().getStatementName())||e.getSteps()?.set(a.getData().getStatement().getStatementName(),new Map),e.getSteps()?.get(a.getData().getStatement().getStatementName())?.set(n.getName(),this.resolveInternalExpressions(n.getResult(),e)),this.debugMode)){let t=a.getData().getStatement();console.log(`EID: ${e.getExecutionId()} Step : ${t.getStatementName()} => ${t.getNamespace()}.${t.getName()}`),console.log(`EID: ${e.getExecutionId()} Event : ${n.getName()} : `,e.getSteps().get(t.getStatementName()).get(n.getName()))}while(n&&n.getName()!=en.OUTPUT)n?.getName()==en.OUTPUT&&a.getOutVertices().has(en.OUTPUT)&&(a?.getOutVertices()?.get(en.OUTPUT)??[]).forEach(async r=>{await this.allDependenciesResolvedVertex(r,e.getSteps())&&t.add(r)})}async executeVertex(e,t,r,n,a){let s,i=e.getData().getStatement();if(i.getExecuteIftrue().size&&!(Array.from(i.getExecuteIftrue().entries())??[]).filter(e=>e[1]).map(([e])=>new no(e).evaluate(t.getValuesMap())).every(e=>!N(e)&&!1!==e))return;let o=await a.find(i.getNamespace(),i.getName());if(!o)throw new eo(ep.format("$.$ function is not found.",i.getNamespace(),i.getName()));let E=o?.getSignature().getParameters(),u=this.getArgumentsFromParametersMap(t,i,E??new Map);this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Arguments : `,u));let l=t.getContext();s=o instanceof sN?new sh(t.getFunctionRepository(),t.getSchemaRepository(),`${t.getExecutionId()}_${i.getStatementName()}`).setArguments(u).setValuesMap(new Map(Array.from(t.getValuesMap().values()).filter(e=>e.getPrefix()!==so.PREFIX&&e.getPrefix()!==ss.PREFIX&&e.getPrefix()!==sn.PREFIX).map(e=>[e.getPrefix(),e]))):new sh(t.getFunctionRepository(),t.getSchemaRepository(),t.getExecutionId()).setValuesMap(t.getValuesMap()).setContext(l).setArguments(u).setEvents(t.getEvents()).setSteps(t.getSteps()).setStatementExecution(e.getData()).setCount(t.getCount()).setExecutionContext(t.getExecutionContext());let A=await o.execute(s),g=A.next();if(!g)throw new eo(ep.format("Executing $ returned no events",i.getStatementName()));let c=g.getName()==en.OUTPUT;if(t.getSteps()?.has(i.getStatementName())||t.getSteps().set(i.getStatementName(),new Map),t.getSteps().get(i.getStatementName()).set(g.getName(),this.resolveInternalExpressions(g.getResult(),t)),this.debugMode&&(console.log(`EID: ${t.getExecutionId()} Step : ${i.getStatementName()} => ${i.getNamespace()}.${i.getName()}`),console.log(`EID: ${t.getExecutionId()} Event : ${g.getName()} : `,t.getSteps().get(i.getStatementName()).get(g.getName()))),c){let r=e.getOutVertices().get(en.OUTPUT);r&&r.forEach(async e=>{await this.allDependenciesResolvedVertex(e,t.getSteps())&&n.add(e)})}else{let t=e.getSubGraphOfType(g.getName()),n=this.makeEdges(t).getT1();r.push(new ed(t,n,A,e))}}resolveInternalExpressions(e,t){return e?Array.from(e.entries()).map(e=>new ew(e[0],this.resolveInternalExpression(e[1],t))).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map):e}resolveInternalExpression(e,t){if(N(e)||"object"!=typeof e)return e;if(e instanceof sm)return new no(e.getExpression()).evaluate(t.getValuesMap());if(Array.isArray(e)){let r=[];for(let n of e)r.push(this.resolveInternalExpression(n,t));return r}if("object"==typeof e){let r={};for(let n of Object.entries(e))r[n[0]]=this.resolveInternalExpression(n[1],t);return r}}allDependenciesResolvedTuples(e,t){for(let r of e)if(!t.has(r.getT1())||!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(),n=e.getT2();return!(t.has(r)&&t.get(r)?.has(n))}).length}getArgumentsFromParametersMap(e,t,r){return Array.from(t.getParameterMap().entries()).map(t=>{let n,a=Array.from(t[1]?.values()??[]);if(!a?.length)return new ew(t[0],n);let s=r.get(t[0]);return s?(n=s.isVariableArgument()?a.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)).filter(e=>!N(e)).map(t=>this.parameterReferenceEvaluation(e,t)).flatMap(e=>Array.isArray(e)?e:[e]):this.parameterReferenceEvaluation(e,a[0]),new ew(t[0],n)):new ew(t[0],void 0)}).filter(e=>!N(e.getT2())).reduce((e,t)=>(e.set(t.getT1(),t.getT2()),e),new Map)}parameterReferenceEvaluation(e,t){let r;return t.getType()==g.VALUE?r=this.resolveInternalExpression(t.getValue(),e):t.getType()!=g.EXPRESSION||e_.isNullOrBlank(t.getExpression())||(r=new no(t.getExpression()??"").evaluate(e.getValuesMap())),r}async prepareStatementExecution(e,t,r){let n=new st(e),a=await t.find(e.getNamespace(),e.getName());if(!a)return n.addMessage(c.ERROR,ep.format("$.$ is not available",e.getNamespace(),e.getName())),Promise.resolve(n);let s=new Map(a.getSignature().getParameters());if(!e.getParameterMap())return Promise.resolve(n);for(let t of Array.from(e.getParameterMap().entries())){let e=s.get(t[0]);if(!e)continue;let a=Array.from(t[1]?.values()??[]);if(!a.length&&!e.isVariableArgument()){await ey.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,e.getParameterName())),s.delete(e.getParameterName());continue}if(e.isVariableArgument())for(let t of(a.sort((e,t)=>(e.getOrder()??0)-(t.getOrder()??0)),a))this.parameterReferenceValidation(n,e,t,r);else if(a.length){let t=a[0];this.parameterReferenceValidation(n,e,t,r)}s.delete(e.getParameterName())}if(!N(n.getStatement().getDependentStatements()))for(let e of Array.from(n.getStatement().getDependentStatements().entries()))e[1]&&n.addDependency(e[0]);if(!N(n.getStatement().getExecuteIftrue()))for(let e of Array.from(n.getStatement().getExecuteIftrue().entries()))e[1]&&this.addDependencies(n,e[0]);if(s.size)for(let e of Array.from(s.values()))e.isVariableArgument()||await ey.hasDefaultValueOrNullSchemaType(e.getSchema(),r)||n.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,e.getParameterName()));return Promise.resolve(n)}async parameterReferenceValidation(e,t,r,n){if(r){if(r.getType()==g.VALUE){if(N(r.getValue())&&!await ey.hasDefaultValueOrNullSchemaType(t.getSchema(),n)&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName())),N(r.getValue()))return;let a=new eR;for(a.push(new ew(t.getSchema(),r.getValue()));!a.isEmpty();){let t=a.pop();if(t.getT2() instanceof sm)this.addDependencies(e,t.getT2().getExpression());else{if(N(t.getT1())||N(t.getT1().getType()))continue;if(t.getT1().getType()?.contains(E.ARRAY)&&Array.isArray(t.getT2())){let e=t.getT1().getItems();if(!e)continue;if(e.isSingleType())for(let r of t.getT2())a.push(new ew(e.getSingleSchema(),r));else{let r=t.getT2();for(let t=0;t<r.length;t++)a.push(new ew(e.getTupleSchema()[t],r[t]))}}else if(t.getT1().getType()?.contains(E.OBJECT)&&"object"==typeof t.getT2()){let r=t.getT1();if(r.getName()===W.EXPRESSION.getName()&&r.getNamespace()===W.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])&&a.push(new ew(r.getProperties().get(e[0]),e[1]))}}}}else if(r.getType()==g.EXPRESSION){if(e_.isNullOrBlank(r.getExpression()))N(ey.getDefaultValue(t.getSchema(),n))&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName()));else try{this.addDependencies(e,r.getExpression())}catch(t){e.addMessage(c.ERROR,ep.format("Error evaluating $ : $",r.getExpression(),t))}}}else N(await ey.getDefaultValue(t.getSchema(),n))&&e.addMessage(c.ERROR,ep.format(sN.PARAMETER_NEEDS_A_VALUE,t.getParameterName()))}addDependencies(e,t){t&&Array.from(t.match(sN.STEP_REGEX_PATTERN)??[]).forEach(t=>e.addDependency(t))}makeEdges(e){let t=e.getNodeMap().values(),r=[],n=new Map;for(let a of Array.from(t))for(let t of Array.from(a.getData().getDependencies())){let s=t.indexOf(".",6),i=t.substring(6,s),o=t.indexOf(".",s+1),E=-1==o?t.substring(s+1):t.substring(s+1,o);e.getNodeMap().has(i)?a.addInEdgeTo(e.getNodeMap().get(i),E):(r.push(new ew(i,E)),n.set(a.getData().getStatement().getStatementName(),ep.format("Unable to find the step with name $",i)))}return new ew(r,n)}}var s_={};t(s_,"KIRunConstants",()=>sS);class sS{static NAMESPACE="namespace";static NAME="name";static ID="id";constructor(){}}var sM={};t(sM,"Position",()=>sw);class sw{static SCHEMA_NAME="Position";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sw.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["left",Y.ofFloat("left")],["top",Y.ofFloat("top")]]));left;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){if(e)return new sw(e.left,e.top)}}var sO={};t(sO,"FunctionDefinition",()=>sV);var sd={};t(sd,"Statement",()=>sv);var sI={};t(sI,"AbstractStatement",()=>sP);class sP{comment;description;position;override=!1;constructor(e){if(!e)return;this.comment=e.comment,this.description=e.description,this.position=e.position?new sw(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 sy={};t(sy,"ParameterReference",()=>sx);class sx{static SCHEMA_NAME="ParameterReference";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sx.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["key",Y.ofString("key")],["value",Y.ofAny("value")],["expression",Y.ofString("expression")],["type",Y.ofString("type").setEnums(["EXPRESSION","VALUE"])],["order",Y.ofInteger("order")]]));key;type;value;expression;order;constructor(e){e instanceof sx?(this.key=e.key,this.type=e.type,this.value=N(e.value)?void 0:JSON.parse(JSON.stringify(e.value)),this.expression=e.expression,this.order=e.order):(this.type=e,this.key=sR())}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}setOrder(e){return this.order=e,this}getOrder(){return this.order}static ofExpression(e){let t=new sx(g.EXPRESSION).setExpression(e);return[t.getKey(),t]}static ofValue(e){let t=new sx(g.VALUE).setValue(e);return[t.getKey(),t]}static from(e){return new sx(e.type).setValue(e.value).setExpression(e.expression).setKey(e.key).setOrder(e.order)}}class sv extends sP{static SCHEMA_NAME="Statement";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sv.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["statementName",Y.ofString("statementName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["namespace",Y.ofString("namespace")],["name",Y.ofString("name")],["dependentStatements",Y.ofObject("dependentstatement").setAdditionalProperties(new F().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["executeIftrue",Y.ofObject("executeIftrue").setAdditionalProperties(new F().setSchemaValue(Y.ofBoolean("exists"))).setDefaultValue({})],["parameterMap",new Y().setName("parameterMap").setAdditionalProperties(new F().setSchemaValue(Y.ofObject("parameterReference").setAdditionalProperties(new F().setSchemaValue(sx.SCHEMA))))],["position",sw.SCHEMA]]));statementName;namespace;name;parameterMap;dependentStatements;executeIftrue;constructor(e,t,r){if(super(e instanceof sv?e:void 0),e instanceof sv)this.statementName=e.statementName,this.name=e.name,this.namespace=e.namespace,e.parameterMap&&(this.parameterMap=new Map(Array.from(e.parameterMap.entries()).map(e=>[e[0],new Map(Array.from(e[1].entries()).map(e=>[e[0],new sx(e[1])]))]))),e.dependentStatements&&(this.dependentStatements=new Map(Array.from(e.dependentStatements.entries())));else{if(this.statementName=e,!r||!t)throw 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}getExecuteIftrue(){return this.executeIftrue??new Map}setExecuteIftrue(e){return this.executeIftrue=e,this}equals(e){return e instanceof sv&&e.statementName==this.statementName}static ofEntry(e){return[e.statementName,e]}static from(e){return new sv(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])=>sx.from(t)).map(e=>[e.getKey(),e]))]))).setDependentStatements(new Map(Object.entries(e.dependentStatements??{}))).setExecuteIftrue(new Map(Object.entries(e.executeIftrue??{}))).setPosition(sw.from(e.position)).setComment(e.comment).setDescription(e.description)}}var sL={};t(sL,"StatementGroup",()=>sU);class sU extends sP{static SCHEMA_NAME="StatementGroup";static SCHEMA=new Y().setNamespace(R.SYSTEM).setName(sU.SCHEMA_NAME).setType(x.of(E.OBJECT)).setProperties(new Map([["statementGroupName",Y.ofString("statementGroupName")],["comment",Y.ofString("comment")],["description",Y.ofString("description")],["position",sw.SCHEMA]]));statementGroupName;statements;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 sU(e.statementGroupName,new Map(Object.entries(e.statements||{}).map(([e,t])=>[e,(""+t)?.toLowerCase()=="true"]))).setPosition(sw.from(e.position)).setComment(e.comment).setDescription(e.description)}}const sC=new Y().setNamespace(R.SYSTEM).setName("FunctionDefinition").setProperties(new Map([["name",Y.ofString("name")],["namespace",Y.ofString("namespace")],["parameters",Y.ofArray("parameters",W.SCHEMA)],["events",Y.ofObject("events").setAdditionalProperties(new F().setSchemaValue(en.SCHEMA))],["steps",Y.ofObject("steps").setAdditionalProperties(new F().setSchemaValue(sv.SCHEMA))]]));sC.getProperties()?.set("parts",Y.ofArray("parts",sC));class sV extends el{static SCHEMA=sC;version=1;steps;stepGroups;parts;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 sV(e.name).setSteps(new Map(Object.values(e.steps??{}).filter(e=>!!e).map(e=>[e.statementName,sv.from(e)]))).setStepGroups(new Map(Object.values(e.stepGroups??{}).filter(e=>!!e).map(e=>[e.statementGroupName,sU.from(e)]))).setParts(Array.from(e.parts??[]).filter(e=>!!e).map(e=>sV.from(e))).setVersion(e.version??1).setEvents(new Map(Object.values(e.events??{}).filter(e=>!!e).map(e=>[e.name,en.from(e)]))).setParameters(new Map(Object.values(e.parameters??{}).filter(e=>!!e).map(e=>[e.parameterName,W.from(e)]))).setNamespace(e.namespace):new sV("unknown")}}var sD={};t(sD,"Argument",()=>sb);class sb{argumentIndex=0;name;value;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 sb(0,e,t)}}var sG={};e(sG,rZ),e(sG,r9),e(sG,r3),e(sG,r5),e(sG,r0);var sF={};e(sF,ru),e(sF,rA),e(sF,rc),e(sF,rT),e(sF,rR),e(sF,rf),e(sF,r_),e(sF,ri),e(sF,rM),e(sF,rO),e(sF,rI),e(sF,ry),e(sF,rv),e(sF,rU),e(sF,rV),e(sF,rb),e(sF,rF),e(sF,rB),e(sF,rk),e(sF,rX),e(sF,rj),e(sF,rq),e(sF,rK),e(sF,rs),e(module.exports,m),e(module.exports,z),e(module.exports,{}),e(module.exports,e5),e(module.exports,Q),e(module.exports,f),e(module.exports,em),e(module.exports,tP),e(module.exports,eT),e(module.exports,eN),e(module.exports,eM),e(module.exports,tr),e(module.exports,ec),e(module.exports,ts),e(module.exports,a7),e(module.exports,a8),e(module.exports,t6),e(module.exports,sr),e(module.exports,sa),e(module.exports,si),e(module.exports,sE),e(module.exports,{}),e(module.exports,su),e(module.exports,sg),e(module.exports,sf),e(module.exports,sp),e(module.exports,tI),e(module.exports,tF),e(module.exports,r8),e(module.exports,td),e(module.exports,ra),e(module.exports,tD),e(module.exports,tL),e(module.exports,tx),e(module.exports,tC),e(module.exports,{}),e(module.exports,eA),e(module.exports,p),e(module.exports,sc),e(module.exports,T),e(module.exports,eF),e(module.exports,eV),e(module.exports,eb),e(module.exports,eU),e(module.exports,ex),e(module.exports,ek),e(module.exports,eB),e(module.exports,eg),e(module.exports,eI),e(module.exports,H),e(module.exports,eL),e(module.exports,h),e(module.exports,P),e(module.exports,M),e(module.exports,w),e(module.exports,O),e(module.exports,S),e(module.exports,eS),e(module.exports,e$),e(module.exports,a9),e(module.exports,s_),e(module.exports,B),e(module.exports,es),e(module.exports,sM),e(module.exports,sO),e(module.exports,sT),e(module.exports,et),e(module.exports,sI),e(module.exports,sd),e(module.exports,{}),e(module.exports,sL),e(module.exports,eu),e(module.exports,er),e(module.exports,$),e(module.exports,sD),e(module.exports,sy),e(module.exports,e7),e(module.exports,ei),e(module.exports,sG),e(module.exports,sF),e(module.exports,nr);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|