var TcHmi;!function(TcHmi){let Functions;!function(Functions){let Beckhoff;!function(Beckhoff){Beckhoff.GetElementByIndex=function(ctx,arraySymbol,arrayIndex){null!==arraySymbol?arraySymbol instanceof TcHmi.Symbol?arraySymbol.readEx((function(rdata){if(rdata.error===TcHmi.Errors.NONE){if(Array.isArray(rdata.value)){const convertedArrayIndex=parseInt(arrayIndex,10);return isNaN(convertedArrayIndex)?void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: GetElementByIndex, Requested array index (${arrayIndex}) is not a number.`,domain:"Function"}):convertedArrayIndex<0?void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: GetElementByIndex, Requested array index (${convertedArrayIndex}) is negative.`,domain:"Function"}):rdata.value.length>convertedArrayIndex?void ctx.success(rdata.value[convertedArrayIndex]):void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Function: GetElementByIndex, Array length (${rdata.value.length}) is smaller than requested array index (${convertedArrayIndex})`,domain:"Function"})}ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Function: GetElementByIndex, Invalid type. Expected "arraySymbol" to be an array.',domain:"Function"})}else ctx.error(rdata.error,{code:rdata.error,message:TcHmi.Errors[rdata.error],reason:"Function: GetElementByIndex, symbol value read failed",domain:"Function",errors:rdata.details?[rdata.details]:void 0})})):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Function: GetElementByIndex, parameter is no symbol.",domain:"Function"}):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Function: GetElementByIndex, Requested array symbol is not set.",domain:"Function"})}}(Beckhoff=Functions.Beckhoff||(Functions.Beckhoff={}))}(Functions=TcHmi.Functions||(TcHmi.Functions={}))}(TcHmi||(TcHmi={})),TcHmi.Functions.registerFunctionEx("GetElementByIndex","TcHmi.Functions.Beckhoff",TcHmi.Functions.Beckhoff.GetElementByIndex);