var TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi;
/**
* Converts string "\n" (symbol world) to newline (HTML world).
* This supports escaping with "\\n"
* @param text The text to escape
* @returns The encoded representation of parameter text.
* @preserve (Part of the public API)
*/
function tchmi_decode_control_characters(text){if(!text)return"";if("string"!=typeof text){if("function"!=typeof text.toString)return text;text=text.toString()}if(!text.includes("\\"))return text;let decoded="",prevIndex=0,index=text.indexOf("\\");for(;-1!==index;){decoded+=text.slice(prevIndex,index);let nextChar=text.charAt(index+1);switch(nextChar){case"n":decoded+="\n";break;case"r":decoded+="\r";break;case"t":decoded+="\t";break;default:decoded+=nextChar}prevIndex=index+2,index=text.indexOf("\\",prevIndex)}return decoded+=text.slice(prevIndex),decoded}
/**
* Encodes HTML
* @param html The html to encode
* @returns The encoded representation of parameter html.
* @preserve (Part of the public API)
*/function tchmi_encode_html(html){return"string"!=typeof html&&"function"==typeof html.toString&&(html=html.toString()),String(html).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
/**
* Decodes HTML
* @param text The text to decode
* @returns The decoded representation of parameter text.
* "&#176;!\"&#167;$%&/()=?~#|&#233;&#232;€…™&#174;&#169;"
* "°     !\"§     $%&/()=?~#|é     è     €…™®     ©"
* @preserve (Part of the public API)
*/function tchmi_decode_html(text){return"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString()),String(text).replace(/\&amp;/g,"&").replace(/\&lt;/g,"<").replace(/\&gt;/g,">").replace(/\&quot;/g,'"').replace(/\&#39;/g,"'").replace(/\&#228;/g,"ä").replace(/\&#196;/g,"Ä").replace(/\&#246;/g,"ö").replace(/\&#214;/g,"Ö").replace(/\&#252;/g,"ü").replace(/\&#220;/g,"Ü").replace(/\&#223;/g,"ß").replace(/\&#233;/g,"é").replace(/\&#232;/g,"è").replace(/\&#176;/g,"°").replace(/\&#167;/g,"§").replace(/\&#174;/g,"®").replace(/\&#169;/g,"©").replace(/\&#181;/g,"µ")}
/**
* Converts formatted text to formatted html.
* @param text The text which contains the formatting placeholders which shall be encoded.
* @returns The encoded representation of parameter text.
* @preserve (Part of the public API)
*/function tchmi_text_to_html(text){"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString());let res=text,eSpacesCount=0;for(let i=res.length-1,ii=0;i>=ii;i--){if(" "!==res[i])break;eSpacesCount++}res=res.substr(0,res.length-eSpacesCount),res=res.replace(/\\s\\s/g," &nbsp;"),res=res.replace(/  /g," &nbsp;"),res=res.replace(/\\t/g,"&nbsp;&nbsp;&nbsp;");let eSpacesParts=[];for(let i=0,ii=eSpacesCount;i<ii;i++)i%2==0?eSpacesParts.push("&nbsp;"):eSpacesParts.push(" ");for(let i=eSpacesParts.length-1,ii=0;i>=ii;i--)res+=eSpacesParts[i];return res=res.replace(/\\r\\n/g,"<br/>"),res=res.replace(/\\n/g,"<br/>"),res}
/**
* Decode base64 strings
* Attention: JS strings are UTF16!
* @param input
* @returns Returns the String or null
* @preserve (Part of the public API)
*/function tchmi_base64decode(input){return"string"!=typeof input&&"function"==typeof input.toString&&(input=input.toString()),window.atob(input)}
/**
* Encode base64 strings
* Attention: JS strings are UTF16!
* @param input String to encode
* @returns Returns the String or null
* @preserve (Part of the public API)
*/function tchmi_base64encode(input){return"string"!=typeof input&&"function"==typeof input.toString&&(input=input.toString()),window.btoa(input)}
/**
* Creates a Guid string.
* @returns Guid
* @preserve (Part of the public API)
*/function tchmi_create_guid(){let d=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(c){let r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:7&r|8).toString(16)}))}
/**
 * Compares 2 values for equality.
 * @param a Value 1
 * @param b Value 2
 * @param typeSafeOrOptions A boolean or option object to define how the values should be compared.
 * If it is a boolean, a value of false will perform a type unsafe comparison, i.e. 1 == "1", while
 * a value of true will cause the function to only consider the values equal if their types are also equal.
 * @preserve (Part of the public API)
 */function tchmi_equal(a,b,typeSafeOrOptions=!0){var _a,_b;if(a===b)return!0;if(null===a||null===b)return!1;let options={convertPrimitives:!1,compareDates:!1};"boolean"==typeof typeSafeOrOptions?options.convertPrimitives=!typeSafeOrOptions:(options.convertPrimitives=null!==(_a=typeSafeOrOptions.convertPrimitives)&&void 0!==_a&&_a,options.compareMaps=typeSafeOrOptions.compareMaps,options.compareSets=typeSafeOrOptions.compareSets,options.compareDates=null!==(_b=typeSafeOrOptions.compareDates)&&void 0!==_b&&_b);let typeA=typeof a,typeB=typeof b;if(typeA!==typeB){if(options.convertPrimitives)switch(typeA){case"boolean":switch(typeB){case"number":return a==b;case"string":return a.toString()===b.toLowerCase()}break;case"number":switch(typeB){case"boolean":return a==b;case"string":return""!==b&&a==b}break;case"string":switch(typeB){case"boolean":return a.toLowerCase()===b.toString();case"number":return""!==a&&a==b}}return!1}if("number"===typeA&&isNaN(a)&&isNaN(b))return!0;if(a instanceof Map&&b instanceof Map&&options.compareMaps){if(a.size!==b.size)return!1;const aIterator=a.entries(),bIterator=b.entries();let aResult=aIterator.next(),bResult=bIterator.next();for(;!aResult.done&&!bResult.done;){const[aKey,aValue]=aResult.value,[bKey,bValue]=bResult.value;if(options.compareMaps.deepCompareKeys){if(!tchmi_equal(aKey,bKey,typeSafeOrOptions))return!1}else if(aKey!==bKey)return!1;if(options.compareMaps.deepCompareValues){if(!tchmi_equal(aValue,bValue,typeSafeOrOptions))return!1}else if(aValue!==bValue)return!1;aResult=aIterator.next(),bResult=bIterator.next()}return!0}if(a instanceof Set&&b instanceof Set&&options.compareSets){if(a.size!==b.size)return!1;const aIterator=a.values(),bIterator=b.values();let aResult=aIterator.next(),bResult=bIterator.next();for(;!aResult.done&&!bResult.done;){if(options.compareSets.deepCompareValues){if(!tchmi_equal(aResult.value,bResult.value,typeSafeOrOptions))return!1}else if(aResult.value!==bResult.value)return!1;aResult=aIterator.next(),bResult=bIterator.next()}return!0}if(a instanceof Date&&b instanceof Date&&options.compareDates)return a.valueOf()===b.valueOf();if("object"!==typeA||__tchmi_is_instanced_object(a)||__tchmi_is_instanced_object(b))return!1;let aIsArray=Array.isArray(a);if(aIsArray!==Array.isArray(b))return!1;if(aIsArray){let length=a.length;if(length!==b.length)return!1;for(let i=0;i<length;i++)if(!tchmi_equal(a[i],b[i],typeSafeOrOptions))return!1;return!0}if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let key in a){if(!b.hasOwnProperty(key))return!1;if(!tchmi_equal(a[key],b[key],typeSafeOrOptions))return!1}return!0}!function(TcHmi){if(!window.hasOwnProperty("jQuery")||null===jQuery)throw new ReferenceError('Object "jQuery" is missing!');if(!window.hasOwnProperty("$")||null===$)throw new ReferenceError('Object "$" is missing!');if(!window.hasOwnProperty("acorn")||null===acorn)throw new ReferenceError('Object "acorn" is missing!');let flagOverrides=window.localStorage.getItem("TCHMI_FLAG_OVERRIDES"),flagOverridesObj=null;if(flagOverrides)try{flagOverridesObj=JSON.parse(flagOverrides)}catch(e){}TCHMI_DEBUG_TIME_LOAD_LIBRARY=Date.now(),TCHMI_DYNAMIC_INSTANCE_ID="unset",window.hasOwnProperty("TCHMI_ENGINEERING")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE")?TCHMI_ENGINEERING=TCHMI_ENABLE_DESIGNER_MODE:TCHMI_ENGINEERING=!1),TCHMI_ENABLE_DESIGNER_MODE=TCHMI_ENGINEERING,window.hasOwnProperty("TCHMI_DESIGNER")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_MASTER")?TCHMI_DESIGNER=TCHMI_ENABLE_DESIGNER_MODE_MASTER:TCHMI_DESIGNER=!1),TCHMI_ENABLE_DESIGNER_MODE_MASTER=TCHMI_DESIGNER,window.hasOwnProperty("TCHMI_LIVEVIEW")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_SLAVE")?TCHMI_LIVEVIEW=TCHMI_ENABLE_DESIGNER_MODE_SLAVE:TCHMI_LIVEVIEW=!1),TCHMI_ENABLE_DESIGNER_MODE_SLAVE=TCHMI_LIVEVIEW,window.hasOwnProperty("TCHMI_RUNTIME")||(TCHMI_ENGINEERING?TCHMI_RUNTIME=!1:TCHMI_RUNTIME=!0),window.hasOwnProperty("TCHMI_TARGET_PARTIAL")?TCHMI_TARGET_PARTIAL=tchmi_path(TCHMI_TARGET_PARTIAL):window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL")?TCHMI_TARGET_PARTIAL=tchmi_path(TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL):TCHMI_TARGET_PARTIAL="",TCHMI_ENABLE_DESIGNER_MODE_TARGET_PARTIAL=TCHMI_TARGET_PARTIAL,window.hasOwnProperty("TCHMI_CONFIG_OVERRIDE")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON")?TCHMI_CONFIG_OVERRIDE=TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON:TCHMI_CONFIG_OVERRIDE=null),TCHMI_ENABLE_DESIGNER_MODE_FALLBACK_CONFIG_JSON=TCHMI_CONFIG_OVERRIDE,window.hasOwnProperty("TCHMI_ENGINEERING_WEBSOCKET")||(window.hasOwnProperty("TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL")?TCHMI_ENGINEERING_WEBSOCKET=TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL:TCHMI_ENGINEERING_WEBSOCKET=""),TCHMI_ENABLE_DESIGNER_MODE_WEBSOCKET_URL=TCHMI_ENGINEERING_WEBSOCKET,window.hasOwnProperty("TCHMI_CONSOLE_LOG_LEVEL")||(TCHMI_CONSOLE_LOG_LEVEL=0),flagOverridesObj&&void 0!==flagOverridesObj.TCHMI_CONSOLE_LOG_LEVEL&&null!==flagOverridesObj.TCHMI_CONSOLE_LOG_LEVEL&&(TCHMI_CONSOLE_LOG_LEVEL=flagOverridesObj.TCHMI_CONSOLE_LOG_LEVEL),window.hasOwnProperty("TCHMI_CONSOLE_LOG_PERSISTENT")||(TCHMI_CONSOLE_LOG_PERSISTENT=!1),flagOverridesObj&&void 0!==flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT&&null!==flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT&&(TCHMI_CONSOLE_LOG_PERSISTENT=flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT),window.hasOwnProperty("TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES")||(TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES=2e4),flagOverridesObj&&void 0!==flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES&&null!==flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES&&(TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES=flagOverridesObj.TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES),window.hasOwnProperty("TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES")||(TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES=!1),flagOverridesObj&&void 0!==flagOverridesObj.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&null!==flagOverridesObj.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&(TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES=flagOverridesObj.TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES),window.hasOwnProperty("TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES")||(window.hasOwnProperty("TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES")?TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES=TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES:TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES=!1),TCHMI_CONSOLE_LOG_DESIGNER_MODE_COM_MESSAGES=TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES,window.hasOwnProperty("TCHMI_UNITTEST_MODE")||(TCHMI_UNITTEST_MODE=!1),window.hasOwnProperty("TCHMI_BENCHMARK_MODE")||(TCHMI_BENCHMARK_MODE=!1),TCHMI_EVENT_OPTION_OBJECT_SUPPORTED=!0,window.hasOwnProperty("TCHMI_SERVER_STATE_WATCH_INTERVAL")&&"number"==typeof TCHMI_SERVER_STATE_WATCH_INTERVAL||(TCHMI_SERVER_STATE_WATCH_INTERVAL=1e3)}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Config=class{
/**
         *  Returns a copy of the current object which is constructed from tchmiconfig.json
         *  @preserve (Part of the public API)
         * */
static get(){return tchmi_clone_object(TcHmi.System.config)}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Access=
/**
    * Provides functions for checking rights
    * @preserve (Part of the public API)
    */
class{
/**
         * Checks if an right is allowed for the current user on this control or its parents
         * Rules for granting access:
         *      - Designer Mode Master => true
         *      - Server Auth is not restricted (IsAuthRequired == false in Server) => TRUE
         *      - Server Auth is not known right now => null
         *      - Server Auth loading error => false
         *      - On this control: 1 Group  has  ALLOW => TRUE
         *      - On this control: 0 Groups have ALLOW, but 1 Group has DENY => FALSE
         *      - On this control: 0 Groups have ALLOW, 0 Groups have DENY => Ask Parent
         *      - use control default of the bottom most control with this right. TcHmi.Controls.System.TcHmiView has operate/observe set to TRUE
         *      - control has no parent (detached control) => null
         * @param control Control to check
         * @param accessright name of the access right
         * @returns Returns true/false or null if the state is not known right now
         * @preserve (Part of the public API)
         */
static checkAccess(control,requestedAccessright){return control instanceof TcHmi.Controls.System.baseTcHmiControl!=!1&&(!TcHmi.System.isParameterTypeInvalid(requestedAccessright,"requestedAccessright",{type:"string",required:"valueNeeded",minStringLength:1})&&(TcHmi.System.Services.accessManager?TcHmi.System.Services.accessManager.checkAccess(control,requestedAccessright):null))}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.AnimationProvider=class{
/**
         * Deprecated. Please use new TcHmi.Animation()
         * Creates a new animation
         * @param controlName The name of the control for which the animation is intendend.
         * @param selector A CSS selector to identify the element inside the control to animate.
         * @preserve (Part of the public API)
         * @deprecated Please use new TcHmi.Animation()
         */
static create(controlName,selector=""){return new Animation(controlName,selector)}};class Animation{
/**
         * Creates a new animation
         * @param controlName The name of the control for which the animation is intendend.
         * @param selector A CSS selector to identify the element inside the control to animate.
         * @preserve (Part of the public API)
        */
constructor(controlName,selector=""){this.__keyframes=[],this.__duration=0,this.__delay=0,this.__iterationCount=1,this.__direction="normal",this.__timingFunction="ease",this.__fillMode="none",this.__cleanup=!1,this.__useCss=!0,this.__eventHandlers=[],this.__state=Animation.Status.CONFIGURE,this.__stateUpdater=status=>{this.__state=status},this.__animationController=null,this.__controlName=controlName,this.__selector=selector,this.__animationName="anim-"+tchmi_create_guid()}
/**
         * Returns the name of the control the animation is intended for.
         * @returns The name of the control.
         * @preserve (Part of the public API)
         */controlName(){return this.__controlName}
/**
         * Returns the selector of the element to animate.
         * @returns The selector.
         * @preserve (Part of the public API)
         */selector(){return this.__selector}
/**
         * Returns the name of the animation.
         * @returns The name of the animation.
         * @preserve (Part of the public API)
         */animationName(){return this.__animationName}
/**
         * Returns the state of the animation.
         * @returns The state.
         * @preserve (Part of the public API)
         */state(){return this.__state}addKeyframe(keyframeOrStylesOrProperty,valueOrProgressPoint,progressPoint){if(!this.__configAllowed())return this;if(1===arguments.length){if(keyframeOrStylesOrProperty.progressPoint<0||keyframeOrStylesOrProperty.progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");this.__keyframes.push(keyframeOrStylesOrProperty)}else if(2===arguments.length&&"number"==typeof valueOrProgressPoint){if(valueOrProgressPoint<0||valueOrProgressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint:valueOrProgressPoint};for(let key in keyframeOrStylesOrProperty)keyframeOrStylesOrProperty.hasOwnProperty(key)&&("string"==typeof keyframeOrStylesOrProperty[key]?keyframe.styles[key]=[keyframeOrStylesOrProperty[key]]:keyframe.styles[key]=keyframeOrStylesOrProperty[key]);this.__keyframes.push(keyframe)}else if("string"==typeof keyframeOrStylesOrProperty&&("string"==typeof valueOrProgressPoint||Array.isArray(valueOrProgressPoint))){if(void 0===progressPoint||progressPoint<0||progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint:progressPoint};keyframe.styles[keyframeOrStylesOrProperty]="string"==typeof valueOrProgressPoint?[valueOrProgressPoint]:valueOrProgressPoint,this.__keyframes.push(keyframe)}return this}
/**
         * Removes all keyframes.
         * @preserve (Part of the public API)
         */clearKeyframes(){return this.__configAllowed()?(this.__keyframes=[],this):this}
/**
         * Reverses the keyframes by subtracting the progressPoint from 1 and setting that as the new progressPoint.
         * @preserve (Part of the public API)
         */reverseKeyframes(){return this.__keyframes.forEach(keyframe=>{keyframe.progressPoint=1-keyframe.progressPoint}),this}
/**
         * Gets the keyframes of this animation.
         * @returns The keyframes.
         * @preserve (Part of the public API)
         */keyframes(){return this.__keyframes}duration(valueNew){return void 0===valueNew?this.__duration:this.__configAllowed()?(this.__duration=null===valueNew?0:valueNew,this):this}delay(valueNew){return void 0===valueNew?this.__delay:this.__configAllowed()?(this.__delay=null===valueNew?0:valueNew,this):this}iterationCount(valueNew){return void 0===valueNew?this.__iterationCount:this.__configAllowed()?(this.__iterationCount=null===valueNew?1:valueNew,this):this}direction(valueNew){return void 0===valueNew?this.__direction:this.__configAllowed()?(this.__direction=null===valueNew?"normal":valueNew,this):this}timingFunction(valueNew){return void 0===valueNew?this.__timingFunction:this.__configAllowed()?(this.__timingFunction=null===valueNew?"ease":valueNew,this):this}fillMode(valueNew){return void 0===valueNew?this.__fillMode:this.__configAllowed()?(this.__fillMode=null===valueNew?"none":valueNew,this):this}cleanup(valueNew){return void 0===valueNew?this.__cleanup:(this.__cleanup=null!==valueNew&&valueNew,this.__state===Animation.Status.ENDED&&null!==this.__animationController&&this.__animationController.cleanup(),this)}useCss(valueNew){return void 0===valueNew?this.__canUseCss()&&this.__useCss:this.__configAllowed()?(this.__useCss=null===valueNew||valueNew,this):this}
/**
         * Registers an event handler for one of the events animationstart, animationend or animationiteration.
         * @param name The name of the event.
         * @param callback          The callback function.
         * @preserve (Part of the public API)
         */registerEventHandler(name,callback){return this.__eventHandlers.push({name:name,callback:callback}),this}
/**
         * Unregisters a previously registered event handler.
         * @param name The name of the event.
         * @param callback          The callback function to unregister.
         * @preserve (Part of the public API)
         */unregisterEventHandler(name,callback){return this.__eventHandlers=this.__eventHandlers.filter(handler=>!(handler.name===name&&(void 0===callback||handler.callback===callback))),this}
/**
         * Gets all event handlers
         * @returns The event handlers.
         * @preserve (Part of the public API)
         */eventHandlers(){return this.__eventHandlers}
/**
         * Run the animation.
         * @preserve (Part of the public API)
         */run(){return 0===this.__keyframes.length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no keyframes defined."),this):0===this.__keyframes.filter(keyframe=>0===keyframe.progressPoint).length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no start keyframe with progressPoint 0 defined."),this):0===this.__keyframes.filter(keyframe=>1===keyframe.progressPoint).length?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no end keyframe with progressPoint 1 defined."),this):TcHmi.System.Services.animationProvider?(null!==this.__animationController&&this.__animationController.isValid()||(this.__animationController=TcHmi.System.Services.animationProvider.createAnimationController(this,this.__stateUpdater)),this.__animationController.run(),this):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] System not ready."),this)}
/**
         * Pause the animation.
         * @preserve (Part of the public API)
         */pause(){return null!==this.__animationController&&this.__animationController.pause(),this}
/**
         * Cancels the animation and writes the last keyframe styles into the element CSS.
         * @preserve (Part of the public API)
         */skip(){return null!==this.__animationController&&this.__animationController.skip(),this}
/**
         * Resets the animation. This is an asynchronous operation.
         * @param callback The function to call when the animation has been reset.
         * @preserve (Part of the public API)
         */reset(callback){return null!==this.__animationController&&this.__animationController.reset(callback),this}__canUseCss(){return"string"==typeof this.__timingFunction}__configAllowed(){return this.__state===Animation.Status.CONFIGURE||this.__state===Animation.Status.ENDED||(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Animation] Configuring an animation is only allowed when it has the state CONFIGURE or ENDED."),!1)}}TcHmi.Animation=Animation,function(Animation){let Status;!function(Status){Status[Status.CONFIGURE=0]="CONFIGURE",Status[Status.INITIALIZED=1]="INITIALIZED",Status[Status.RUNNING=2]="RUNNING",Status[Status.PAUSED=3]="PAUSED",Status[Status.ENDED=4]="ENDED"}(Status=Animation.Status||(Animation.Status={}))}(Animation=TcHmi.Animation||(TcHmi.Animation={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Base64BinaryReader=
/**
     * Provides methods to read base64 encoded data.
     * @preserve (Part of the public API)
     */
class{
/**
         * Creates a new Base64BinaryReader.
         * This constructor throws an exception if the data is not valid base64.
         * @param data The base64 encoded string to read from.
         * @param endianness    Whether the encoded data uses little endian (default) or big endian to store numbers.
         * @preserve (Part of the public API)
         */
constructor(data,endianness=TcHmi.Endianness.LittleEndian){this.__offset=0,this.__stringEncodings={"UTF-8":{decode:(bytes,endianness)=>{let codePoints=[];for(let i=0,byteLength=bytes.length;i<byteLength;i++){let byte=bytes[i];if(0===byte)return{codePoints:codePoints,byteCount:i+1};if(byte<=127)codePoints.push(byte);else if(byte>=194&&byte<=244){let followBytes=1,firstByteMask=31,mask=32;for(;mask>0;)(byte&mask)>0?(followBytes++,firstByteMask>>>=1,mask>>>=1):mask=0;let codePoint=byte&firstByteMask,lastByteIndex=i+followBytes;if(lastByteIndex>=byteLength)codePoint=65533;else for(;i<lastByteIndex;){i++;let byte=bytes[i];if(byte<128||byte>191){codePoint=65533,i--;break}codePoint=codePoint<=67108863?(codePoint<<6|63&byte)>>>0:codePoint*Math.pow(2,6)+(63&byte)}codePoints.push(codePoint)}else codePoints.push(65533)}return{codePoints:codePoints,byteCount:bytes.length}}}};let decoded=tchmi_base64decode(data);if(null===decoded)throw new Error(`Could not decode string "${data}" as base64.`);this.__data=[];for(let i=0,ii=decoded.length;i<ii;i++)this.__data.push(decoded.charCodeAt(i));this.__endianness=endianness}__getChunk(length){if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);let chunk=this.__data.slice(this.__offset,this.__offset+length);return this.__offset+=length,this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),chunk}__readInteger(lengthInBytes,signed){let chunk=this.__getChunk(lengthInBytes),result=0;for(let i=0,ii=chunk.length;i<ii;i++){let byte=255&chunk[i];i<4?result=(result|byte<<8*i)>>>0:result+=byte*Math.pow(256,i)}if(signed){let mask=Math.pow(2,8*lengthInBytes-1);lengthInBytes<=4?result=(result&~mask)-((result&mask)>>>0):128==(128&chunk[chunk.length-1])&&(result-=2*mask)}return result}__readFloatingPointNumber(lengthInBytes){let chunk=this.__getChunk(lengthInBytes),exponentBits=8,significandBits=23;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let bias=Math.pow(2,exponentBits-1)-1,parts=[{value:0,bitsToRead:significandBits},{value:0,bitsToRead:exponentBits},{value:0,bitsToRead:1}],partIndex=0,shift=0;for(let i=0;i<lengthInBytes||parts[partIndex].bitsToRead<0;i++){let carryOver=0;parts[partIndex].bitsToRead<0?(carryOver=8+parts[partIndex].bitsToRead,i--,partIndex++,shift=0):0===parts[partIndex].bitsToRead&&(partIndex++,shift=0);let byte=(255&chunk[i])>>>carryOver;parts[partIndex].bitsToRead<8&&(byte&=Math.pow(2,parts[partIndex].bitsToRead)-1),shift<=24?parts[partIndex].value=(parts[partIndex].value|byte<<shift)>>>0:parts[partIndex].value+=byte*Math.pow(2,shift),shift+=8-carryOver,parts[partIndex].bitsToRead-=8-carryOver}let significand=parts[0].value,exponent=parts[1].value,sign=parts[2].value;return exponent===Math.pow(2,exponentBits)-1?significand>0?NaN:1/0*(1===sign?-1:1):0===exponent&&0===significand?0*(1===sign?-1:1):0===exponent?(1===sign?-1:1)*significand*Math.pow(2,1-bias-significandBits):(1===sign?-1:1)*(1+significand/Math.pow(2,significandBits))*Math.pow(2,exponent-bias)}
/**
         * Reads a boolean value.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readBoolean(){return 0!==this.__readInteger(1,!1)}
/**
         * Reads a single byte of data.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readByte(){return this.__readInteger(1,!1)}
/**
         * Reads a signed byte.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readSByte(){return this.__readInteger(1,!0)}
/**
         * Reads a signed 16-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readInt16(){return this.__readInteger(2,!0)}
/**
         * Reads an unsigned 16-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readUInt16(){return this.__readInteger(2,!1)}
/**
         * Reads a signed 32-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readInt32(){return this.__readInteger(4,!0)}
/**
         * Reads an unsigned 32-bit integer.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readUInt32(){return this.__readInteger(4,!1)}
/**
         * Reads a single precision floating point number.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readFloat(){return this.__readFloatingPointNumber(4)}
/**
         * Reads a double precision floating point number.
         * This function throws an exception if reading from the current offset position would exceed the length of the available data.
         * @preserve (Part of the public API)
         */readDouble(){return this.__readFloatingPointNumber(8)}
/**
         * Reads a string. Will read until a zero byte is encountered, or until the specified length has been reached, or, if no length has been specified, until the end of the data.
         * This function throws an exception if length is negative or reading the number of bytes specified by length from the current offset position would exceed the length of the available data.
         * @param length The length of the string to read in bytes.
         * @preserve (Part of the public API)
         */readString(length){let stringBytes;if(void 0!==length){if(length<0)throw new RangeError("Length of the string to read must be positive.");if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);stringBytes=this.__data.slice(this.__offset,this.__offset+length)}else stringBytes=this.__data.slice(this.__offset);let result=this.__stringEncodings["UTF-8"].decode(stringBytes,this.__endianness);return this.__offset+=void 0!==length?length:result.byteCount,this.__getStringFromCodePoints(result.codePoints)}__getStringFromCodePoints(codePoints){let codeUnits=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=65535)codeUnits.push(codePoint);else{codePoint-=65536;let highSurrogate=55296+(codePoint>>10),lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}}return String.fromCharCode(...codeUnits)}
/**
        * @preserve (Part of the public API)
         */getLength(){return this.__data.length}
/**
        * @preserve (Part of the public API)
         */getOffset(){return this.__offset}
/**
        * @preserve (Part of the public API)
         */setOffset(offset){let convertedValue=Math.floor(TcHmi.ValueConverter.toNumber(offset,0));this.__offset=convertedValue}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Base64BinaryWriter=
/**
     * Provides methods to write base64 encoded data.
     * @preserve (Part of the public API)
     */
class{
/**
         * Creates a new Base64BinaryWriter.
         * @param endianness    Whether to use little endian (default) or big endian when encoding numbers.
         * @param length The desired length of the data. If this parameter is omitted the data will be expanded dynamically.
         * @preserve (Part of the public API)
         */
constructor(endianness=TcHmi.Endianness.LittleEndian,length){this.__data=[],this.__stringEncodings={"UTF-8":{encode:(codePoints,endianness)=>{let bytes=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=127)bytes.push(codePoint);else{let cpBytes=[],firstByteTemplate=192,firstByteMask=31,followByteTemplate=128,followByteMask=63;for(;codePoint>0&&cpBytes.length<=6;)cpBytes.push(followByteTemplate|codePoint&followByteMask),codePoint<=4294967295?codePoint>>>=6:codePoint=Math.floor(codePoint/Math.pow(2,6)),codePoint<=firstByteMask?(cpBytes.push(firstByteTemplate|codePoint&firstByteMask),codePoint=0):(firstByteTemplate=followByteTemplate|firstByteTemplate>>>1,firstByteMask>>>=1);bytes=bytes.concat(cpBytes.reverse())}}return bytes}}},this.__endianness=endianness,this.__length=void 0!==length?length:1/0}__addChunk(chunk){if(this.__data.length+chunk.length>this.__length)throw new RangeError(`Trying to write ${chunk.length} bytes exceeds the length of the data.`);this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),this.__data=this.__data.concat(chunk)}__checkIntegerBounds(value,lengthInBytes,signed){if(value%1!=0)return!1;let range=Math.pow(2,8*lengthInBytes)-1,lowerBound=signed?-Math.ceil(range/2):0;return value>=lowerBound&&value<=range+lowerBound}__writeInteger(value,lengthInBytes){let chunk=[];for(let i=0;i<lengthInBytes;i++)chunk.push(255&value),lengthInBytes-i<=4?value>>>=8:value=Math.floor(value/256);this.__addChunk(chunk)}__writeFloatingPointNumber(value,lengthInBytes){let exponentBits,significandBits;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let exponent,significand,bias=Math.pow(2,exponentBits-1)-1,sign=value<0?1:0;if(isFinite(value))if(0===value)sign=1/value==-1/0?1:0,exponent=0,significand=0;else{value=Math.abs(value);let preComma=Math.floor(value),postComma=value-preComma,preCommaLength=0,num=preComma;for(;num>0;)preCommaLength++,num<=4294967295?num>>>=1:num=Math.floor(num/2);significand=preComma>0?preComma-Math.pow(2,preCommaLength-1):0;let significandLength=preCommaLength>0?preCommaLength-1:0;significandLength>significandBits&&(significand<=4294967295?significand>>>=significandLength-significandBits:significand=Math.floor(significand/Math.pow(2,significandLength-significandBits)),significandLength=significandBits);let postCommaIndexOfOne=-1;num=postComma;let i=0;for(;significandLength<significandBits;){num*=2;let bit=num>=1?1:0;i>=bias-1&&-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i),bit&&(num--,-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i,0===preCommaLength))?i++:(significand=significandLength<32?(significand<<1|bit)>>>0:2*significand+bit,(preCommaLength>0||postCommaIndexOfOne>-1||0===postComma)&&significandLength++,i++)}exponent=preCommaLength>0?preCommaLength-1:-postCommaIndexOfOne-1,exponent+=bias;let maxExponentValue=Math.pow(2,exponentBits)-1;exponent<1?exponent=0:exponent>maxExponentValue-1&&(exponent=maxExponentValue,significand=0)}else{exponent=0;for(let i=0;i<exponentBits;i++)exponent=exponent<<1|1;significand=isNaN(value)?1:0}let parts=[{value:significand,length:significandBits},{value:exponent,length:exponentBits},{value:sign,length:1}],chunk=[],partIndex=0;for(let i=0;i<lengthInBytes||parts[partIndex].length<0;i++){let carryBack=0;parts[partIndex].length<0?(carryBack=8+parts[partIndex].length,i--,partIndex++):0===parts[partIndex].length&&partIndex++,void 0===chunk[i]&&(chunk[i]=0),chunk[i]|=parts[partIndex].value<<carryBack&255,parts[partIndex].length<=32?parts[partIndex].value=parts[partIndex].value>>>8-carryBack:parts[partIndex].value=Math.floor(parts[partIndex].value/Math.pow(2,8-carryBack)),parts[partIndex].length-=8-carryBack}this.__addChunk(chunk)}
/**
         * Writes a boolean value.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The boolean value to write.
         * @preserve (Part of the public API)
         */writeBoolean(value){return this.writeByte(value?1:0),this}
/**
         * Writes a single byte of data.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The byte to write.
         * @preserve (Part of the public API)
         */writeByte(value){if(!this.__checkIntegerBounds(value,1,!1))throw new RangeError(`The value ${value} does not fit into a byte.`);return this.__writeInteger(value,1),this}
/**
         * Writes a signed byte.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The byte to write.
         * @preserve (Part of the public API)
         */writeSByte(value){if(!this.__checkIntegerBounds(value,1,!0))throw new RangeError(`The value ${value} does not fit into a signed byte.`);return this.__writeInteger(value,1),this}
/**
         * Writes a signed 16-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeInt16(value){if(!this.__checkIntegerBounds(value,2,!0))throw new RangeError(`The value ${value} does not fit into an int16.`);return this.__writeInteger(value,2),this}
/**
         * Writes an unsigned 16-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeUInt16(value){if(!this.__checkIntegerBounds(value,2,!1))throw new RangeError(`The value ${value} does not fit into an uint16.`);return this.__writeInteger(value,2),this}
/**
         * Writes a signed 32-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeInt32(value){if(!this.__checkIntegerBounds(value,4,!0))throw new RangeError(`The value ${value} does not fit into a int32.`);return this.__writeInteger(value,4),this}
/**
         * Writes an unsigned 32-bit integer.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeUInt32(value){if(!this.__checkIntegerBounds(value,4,!1))throw new RangeError(`The value ${value} does not fit into an uint32.`);return this.__writeInteger(value,4),this}
/**
         * Writes a single precision floating point number.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeFloat(value){return this.__writeFloatingPointNumber(value,4),this}
/**
         * Writes a double precision floating point number.
         * This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The number to write.
         * @preserve (Part of the public API)
         */writeDouble(value){return this.__writeFloatingPointNumber(value,8),this}
/**
         * Writes a string.
         * This function throws an exception if the provided value does not fit into the given length or if length was specified during writer construction and the value to write does not fit into the remaining length.
         * @param value The string to write.
         * @param length (Optional) The length of the string to write. If the string is shorter, the remaining space is filled with 0.
         * @preserve (Part of the public API)
         */writeString(value,length){let bytes=this.__stringEncodings["UTF-8"].encode(this.__getCodePointsFromString(value),this.__endianness);if(void 0!==length){for(;bytes.length<length;)bytes.push(0);if(bytes.length>length)throw new RangeError("The specified string does not fit into the specified length.")}if(this.__data.length+bytes.length>this.__length)throw new RangeError(`Trying to write ${bytes.length} bytes exceeds the length of the data.`);return this.__data=this.__data.concat(bytes),this}__getCodePointsFromString(value){let codePoints=[];for(let i=0,ii=value.length;i<ii;i++){let first=value.charCodeAt(i);if(first>=55296&&first<=56319&&i<ii-1){let second=value.charCodeAt(i+1);second>=56320&&second<=57343?(codePoints.push(1024*(first-55296)+second-56320+65536),i++):codePoints.push(first)}else codePoints.push(first)}return codePoints}
/**
         * Returns the base64 encoded string. If not enough data was written to fill the length the data should have, the rest is filled up with zeros.
         * @preserve (Part of the public API)
         */getEncodedString(){const length=this.__data.length;if(isFinite(this.__length)&&this.__data.length<this.__length){const start=this.__data.length;this.__data.length=this.__length,this.__data.fill(0,start)}const rawChunks=[];for(let i=0;i<this.__data.length;i+=1e4)rawChunks.push(String.fromCharCode(...this.__data.slice(i,i+1e4)));return this.__data.length=length,tchmi_base64encode(rawChunks.join(""))}
/**
         * Returns the length of the data that has been written.
         * @preserve (Part of the public API)
         */getLength(){return this.__data.length}}}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Reserved
    * @preserve (Part of the public API)
    */
class Binding{static __getFuncName(fn,control){let res=null,current=control;do{let propertyNames=Object.getOwnPropertyNames(current);if(propertyNames)for(let i=0,ii=propertyNames.length;i<ii;i++){let propertyName=propertyNames[i];if(current[propertyName]===fn){res=propertyName;break}}}while(current=Object.getPrototypeOf(current));return res}
/**
         * Creates a binding between a symbol and a control attribute setter function.
         * @param expression The target symbol expression.
         * @param fn The target function as prototype reference.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static create(expression,fn,control){let fnName=Binding.__getFuncName(fn,control);null!==fnName&&Binding.createEx(expression,fnName,control)}
/**
         * Creates a binding between a symbol and a control attribute setter function by name.
         * @param expression The target symbol expression.
         * @param fn The name of the control setter function.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static createEx(expression,fn,control){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Creating binding at control "+control.getId()+" failed. System not ready."));let attr=TcHmi.System.Services.controlManager.getAttributeByPropertySetterName(control,fn);attr?TcHmi.System.Services.bindingManager.createBinding(expression,attr.propertyName,control):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Creating a binding with this attribute failed.")}
/**
        * Creates a binding between a symbol and a control attribute setter function by name of property.
        * @param expression The target symbol expression.
        * @param propertyName The name of the control property.
        * @param control
        * @preserve (Part of the public API)
        */static createEx2(expression,propertyName,control){TcHmi.System.Services.bindingManager.createBinding(expression,propertyName,control)}
/**
         * Removes a binding between a symbol and a control attribute setter function.
         * @param expression [OBSOLETE] The target symbol expression.
         * @param fn
         * @param control The target control instance.
         * @param bReset [Optional] If set to false the setter will not resetted with null.
         * @preserve (Part of the public API)
         */static remove(expression,fn,control,bReset=!0){let fnName=Binding.__getFuncName(fn,control);null!==fnName&&Binding.removeEx(expression,fnName,control,bReset)}
/**
         * Removes a binding between a symbol and a control attribute setter function.
         * @param expression [OBSOLETE] The target symbol expression.
         * @param fn The name of the control setter function.
         * @param control The target control instance.
         * @param bReset [Optional] If set to false the setter will not resetted with null.
         * @preserve (Part of the public API)
         */static removeEx(expression,fn,control,bReset=!0){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Removing binding at control "+control.getId()+" failed. System not ready."));let attr=TcHmi.System.Services.controlManager.getAttributeByPropertySetterName(control,fn);attr?Binding.removeEx2(expression,attr.propertyName,control,bReset):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Removing a binding with this attribute failed.")}
/**
        * Removes a binding between a symbol and a control attribute setter function by name of property.
        * @param unused [OBSOLETE] The target symbol expression.
        * @param propertyName The name of the control attribute property.
        * @param control The target control instance.
        * @param bReset [Optional] If set to false the setter will not resetted with null.
        * @preserve (Part of the public API)
        */static removeEx2(unused,propertyName,control,bReset=!0){TcHmi.System.Services.bindingManager?TcHmi.System.Services.bindingManager.removeBinding(propertyName,control,bReset):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Removing binding at control "+control.getId()+" failed. System not ready.")}
/**
         * Returns true if a symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static exists(propertyName,control){return!!Binding.resolve(propertyName,control)}
/**
         * Returns the symbol expression of a binding as string or null if no symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static resolve(propertyName,control){if(!TcHmi.System.Services.bindingManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Resolving binding at control "+control.getId()+" failed. System not ready."),null;let binding=TcHmi.System.Services.bindingManager.getBinding(propertyName,control);if(binding){let symbol=binding.getSymbol();if(symbol)return symbol.getExpression().toString()}return null}
/**
         * Returns the symbol expression of a binding as SymbolExpression object or null if no symbol is bound to the target control property.
         * @param propertyName The name of the control attribute property.
         * @param control The target control instance.
         * @preserve (Part of the public API)
         */static resolveEx(propertyName,control){if(!TcHmi.System.Services.bindingManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] Resolving binding at control "+control.getId()+" failed. System not ready."),null;let binding=TcHmi.System.Services.bindingManager.getBinding(propertyName,control);if(binding){let symbol=binding.getSymbol();if(symbol)return new TcHmi.SymbolExpression(symbol.getExpression().toString())}return null}}TcHmi.Binding=Binding}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Callback=class{
/**
         * Calls a callback and catches exceptions to return them as value of type {Error} for further processing.
         * @param callback function to call
         * @param thisArg the this pointer in the function call
         * @param args parameters for the function call
         * @returns undefined or the Error in case of an exception
         * @template T this for the call
         * @template A Array of types for all parameter for the function
         * @preserve (Part of the public API)
         */
static callSafe(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res}
/**
         * Calls a callback and catches exceptions to return them as value of type {Error} for further processing and prints it to console for proper call stack.
         * @param callback function to call
         * @param thisArg the this pointer in the function call
         * @param args parameters for the function call
         * @returns undefined or the Error in case of an exception
         * @template T this for the call
         * @template A Array of types for all parameter for the function
         * @preserve (Part of the public API)
         */static callSafeEx(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(res),res}}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.control={};TcHmi.Control=class{}}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.ControlFactory=class{
/**
        * Creates a new control.
        * This function throws an exception if one of the given parameter values is invalid.
        * @param type The type of the control.
        * @param name The name of the control.
        * @param attributes The attributes.
        * @param parent Optional. The logical parent control.
        * @template C defines the type for the new control
        * @preserve (Part of the public API)
         */
static createEx(type,name,attributes,parent){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Creating a control failed. System not ready."));if(TcHmi.System.isParameterTypeInvalid(type,"type",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError("[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: '"+type+"' for parameter: 'type'.");if(TcHmi.System.isParameterTypeInvalid(name,"name",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError("[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: '"+name+"' for parameter: 'name'.");if(TcHmi.System.isParameterTypeInvalid(attributes,"attributes ",{type:"object",required:"nullOk"})||__tchmi_is_instanced_object(attributes))throw new TypeError("[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: '"+attributes+"' for parameter: 'attributes'.");if(parent&&!(parent instanceof TcHmi.Controls.System.baseTcHmiControl))throw new TypeError("[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: '"+parent+"' for parameter: 'parent'.");let elem=document.createElement("div");elem.id=name,elem.setAttribute("data-tchmi-type",type);for(let key in attributes){let value=attributes[key];if(null!=value)if("object"!=typeof value)elem.setAttribute(key,value);else{let attrScript=document.createElement("script");attrScript.setAttribute("data-tchmi-target-attribute",key),attrScript.setAttribute("type","application/json"),attrScript.textContent=JSON.stringify(value),elem.appendChild(attrScript)}}return TcHmi.System.Services.controlManager.compile(elem,parent,{designerIgnore:!0})}
/**
        * DEPRECATED
        * Creates a new control.
        * @param htmlOrElementOrType The HTML, jQuery element or type of the control.
        * @param [name] Optional the name of the control.
        * @param [parent] Optional. The logical parent control.
        * @deprecated Please use createEx()
        * @template C defines the type for the new control
        * @preserve (Part of the public API)
        */static create(htmlOrElementOrType,name,parent){if(!TcHmi.System.Services.controlManager)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Creating a control failed. System not ready."));let jControl;if(null==name)jControl="string"==typeof htmlOrElementOrType?$(htmlOrElementOrType):htmlOrElementOrType;else{if("string"!=typeof htmlOrElementOrType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. Wrong input parameter given."));jControl=$('<div id="'+name+'" data-tchmi-type="'+htmlOrElementOrType+'"></div>')}if(0===jControl.length)return;if(void 0!==TcHmi.Controls.get(jControl[0].id))return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. A control with the name "+jControl[0].id+" already exists."));return TcHmi.System.Services.controlManager.compile(jControl[0],parent,{designerIgnore:!0})}}}(TcHmi||(TcHmi={})),function(TcHmi){let Controls;!function(Controls){Controls.register=
/**
         * DEPRECATED
         * Register a control.
         * The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
         * @param name Name of the Control.
         * @param constructor Constructor which generates the TcHmi Control.
         * @param directory Directory of the Control (base path is the Controls directory).
         * @param template Template file of the Control (base path is the Controls directory).
         * @template C defines the type for the control to register
         * @preserve (Part of the public API)
         * @deprecated Please use registerEx()
         */
function(name,constructor,directory,template){let registration={error:TcHmi.Errors.NONE,apiVersion:0,name:name,ctrlConstructor:constructor,directory:directory,template:template};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}TcHmi.System.Data.Registrations.controls.map.has(name)?TcHmi.System.Data.Registrations.controls.map.set(name,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.register",reason:'Ambiguous registration for the name: "'+name+'". Control will not be addressable by this name. Please try fully qualified name to access control.'}}):TcHmi.System.Data.Registrations.controls.map.set(name,registration),TcHmi.System.Data.Registrations.controls.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration)},Controls.registerEx=
/**
         * Register a control.
         * The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
         * @param name Name of the Control.
         * @param constructor Constructor which generates the TcHmi Control.
         * @template C defines the type for the control to register
         * @preserve (Part of the public API)
         */
function(name,namespace,constructor){let registration={error:TcHmi.Errors.NONE,apiVersion:1,name:name,namespace:namespace,ctrlConstructor:constructor};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}let qname=TcHmi.System.resolveQualifiedName(name,namespace);if(TcHmi.System.Data.Registrations.controls.map.has(name)?TcHmi.System.Data.Registrations.controls.map.set(name,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the name: "'+name+'". Control will not be addressable by this name. Please try fully qualified name to access control.'}}):TcHmi.System.Data.Registrations.controls.map.set(name,registration),TcHmi.System.Data.Registrations.controls.map.has(qname)?TcHmi.System.Data.Registrations.controls.map.set(qname,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the name: " '+qname+'". Control will not be addressable by this name.'}}):TcHmi.System.Data.Registrations.controls.map.set(qname,registration),TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.has(qname)){let nameLegacy=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(qname);TcHmi.System.Data.Registrations.controls.map.has(nameLegacy)?TcHmi.System.Data.Registrations.controls.map.set(nameLegacy,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:'Ambiguous registration for the name: " '+qname+'". Control will not be addressable by this name.'}}):TcHmi.System.Data.Registrations.controls.map.set(nameLegacy,registration)}TcHmi.System.Data.Registrations.controls.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration)},Controls.get=
/**
         * Get control by name. Returns the Control or undefined
         * @param name Name of the Control.
         * @template T Type of the Control
         * @preserve (Part of the public API)
         */
function(name){if(!name||!TcHmi.System.Services.controlManager)return;return TcHmi.System.Services.controlManager.getControlsCache().get(name)},Controls.getVersion=
/**
         * Gets version information of control by type.
         * @param type Type of the Control.
         * @preserve (Part of the public API)
         */
function(type){if(!type||!TcHmi.System.Services.controlManager)return null;let descr=TcHmi.System.Services.controlManager.getDescription(type);return descr&&descr.version&&"object"==typeof descr.version?descr.version:null},Controls.getBasePath=
/**
        * Returns the dynamic base path of a control.
        * @preserve (Part of the public API)
        * @param type Control type name
        */
function(type){return TcHmi.Environment.getControlBasePath(type)},Controls.getBasePathEx=
/**
        * Returns the dynamic base path of a control.
        * @preserve (Part of the public API)
        * @param TcHmi Control reference
        */
function(control){return TcHmi.Environment.getControlBasePathEx(control)},Controls.getMap=
/**
         * Get an ES5 Map of all controls. Key of the map is the control identifier
         * @preserve (Part of the public API)
         */
function(){return TcHmi.System.Services.controlManager?TcHmi.System.Services.controlManager.getControlsCache():(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Controls] Accessing control map failed. System not ready."),new Map)},Controls.tachControls=
/**
         * DEPRECATED
         * Does no longer do anything
         * @deprecated  Does no longer do anything
         * @param callback
         * @preserve (Part of the public API)
         */
function(callback=null){TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Controls] The function 'TcHmi.Controls.tachControls(callback: null | ((this: void) => void) = null)' has been marked as deprecated and should no longer be used because it does no longer do anything."),"function"==typeof callback&&callback.apply(null)},Controls.tachControlsAsync=function(callback=null){TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Controls] The function 'TcHmi.Controls.tachControlsAsync(callback: null | ((this: void) => void) = null)' has been marked as deprecated and should no longer be used because it does no longer do anything."),"function"==typeof callback&&callback.apply(null)}}(Controls=TcHmi.Controls||(TcHmi.Controls={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Provides multiple types of dialogs to the user.
   * @preserve (Part of the public API)
    */
class DialogManager{
/**
        * Change visibility of dialog and set its DialogType when showing.
        * @param dialogOwner Caller Id to prevent overwriting forreign dialogs
        * @param bVisibility Toggling visiblity of dialog
        * @param dialogType Type of dialog
        * @param options Options
        * @returns returns false if the dialog could not be opened
        * @preserve (Part of the public API)
        */
static showDialog(dialogOwner,bVisibility,dialogType,options){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.showDialog(dialogOwner,bVisibility,dialogType,options):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Creating dialog failed. System not ready."),!1)}
/**
         * Changes the output content of the Dialog to a new value.
         * The default Severity is Info.
         * @param dialogOwner Caller Id to prevent overwriting forreign dialogs
         * @param html
         * @param [severity = DialogManager.DialogSeverity.Info]
         * @returns Success of the text update
         * @preserve (Part of the public API)
         */static updateText(dialogOwner,html,severity=DialogManager.DialogSeverity.Info){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.updateText(dialogOwner,html,severity):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Updating dialog failed. System not ready."),!1)}
/**
         * Returns the current dialog owner or null.
         * @preserve (Part of the public API)
         */static getDialogOwner(){return TcHmi.System.Services.dialogManager?TcHmi.System.Services.dialogManager.getDialogOwner():(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.DialogManager] Getting dialog owner failed. System not ready."),null)}
/**
         * Builds a formatted message of hierarchical error objects for use in dialog.
         * @param error
         * @preserve (Part of the public API)
         */static buildMessage(error){let __buildMessage=function(error,level){if(!error)return"";let res="",space="&nbsp;&nbsp;";for(let i=0,ii=level;i<ii;i++)space+="&nbsp;&nbsp;";if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="<br />"+space+"Reason: "+error.reason),error.domain&&(res+="<br />"+space+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="<br />"+space+"as result of: ";for(let i=0,ii=error.errors.length;i<ii;i++)res+=__buildMessage(error.errors[i],level+1)}return res};return __buildMessage(error,0)}}TcHmi.DialogManager=DialogManager,function(DialogManager){let DialogSeverity,DialogType;!function(DialogSeverity){DialogSeverity[DialogSeverity.Info=0]="Info",DialogSeverity[DialogSeverity.Error=1]="Error"}(DialogSeverity=DialogManager.DialogSeverity||(DialogManager.DialogSeverity={})),function(DialogType){DialogType[DialogType.Overlay=1]="Overlay"}(DialogType=DialogManager.DialogType||(DialogManager.DialogType={}))}(DialogManager=TcHmi.DialogManager||(TcHmi.DialogManager={}))}(TcHmi||(TcHmi={})),function(TcHmi){let Engineering;!function(Engineering){class ErrorPane{static add(name,content,type){TcHmi.System.Services.Engineering.errorPane&&TcHmi.System.Services.Engineering.errorPane.add(name,content,type)}static remove(name){TcHmi.System.Services.Engineering.errorPane&&TcHmi.System.Services.Engineering.errorPane.remove(name)}}Engineering.ErrorPane=ErrorPane,function(ErrorPane){let MessageType;!function(MessageType){MessageType[MessageType.Message=0]="Message",MessageType[MessageType.Error=1]="Error",MessageType[MessageType.Warning=2]="Warning",MessageType[MessageType.Information=3]="Information"}(MessageType=ErrorPane.MessageType||(ErrorPane.MessageType={}))}(ErrorPane=Engineering.ErrorPane||(Engineering.ErrorPane={}))}(Engineering=TcHmi.Engineering||(TcHmi.Engineering={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Reserved
    * @preserve (Part of the public API)
    */
class Environment{
/**
         * Returns the dynamic framework base path.
         * @preserve (Part of the public API)
         */
static getBasePath(){return TcHmi.System.config.basePath}
/**
         * Returns the dynamic base path of a control.
         * @preserve (Part of the public API)
         * @param type Control type name
         */static getControlBasePath(type){let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.package&&void 0!==module.package.basePath&&null!==module.package.basePath&&module.manifestData&&void 0!==module.manifestData.basePath&&null!==module.manifestData.basePath?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath):null}
/**
        * Returns the dynamic base path of a control.
        * @preserve (Part of the public API)
        * @param TcHmi Control reference
        */static getControlBasePathEx(control){return control?Environment.getControlBasePath(control.getType()):null}}TcHmi.Environment=Environment}(TcHmi||(TcHmi={})),function(TcHmi){let Errors;!function(Errors){Errors[Errors.NONE=0]="NONE",Errors[Errors.ERROR=1]="ERROR",Errors[Errors.E_PARAMETER_INVALID=2]="E_PARAMETER_INVALID",Errors[Errors.E_TIMEOUT=3]="E_TIMEOUT",Errors[Errors.E_EXCEPTION=4]="E_EXCEPTION",Errors[Errors.E_INVALID=5]="E_INVALID",Errors[Errors.E_NOT_UNIQUE=6]="E_NOT_UNIQUE",Errors[Errors.E_NOT_SUPPORTED=100]="E_NOT_SUPPORTED",Errors[Errors.E_SYSTEM_NOT_READY=105]="E_SYSTEM_NOT_READY",Errors[Errors.E_NOT_ALLOWED=110]="E_NOT_ALLOWED",Errors[Errors.E_UNKNOWN=115]="E_UNKNOWN",Errors[Errors.E_UNKNOWN_TYPE=120]="E_UNKNOWN_TYPE",Errors[Errors.E_KEY_NOT_FOUND=130]="E_KEY_NOT_FOUND",Errors[Errors.E_TYPE_INVALID=150]="E_TYPE_INVALID",Errors[Errors.E_VALUE_INVALID=160]="E_VALUE_INVALID",Errors[Errors.E_REGISTRATION_MISSING=180]="E_REGISTRATION_MISSING",Errors[Errors.E_REGISTRATION_ERROR=190]="E_REGISTRATION_ERROR",Errors[Errors.E_MODULE_MISSING=200]="E_MODULE_MISSING",Errors[Errors.E_MODULE_ERROR=210]="E_MODULE_ERROR",Errors[Errors.E_WEBSOCKET_NOT_READY=1e3]="E_WEBSOCKET_NOT_READY",Errors[Errors.E_WEBSOCKET_CLOSED=1001]="E_WEBSOCKET_CLOSED",Errors[Errors.E_WEBSOCKET_NOT_SUPPORTED=1404]="E_WEBSOCKET_NOT_SUPPORTED",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED=1500]="E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING=1501]="E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING",Errors[Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS=1502]="E_WEBSOCKET_OPEN_SERVER_NO_ACCESS",Errors[Errors.E_SYMBOL_STATE_INVALID=2e3]="E_SYMBOL_STATE_INVALID",Errors[Errors.E_SYMBOL_VALUE_INVALID=2001]="E_SYMBOL_VALUE_INVALID",Errors[Errors.E_SYMBOL_RESOLVE_SCHEMA=2002]="E_SYMBOL_RESOLVE_SCHEMA",Errors[Errors.E_SYMBOL_READONLY=2003]="E_SYMBOL_READONLY",Errors[Errors.E_SYMBOL_UNKNOWN=2010]="E_SYMBOL_UNKNOWN",Errors[Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY=2020]="E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY",Errors[Errors.E_SYMBOL_INVALID_PATH=2030]="E_SYMBOL_INVALID_PATH",Errors[Errors.E_SYMBOL_SUBSYMBOL_ERROR=2040]="E_SYMBOL_SUBSYMBOL_ERROR",Errors[Errors.E_SYMBOL_OBJECT_RESOLVE=2050]="E_SYMBOL_OBJECT_RESOLVE",Errors[Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE=2100]="E_SYMBOL_UNKNOWN_ATTRIBUTE",Errors[Errors.E_SERVER_RESPONSE_ERROR=3e3]="E_SERVER_RESPONSE_ERROR",Errors[Errors.E_SERVER_COMMAND_ERROR=3005]="E_SERVER_COMMAND_ERROR",Errors[Errors.E_SERVER_INVALID_RESPONSE=3010]="E_SERVER_INVALID_RESPONSE",Errors[Errors.E_SERVER_COMMANDS_MISSING=3015]="E_SERVER_COMMANDS_MISSING",Errors[Errors.E_SERVER_COMMAND_MISSING=3016]="E_SERVER_COMMAND_MISSING",Errors[Errors.E_SERVER_READVALUE_MISSING=3020]="E_SERVER_READVALUE_MISSING",Errors[Errors.E_SERVER_WRITEVALUE_MISSING=3025]="E_SERVER_WRITEVALUE_MISSING",Errors[Errors.E_SERVER_RESPONSE_MISSING=3030]="E_SERVER_RESPONSE_MISSING",Errors[Errors.E_SERVER_DOMAIN_UNKNOWN=3100]="E_SERVER_DOMAIN_UNKNOWN",Errors[Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE=4e3]="E_FUNCTION_MISSING_FUNCTION_REFERENCE",Errors[Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION=4005]="E_FUNCTION_MISSING_FUNCTION_DESCRIPTION",Errors[Errors.E_FUNCTION_INVALID_CONFIGURATION=4010]="E_FUNCTION_INVALID_CONFIGURATION",Errors[Errors.E_FUNCTION_EXCEPTION=4020]="E_FUNCTION_EXCEPTION",Errors[Errors.E_FUNCTION_UNKNOWN=4030]="E_FUNCTION_UNKNOWN",Errors[Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING=4040]="E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING",Errors[Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED=4050]="E_FUNCTION_RESOLVING_PARAMETER_FAILED",Errors[Errors.E_FUNCTION_HANDLED_VIA_RETURN_VALUE=4060]="E_FUNCTION_HANDLED_VIA_RETURN_VALUE",Errors[Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR=4100]="E_FUNCTION_EXPRESSION_PARSER_ERROR",Errors[Errors.E_FUNCTION_EXPRESSION_EXCEPTION=4120]="E_FUNCTION_EXPRESSION_EXCEPTION",Errors[Errors.E_FUNCTION_CALL_ABORTED=4130]="E_FUNCTION_CALL_ABORTED",Errors[Errors.E_FUNCTION_DESTROYED=4140]="E_FUNCTION_DESTROYED",Errors[Errors.E_TRIGGER_ACTION_EXCEPTION=5050]="E_TRIGGER_ACTION_EXCEPTION",Errors[Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION=5055]="E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION",Errors[Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION=5060]="E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION",Errors[Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION=5065]="E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION",Errors[Errors.E_TRIGGER_CONDITION_INVALID=5200]="E_TRIGGER_CONDITION_INVALID",Errors[Errors.E_CONTROL_INSTANCE_NOT_FOUND=6e3]="E_CONTROL_INSTANCE_NOT_FOUND",Errors[Errors.E_CONTROL_INVALID_CONFIGURATION=6001]="E_CONTROL_INVALID_CONFIGURATION",Errors[Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND=6005]="E_CONTROL_ATTRIBUTE_NOT_FOUND",Errors[Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION=6010]="E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION",Errors[Errors.E_CONTROL_INSTANCE_NO_LONGER_AVAILABLE=6020]="E_CONTROL_INSTANCE_NO_LONGER_AVAILABLE",Errors[Errors.E_SCHEMA_INVALID=7e3]="E_SCHEMA_INVALID",Errors[Errors.E_SCHEMA_INVALID_PATH=7010]="E_SCHEMA_INVALID_PATH",Errors[Errors.E_SCHEMA_INVALID_REF_ID=7020]="E_SCHEMA_INVALID_REF_ID",Errors[Errors.E_SCHEMA_UNKNOWN_FILE=7030]="E_SCHEMA_UNKNOWN_FILE",Errors[Errors.E_SCHEMA_UNKNOWN_DEFINITION=7040]="E_SCHEMA_UNKNOWN_DEFINITION",Errors[Errors.E_SCHEMA_NOT_RESOLVED=7050]="E_SCHEMA_NOT_RESOLVED",Errors[Errors.E_PACKAGE=8e3]="E_PACKAGE",Errors[Errors.E_LOCALIZATION_UNKNOWN_KEY=9e3]="E_LOCALIZATION_UNKNOWN_KEY"}(Errors=TcHmi.Errors||(TcHmi.Errors={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
   * @preserve (Part of the public API)
    */
class EventProvider{
/**
         * Register a callback to an event name.
         * If the name is a binding expression the callback will be initially called if there is a binding with this name
         * @param name Name of the event.
         * @param callback Callback which will be called
         * @param options Data an event can be given while registration.
         * @returns Destroy function which cleans up/unregisters
         * @preserve (Part of the public API)
         */
static register(name,callback,options){const internalEventId=this.__internalEventId++;let destroyWatch,s=null,destroy=()=>{s||(TcHmi.EventProvider.raise("System.EventProvider.onDestroyCallback<"+name+">",entry),TcHmi.EventProvider.raise("System.EventProvider.onDestroyCallback",entry)),destroyWatch&&(destroyWatch(),destroyWatch=void 0),s&&(s.destroy(),s=null);const event=EventProvider.__events.get(name);event&&(event.delete(internalEventId),0===event.size&&EventProvider.__events.delete(name))},event=EventProvider.__events.get(name);void 0===event&&(event=new Map,EventProvider.__events.set(name,event));const entry={id:internalEventId,name:name,callback:callback,options:options,destroy:destroy};return event.set(internalEventId,entry),!0===TcHmi.Symbol.isSymbolExpression(name)?(s=new TcHmi.System.Symbol(name),destroyWatch=s.watch((function(data){destroyWatch||(destroyWatch=data.destroy),data.error===TcHmi.Errors.NONE&&TcHmi.Callback.callSafeEx(callback,null,{name:name,destroy:destroy},data.value)}))):(TcHmi.EventProvider.raise("System.EventProvider.onRegisterCallback<"+name+">",entry),TcHmi.EventProvider.raise("System.EventProvider.onRegisterCallback",entry)),destroy}
/**
         * Calls all registered callbacks related to an event name.
         * @param name Name of the event.
         * @param ...args optional parameter(s) which will be transfered to the callbacks
         * @preserve (Part of the public API)
         */static raise(name,...args){var _a;const eventMap=EventProvider.__events.get(name);if(eventMap)for(const event of eventMap.values())TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:null!==(_a=event.destroy)&&void 0!==_a?_a:function(){}},...args)}
/**
         * Calls the callback of an specific event registration.
         * @param event
         * @param args optional parameter(s) which will be transfered to the callbacks
         * @preserve (Part of the public API)
         */static raiseEx(event,...args){var _a;TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:null!==(_a=event.destroy)&&void 0!==_a?_a:function(){}},...args)}static watchEventRegistration(name,callback){let destroyEventOnDestroyCallback=null,register=function(event){destroyEventOnDestroyCallback=TcHmi.EventProvider.register("System.EventProvider.onDestroyCallback<"+name+">",(function(e,event){TcHmi.Callback.callSafeEx(callback,EventProvider,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.DESTROY,event:event}),destroyEventOnDestroyCallback?(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null):e.destroy()})),TcHmi.Callback.callSafeEx(callback,EventProvider,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.REGISTER,event:event})},eventMap=EventProvider.__events.get(name);eventMap&&eventMap.forEach(register);let destroyEventOnRegisterCallback=TcHmi.EventProvider.register("System.EventProvider.onRegisterCallback<"+name+">",(function(e,event){register(event)}));return function(){destroyEventOnRegisterCallback&&(destroyEventOnRegisterCallback(),destroyEventOnRegisterCallback=null),destroyEventOnDestroyCallback&&(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null)}}static has(name){return TcHmi.EventProvider.__events.has(name)}static count(name){let events=TcHmi.EventProvider.__events.get(name);return events?events.size:0}}EventProvider.__events=new Map,EventProvider.__internalEventId=0,TcHmi.EventProvider=EventProvider,function(EventProvider){let EventRegWatchType;!function(EventRegWatchType){EventRegWatchType[EventRegWatchType.REGISTER=100]="REGISTER",EventRegWatchType[EventRegWatchType.DESTROY=200]="DESTROY"}(EventRegWatchType=EventProvider.EventRegWatchType||(EventProvider.EventRegWatchType={}))}(EventProvider=TcHmi.EventProvider||(TcHmi.EventProvider={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.Function=class{constructor(functionCallDescription){var _a;this.__lastExecuteId=0,this.__pendingExecutes=new Map,this.__isDestroying=!1,this.__isDestroyed=!1,this.__f=functionCallDescription;let module=TcHmi.System.Data.Modules.functions.map.get(functionCallDescription.fn);module&&(this.__module=module,this.__module.error===TcHmi.Errors.NONE&&(this.__fn=null===(_a=this.__module.reg)||void 0===_a?void 0:_a.func,this.__fnDescr=this.__module.description))}__execute(ctx,requiredArgs){if(this.__isDestroyed)return ctx.error(TcHmi.Errors.E_FUNCTION_DESTROYED,{code:TcHmi.Errors.E_FUNCTION_DESTROYED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_DESTROYED],reason:"Function was already destroyed",domain:"TcHmi.Function"}),()=>{};if(!this.__f)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:"Function reference missing.",domain:"TcHmi.Function"}),()=>{};if(!this.__module)return ctx.error(TcHmi.Errors.E_MODULE_MISSING,{code:TcHmi.Errors.E_MODULE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_MISSING],reason:this.__f.fn,domain:"TcHmi.Function"}),()=>{};if(this.__module.error!==TcHmi.Errors.NONE)return ctx.error(TcHmi.Errors.E_MODULE_ERROR,{code:TcHmi.Errors.E_MODULE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_ERROR],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};if(!this.__fn)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};if(!this.__fnDescr)return ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION],reason:this.__f.fn,domain:"TcHmi.Function",errors:this.__module.errorDetails?[this.__module.errorDetails]:void 0}),()=>{};let results=[],fnParams=this.__f.fnParams;Array.isArray(fnParams)||(fnParams=[]);let fnDescr=this.__fnDescr,fnArgDescriptions=fnDescr.function.arguments,done=!1,argoffset=0;!0===fnDescr.function.injectContextObject&&argoffset++,this.__lastExecuteId++;let executeId=this.__lastExecuteId,finish=(error,details)=>{if(!done){if(done=!0,!this.__isDestroying&&this.__pendingExecutes.has(executeId)&&this.__pendingExecutes.delete(executeId),error!==TcHmi.Errors.NONE)return ctx.error(error,details),void destroy();{let res;!0===fnDescr.function.injectContextObject&&(fnDescr.function&&fnDescr.function.waitMode&&"Asynchronous"===fnDescr.function.waitMode?results.unshift(ctx):results.unshift({}));try{res=this.__fn.call(this,...results)}catch(e){return ctx.error(TcHmi.Errors.E_FUNCTION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXCEPTION],reason:fnDescr.function.name+', Exception: "'+e+'"',domain:"TcHmi.Function"}),void destroy()}if(fnDescr.function&&(!fnDescr.function.waitMode||fnDescr.function.waitMode&&"Synchronous"===fnDescr.function.waitMode))return ctx.success(res),void destroy()}}};if(fnDescr.function&&fnDescr.function.waitMode&&"Asynchronous"===fnDescr.function.waitMode&&!1===fnDescr.function.injectContextObject)return finish(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:fnDescr.function.name+", Setting waitMode=Asynchronous and injectContextObject="+fnDescr.function.injectContextObject+" is an invalid function configuration. Please define a context object if you want to use waitMode=Asynchronous.",domain:"TcHmi.Function"}),()=>{};let pending=requiredArgs.length+fnParams.length,underlyingSymbols=[],underlyingDestroyFunctions=[],isDestroyed=!1,destroy=()=>{if(!isDestroyed){for(let i=0,ii=underlyingDestroyFunctions.length;i<ii;i++){let destroy=underlyingDestroyFunctions[i];destroy&&destroy()}underlyingDestroyFunctions=[];for(let i=0,ii=underlyingSymbols.length;i<ii;i++){let symbol=underlyingSymbols[i];symbol&&symbol.destroy()}underlyingSymbols=[],done||finish(TcHmi.Errors.E_FUNCTION_CALL_ABORTED,{code:TcHmi.Errors.E_FUNCTION_CALL_ABORTED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_CALL_ABORTED],reason:fnDescr.function.name+", Function call was aborted.",domain:"TcHmi.Function"}),isDestroyed=!0}};this.__pendingExecutes.set(executeId,destroy);let addArgumentResult=(i,descr,value)=>{if(descr){let typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf?value instanceof TcHmi.Symbol?results[i]=value:results[i]=null:results[i]=TcHmi.ValueConverter.toSchemaType(value,typeSchema)}else results[i]=value;pending--,0===pending&&finish(TcHmi.Errors.NONE)},resolveSymbolValue=(i,descr,s)=>{let destroy=s.readEx((function(data){data.error===TcHmi.Errors.NONE?addArgumentResult(i,descr,data.value):finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+", Resolving symbol: '"+s.getExpression()+"' for parameter: "+i+" failed.",domain:"TcHmi.Function",errors:data.details?[data.details]:void 0})}));underlyingDestroyFunctions.push(destroy)},resolveFunctionExpressionValue=(i,descr,functionExpression)=>{let func;try{func=new TcHmi.System.FunctionExpression(functionExpression),func.execute({success:function(result){addArgumentResult(i,descr,result),null==func||func.destroy()},error:function(error,details){finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+", Resolving function expression: '"+functionExpression+"' for parameter: "+i+" failed.",domain:"TcHmi.Function",errors:[details]}),null==func||func.destroy()}})}catch(e){finish(TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,{code:TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESOLVING_PARAMETER_FAILED],reason:fnDescr.function.name+", Resolving function expression: '"+functionExpression+"' for parameter: "+i+"  failed with exception.",domain:"TcHmi.Function",errors:[{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],exception:e,reason:"An uncaught exception occurred while parsing a function parameter",domain:"TcHmi.System.FunctionExpression"}]}),null==func||func.destroy()}};if(done)return destroy;if(0===pending)return finish(TcHmi.Errors.NONE),destroy;for(let i=0,ii=requiredArgs.length;i<ii;i++){let descr,arg=requiredArgs[i];i<fnArgDescriptions.length?descr=fnArgDescriptions[i+argoffset]:(descr=fnArgDescriptions[fnArgDescriptions.length-1+argoffset],descr.restParameter||(descr=null)),addArgumentResult(i,descr,arg)}for(let i=0,ii=fnParams.length;i<ii;i++){if(done)return destroy;let descr,fnParam=fnParams[i];if(i<fnArgDescriptions.length-requiredArgs.length?descr=fnArgDescriptions[i+requiredArgs.length+argoffset]:(descr=fnArgDescriptions[fnArgDescriptions.length-1+argoffset],descr.restParameter||(descr=null)),!descr)return finish(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:fnDescr.function.name,domain:"TcHmi.Function"}),destroy;if(TcHmi.IFunction.isStaticValue(fnParam))addArgumentResult(i+requiredArgs.length,descr,fnParam.value);else if(TcHmi.IFunction.isSymbol(fnParam)){let s=new TcHmi.Symbol(fnParam.symbolExpression),typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf?addArgumentResult(i+requiredArgs.length,descr,s):resolveSymbolValue(i+requiredArgs.length,descr,s),underlyingSymbols.push(s)}else TcHmi.IFunction.isFunctionExpression(fnParam)?resolveFunctionExpressionValue(i+requiredArgs.length,descr,fnParam.functionExpression):finish(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:fnDescr.function.name,domain:"TcHmi.Function"})}return destroy}
/**
         * Will raise the function defined in constructor argument f: IFunction.
         * @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
         * @preserve (Part of the public API)
         */execute(requiredArgs=[]){let res=null,bContextLock=!1,destroy=this.__execute({success:function(result){bContextLock||(bContextLock=!0,res=result)},error:function(error){bContextLock||(bContextLock=!0,res=null)}},requiredArgs);return destroy&&destroy(),res}
/**
         * Will raise the function defined in constructor argument f: IFunction and raises a callback afterwards.
         * @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
         * @param callback
         * @preserve (Part of the public API)
         */executeEx(requiredArgs=[],callback){let __this=this;requiredArgs||(requiredArgs=[]);let bContextLock=!1;return this.__execute({success:function(result){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,result:result}))},error:function(error,details){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:details}))}},requiredArgs)}__resolveProcessedWaitMode(){let res="Synchronous";if(this.__processedWaitMode)return res=this.__processedWaitMode,res;if(this.__isDestroyed)throw new Error("Object was already destroyed.");if(!this.__f)throw new Error("Function call description is missing.");if(!this.__fnDescr)throw new Error("Function description is missing.");if("Synchronous"===res&&(this.__fnDescr.function&&this.__fnDescr.function.waitMode&&(res=this.__fnDescr.function.waitMode),this.__f&&this.__f.fnParams))for(let i=0,ii=this.__f.fnParams.length;i<ii;i++){let fnParam=this.__f.fnParams[i];if(fnParam)if(TcHmi.IFunction.isSymbol(fnParam)){let expr=new TcHmi.SymbolExpression(fnParam.symbolExpression),type=expr.getType();if(type===TcHmi.SymbolType.Server){res="Asynchronous";break}if(type===TcHmi.SymbolType.Function){const content=expr.getContent();if(!content)continue;let func=new TcHmi.System.FunctionExpression(content);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}else if(TcHmi.IFunction.isFunctionExpression(fnParam)){let func=new TcHmi.System.FunctionExpression(fnParam.functionExpression);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}return this.__processedWaitMode=res,res}isProcessedAsync(){return"Asynchronous"===this.__resolveProcessedWaitMode()}
/**
         * Releases all resources of the function
         * @preserve (Part of the public API)
         */destroy(){this.__isDestroying=!0,this.__pendingExecutes.forEach(destroy=>{destroy()}),this.__pendingExecutes.clear(),this.__module=void 0,this.__f=void 0,this.__fn=void 0,this.__fnDescr=void 0,this.__isDestroying=!1,this.__isDestroyed=!0}}}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * @preserve (Part of the public API)
     */
let Functions;!function(Functions){Functions.registerFrameworkFunction=
/**
         * Deprecated! Please use registerFunctionEx.
         * @deprecated Please use registerFunctionEx.
         * @param name
         * @param functionImplementation
         * @param descriptionUrl
         * @preserve (Part of the public API)
         */
function(name,functionImplementation,descriptionUrl){TcHmi.Functions.registerFunction(name,functionImplementation)},Functions.registerFunction=
/**
         * @param name
         * @param functionImplementation
         * @preserve (Part of the public API)
         */
function(name,functionImplementation){let registration={error:TcHmi.Errors.NONE,name:name,func:functionImplementation};TcHmi.System.Data.Registrations.functions.map.has(name)?TcHmi.System.Data.Registrations.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunction",reason:'Ambiguous registration for the name: "'+name+'". Function will not be addressable by this name. Please try fully qualified name to access function.'}}):TcHmi.System.Data.Registrations.functions.map.set(name,registration),TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)},Functions.registerFunctionEx=
/**
         * @param name
         * @param namespace
         * @param functionImplementation
         * @preserve (Part of the public API)
         */
function(name,namespace,functionImplementation){let qname=TcHmi.System.resolveQualifiedName(name,namespace),registration={error:TcHmi.Errors.NONE,name:name,namespace:name,func:functionImplementation};TcHmi.System.Data.Registrations.functions.map.has(name)?TcHmi.System.Data.Registrations.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:'Ambiguous registration for the name: "'+name+'". Function will not be addressable by this name. Please try fully qualified name to access function.'}}):TcHmi.System.Data.Registrations.functions.map.set(name,registration),TcHmi.System.Data.Registrations.functions.map.has(qname)?TcHmi.System.Data.Registrations.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:'Ambiguous registration for the name: " '+qname+'". Function will not be addressable by this name.'}}):TcHmi.System.Data.Registrations.functions.map.set(qname,registration),TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)},Functions.getFunction=
/**
         * Returns a registered HMI function
         * @param name
         * @preserve (Part of the public API)
         */
function(name){let module=TcHmi.System.Data.Modules.functions.map.get(name);if(module&&module.error===TcHmi.Errors.NONE)return module.reg.func},Functions.getFunctionVersion=
/**
         * Gets version information of function by name.
         * @param name
         * @preserve (Part of the public API)
         */
function(name){let module=TcHmi.System.Data.Modules.functions.map.get(name);return module&&module.error===TcHmi.Errors.NONE&&module.description&&module.description.version&&"object"==typeof module.description.version?module.description.version:null}}(Functions=TcHmi.Functions||(TcHmi.Functions={}))}(TcHmi||(TcHmi={})),function(TcHmi){class List extends Array{constructor(){super(),this.__proto__!==TcHmi.List.prototype&&(Object.setPrototypeOf?Object.setPrototypeOf(this,List.prototype):this.__proto__=List.prototype)}first(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];throw new Error("Array does not contain elements")}firstOrDefault(predicate,defaultValue=null){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];return null}remove(item){for(let i=0,len=this.length;i<len;i++)if(this[i]===item)return this.splice(i,1),!0;return!1}addRange(items){for(let i=0,len=items.length;i<len;i++)this.push(items[i])}clearAll(){for(;this.length>0;)this.pop()}findIndex(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i],i,this))return i;return-1}}TcHmi.List=List}(TcHmi||(TcHmi={})),function(TcHmi){let Locale;!function(Locale){Locale.load=
/**
         * Loads a language file and refreshes localization symbols.
         * @param locale
         * @param callback
         * @preserve (Part of the public API)
         */
function(locale,callback=null){if(!TcHmi.System.Services.localizationManager)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale] Loading locale failed. System not ready."),void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],domain:"TcHmi.Locale"}});TcHmi.System.isParameterTypeInvalid(locale,"locale",{type:"string",required:"nullOk",minStringLength:1},"TcHmi.Locale",callback)||TcHmi.System.Services.localizationManager.loadLocale(locale,callback)},Locale.get=
/**
         * Returns the current locale string for texts or undefined if no localized Symbol is available.
         * @returns The current locale identifier.
         * @preserve (Part of the public API)
         */
function(){if(TcHmi.System.Services.localizationManager)return TcHmi.System.Services.localizationManager.getLocale();TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale] Fetching locale failed. System not ready.")},Locale.getRegisteredLocales=
/**
         * Returns the list of available application locales.
         * @preserve (Part of the public API)
         */
function(){var _a;let res=[],files=null===(_a=TcHmi.System.Services.localizationManager)||void 0===_a?void 0:_a.getFiles();if(!files)return res;let applicationFiles=files.get("TcHmi.System.Localization.Application");return applicationFiles?(applicationFiles.forEach((files,key)=>{res.push(key)}),res):res},Locale.getRegisteredLocalesForControl=function(type){var _a;let res=[],files=null===(_a=TcHmi.System.Services.localizationManager)||void 0===_a?void 0:_a.getFiles();if(!files)return res;let controlFiles=files.get("TcHmi.System.Localization.Control<"+type+">");return controlFiles?(controlFiles.forEach((files,key)=>{res.push(key)}),res):res},Locale.getRegisteredLocalesForFunction=function(type){var _a;let files=null===(_a=TcHmi.System.Services.localizationManager)||void 0===_a?void 0:_a.getFiles();if(!files)return[];let functionFiles=files.get("TcHmi.System.Localization.Function<"+type+">");return functionFiles?Array.from(functionFiles.keys()):[]};Locale.LocalizationReader=class{constructor(localization){this.__localizationReader=localization}getLocalization(){return this.__localizationReader}get(key){let res=this.__localizationReader[key];return null==res&&(res=key),res}};Locale.Localization=class{constructor(){this.__namespace=""}get(options){return TcHmi.System.Services.localizationManager?TcHmi.System.Services.localizationManager.get(this.__namespace,options):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Locale.Localization] System not ready."),new TcHmi.Locale.LocalizationReader({}))}watch(callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localisation. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watch(this.__namespace,void 0,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}watchEx(options={level:TcHmi.Locale.Level.Application},callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localisation. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watch(this.__namespace,options,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}getText(key,options){return TcHmi.System.Services.localizationManager?TcHmi.System.Services.localizationManager.getText(this.__namespace,key,options):key}watchText(key,callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localisation. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watchText(this.__namespace,key,void 0,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}watchTextEx(key,options={level:TcHmi.Locale.Level.Application},callback){if(!TcHmi.System.Services.localizationManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to watch localisation. System not ready.",domain:"TcHmi.Locale.Localization"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),()=>{}}return TcHmi.System.Services.localizationManager.watchText(this.__namespace,key,options,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}};class ApplicationLocalization extends TcHmi.Locale.Localization{constructor(){super(),this.__namespace="TcHmi.System.Localization.Application"}}Locale.ApplicationLocalization=ApplicationLocalization;class ControlLocalization extends TcHmi.Locale.Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Control<"+type+">"}}Locale.ControlLocalization=ControlLocalization;class FunctionLocalization extends TcHmi.Locale.Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Function<"+type+">"}}let Level;Locale.FunctionLocalization=FunctionLocalization,function(Level){Level[Level.Application=0]="Application",Level[Level.Engineering=1]="Engineering"}(Level=Locale.Level||(Locale.Level={}))}(Locale=TcHmi.Locale||(TcHmi.Locale={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Allows handling date and time formatting
    * @preserve (Part of the public API)
    */
class Localization{constructor(){}static __rebuildLocalizationCache(){this.__numberFormatMilliSecondsCache.clear(),this.__dateFormatCache.clear()}static __getMillisecondsFormatter(timeFormatLocaleArg){var _a;let numberFormatMilliSeconds=this.__numberFormatMilliSecondsCache.get(timeFormatLocaleArg);if(numberFormatMilliSeconds)return numberFormatMilliSeconds;let timeFormatLocale=timeFormatLocaleArg;if(!timeFormatLocale){const config=null===(_a=TcHmi.System.Services.accessManager)||void 0===_a?void 0:_a.getCurrentUserConfig();timeFormatLocale=null==config?void 0:config.timeFormatLocale}try{numberFormatMilliSeconds=new Intl.NumberFormat(timeFormatLocale,{style:"decimal",minimumIntegerDigits:2,minimumFractionDigits:3})}catch(e){timeFormatLocale=void 0,numberFormatMilliSeconds=new Intl.NumberFormat(timeFormatLocale,{style:"decimal",minimumIntegerDigits:2,minimumFractionDigits:3})}return this.__numberFormatMilliSecondsCache.set(timeFormatLocaleArg,numberFormatMilliSeconds),numberFormatMilliSeconds}static getDateTimeFormatter(locale,timeZone,hour12,type="full"){var _a;let level1=this.__dateFormatCache.get(locale);level1||(level1=new Map,this.__dateFormatCache.set(locale,level1));let level2=level1.get(timeZone);level2||(level2=new Map,level1.set(timeZone,level2));let level3=level2.get(hour12);level3||(level3=new Map,level2.set(hour12,level3));let formatter=level3.get(type);if(formatter)return formatter;const config=null===(_a=TcHmi.System.Services.accessManager)||void 0===_a?void 0:_a.getCurrentUserConfig();let timeFormatLocale=locale;timeFormatLocale||(timeFormatLocale=null==config?void 0:config.timeFormatLocale);let _timeZone=timeZone;_timeZone||(_timeZone=null==config?void 0:config.timeZone);try{new Intl.DateTimeFormat(timeFormatLocale)}catch(e){timeFormatLocale=void 0}try{new Intl.DateTimeFormat(timeFormatLocale,{timeZone:_timeZone})}catch(e){e instanceof RangeError&&(_timeZone=void 0)}let IntlOptions={timeZone:_timeZone,hour12:hour12};switch(type){case"date":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric";break;case"time":case"time-no-millisec":IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric";break;case"full":case"full-no-millisec":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric",IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric"}return IntlOptions.hour&&"function"!=typeof Intl.DateTimeFormat.prototype.formatToParts&&(IntlOptions.hour12=!1),formatter=new Intl.DateTimeFormat(timeFormatLocale,IntlOptions),level3.set(type,formatter),formatter}
/**
         *  Skip non numberic chars and parseInt the rest.
         *  MS Browsers add Left-To-Right-Mark to output
         *  https://github.com/tc39/ecma402/issues/28
         * @param input
         * @preserve (Part of the public API)
         */static parseInt(input){let value="";for(let i=0;i<input.length;i++)input.charCodeAt(i)>=32&&input.charCodeAt(i)<=126&&(value+=input[i]);return parseInt(value,10)}
/**
         * Parses a Date object
         * formats it to a time zone and split its components into an object
         * On error all entries will be NaN
         * @param date
         * @preserve (Part of the public API)
         */static parseDate(date,options){const dateObject={year:NaN,month:NaN,day:NaN,hour:NaN,minute:NaN,second:NaN,millisecond:NaN};if(isNaN(date.getTime()))return dateObject;let timeZone;if(options&&"string"==typeof options.timeZone&&(timeZone=options.timeZone),"function"==typeof Intl.DateTimeFormat.prototype.formatToParts){let parts=this.getDateTimeFormatter("de-DE",timeZone,!1,"full").formatToParts(date);dateObject.year=TcHmi.Localization.parseInt(parts.find(value=>"year"===value.type).value),dateObject.month=TcHmi.Localization.parseInt(parts.find(value=>"month"===value.type).value),dateObject.day=TcHmi.Localization.parseInt(parts.find(value=>"day"===value.type).value),dateObject.hour=TcHmi.Localization.parseInt(parts.find(value=>"hour"===value.type).value),dateObject.minute=TcHmi.Localization.parseInt(parts.find(value=>"minute"===value.type).value),dateObject.second=TcHmi.Localization.parseInt(parts.find(value=>"second"===value.type).value),dateObject.millisecond=date.getUTCMilliseconds()}else{let formatter=this.getDateTimeFormatter("de-DE",timeZone,!1,"date"),dateArray=formatter.format(date).split(".");dateObject.year=TcHmi.Localization.parseInt(dateArray[2]),dateObject.month=TcHmi.Localization.parseInt(dateArray[1]),dateObject.day=TcHmi.Localization.parseInt(dateArray[0]),formatter=this.getDateTimeFormatter("de-DE",timeZone,!1,"time");let timeArray=formatter.format(date).split(":");dateObject.hour=TcHmi.Localization.parseInt(timeArray[0]),dateObject.minute=TcHmi.Localization.parseInt(timeArray[1]),dateObject.second=TcHmi.Localization.parseInt(timeArray[2]),dateObject.millisecond=date.getUTCMilliseconds()}return dateObject}
/**
         * Formats a Date object down to milliseconds in the correct locale and time zone (config from server user or browser default)
         * On error this will be null
         * @param date
         * @preserve (Part of the public API)
         */static formatDate(date,options){if(isNaN(date.getTime()))return null;let locale=void 0;options&&"string"==typeof options.locale&&(locale=options.locale);let timeZone=void 0;options&&"string"==typeof options.timeZone&&(timeZone=options.timeZone);let format=void 0;options&&"string"==typeof options.type&&(format=options.type);let dateString="";if("function"==typeof Intl.DateTimeFormat.prototype.formatToParts){this.getDateTimeFormatter(locale,timeZone,void 0,format).formatToParts(date).forEach(part=>{if("second"===part.type&&"time-no-millisec"!==format&&"full-no-millisec"!==format){let secMillisec=Localization.parseInt(part.value);secMillisec%1==0&&(secMillisec+=date.getMilliseconds()/1e3);let numberFormatMilliSeconds=this.__getMillisecondsFormatter(locale);dateString+=numberFormatMilliSeconds.format(secMillisec)}else dateString+=part.value})}else{let formatter=this.getDateTimeFormatter(locale,timeZone,!1,format);if(dateString=formatter.format(date),!options||"date"!==options.type&&"time-no-millisec"!==format&&"full-no-millisec"!==format){let fractionString=this.__getMillisecondsFormatter(locale).format(date.getMilliseconds()/1e3);dateString+=fractionString.slice(2)}}return dateString}}Localization.__numberFormatMilliSecondsCache=new Map,Localization.__dateFormatCache=new Map,TcHmi.Localization=Localization}(TcHmi||(TcHmi={})),function(TcHmi){class Log{}Log.Prefix=!0,TcHmi.Log=Log,
/**
    * @preserve (Part of the public API)
     */
function(Log){let __il=new class{constructor(){if(this.__db=null,this.__cache=[],this.__ready=!1,this.__error=!1,TCHMI_CONSOLE_LOG_PERSISTENT)if(window.indexedDB){let request=null;try{request=window.indexedDB.open("TcHmi.Log")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception while opening database:\n",e)}null!==request&&(request.onerror=e=>{this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of request.onerror:\n",e)},request.onsuccess=e=>{this.__db=request.result,this.__ready=!0},request.onupgradeneeded=e=>{this.__db=e.target.result;try{this.__db.createObjectStore("data",{keyPath:"id",autoIncrement:!0}),this.__ready=!0}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception in request.onupgradeneeded event handler:\n",e)}})}else this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because IndexedDB API is missing in your browser.")}add(timespan,type,message,...optionalParameters){if(!TCHMI_CONSOLE_LOG_PERSISTENT)return;if(!window.indexedDB)return;let optionalParametersPrepared=[];for(let i=0,ii=optionalParameters.length;i<ii;i++){let op=optionalParameters[i];try{if(null!==op&&"object"==typeof op){op=__tchmi_is_instanced_object(op)?op.constructor&&op.constructor.name?"[IndexedDBLog: Serializing data not possible for type: 'object' with constructor: '"+op.constructor.name+"']":"[IndexedDBLog: Serializing data not possible for type: 'object']":JSON.parse(JSON.stringify(op,(key,value)=>{var _a;if("function"==typeof value)return"[IndexedDBLog: Serializing data not possible for type: 'function']";if("object"==typeof value){return __tchmi_is_instanced_object(value)?(null===(_a=null==value?void 0:value.constructor)||void 0===_a?void 0:_a.name)?"[IndexedDBLog: Serializing data not possible for type: 'object' with constructor: '"+value.constructor.name+"']":"[IndexedDBLog: Serializing data not possible for type: 'object']":value}return value}))}else null!==op&&"function"==typeof op&&(op="[IndexedDBLog: Serializing data not possible for type: 'function']")}catch(e){op="[IndexedDBLog: Serializing data failed with exception: '"+e+"']"}optionalParametersPrepared.push(op)}if(!this.__ready)return void(this.__error||this.__cache.push({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared}));if(this.__cache&&this.__cache.length>0){let cache=this.__cache;for(this.__cache=[];cache.length>0;){let entry=cache.shift();this.add(entry.timespan,entry.type,entry.message,...entry.optionalParameters)}}if(!this.__db)return;let ta=null;try{ta=this.__db.transaction(["data"],"readwrite")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!ta)return;let os=null;try{os=ta.objectStore("data")}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!os)return;let count=null;try{count=os.count()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e),this.__ready=!1,this.__error=!0}count&&(count.onsuccess=e=>{let count=e.target.result;if(count+1>TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES){let cdel=count+1-TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES,cdone=0,cursor=null;try{cursor=os.openCursor()}catch(e){this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)}if(!cursor)return;cursor.onerror=e=>{this.__ready=!1,this.__error=!0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because of unexpected exception:\n",e)},cursor.onsuccess=e=>{let cursor=e.target.result;if(cursor)return cdone<cdel?(cdone++,cursor.delete(),void cursor.continue()):void os.add({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared})}}else os.add({timespan:timespan,type:type,message:message,optionalParameters:optionalParametersPrepared})})}},__oldTimerName=null,__performanecLogCache=new Map;window.addEventListener("error",e=>{TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Error",e.error.stack)}),Log.error=
/**
        * Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
        * If the message is an object it will be inspectable in most debug tools. See errorEx if you want to show multiple objects.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @preserve (Part of the public API)
        */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<1||(console&&console.error&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.error("["+(new Date).toISOString()+"][Error] "+message):console.error(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Warning",message):__il.add(Date.now(),"Warning","",message)))},Log.errorEx=
/**
        * Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @param optionalParameters Optional parameters
        * @preserve (Part of the public API)
        */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<1||(console&&console.error&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Error] "+message),console.error(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Error",message,...optionalParameters))},Log.warn=
/**
        * Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
        * If the message is an object it will be inspectable in most debug tools. See warnEx if you want to show multiple objects.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console
        * @preserve (Part of the public API)
        */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<2||(console&&console.warn&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.warn("["+(new Date).toISOString()+"][Warning] "+message):console.warn(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Warning",message):__il.add(Date.now(),"Warning","",message)))},Log.warnEx=
/**
        * Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @param optionalParameters Optional parameters
        * @preserve (Part of the public API)
        */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<2||(console&&console.warn&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Warning] "+message),console.warn(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Warning",message,...optionalParameters))},Log.info=
/**
        * Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
        * If the message is an object it will be inspectable in most debug tools. See infoEx if you want to show multiple objects.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console
        * @preserve (Part of the public API)
        */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<3||(console&&console.info&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.info("["+(new Date).toISOString()+"][Info] "+message):console.info(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Info",message):__il.add(Date.now(),"Info","",message)))},Log.infoEx=
/**
        * Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @param optionalParameters Optional parameters
        * @preserve (Part of the public API)
        */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<3||(console&&console.info&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Info] "+message),console.info(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Info",message,...optionalParameters))},Log.debug=
/**
        * Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
        * If the message is an object it will be inspectable in most debug tools. See debugEx if you want to show multiple objects.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @preserve (Part of the public API)
        */
function(message,forceNoPrefix=!1){TCHMI_CONSOLE_LOG_LEVEL<4||(console&&console.log&&!TcHmi.System.isUnloaded&&(!0===TcHmi.Log.Prefix&&!1===forceNoPrefix&&"object"!=typeof message?console.log("["+(new Date).toISOString()+"][Debug] "+message):console.log(message)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&("string"==typeof message?__il.add(Date.now(),"Debug",message):__il.add(Date.now(),"Debug","",message)))},Log.debugEx=
/**
        * Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
        * Can log into a browser database, too. See "client" page in config page of the server.
        * @param message The text which will be printed out in the browsers console.
        * @param optionalParameters Optional parameters
        * @preserve (Part of the public API)
        */
function(message,...optionalParameters){TCHMI_CONSOLE_LOG_LEVEL<4||(console&&console.log&&!TcHmi.System.isUnloaded&&(TcHmi.Log.Prefix&&(message="["+(new Date).toISOString()+"][Debug] "+message),console.log(message,...optionalParameters)),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&__il.add(Date.now(),"Debug",message,...optionalParameters))},Log.performanceLog=function(timerName){if(!(TCHMI_CONSOLE_LOG_LEVEL<4)&&window.console&&window.console.time&&window.console.timeEnd){let intTimerName="["+(new Date).toISOString()+"][Performance] "+timerName;null!==__oldTimerName&&window.console.timeEnd(__oldTimerName),"[Source=Framework, Module=TcHmi] End"!==timerName?(window.console.time(intTimerName),__oldTimerName=intTimerName):__oldTimerName=null}},Log.performanceLogStart=function(timerName){TCHMI_CONSOLE_LOG_LEVEL<4||(window.console&&window.console.time&&window.console.time(timerName),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&window.performance&&window.performance.now&&(__performanecLogCache.set(timerName,performance.now()),__il.add(Date.now(),"Debug","Timer: '"+timerName+"' started.")))},Log.performanceLogEnd=function(timerName){if(!(TCHMI_CONSOLE_LOG_LEVEL<4)&&(window.console&&window.console.timeEnd&&window.console.timeEnd(timerName),TCHMI_CONSOLE_LOG_PERSISTENT&&window.indexedDB&&window.performance&&window.performance.now)){let start=__performanecLogCache.get(timerName);if(__performanecLogCache.delete(timerName),void 0!==start){let end=performance.now();__il.add(Date.now(),"Debug","Timer: '"+timerName+"' finished after "+(end-start)+"ms.")}}},Log.buildMessage=
/**
         * Builds a formatted message of hierarchical error objects
         * @param error
         * @preserve (Part of the public API)
         */
function(error){const __buildMessage=function(error,level){if(!error)return"";let res="",indention="  ".repeat(level+1);if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="\n"+indention+"Reason: "+error.reason),error.exception&&(res+="\n"+indention+"Exception: "+error.exception),error.domain&&(res+="\n"+indention+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="\n"+indention+"as result of: ";for(let[index,errorItem]of error.errors.entries())res+=__buildMessage(errorItem,level+1),index!==error.errors.length-1&&(res+="\n"+indention)}return res};return __buildMessage(error,0)}}(Log=TcHmi.Log||(TcHmi.Log={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Provides functions for interaction with the TwinCAT HMI Server.
    * @preserve (Part of the public API)
    */
class Server{
/**
         * Returns the current readyState value of the underlying websocket which is connected to the TwinCAT HMI Server. Returns null when system is not ready.
         * Use constants like WebSocket.CLOSED or WebSocket.OPEN for comparison.
         * @returns The current readyState value of the underlying websocket which is connected to the TwinCAT HMI Server or null.
         * @preserve (Part of the public API)
         */
static getWebsocketReadyState(){return TcHmi.System.Services.serverManager?TcHmi.System.Services.serverManager.getWebsocketReadyState():null}
/**
         * Returns true if the websocket is ready and false if its not.
         * @returns If true the websocket is ready for connectivity.
         * @preserve (Part of the public API)
         */static isWebsocketReady(){var _a;return(null===(_a=TcHmi.System.Services.serverManager)||void 0===_a?void 0:_a.getWebsocketReadyState())===WebSocket.OPEN}
/**
         * Write one or more values to a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param value The value which should be written to the target symbol.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static writeSymbol(symbolName,value,callback){return Server.writeSymbolEx(symbolName,value,null,callback)}
/**
        * Write one or more values to a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param value The value which should be written to the target symbol.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static writeSymbolEx(symbolName,value,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;let symbolNameArr,symbolValueArr;if(Array.isArray(symbolName)){if(!Array.isArray(value)||symbolName.length!==value.length)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Symbol array length does not match value array length",domain:"TcHmi.Server"}}),null;symbolNameArr=symbolName,symbolValueArr=value}else symbolNameArr=[symbolName],symbolValueArr=[value];const request={requestType:"ReadWrite",commands:[]};for(let i=0;i<symbolNameArr.length;i++){let strSymbolName=symbolNameArr[i],SymbolValue=symbolValueArr[i];if(TcHmi.System.isParameterTypeInvalid(strSymbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:strSymbolName,writeValue:SymbolValue})}return TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}}))}
/**
         * Reads the value of a TwinCAT HMI Server symbol.
         * @param symbolName The target TwinCAT HMI Server symbolname.
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value.
         * @template R Type of the read value.
         * @preserve (Part of the public API)
         */static readSymbol(symbolName,callback){return Server.readSymbolEx(symbolName,null,callback)}
/**
        * Reads the value of a TwinCAT HMI Server symbol.
        * @param symbolName The target TwinCAT HMI Server symbolname.
        * @param requestOptions Options for the request itself
        * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
        * @returns Request id
        * @template W Type of the write value.
        * @template R Type of the read value.
        * @preserve (Part of the public API)
        */static readSymbolEx(symbolName,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;let symbolNameArr;if(Array.isArray(symbolName)){if(TcHmi.System.isParameterTypeInvalid(symbolName,"symbolName",{type:"string",expectArray:!0,required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;symbolNameArr=symbolName}else{if(TcHmi.System.isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback))return null;symbolNameArr=[symbolName]}const request={requestType:"ReadWrite",commands:[]};for(let i=0;i<symbolNameArr.length;i++){let strSymbolName=symbolNameArr[i];request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:strSymbolName})}return TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}}))}
/**
         * Requests a message to the hmi server with default connection parameter
         * @param request Request object
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static request(request,callback){return Server.requestEx(request,null,callback)}
/**
         * Requests a message to the hmi server with given connection parameter
         * @param request Request object
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished. The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
         * @returns Request id
         * @template W Type of the write value. Use any (or omit) if this contains multiple different types.
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static requestEx(request,requestOptions,callback){return TcHmi.System.Services.serverManager?TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}})):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null)}
/**
         * Subscribe to a to a list of commands.
         * Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
         * @param commands
         * @param interval Subscription refresh interval.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static subscribe(commands,interval,callback){return Server.subscribeEx(commands,interval,null,callback)}
/**
         * Subscribe to a to a list of commands.
         * Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
         * @param commands
         * @param interval Subscription refresh interval.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @template R Type of the read value. Use any (or omit) if this contains multiple different types.
         * @preserve (Part of the public API)
         */static subscribeEx(commands,interval,requestOptions,callback){if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;if(TcHmi.System.isParameterTypeInvalid(commands,"commands",{type:"object",required:"valueNeeded",expectArray:!0},"TcHmi.Server",callback))return null;let request={requestType:"Subscription",commands:commands};return TcHmi.System.isParameterTypeInvalid(interval,"interval",{type:"number",required:"valueNeeded"},"TcHmi.Server",callback)?null:(null!=interval&&(request.intervalTime=interval),TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafeEx(callback,null,data)}})))}
/**
         * Unsubscribe a list of commands.
         * @param requestId The id of the subscription request which shall be unsubscribed.
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @preserve (Part of the public API)
         */static unsubscribe(requestId,callback){return Server.unsubscribeEx(requestId,null,callback)}
/**
         * Unsubscribe a list of commands.
         * @param requestId The id of the subscription request which shall be unsubscribed.
         * @param requestOptions Options for the request itself
         * @param callback Asynchronous response callback which will be raised if the operation has finished.
         * @returns Request id
         * @preserve (Part of the public API)
         */static unsubscribeEx(requestId,requestOptions,callback){let res=null;if(!TcHmi.System.Services.serverManager)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),null;if(TcHmi.System.isParameterTypeInvalid(requestId,"requestId",{type:"number",required:"valueNeeded"},"TcHmi.Server",callback))return null;const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:requestId}]};let requestEntry=TcHmi.System.Services.serverManager.getRequest(requestId);return requestEntry?(!requestEntry.pending&&requestEntry.queued?TcHmi.System.Services.serverManager.releaseRequest(requestId):(TcHmi.System.Services.serverManager.releaseRequest(requestId),res=TcHmi.System.Services.serverManager.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))),res):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE}),null)}
/**
        * Releases a request and associated resources like callbacks.
        * @param id Id of the request to release.
        * @preserve (Part of the public API)
        */static releaseRequest(id){TcHmi.System.Services.serverManager&&TcHmi.System.Services.serverManager.releaseRequest(id)}
/**
         * Get current username as string or null.
         * @preserve (Part of the public API)
         */
static getCurrentUser(){return TcHmi.System.Services.accessManager?TcHmi.System.Services.accessManager.getCurrentUserConfig().name:(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),null)}
/**
         * Get groups membership of current user as array (can be empty).
         * @preserve (Part of the public API)
         */static getGroupsOfCurrentUser(){return TcHmi.System.Services.accessManager?tchmi_clone_object(TcHmi.System.Services.accessManager.getCurrentUserConfig().userIsInGroups):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),[])}
/**
         * Get current user config.
         * @preserve (Part of the public API)
         */static getCurrentUserConfig(){return TcHmi.System.Services.accessManager?tchmi_clone_object(TcHmi.System.Services.accessManager.getCurrentUserConfig()):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] System not ready."),{state:0,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"})}
/**
         * Login into a TcHmiServer, reloads the page on success, call of a callback on failure.
         * The authentification domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param callback This callback is called if the login was not successful
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static login(userName,password,persistent=!0,callback){return Server.loginEx(userName,password,persistent,null,callback)}
/**
         * Login into a TcHmiServer, reloads the page on success, call of a callback on failure.
         * The authentification domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param requestOptions Options for the request itself
         * @param callback This callback is called if the login was not successful
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static loginEx(userName,password,persistent=!0,requestOptions,callback){return Server.loginEx2(userName,password,persistent,!0,requestOptions,callback)}
/**
         * Login into a TcHmiServer, reloads the page on success if not deactivated, call of a callback on failure.
         * The authentification domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
         * @param userName String with the username
         * @param password String with the password
         * @param persistent Should the session be valid even after browser restart
         * @param reload Reload hmi after session login.
         * @param requestOptions Options for the request itself
         * @param callback This callback is called if the login was not successful
         * @returns returns a boolean if the login was called
         * @preserve (Part of the public API)
         */static loginEx2(userName,password,persistent=!0,reload=!1,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?!TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server",callback)&&(!TcHmi.System.isParameterTypeInvalid(password,"password",{type:"string",required:"valueNeeded"},"TcHmi.Server",callback)&&(res=TcHmi.System.Services.serverManager.login(userName,password,persistent,reload,requestOptions,callback),res)):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),!1)}
/**
         * Logout from a TcHmiServer, reloads the page on success
         * @param callback This callback is called after the logout was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static logout(callback){return Server.logoutEx(null,callback)}
/**
         * Logout from a TcHmiServer, reloads the page on success
         * @param requestOptions Options for the request itself
         * @param callback This callback is called after the logout was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static logoutEx(requestOptions,callback){return TcHmi.Server.logoutEx2(!0,requestOptions,callback)}
/**
        * Logout from a TcHmiServer, optional reloads the page on success
        * @param reload Reload hmi after session logout
        * @param requestOptions Options for the request itself
        * @param callback This callback is called after the logout was sent
        * @returns returns a boolean if the logout was called
        * @preserve (Part of the public API)
        */static logoutEx2(reload=!0,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?(res=TcHmi.System.Services.serverManager.logout(reload,requestOptions,callback),res):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),res)}
/**
         * Logout all users with a specific username or all users from a TcHmiServer
         * @param username username to logout.
         * If empty string or null is provided, all users are logged out.
         * The authentification domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
         * 'Domain::' will logout every user from this domain
         * @param callback This callback is called after the request was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static forceLogout(username,callback){return Server.forceLogoutEx(username,null,callback)}
/**
         * Logout all users with a specific username or all users from a TcHmiServer
         * @param userName username to logout.
         * If empty string or null is provided, all users are logged out.
         * The authentification domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
         * 'Domain::' will logout every user from this domain
         * @param requestOptions Options for the request itself
         * @param callback This callback is called after the request was sent
         * @returns returns a boolean if the logout was called
         * @preserve (Part of the public API)
         */static forceLogoutEx(userName,requestOptions,callback){let res=!1;return TcHmi.System.Services.serverManager?(void 0!==userName&&""!==userName||(userName=null),res=TcHmi.System.Services.serverManager.forceLogout(userName,requestOptions,callback),res):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.Server"}}),!1)}static __handleServerResponse(p){return function(data){if(data.error!==TcHmi.Errors.NONE)return TcHmi.Callback.callSafeEx(p.error,null,data),void TcHmi.Callback.callSafeEx(p.completed,null,data);let response=data.response;if(!response)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server"}}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server"}});if(response.error)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server",errors:[response.error]},response:response}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server",errors:[response.error]},response:response});let commands=response.commands;if(!commands||0===commands.length)return TcHmi.Callback.callSafeEx(p.error,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server"},response:response}),void TcHmi.Callback.callSafeEx(p.completed,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server"},response:response});let hasCommandError=!1,commandErrors=[];data.results=[];for(let command of commands)command.error?(hasCommandError=!0,commandErrors.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: '"+command.symbol+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server",errors:[command.error]}),data.results.push({error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: '"+command.symbol+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server",errors:[command.error]},symbol:command.symbol})):data.results.push({error:TcHmi.Errors.NONE,symbol:command.symbol,value:command.readValue});hasCommandError?TcHmi.Callback.callSafeEx(p.error,null,data):TcHmi.Callback.callSafeEx(p.success,null,data),TcHmi.Callback.callSafeEx(p.completed,null,data)}}}TcHmi.Server=Server,function(Server){let Error,ACCESS;!function(Error){Error[Error.HMI_SUCCESS=0]="HMI_SUCCESS",Error[Error.HMI_E_FAIL=257]="HMI_E_FAIL",Error[Error.HMI_E_SYMBOL_IN_USE=274]="HMI_E_SYMBOL_IN_USE",Error[Error.HMI_E_SYMBOL_NOT_MAPPED=513]="HMI_E_SYMBOL_NOT_MAPPED",Error[Error.HMI_E_LICENSE_TARGET=778]="HMI_E_LICENSE_TARGET",Error[Error.HMI_E_MISSING_LICENSE_HANDSHAKE=781]="HMI_E_MISSING_LICENSE_HANDSHAKE",Error[Error.HMI_E_LICENSE_VERIFY=782]="HMI_E_LICENSE_VERIFY",Error[Error.HMI_E_INSUFFICIENT_ACCESS=4101]="HMI_E_INSUFFICIENT_ACCESS"}(Error=Server.Error||(Server.Error={})),function(ACCESS){ACCESS[ACCESS.NONE=0]="NONE",ACCESS[ACCESS.READ=1]="READ",ACCESS[ACCESS.WRITE=2]="WRITE",ACCESS[ACCESS.READWRITE=3]="READWRITE"}(ACCESS=Server.ACCESS||(Server.ACCESS={}));Server.UserManagement=class{
/**
             * Add a new user with a given password
             * @param userName Username to add.
             * @param password Password for the new user. Could be null if the extension does not support passwords.
             * @param callback
             * @preserve (Part of the public API)
             */
static addUser(userName,password,callback=null){return this.addUserEx(userName,password,null,null,callback)}
/**
             * Add a new user with a given password
             * @param userName Username to add.
             * @param password Password for the new user. Could be null if the extension does not support passwords.
             * @param options Optional details for this new user.
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static addUserEx(userName,password,options=null,requestOptions=null,callback=null){const paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to add user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let writeValue={domain:TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension,userName:userName,parameters:{password:password||void 0},settings:{}};if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(writeValue.domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.enabled,"options.enabled",{type:"boolean",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if("boolean"==typeof options.enabled&&(writeValue.parameters.enabled=options.enabled),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(writeValue.settings.locale=options.locale),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.timeFormatLocale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(writeValue.settings.timeFormatLocale=options.timeFormatLocale),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeFormatLocale",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(writeValue.settings.timeZone=options.timeZone),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.autoLogout,"options.autoLogout",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if("string"==typeof options.autoLogout&&options.autoLogout.length>0&&(writeValue.settings.autoLogoff=options.autoLogout),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.groups,"options.groups",{type:"string",expectArray:!0,required:"undefinedOk"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;options.groups&&(writeValue.settings.groups=options.groups)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:writeValue}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all usernames as a string array
             * @param callback
             * @preserve (Part of the public API)
             */static listUsernames(callback=null){return this.listUsernamesEx(null,null,callback)}
/**
             * Lists all usernames as a string array
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listUsernamesEx(options,requestOptions=null,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list usernames. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ListUsers"}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userList:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all username as a dictionary with all meta data
             * @param callback
             * @preserve (Part of the public API)
             */static listUsers(callback=null){return this.listUsersEx(null,null,callback)}
/**
             * Lists all username as a dictionary with all meta data
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listUsersEx(options,requestOptions=null,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list users. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ListDisabledUsers"}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({completed:data=>{var _a,_b;if(data.error!==TcHmi.Errors.NONE||!data.response)return void TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details});let result={},disabledUsers=null!==(_b=null===(_a=data.response.commands.find(x=>x.symbol===domain+".ListDisabledUsers"))||void 0===_a?void 0:_a.readValue)&&void 0!==_b?_b:[],userConfigListCommand=data.response.commands.find(x=>x.symbol==="TcHmiSrv.Config::USERGROUPUSERS::"+domain);if(!userConfigListCommand||userConfigListCommand.error)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: 'TcHmiSrv.Config::USERGROUPUSERS::"+domain+"' in response from server with id: '"+data.response.id+"'.",domain:"TcHmi.Server",errors:(null==userConfigListCommand?void 0:userConfigListCommand.error)?[userConfigListCommand.error]:void 0}});let userConfigList=userConfigListCommand.readValue;for(let userName in userConfigList)result[userName]={domain:domain,enabled:!disabledUsers.includes(userName),autoLogout:userConfigList[userName].USERGROUPUSERS_AUTO_LOGOFF,locale:userConfigList[userName].USERGROUPUSERS_LOCALE,timeFormatLocale:userConfigList[userName].USERGROUPUSERS_TIMEFORMATLOCALE,timeZone:userConfigList[userName].USERGROUPUSERS_TIMEZONE,groups:userConfigList[userName].USERGROUPUSERS_GROUPS};TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userDetails:result})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all user groups as a dictionary with all meta data
             * @param callback
             * @preserve (Part of the public API)
             */static listUserGroups(callback=null){return this.listUserGroupsEx(null,null,callback)}
/**
             * Lists all user groups as a dictionary with all meta data
             * @param options (not used till now)
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listUserGroupsEx(options,requestOptions=null,callback=null){if(null===Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPS"}]},requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let result={},groupList=data.results[0].value;for(let groupName in groupList)result[groupName]={enabled:groupList[groupName].ENABLED,fileAccess:groupList[groupName].FILEACCESS,files:groupList[groupName].FILES,symbolAccess:groupList[groupName].SYMBOLACCESS,symbols:groupList[groupName].SYMBOLS};TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,groupDetailsList:result})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all users of a group as a string array
             * @param callback
             * @preserve (Part of the public API)
             */static listUsersInGroup(groupName,callback=null){return this.listUsersInGroupEx(groupName,null,null,callback)}
/**
             * Lists all users of a group as a string array
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listUsersInGroupEx(groupName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(groupName,"groupName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to list users in group. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPS"},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results.filter(data=>data.error!==TcHmi.Errors.NONE)[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{const groupList=data.results[0].value;if(groupName in groupList){let result=data.response.commands[1].readValue,userList=[];for(let userName in result)result[userName].USERGROUPUSERS_GROUPS&&-1!==result[userName].USERGROUPUSERS_GROUPS.indexOf(groupName)&&userList.push(userName);TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,userList:userList})}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_KEY_NOT_FOUND,details:{code:TcHmi.Errors.E_KEY_NOT_FOUND,reason:"Requested user group not found",domain:"TcHmi.Server.UserManagement"}})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Removes a user
             * @param userName
             * @param callback
             * @preserve (Part of the public API)
             */static removeUser(userName,callback=null){return this.removeUserEx(userName,null,null,callback)}
/**
              * Removes a user
              * @param userName Username
              * @param options Options
              * @param requestOptions Options for the request itself
              * @param callback
              * @preserve (Part of the public API)
              */static removeUserEx(userName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to remove user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"RemoveUser",writeValue:{userName:userName,domain:domain}}]};if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Update user config
             * @param userName Username to update.
             * @param options Details for this user.
             * @param callback
             * @preserve (Part of the public API)
             */static updateUser(userName,options,callback=null){return this.updateUserEx(userName,options,null,callback)}
/**
             * Update user config
             * @param userName Username to update.
             * @param options Details for this user.
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static updateUserEx(userName,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(userName,"userName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options,"options",{type:"object",required:"valueNeeded"},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to update user. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback),paramInvalid)return paramInvalid;options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);if(null!==TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:"AddOrChangeUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".EnableUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".DisableUser"},{commandOptions:["SendWriteValue"],symbol:"GetSymbolAccess",writeValue:domain+".RenameUser"}]},{},data=>{var _a;if(data.error||!data.response){const errorDetail={code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],domain:"TcHmi.Server.UserManagement",errors:data.details?[data.details]:void 0};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}let AddOrChangeUserAccessCommand=data.response.commands.find(value=>"AddOrChangeUser"===value.writeValue);if(AddOrChangeUserAccessCommand.readValue===TcHmi.Server.ACCESS.NONE||AddOrChangeUserAccessCommand.readValue===TcHmi.Server.ACCESS.READ){if(options){if(options.newName){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for renaming "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.addGroups){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for adding groups of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.removeGroups){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for removing groups of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(void 0!==options.enabled){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights to "+(options.enabled?"enable ":"disable ")+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}if(options.autoLogout){const errorDetail={code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:"Missing access rights for changing auto logout of "+userName,domain:"TcHmi.Server.UserManagement"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}const writeValue={},request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ChangeUserSettings",writeValue:writeValue}]};if(TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(writeValue.locale=options.locale),TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(writeValue.timeFormatLocale=options.timeFormatLocale),TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeZone",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(writeValue.timeZone=options.timeZone),TcHmi.System.isParameterTypeInvalid(options.password,"options.password",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.password){if(TcHmi.System.isParameterTypeInvalid(options.currentPassword,"options.currentPassword",{type:"string",required:"valueNeeded"},"TcHmi.Server.UserManagment",callback))return;writeValue.changePassword={currentPassword:options.currentPassword,newPassword:options.password}}if(Object.keys(writeValue).length){if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}else{const parameters={},settings={},writeValue={domain:domain,userName:userName,parameters:parameters,settings:settings},request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:writeValue}]};if(options){if(options.currentPassword&&TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Server.UserManagement.updateUser] The current user has access to server symbol AddOrChangeUser thus the given current password will be ignored by the server."),TcHmi.System.isParameterTypeInvalid(options.password,"options.password",{type:"string",required:"undefinedOk"},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.password)parameters.password=options.password,parameters.enabled=null!==(_a=options.enabled)&&void 0!==_a?_a:void 0;else if("boolean"==typeof options.enabled){const EnOrDisableCommandName=options.enabled?"EnableUser":"DisableUser";let EnOrDisableUserAccessCommand=data.response.commands.find(value=>value.writeValue===domain+"."+EnOrDisableCommandName);EnOrDisableUserAccessCommand.readValue!==TcHmi.Server.ACCESS.READWRITE&&EnOrDisableUserAccessCommand.readValue!==TcHmi.Server.ACCESS.WRITE||request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+"."+EnOrDisableCommandName,writeValue:userName})}if(TcHmi.System.isParameterTypeInvalid(options.autoLogout,"options.autoLogout",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.autoLogout&&(settings.autoLogoff=options.autoLogout),TcHmi.System.isParameterTypeInvalid(options.locale,"options.locale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.locale&&options.locale.length>0||null===options.locale)&&(settings.locale=options.locale),TcHmi.System.isParameterTypeInvalid(options.timeFormatLocale,"options.timeFormatLocale",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeFormatLocale&&options.timeFormatLocale.length>0||null===options.timeFormatLocale)&&(settings.timeFormatLocale=options.timeFormatLocale),TcHmi.System.isParameterTypeInvalid(options.timeZone,"options.timeZone",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if(("string"==typeof options.timeZone&&options.timeZone.length>0||null===options.timeZone)&&(settings.timeZone=options.timeZone),TcHmi.System.isParameterTypeInvalid(options.newName,"options.newName",{type:"string",required:"fullOptional",minStringLength:1},"TcHmi.Server.UserManagement",callback))return;if("string"==typeof options.newName&&options.newName.length>0){let RenameUserAccessCommand=data.response.commands.find(value=>value.writeValue===domain+".RenameUser");RenameUserAccessCommand.readValue!==TcHmi.Server.ACCESS.READWRITE&&RenameUserAccessCommand.readValue!==TcHmi.Server.ACCESS.WRITE||request.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".RenameUser",writeValue:{currentUserName:userName,newUserName:options.newName}})}writeValue.parameters&&0===Object.keys(writeValue.parameters).length&&delete writeValue.parameters,writeValue.settings&&0===Object.keys(writeValue.settings).length&&delete writeValue.settings;if(null===Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{var _a,_b,_c,_d,_e,_f;let AddOrChangeUserCommandResult=data.results.find(value=>"AddOrChangeUser"===value.symbol),newGroups=null!==(_c=tchmi_clone_object(null===(_b=null===(_a=AddOrChangeUserCommandResult.value)||void 0===_a?void 0:_a.settings)||void 0===_b?void 0:_b.groups))&&void 0!==_c?_c:[];if(!TcHmi.System.isParameterTypeInvalid(options.addGroups,"options.addGroups",{type:"string",required:"undefinedOk",minStringLength:1,expectArray:!0},"TcHmi.Server.UserManagement",callback)&&(Array.isArray(options.addGroups)&&options.addGroups.forEach(newGroup=>{newGroups.includes(newGroup)||newGroups.push(newGroup)}),!TcHmi.System.isParameterTypeInvalid(options.removeGroups,"options.removeGroups",{type:"string",required:"undefinedOk",minStringLength:1,expectArray:!0},"TcHmi.Server.UserManagement",callback)))if(Array.isArray(options.removeGroups)&&options.removeGroups.forEach(deleteGroup=>{let deleteIndex=newGroups.indexOf(deleteGroup);-1!==deleteIndex&&newGroups.splice(deleteIndex,1)}),tchmi_equal(tchmi_clone_object(newGroups).sort(),tchmi_clone_object(null!==(_f=null===(_e=null===(_d=AddOrChangeUserCommandResult.value)||void 0===_d?void 0:_d.settings)||void 0===_e?void 0:_e.groups)&&void 0!==_f?_f:[]).sort()))TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE});else{const request={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"AddOrChangeUser",writeValue:{domain:domain,userName:userName,settings:{groups:newGroups}}}]};"string"==typeof options.newName&&options.newName.length>0&&(request.commands[0].writeValue.userName=options.newName),Server.requestEx(request,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}}}))return{code:TcHmi.Errors.NONE};{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}}
/**
             * Check access rights for usermanagement functions
             * @param options Option for setting usermanagement domain
             * @param callback
             * @preserve (Part of the public API)
             */static getApiAccess(options,callback=null){if(!TcHmi.System.Services.accessManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to check api access. System not ready.",domain:"TcHmi.Server"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain=TcHmi.System.Services.accessManager.getCurrentUserConfig().defaultAuthExtension;if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.UserManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const canRead=function(access){return access===ACCESS.READWRITE||access===ACCESS.READ},canWrite=function(access){return access===ACCESS.READWRITE||access===ACCESS.WRITE},symbolToCheck={};symbolToCheck.AddOrChangeUser=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".ListUsers"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".Config"]=TcHmi.Server.ACCESS.NONE,symbolToCheck["TcHmiSrv.Config"]=TcHmi.Server.ACCESS.NONE,symbolToCheck.RemoveUser=TcHmi.Server.ACCESS.NONE,symbolToCheck.ChangeUserSettings=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".EnableUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".DisableUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".RenameUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".AddUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".RemoveUser"]=TcHmi.Server.ACCESS.NONE,symbolToCheck[domain+".ChangePassword"]=TcHmi.Server.ACCESS.NONE;let commands=[];for(let symbolName of Object.keys(symbolToCheck))commands.push({commandOptions:["SendWriteValue","SendErrorMessage"],symbol:"GetSymbolAccess",writeValue:symbolName});commands.push({commandOptions:["SendErrorMessage"],symbol:"TcHmiSrv.Config::USERGROUPUSERS::"+domain});if(null!==TcHmi.Server.requestEx({requestType:"ReadWrite",commands:commands},{},data=>{var _a,_b;if(data.error||!(null===(_a=data.response)||void 0===_a?void 0:_a.commands)){const errorDetail={code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],domain:"TcHmi.Server.UserManagement",errors:data.details?[data.details]:void 0};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}for(let symbolName of Object.keys(symbolToCheck))symbolToCheck[symbolName]=data.response.commands.find(value=>value.writeValue===symbolName).readValue;let usergroupUsers=null!==(null===(_b=data.response.commands.find(command=>command.symbol==="TcHmiSrv.Config::USERGROUPUSERS::"+domain))||void 0===_b?void 0:_b.readValue);TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,result:{addUser:{general:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),enable:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),locale:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),timeFormatLocale:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),timeZone:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),autoLogoff:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser),groups:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser)},listUserNames:{general:canRead(symbolToCheck[domain+".ListUsers"])},listUsers:{general:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),enabled:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),locale:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),timeFormatLocale:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),timeZone:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),autoLogoff:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"]),groups:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"])},listUserGroups:{general:canRead(symbolToCheck["TcHmiSrv.Config"]),enabled:canRead(symbolToCheck["TcHmiSrv.Config"]),fileAccess:canRead(symbolToCheck["TcHmiSrv.Config"]),files:canRead(symbolToCheck["TcHmiSrv.Config"]),symbolAccess:canRead(symbolToCheck["TcHmiSrv.Config"]),symbols:canRead(symbolToCheck["TcHmiSrv.Config"])},listUsersInGroup:{general:usergroupUsers&&canRead(symbolToCheck["TcHmiSrv.Config"])},removeUser:{general:null!==symbolToCheck[domain+".RemoveUser"]&&canWrite(symbolToCheck.RemoveUser)},updateUser:{general:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),newName:canWrite(symbolToCheck.AddOrChangeUser)&&canWrite(symbolToCheck[domain+".RenameUser"]),addGroups:canWrite(symbolToCheck.AddOrChangeUser),removeGroups:canWrite(symbolToCheck.AddOrChangeUser),enabled:canWrite(symbolToCheck.AddOrChangeUser)&&canWrite(symbolToCheck[domain+".EnableUser"])&&canWrite(symbolToCheck[domain+".DisableUser"]),autoLogout:canWrite(symbolToCheck.AddOrChangeUser),locale:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),timeFormatLocale:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),timeZone:canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser),changeOwnPassword:null!==symbolToCheck[domain+".ChangePassword"]&&(canWrite(symbolToCheck.ChangeUserSettings)||canWrite(symbolToCheck.AddOrChangeUser)),changePassword:null!==symbolToCheck[domain+".AddUser"]&&canWrite(symbolToCheck.AddOrChangeUser)}}})}))return{code:TcHmi.Errors.NONE};{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.UserManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}}};class RecipeManagement{
/**
             * Lists all available recipe types
             * @param callback
             * @preserve (Part of the public API)
             */
static listRecipeTypes(callback=null){return this.listRecipeTypesEx(null,null,callback)}
/**
             * Lists all available recipe types
             * This function provides more options to manipulate the request
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listRecipeTypesEx(options,requestOptions=null,callback=null){let domain="TcHmiRecipeManagement",path="";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.path,"options.path",{type:"string",required:"fullOptional",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.path&&options.path.length>0&&(path="::"+options.path)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList"+path}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
            * Watches a list of all available recipe types
            * @param options Options for the watch
            * @param callback Callback which is called once and on every change
            * @preserve (Part of the public API)
            */static watchRecipeTypesList(options,callback=null){let domain="TcHmiRecipeManagement";if(options){if(TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback))return function(){};"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}let recipeSymbol=new TcHmi.Symbol("%s%"+domain+".Config::recipeTypeList%/s%"),destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})}));return destroy}
/**
            * Returns a recipe types addressed by name and optional path
            * @param callback
            * @preserve (Part of the public API)
            */static getRecipeType(recipeTypeName,path,callback=null){return this.getRecipeTypeEx(recipeTypeName,path,null,null,callback)}
/**
             * Returns a recipe types addressed by name and optional path
             * This function provides more options to manipulate the request
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static getRecipeTypeEx(recipeTypeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}return this.listRecipeTypesEx({domain:domain,path:(path?path+"::":"")+recipeTypeName},requestOptions,callback)}
/**
            * Watches a recipe type
            * @param options Options for the watch
            * @param callback Callback which is called once and on every change
            * @preserve (Part of the public API)
            */static watchRecipeType(recipeTypeName,path,options,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}let recipeSymbol=new TcHmi.Symbol("%s%"+domain+".Config::recipeTypeList::"+(path?path+"::":"")+recipeTypeName+"%/s%"),destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})}));return destroy}
/**
             * Creates a recipe type folder
             * @param path name of the new folder
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeTypeFolder(path,callback=null){return this.createRecipeTypeFolderEx(path,null,null,callback)}
/**
             * Creates a recipe type folder
             * This function provides more options to manipulate the request
             * @param path Name of the new folder
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeTypeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList::"+path,writeValue:{}}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe type folder
             * @param path name of the folder
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeTypeFolder(path,callback=null){return this.deleteRecipeTypeFolderEx(path,null,null,callback)}
/**
             * Deletes a recipe type folder
             * This function provides more options to manipulate the request
             * @param path Name of the folder
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeTypeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeTypeList::"+path}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Creates a new recipe type
             * @param recipeTypeName name of the recipe type
             * @param recipeType recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeType(recipeTypeName,recipeType,path,callback=null){return this.createRecipeTypeEx(recipeTypeName,recipeType,path,null,null,callback)}
/**
             * Creates a new recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param recipeType Recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeTypeEx(recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){return this.__manipulateRecipeType(!1,recipeTypeName,recipeType,path,options,requestOptions,callback)}
/**
             * Updates a recipe type
             * @param recipeTypeName name of the recipe type
             * @param recipeType recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static updateRecipeType(recipeTypeName,recipeType,path,callback=null){return this.updateRecipeTypeEx(recipeTypeName,recipeType,path,null,null,callback)}
/**
             * Updates a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param recipeType Recipe type definition
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static updateRecipeTypeEx(recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){return this.__manipulateRecipeType(!0,recipeTypeName,recipeType,path,options,requestOptions,callback)}static __manipulateRecipeType(update,recipeTypeName,recipeType,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeTypeList::"+(path?path+"::":"")+recipeTypeName,writeValue:recipeType}]};update&&writeRequest.commands[0].commandOptions.push("Replace");if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Renames or moves a recipe type
             * @param recipeTypeName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeType(recipeTypeName,path,newName,newPath,callback=null){return this.renameRecipeTypeEx(recipeTypeName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeTypeEx(recipeTypeName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeTypeList",recipeTypeName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Renames or moves a recipe type folder
             * @param recipeTypeFolderName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeTypeFolder(recipeTypeFolderName,path,newName,newPath,callback=null){return this.renameRecipeTypeFolderEx(recipeTypeFolderName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe type folder
             * This function provides more options to manipulate the request
             * @param recipeTypeFolderName Old name of the recipe type
             * @param path Old path of the recipe type (root folder if set to null)
             * @param newName New name of the recipe type
             * @param newPath New path of the recipe type (root folder if set to null)
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeTypeFolderEx(recipeTypeFolderName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeTypeList",recipeTypeFolderName,path,newName,newPath,options,requestOptions,callback)}static __renameRecipeEntry(rootFolder,oldName,path,newName,newPath,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(oldName,"oldName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newName,"newName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newPath,"newpath",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Rename",writeValue:{domain:domain,configuration:"default",old:rootFolder+"::"+(path?path+"::":"")+oldName,new:rootFolder+"::"+(newPath?newPath+"::":"")+newName}}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe type
             * @param recipeTypeName name of the recipe type
             * @param path Path of the recipe type (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeType(recipeTypeName,path,callback=null){return this.deleteRecipeTypeEx(recipeTypeName,path,null,null,callback)}
/**
             * Deletes a recipe type
             * This function provides more options to manipulate the request
             * @param recipeTypeName Name of the recipe type
             * @param path Path of the recipe type (root folder if set to null)
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeTypeEx(recipeTypeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeTypeName,"recipeTypeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeTypeList::"+(path?path+"::":"")+recipeTypeName}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all available recipes
             * @param callback
             * @preserve (Part of the public API)
             */static listRecipes(callback=null){return this.listRecipesEx(null,null,callback)}
/**
             * Lists all available recipes
             * This function provides more options to manipulate the request
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static listRecipesEx(options,requestOptions=null,callback=null){let path="",domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.path,"options.path",{type:"string",required:"fullOptional"},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if("string"==typeof options.path&&options.path.length>0&&(path="::"+options.path),paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+path}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
            * Watches a list of all available recipes
            * @param options Options for the watch
            * @param callback Callback which is called once and on every change
            * @preserve (Part of the public API)
            */static watchRecipeList(options,callback=null){let domain="TcHmiRecipeManagement";if(options){if(TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback))return function(){};"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);let recipeSymbol=new TcHmi.Symbol("%s%"+domain+".Config::recipeList%/s%"),destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})}));return destroy}
/**
             * Creates a recipe folder
             * @param path name of the new folder
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeFolder(path,callback=null){return this.createRecipeFolderEx(path,null,null,callback)}
/**
             * Creates a recipe folder
             * This function provides more options to manipulate the request
             * @param path name of the new folder
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList::"+path,writeValue:{}}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Deletes a recipe folder
             * @param path name of the folder
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeFolder(path,callback=null){return this.deleteRecipeFolderEx(path,null,null,callback)}
/**
             * Deletes a recipe folder
             * This function provides more options to manipulate the request
             * @param path Name of the folder
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeFolderEx(path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeList::"+path}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Creates a new recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param recipe recipe definition
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipe(recipeName,path,recipe,callback=null){return this.createRecipeEx(recipeName,path,recipe,null,null,callback)}
/**
             * Creates a new recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param recipe Recipe definition
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static createRecipeEx(recipeName,path,recipe,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(path?"::"+path:"")+"::"+recipeName,writeValue:recipe}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".UpdateRecipe",writeValue:{path:(path?path+"::":"")+recipeName}}]};Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists one recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static getRecipe(recipeName,path,callback=null){return this.getRecipeEx(recipeName,path,null,null,callback)}
/**
             * Lists one recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static getRecipeEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(path?"::"+path:"")+"::"+recipeName}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
            * Watches a recipe
            * @param options Options for the watch
            * @param callback Callback which is called once and on every change
            * @preserve (Part of the public API)
            */static watchRecipe(recipeName,path,options,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return function(){};if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return function(){};"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}let recipeSymbol=new TcHmi.Symbol("%s%"+domain+".Config::recipeList"+(path?"::"+path:"")+"::"+recipeName+"%/s%"),destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})}));return destroy}
/**
             * Updates a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newValues dictionary of the new values
             * @param callback
             * @preserve (Part of the public API)
             */static updateRecipe(recipeName,path,newValues,callback=null){return this.updateRecipeEx(recipeName,path,newValues,null,null,callback)}
/**
             * Updates a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newValues Dictionary of the new values
             * @param options Options
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static updateRecipeEx(recipeName,path,newValues,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(newValues,"newValues",{type:"object",required:"valueNeeded"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::recipeList"+(path?"::"+path:"")+"::"+recipeName+"::values",writeValue:newValues}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Reads all values which is referenced by a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static readFromTarget(recipeName,path,callback=null){return this.readFromTargetEx(recipeName,path,null,null,callback)}
/**
             * Reads all values which is referenced by a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static readFromTargetEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ReadFromTarget",writeValue:{path:(path?path+"::":"")+recipeName}}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Reads the current values which are referenced from a base recipe and write it back
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static teach(recipeName,path,callback=null){return this.teachEx(recipeName,path,null,null,callback)}
/**
             * Reads the current values which are referenced from a base recipe and write it back
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static teachEx(recipeName,path,options,requestOptions=null,callback=null){return this.readFromTargetEx(recipeName,path,options,requestOptions,(function(data){data.error===TcHmi.Errors.NONE?RecipeManagement.createRecipeEx(recipeName,path,data.value[(path?path+"::":"")+recipeName],options,requestOptions,callback):TcHmi.Callback.callSafeEx(callback,null,data)}))}
/**
             * Reads the current values which are referenced from a base recipe and write it into a new recipe
             * @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newrecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
             * @param newRecipePath Path of the new recipe. (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static teachAsNewRecipe(recipeName,path,newRecipeName,newRecipePath,callback=null){return this.teachAsNewRecipeEx(recipeName,path,newRecipeName,newRecipePath,null,null,callback)}
/**
             * Reads the current values which are referenced from a base recipe and write it into a new recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param newrecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
             * @param newRecipePath Path of the new recipe. (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static teachAsNewRecipeEx(recipeName,path,newRecipeName,newRecipePath,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);return paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(newRecipeName,"newRecipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid||(paramInvalid=TcHmi.System.isParameterTypeInvalid(newRecipePath,"newRecipepath",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid||this.readFromTargetEx(recipeName,path,options,requestOptions,(function(data){data.error===TcHmi.Errors.NONE?RecipeManagement.createRecipeEx(newRecipeName,newRecipePath,data.value[(path?path+"::":"")+recipeName],options,requestOptions,callback):TcHmi.Callback.callSafeEx(callback,null,data)})))))}
/**
             * Activates a recipe (writes all values)
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static activate(recipeName,path,callback=null){return this.activateEx(recipeName,path,null,null,callback)}
/**
             * Activates a recipe (writes all values)
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static activateEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".ActivateRecipe",writeValue:{path:(path?path+"::":"")+recipeName}}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Lists all active recipes
             * @param callback
             * @preserve (Part of the public API)
             */static getActiveRecipes(callback=null){return this.getActiveRecipesEx(null,null,callback)}
/**
             * Lists all active recipes
             * This function provides more options to manipulate the request
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static getActiveRecipesEx(options,requestOptions=null,callback=null){let domain="TcHmiRecipeManagement";if(options){let paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".GetActiveRecipes"}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,recipeList:data.results[0].value})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
            * Watches a list of all active recipes
            * @param options Options for the watch
            * @param callback Callback which is called once and on every change
            * @preserve (Part of the public API)
            */static watchActiveRecipes(options,callback=null){let domain="TcHmiRecipeManagement";if(options){if(TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback))return function(){};"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}let recipeSymbol=new TcHmi.Symbol("%s%"+domain+".GetActiveRecipes%/s%"),destroy=recipeSymbol.watch((function(data){destroy||(destroy=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:recipeSymbol.getExpression().toString(),domain:"TcHmi.Server.RecipeManagement",errors:data.details?[data.details]:void 0},destroy:destroy})}));return destroy}
/**
             * Renames or moves a recipe
             * @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipe(recipeName,path,newName,newPath,callback=null){return this.renameRecipeEx(recipeName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeEx(recipeName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeList",recipeName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Renames or moves a recipe folder
             * @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName New name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeFolder(recipeFolderName,path,newName,newPath,callback=null){return this.renameRecipeFolderEx(recipeFolderName,path,newName,newPath,null,null,callback)}
/**
             * Renames or moves a recipe folder
             * This function provides more options to manipulate the request
             * @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Old path of the recipe (root folder if set to null)
             * @param newName Mew name of the recipe
             * @param newPath New path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static renameRecipeFolderEx(recipeFolderName,path,newName,newPath,options,requestOptions=null,callback=null){return this.__renameRecipeEntry("recipeList",recipeFolderName,path,newName,newPath,options,requestOptions,callback)}
/**
             * Deletes a recipe
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipe(recipeName,path,callback=null){return this.deleteRecipeEx(recipeName,path,null,null,callback)}
/**
             * Deletes a recipe
             * This function provides more options to manipulate the request
             * @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
             * @param path Path of the recipe (root folder if set to null)
             * @param options Options for the recipeManagement
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static deleteRecipeEx(recipeName,path,options,requestOptions=null,callback=null){let paramInvalid=TcHmi.System.isParameterTypeInvalid(recipeName,"recipeName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.RecipeManagement",callback);if(paramInvalid)return paramInvalid;if(paramInvalid=TcHmi.System.isParameterTypeInvalid(path,"path",{type:"string",required:"nullOk"},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;let domain="TcHmiRecipeManagement";if(options){if(paramInvalid=TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Server.RecipeManagement",callback),paramInvalid)return paramInvalid;"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain)}const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::recipeList::"+(path?path+"::":"")+recipeName}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.RecipeManagement"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}}Server.RecipeManagement=RecipeManagement;Server.Historize=class{
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param callback
             * @preserve (Part of the public API)
             */
static add(symbolName,settings,callback=null){return this.addEx2(symbolName,settings,null,null,callback)}
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static addEx(symbolName,settings,requestOptions,callback=null){return this.addEx2(symbolName,settings,null,requestOptions,callback)}
/**
             * Adding a Symbol to the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static addEx2(symbolName,settings,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}if(null==settings||"object"!=typeof settings){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter settings given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);let writeValue={interval:"PT1S",maxEntries:1e4,rowLimit:1e4,recordingEnabled:!0};void 0!==settings.INTERVAL&&(writeValue.interval=settings.INTERVAL),void 0!==settings.MAXENTRIES&&(writeValue.maxEntries=settings.MAXENTRIES),void 0!==settings.ROWLIMIT&&(writeValue.rowLimit=settings.ROWLIMIT),void 0!==settings.RECORDINGENABLED&&(writeValue.recordingEnabled=settings.RECORDINGENABLED);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue:writeValue}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Removing a Symbol from the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param callback
             * @preserve (Part of the public API)
             */static remove(symbolName,callback=null){return this.removeEx2(symbolName,null,null,callback)}
/**
            * Removing a Symbol from the Historize Configuration of the server
            * @param symbolName Name of the Symbol to manipulate
            * @param requestOptions Options for the request itself
            * @param callback
            * @preserve (Part of the public API)
            */static removeEx(symbolName,requestOptions,callback=null){return this.removeEx2(symbolName,null,requestOptions,callback)}
/**
             * Removing a Symbol from the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static removeEx2(symbolName,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue","Delete"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param callback
             * @preserve (Part of the public API)
             */static update(symbolName,settings,callback=null){return this.updateEx2(symbolName,settings,null,null,callback)}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static updateEx(symbolName,settings,requestOptions,callback=null){return this.updateEx2(symbolName,settings,null,requestOptions,callback)}
/**
             * Update a config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param settings
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static updateEx2(symbolName,settings,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}if(null==settings||"object"!=typeof settings){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter settings given",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(readRequest,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let writeValue=tchmi_clone_object(readValue);void 0!==settings.INTERVAL&&(writeValue.interval=settings.INTERVAL),void 0!==settings.MAXENTRIES&&(writeValue.maxEntries=settings.MAXENTRIES),void 0!==settings.ROWLIMIT&&(writeValue.rowLimit=settings.ROWLIMIT),void 0!==settings.RECORDINGENABLED&&(writeValue.recordingEnabled=settings.RECORDINGENABLED);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue:writeValue}]};Server.requestEx(writeRequest,requestOptions,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param callback
             * @preserve (Part of the public API)
             */static get(symbolName,callback=null){return this.getEx2(symbolName,null,null,callback)}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static getEx(symbolName,requestOptions,callback=null){return this.getEx2(symbolName,null,requestOptions,callback)}
/**
             * Gets the current config of a Symbol in the Historize Configuration of the server
             * @param symbolName Name of the Symbol to manipulate
             * @param options global settings
             * @param requestOptions Options for the request itself
             * @param callback
             * @preserve (Part of the public API)
             */static getEx2(symbolName,options,requestOptions,callback=null){if(!symbolName){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid parameter symbolName given.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}let domain="TcHmiSqliteHistorize";options&&"string"==typeof options.domain&&options.domain.length>0&&(domain=options.domain);const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};if(null===Server.requestEx(readRequest,requestOptions,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let settings={};void 0!==readValue.interval&&(settings.INTERVAL=readValue.interval),void 0!==readValue.maxEntries&&(settings.MAXENTRIES=readValue.maxEntries),void 0!==readValue.rowLimit&&(settings.ROWLIMIT=readValue.rowLimit),void 0!==readValue.recordingEnabled&&(settings.RECORDINGENABLED=readValue.recordingEnabled),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,key:symbolName,settings:settings})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.Server.Historize"};return TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail}return{code:TcHmi.Errors.NONE}}};class Events{static confirmAlarm(alarm,callback){var _a,_b,_c,_d;let rawAlarm={name:alarm.name,domain:alarm.sourceDomain,severity:alarm.severity,timeRaised:alarm.timeRaised.toISOString(),params:alarm.params,id:alarm.id,timeCleared:null!==(_b=null===(_a=alarm.timeCleared)||void 0===_a?void 0:_a.toISOString())&&void 0!==_b?_b:null,timeConfirmed:null!==(_d=null===(_c=alarm.timeConfirmed)||void 0===_c?void 0:_c.toISOString())&&void 0!==_d?_d:null,alarmState:alarm.alarmState,confirmationState:alarm.confirmationState};if(TcHmi.System.Services.serverEventManager)TcHmi.System.Services.serverEventManager.confirmAlarm(rawAlarm,callback);else{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to confirm alarm. System not ready.",domain:"TcHmi.Server.Events"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}static registerConsumer(filter,callbacks,doneCallback){let parsedFilter;try{parsedFilter=TcHmi.System.Filter.parse(filter,TcHmi.Type.getSchema("tchmi:server#/definitions/eventFilter"))}catch(e){const error={error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"An uncaught exception occurred while parsing the filter",exception:e,domain:"TcHmi.Server.Events"}};return TcHmi.Callback.callSafeEx(callbacks.list,null,error),TcHmi.Callback.callSafeEx(callbacks.subscription,null,error),TcHmi.Callback.callSafeEx(doneCallback,null,error),null}let consumer={filter:parsedFilter,rawFilter:filter,activeAlarmIds:[],listCallback:callbacks.list,subscriptionCallback:callbacks.subscription,registration:{listPending:void 0!==callbacks.list,subscriptionPending:void 0!==callbacks.subscription,callback:doneCallback}};return this.__consumersToAdd.push(consumer),-1!==this.__registerTimeoutId&&window.clearTimeout(this.__registerTimeoutId),this.__registerTimeoutId=window.setTimeout(()=>{this.__registerTimeoutId=-1,this.__addConsumers()},200),()=>{const indexToAdd=this.__consumersToAdd.indexOf(consumer),indexAdded=this.__consumers.indexOf(consumer);-1!==indexToAdd&&this.__consumersToAdd.splice(indexToAdd,1),-1!==indexAdded&&(this.__consumers.splice(indexAdded,1),consumer.subscriptionCallback&&(-1!==this.__unregisterTimeoutId&&window.clearTimeout(this.__unregisterTimeoutId),this.__unregisterTimeoutId=window.setTimeout(()=>{this.__unregisterTimeoutId=-1,this.__updateSubscription()},500)))}}static __addConsumers(){this.__listEvents(this.__consumersToAdd),this.__consumers.push(...this.__consumersToAdd),this.__consumersToAdd=[],this.__updateSubscription(data=>{for(const consumer of this.__consumers)consumer.registration.subscriptionPending&&(consumer.registration.subscriptionPending=!1,!consumer.registration.listPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,data))})}static __feedListConsumers(consumers,events){for(let i=0,ii=consumers.length;i<ii;i++){let consumer=consumers[i];if(!consumer.listCallback)continue;consumer.activeAlarmIds=[];let eventsForConsumer=[];for(let j=0,jj=events.length;j<jj;j++){let parsedEvent=this.parseServerEvent(events[j]);consumer.filter.test(parsedEvent)&&(eventsForConsumer.push(parsedEvent),Events.isAlarm(parsedEvent)&&parsedEvent.id>-1&&-1===consumer.activeAlarmIds.indexOf(parsedEvent.id)&&consumer.activeAlarmIds.push(parsedEvent.id))}TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:TcHmi.Errors.NONE,events:eventsForConsumer}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:TcHmi.Errors.NONE}))}}static __feedSubscriptionConsumers(event){for(let i=0,ii=this.__consumers.length;i<ii;i++){let consumer=this.__consumers[i];if(!consumer.subscriptionCallback)continue;let parsedEvent=this.parseServerEvent(event);if(consumer.filter.test(parsedEvent))Events.isAlarm(parsedEvent)&&parsedEvent.id>-1&&-1===consumer.activeAlarmIds.indexOf(parsedEvent.id)&&consumer.activeAlarmIds.push(parsedEvent.id),consumer.subscriptionCallback({error:TcHmi.Errors.NONE,event:parsedEvent,changeType:this.__toServerEventChangeType(event.changeType),removedByFilter:!1});else if(Events.isAlarm(parsedEvent)&&parsedEvent.id>-1){let alarmIndex=consumer.activeAlarmIds.indexOf(parsedEvent.id);-1!==alarmIndex&&(consumer.activeAlarmIds.splice(alarmIndex,1),TcHmi.Callback.callSafeEx(consumer.subscriptionCallback,null,{error:TcHmi.Errors.NONE,event:parsedEvent,changeType:this.__toServerEventChangeType(event.changeType),removedByFilter:!0}))}}}static __listEvents(consumers){if(!TcHmi.System.Services.serverEventManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to handle events. System not ready.",domain:"TcHmi.Server.Events"};for(const consumer of consumers)TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:errorDetail.code,details:errorDetail}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:errorDetail.code,details:errorDetail}));return}const filter=this.__accumulateFilters(consumers,!1);void 0!==filter&&TcHmi.System.Services.serverEventManager.listEvents(filter,data=>{if(data.error===TcHmi.Errors.NONE&&data.events)this.__feedListConsumers(consumers,data.events);else for(const consumer of consumers)TcHmi.Callback.callSafeEx(consumer.listCallback,null,{error:data.error,details:data.details}),consumer.registration.listPending&&(consumer.registration.listPending=!1,!consumer.registration.subscriptionPending&&consumer.registration.callback&&TcHmi.Callback.callSafeEx(consumer.registration.callback,null,{error:data.error,details:data.details}))})}static __updateSubscription(callback){if(!TcHmi.System.Services.serverEventManager){const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to handle events. System not ready.",domain:"TcHmi.Server.Events"};return void TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}const filter=this.__accumulateFilters(this.__consumers,!0);if(void 0!==filter)if(-1===this.__subscriptionId){let subscriptionId=TcHmi.System.Services.serverEventManager.subscribe(filter,this.__onEventReveived(),callback);subscriptionId?(this.__subscriptionId=subscriptionId,this.__onLocaleChangedDestroyer=TcHmi.EventProvider.register("onLocaleChanged",this.__onLocaleChanged())):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Server] Reached maxium of parallel requests.")}else TcHmi.System.Services.serverEventManager.updateSubscription(this.__subscriptionId,filter,callback);else-1!==this.__subscriptionId&&(TcHmi.System.Services.serverEventManager.unsubscribe(this.__subscriptionId,callback),this.__subscriptionId=-1,this.__onLocaleChangedDestroyer&&(this.__onLocaleChangedDestroyer(),this.__onLocaleChangedDestroyer=null))}static __onEventReveived(){return data=>{data.error===TcHmi.Errors.NONE&&data.event?this.__feedSubscriptionConsumers(data.event):this.__consumers.forEach(consumer=>TcHmi.Callback.callSafeEx(consumer.subscriptionCallback,null,{error:data.error}))}}static __onLocaleChanged(){return()=>{this.__listEvents(this.__consumers)}}static __accumulateFilters(consumers,forSubscription){let filter;if(1===consumers.length)filter=forSubscription&&consumers[0].subscriptionCallback||!forSubscription&&consumers[0].listCallback?consumers[0].rawFilter:void 0;else{filter=[];for(let i=0,ii=consumers.length;i<ii;i++){if(forSubscription&&!consumers[i].subscriptionCallback||!forSubscription&&!consumers[i].listCallback)continue;const rawFilter=consumers[i].rawFilter;if(null===rawFilter||0===rawFilter.length){filter=null;break}filter.push(1===rawFilter.length?rawFilter[0]:rawFilter),i+1!==ii&&filter.push({logic:"OR"})}null!==filter&&0===filter.length&&(filter=void 0)}return filter}static parseServerEvent(rawEvent){var _a;switch(null!==(_a=rawEvent.payloadType)&&void 0!==_a?_a:Events.Type.Payload){case Events.Type.Message:let rawMessage=rawEvent.payload,message={type:Events.Type.Message,domain:rawEvent.domain,sourceDomain:rawMessage.domain,name:rawMessage.name,severity:rawMessage.severity,text:rawEvent.localizedString,timeRaised:new Date(rawMessage.timeRaised),timeReceived:new Date(rawEvent.timeReceived),params:rawMessage.params};return void 0!==rawEvent.sessionId&&(message.sessionId=rawEvent.sessionId),message;case Events.Type.Alarm:let rawAlarm=rawEvent.payload,alarm={type:Events.Type.Alarm,domain:rawEvent.domain,sourceDomain:rawAlarm.domain,name:rawAlarm.name,severity:rawAlarm.severity,id:rawAlarm.id,text:rawEvent.localizedString,timeRaised:new Date(rawAlarm.timeRaised),timeCleared:rawAlarm.timeCleared?new Date(rawAlarm.timeCleared):null,timeConfirmed:rawAlarm.timeConfirmed?new Date(rawAlarm.timeConfirmed):null,timeReceived:new Date(rawEvent.timeReceived),alarmState:rawAlarm.alarmState,confirmationState:rawAlarm.confirmationState,params:rawAlarm.params};return void 0!==rawEvent.sessionId&&(alarm.sessionId=rawEvent.sessionId),alarm;case Events.Type.Payload:let payloadEvent={type:Events.Type.Payload,domain:rawEvent.domain,name:rawEvent.name,timeReceived:new Date(rawEvent.timeReceived)};return void 0!==rawEvent.payload&&(payloadEvent.payload=rawEvent.payload),void 0!==rawEvent.sessionId&&(payloadEvent.sessionId=rawEvent.sessionId),payloadEvent}}static __toServerEventChangeType(alarmChangeType){if(void 0===alarmChangeType)return Events.ChangeType.MessageSent;switch(alarmChangeType){case TcHmi.Server.Events.ServerAlarmChangeType.Raise:return Events.ChangeType.AlarmRaised;case TcHmi.Server.Events.ServerAlarmChangeType.Change:return Events.ChangeType.AlarmChanged;case TcHmi.Server.Events.ServerAlarmChangeType.Dispose:return Events.ChangeType.AlarmDisposed}}static createEvent(event,callback){if(TcHmi.System.isParameterTypeInvalid(event,"event",{type:"object",required:"valueNeeded",expectArray:!1},"TcHmi.Server.Events",callback))return;const rawEvent={domain:event.domain,name:event.name,timeReceived:event.timeReceived.toISOString()};switch(event.sessionId&&(rawEvent.sessionId=event.sessionId),event.type){case Events.Type.Message:const rawMessage={name:event.name,domain:event.domain,severity:event.severity,timeRaised:event.timeRaised.toISOString(),params:event.params};rawEvent.payloadType=Events.Type.Message,rawEvent.payload=rawMessage,event.text&&(rawEvent.localizedString=event.text);break;case Events.Type.Payload:event.payload&&(rawEvent.payloadType=Events.Type.Payload,rawEvent.payload=event.payload)}Server.writeSymbol("CreateEvent",rawEvent,Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}}))}}Events.__consumers=[],Events.__consumersToAdd=[],Events.__registerTimeoutId=-1,Events.__unregisterTimeoutId=-1,Events.__subscriptionId=-1,Events.__onLocaleChangedDestroyer=null,Server.Events=Events,function(Events){let Type,Severity,AlarmState,ConfirmationState,ChangeType,ServerAlarmChangeType;!function(Type){Type[Type.Message=0]="Message",Type[Type.Alarm=1]="Alarm",Type[Type.Payload=2]="Payload"}(Type=Events.Type||(Events.Type={})),function(Severity){Severity[Severity.Verbose=0]="Verbose",Severity[Severity.Info=1]="Info",Severity[Severity.Warning=2]="Warning",Severity[Severity.Error=3]="Error",Severity[Severity.Critical=4]="Critical"}(Severity=Events.Severity||(Events.Severity={})),function(AlarmState){AlarmState[AlarmState.Raised=0]="Raised",AlarmState[AlarmState.Confirmed=1]="Confirmed",AlarmState[AlarmState.Cleared=2]="Cleared",AlarmState[AlarmState.ClearedAndConfirmed=3]="ClearedAndConfirmed",AlarmState[AlarmState.Invalid=4]="Invalid"}(AlarmState=Events.AlarmState||(Events.AlarmState={})),function(ConfirmationState){ConfirmationState[ConfirmationState.NotSupported=0]="NotSupported",ConfirmationState[ConfirmationState.NotRequired=1]="NotRequired",ConfirmationState[ConfirmationState.WaitForConfirmation=2]="WaitForConfirmation",ConfirmationState[ConfirmationState.Confirmed=3]="Confirmed",ConfirmationState[ConfirmationState.Reset=4]="Reset"}(ConfirmationState=Events.ConfirmationState||(Events.ConfirmationState={})),function(ChangeType){ChangeType[ChangeType.AlarmRaised=0]="AlarmRaised",ChangeType[ChangeType.AlarmChanged=1]="AlarmChanged",ChangeType[ChangeType.AlarmDisposed=2]="AlarmDisposed",ChangeType[ChangeType.MessageSent=3]="MessageSent"}(ChangeType=Events.ChangeType||(Events.ChangeType={})),function(ServerAlarmChangeType){ServerAlarmChangeType[ServerAlarmChangeType.Raise=0]="Raise",ServerAlarmChangeType[ServerAlarmChangeType.Change=1]="Change",ServerAlarmChangeType[ServerAlarmChangeType.Dispose=2]="Dispose"}(ServerAlarmChangeType=Events.ServerAlarmChangeType||(Events.ServerAlarmChangeType={})),Events.isAlarm=function(value){return value.type===Type.Alarm},Events.isMessage=function(value){return value.type===Type.Message},Events.isPayload=function(value){return value.type===Type.Payload}}(Events=Server.Events||(Server.Events={}));class ADS{static checkLicense(licenseId,callback=null){return Server.ADS.checkLicenseEx(licenseId,null,callback)}static checkLicenseEx(licenseId,requestOptions,callback=null){return licenseId?(TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{symbol:"ADS.CheckLicense",writeValue:licenseId,commandOptions:["SendWriteValue","SendErrorMessage"]}]},requestOptions,data=>{if(data.error===TcHmi.Errors.NONE){let response=data.response;if(!response)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.Server.ADS"};if(response.error)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS",errors:[response.error]}}),{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS",errors:[response.error]};let commands=response.commands;if(!commands)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"};let command=null;for(let i=0,ii=commands.length;i<ii;i++){if(command=commands[i],"ADS.CheckLicense"===command.symbol){if(command.error)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS",errors:[command.error]}}),{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS",errors:[command.error]};break}command=null}if(!command)return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:"Missing command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:"Missing command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"};let rv=command.readValue;return rv?(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,count:rv.count,expireTimeUTC:rv.expireTimeUTC,result:rv.result}),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE]}):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING,details:{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:"Missing property: 'readValue' in command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:"Missing property: 'readValue' in command for symbol: 'ADS.CheckLicense' in response from server with id: '"+response.id+"'.",domain:"TcHmi.Server.ADS"})}return TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request failed.",domain:"TcHmi.Server.ADS",errors:data.details?[data.details]:void 0}}),{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request failed.",domain:"TcHmi.Server.ADS",errors:data.details?[data.details]:void 0}}),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE]}):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Parameter: 'licenseId' must not be empty or undefined or null.",domain:"TcHmi.Server.ADS"}}),{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Parameter: 'licenseId' must not be empty or undefined or null.",domain:"TcHmi.Server.ADS"})}}Server.ADS=ADS,function(ADS){let CheckLicenseResult;!function(CheckLicenseResult){CheckLicenseResult[CheckLicenseResult.S_VALID=0]="S_VALID",CheckLicenseResult[CheckLicenseResult.S_PENDING=515]="S_PENDING",CheckLicenseResult[CheckLicenseResult.E_LICENSENOTFOUND=-403769124]="E_LICENSENOTFOUND",CheckLicenseResult[CheckLicenseResult.E_LICENSEEXPIRED=-403769125]="E_LICENSEEXPIRED",CheckLicenseResult[CheckLicenseResult.E_LICENSEEXCEEDED=-403769126]="E_LICENSEEXCEEDED",CheckLicenseResult[CheckLicenseResult.E_LICENSEINVALID=-403769127]="E_LICENSEINVALID",CheckLicenseResult[CheckLicenseResult.E_LICENSESYSTEMID=-403769128]="E_LICENSESYSTEMID",CheckLicenseResult[CheckLicenseResult.E_LICENSENOTIMELIMIT=-403769129]="E_LICENSENOTIMELIMIT",CheckLicenseResult[CheckLicenseResult.E_LICENSEFUTUREISSUE=-403769130]="E_LICENSEFUTUREISSUE",CheckLicenseResult[CheckLicenseResult.E_LICENSETIMETOLONG=-403769131]="E_LICENSETIMETOLONG"}(CheckLicenseResult=ADS.CheckLicenseResult||(ADS.CheckLicenseResult={}))}(ADS=Server.ADS||(Server.ADS={}));Server.Domains=class{static watch(name,callback){let s=new TcHmi.Symbol("%s%ListDomains%/s%"),destroy=s.watch(data=>{data&&data.error===TcHmi.Errors.NONE?data.value&&data.value[name]?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value[name])}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,details:{code:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN],reason:"Domain is unknown!",domain:"TcHmi.Server.Domains",errors:data.details?[data.details]:void 0}}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})});return()=>{destroy&&(destroy(),destroy=null),null==s||s.destroy(),s=null}}}}(Server=TcHmi.Server||(TcHmi.Server={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Reserved
    * @preserve (Part of the public API)
    */
class StyleProvider{
/**
         * Returns the given computed CSS property on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
         * Unset or unknown CSS values will not be set in the result object.
         * @param element The jQuery collection or single HTML/SVG element.
         * @param propertyNames The CSS property (string) or properties (string array) to get.
         * @preserve (Part of the public API)
         */
static getComputedElementStyle(element,propertyName){return TcHmi.System.Services.styleManager.__getElementStyle(element,propertyName,!0)}
/**
         * Returns the given CSS property on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
         * @param element The jQuery element.
         * @param propertyNames The CSS property (string) or properties (string array) to get.
         * @preserve (Part of the public API)
         */static getSimpleElementStyle(element,propertyName){return TcHmi.System.Services.styleManager.__getElementStyle(element,propertyName,!1)}
/**
         * Style setter for simple styles in a collection of JQuery elements or single HTML or SVG Elements.
         * @param element The jQuery element.
         * @param propertyName The CSS property to process or a dictionary of property value pairs.
         * @param [value] The value for the CSS property or an array of values. Only used if second parameter is no object.
         * @preserve (Part of the public API)
         */static setSimpleElementStyle(element,propertyName,value=null){return TcHmi.System.Services.styleManager.__setSimpleElementStyle(element,propertyName,value)}static processGenericStyle(controlName,selector,propertyName,value=null){return TcHmi.System.Services.styleManager.processGenericStyle(controlName,selector,propertyName,value)}
/**
         * Resolves a SolidColor object to a string representation for use as css color property.
         * Has to be called with a valid SolidColor. Use isSolidColor to check
         * @param colorObject The SolidColor to resolve.
         * @preserve (Part of the public API)
        */static resolveSolidColorAsCssValue(colorObject){return"none"===colorObject.color.toLowerCase()?"transparent":colorObject.color}
/**
        * Resolve a SolidColor object to a RGBAColor object.
        * Has to be called with a valid SolidColor. Use isSolidColor to check
        * @param colorObject The SolidColor to resolve.
        * @preserve (Part of the public API)
        */static resolveSolidColorAsRGBA(colorObject){const canvas=document.createElement("canvas");canvas.width=canvas.height=1;const ctx=canvas.getContext("2d");ctx.clearRect(0,0,1,1),ctx.fillStyle=StyleProvider.resolveSolidColorAsCssValue(colorObject),ctx.fillRect(0,0,1,1);const rgba=ctx.getImageData(0,0,1,1).data;return{r:rgba[0],g:rgba[1],b:rgba[2],a:rgba[3]}}
/**
         * Resolves a LinearGradientColor object to a string representation for use in css background-image property.
         * Has to be called with a valid LinearGradientColor. Use isLinearGradientColor to check
         * @param colorObject The LinearGradientColor to resolve.
         * @preserve (Part of the public API)
        */static resolveLinearGradientColorAsCssValue(colorObject){let angle=colorObject.angle;null==angle&&(angle=0);let backgroundCssString="linear-gradient(";if(backgroundCssString+=angle+"deg",colorObject.stopPoints)for(let i=0,ii=colorObject.stopPoints.length;i<ii;i++){let stopPoint=colorObject.stopPoints[i];void 0!==stopPoint.stop&&null!==stopPoint.stop?backgroundCssString+=","+stopPoint.color+" "+stopPoint.stop:backgroundCssString+=","+stopPoint.color}return backgroundCssString+=")",backgroundCssString}
/**
         * Style Processor for background.
         * @param element The jQuery element.
         * @param valueNew  The new value for the background.
         * @preserve (Part of the public API)
         */static processBackground(element,valueNew){return TcHmi.System.Services.styleManager.processBackground(element,valueNew)}
/**
         * Style Processor for background colors and gradients.
         * @param element The jQuery element.
         * @param valueNew  The new value for the background.
         * @preserve (Part of the public API)
         */static processBackgroundColor(element,valueNew){return TcHmi.System.Services.styleManager.processBackground(element,{color:valueNew})}
/**
         * Style Processor for background images.
         * @param element The jQuery element.
         * @param valueNew  The URL of the image.
         * @preserve (Part of the public API)
         */static processBackgroundImage(element,valueNew){return TcHmi.System.Services.styleManager.processBackground(element,{image:valueNew})}
/**
         * Style processor for SVG fill color.
         * @param element The jQuery element.
         * @param valueNew The new fill color.
         * @preserve (Part of the public API)
         * HTMLElement allowed because default jQuery type is HTMLElement
         */static processFillColor(element,valueNew){return TcHmi.System.Services.styleManager.processFillColor(element,valueNew)}
/**
         * Style processor for SVG stroke color.
         * @param element The jQuery element.
         * @param valueNew      The new stroke color.
         * @preserve (Part of the public API)
         * HTMLElement allowed because default jQuery type is HTMLElement
         */static processStrokeColor(element,valueNew){return TcHmi.System.Services.styleManager.processStrokeColor(element,valueNew)}
/**
         * Style processor for text color.
         * @param element The jQuery element.
         * @param valueNew      The new text color.
         * @preserve (Part of the public API)
         */static processTextColor(element,valueNew){return TcHmi.System.Services.styleManager.processTextColor(element,valueNew)}
/**
         * Style processor for border color.
         * @param element The jQuery element.
         * @param valueNew The new border color.
         * @preserve (Part of the public API)
         */static processBorderColor(element,valueNew){return TcHmi.System.Services.styleManager.processBorderColor(element,valueNew)}
/**
         * Style processor for border width.
         * @param element The jQuery element.
         * @param valueNew The new border widths.
         * @preserve (Part of the public API)
         */static processBorderWidth(element,valueNew){return TcHmi.System.Services.styleManager.processBorderWidth(element,valueNew)}
/**
         * Style processor for border radius.
         * @param element The jQuery element.
         * @param valueNew The new border radii.
         * @preserve (Part of the public API)
         */static processBorderRadius(element,valueNew){return TcHmi.System.Services.styleManager.processBorderRadius(element,valueNew)}
/**
         * Style processor for border style.
         * @param element The jQuery element.
         * @param valueNew The new border styles.
         * @preserve (Part of the public API)
         */static processBorderStyle(element,valueNew){return TcHmi.System.Services.styleManager.processBorderStyle(element,valueNew)}
/**
         * Style processor for box shadow.
         * @param element The jQuery element.
         * @param valueNew      The new border styles.
         * @preserve (Part of the public API)
         */static processBoxShadow(element,valueNew){return TcHmi.System.Services.styleManager.processBoxShadow(element,valueNew)}
/**
         * Style processor for font family.
         * @param element The jQuery element.
         * @param valueNew      The new font family.
         * @preserve (Part of the public API)
         */static processFontFamily(element,valueNew){return TcHmi.System.Services.styleManager.processFontFamily(element,valueNew)}
/**
         * Style processor for font size.
         * @param element The jQuery element.
         * @param valueNew      The new font size.
         * @param unitNew       The new font size unit. Defaults to "px".
         * @preserve (Part of the public API)
         */static processFontSize(element,valueNew,unitNew="px"){return TcHmi.System.Services.styleManager.processFontSize(element,valueNew,unitNew)}
/**
         * Style processor for font style.
         * @param element The jQuery element.
         * @param valueNew      The new font style. Allowed values are "Normal", "Italic" and "Oblique".
         * @preserve (Part of the public API)
         */static processFontStyle(element,valueNew){return TcHmi.System.Services.styleManager.processFontStyle(element,valueNew)}
/**
         * Style processor for font weight.
         * @param element The jQuery element.
         * @param valueNew      The new font weight. Allowed values are "Normal" and "Bold".
         * @preserve (Part of the public API)
         */static processFontWeight(element,valueNew){return TcHmi.System.Services.styleManager.processFontWeight(element,valueNew)}
/**
         * Style processor for visibility.
         * Visibility also affects pointer events, i.e. a hidden element will not receive mouse click events.
         * Hidden still uses space in fluid calculations, collapsed is ignored there.
         * @param element The jQuery element.
         * @param valueNew      The new visibility. Allowed values are "Visible", "Collapsed" and "Hidden". Hidden still uses space in fluid calculations, collapsed is ignored there.
         * @preserve (Part of the public API)
         */static processVisibility(element,valueNew){return TcHmi.System.Services.styleManager.processVisibility(element,valueNew)}
/**
         * Style processor for horizontal alignment. This aligns the content of the target element, not the target element itself.
         * @param element The jQuery element.
         * @param valueNew      The new horizontal alignment. Allowed values are "Left", "Center" and "Right".
         * @preserve (Part of the public API)
         */static processContentHorizontalAlignment(element,valueNew){return TcHmi.System.Services.styleManager.processContentHorizontalAlignment(element,valueNew)}
/**
         * Style processor for vertical alignment. This aligns the content of the target element, not the target element itself.
         * @param element The jQuery element.
         * @param valueNew      The new vertical alignment. Allowed values are "Top", "Center" and "Bottom".
         * @preserve (Part of the public API)
         */static processContentVerticalAlignment(element,valueNew){return TcHmi.System.Services.styleManager.processContentVerticalAlignment(element,valueNew)}
/**
         * Style processor for content padding.
         * @param element The jQuery element.
         * @param valueNew      The new content padding.
         * @preserve (Part of the public API)
         */static processContentPadding(element,valueNew){return TcHmi.System.Services.styleManager.processContentPadding(element,valueNew)}
/**
         * Theme processor for transforms.
         * @param element The jQuery element.
         * @param valueNew      The new transform value or an array of transform values.
         * @param order         If this parameter is passed, the transforms in valueNew will replace the transform at the specified place, instead of replacing all transforms.
         * @preserve (Part of the public API)
         */static processTransform(element,valueNew,order){return TcHmi.System.Services.styleManager.processTransform(element,valueNew,order)}}TcHmi.StyleProvider=StyleProvider}(TcHmi||(TcHmi={})),function(TcHmi){
/**
     * Provides methods to read and write symbol values and schemas.
     * @template ST Type of the value in the symbol.
     * @preserve (Part of the public API)
     */
class Symbol{constructor(expression){this.__symbol=new TcHmi.System.Symbol(expression)}
/**
        * Reads the value of the current symbol.
        * return undefined if the symbol is not available
        * @returns A copy of the value
        * @template T Type of the read value. Falls back to type of the symbol.
        * @preserve (Part of the public API)
        */read(){if(!this.__symbol)return;let res=void 0;return this.__symbol.isProcessedAsync()?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Symbol] The non static function 'TcHmi.Symbol.read()' does no longer support synchronous access to this symbol. Please use the non static function 'TcHmi.Symbol.readEx(callback ?: (this: TcHmi.Symbol, data: TcHmi.Symbol.IReadResultObject | TcHmi.Symbol.IServerReadResultObject) => void)' instead."),res):(this.__symbol.read((function(data){data.error===TcHmi.Errors.NONE&&(res=data.value)})),res)}
/**
        * Reads the value of the current symbol and raises a callback with a copy of the result.
        * @param expression
        * @param callback with gets a copy of the value
        * @template T Type of the read value. Falls back to type of the symbol.
        * @preserve (Part of the public API)
        */readEx(callback){let __this=this,destroy=this.__symbol.read((function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,response:data.response,details:data.details}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,details:data.details})}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Writes the value of the current symbol.
         * @param value
         * @param callback
         * @template T Type of the write value. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */write(value,callback){let __this=this,destroy=this.__symbol.write(value,(function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,response:data.response,details:data.details}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,details:data.details})}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Watches for changes of the current symbol and raises the callback in case of a change.
         * @param callback
         * @template T Type of the value to watch. Falls back to type of the symbol.
         * @preserve (Part of the public API)
         */watch(callback){let __this=this,destroy=this.__symbol.watch((function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,response:data.response,destroy:data.destroy,details:data.details}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,value:data.value,destroy:data.destroy,details:data.details})}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Returns the underlying TcHmi.SymbolExpression object.
         * @preserve (Part of the public API)
         */getExpression(){return this.__symbol.getExpression()}
/**
         * Resolves the schema of the current symbol.
         * @param callback
         * @preserve (Part of the public API)
         */resolveSchema(callback){let __this=this;this.__symbol.resolveSchema((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:data.schema}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}
/**
        * Resolves a dictionary of attributes from the underlying schema.
        * @param callback
        * @preserve (Part of the public API)
        */resolveAttributes(callback){this.__symbol.resolveAttributes(data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}
/**
         * Resolves an attribute by name from the underlying schema.
         * @param name
         * @param callback
         * @preserve (Part of the public API)
         */resolveAttribute(name,callback){this.__symbol.resolveAttribute(name,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}
/**
        * @param callback
         * @preserve (Part of the public API)
         */exists(callback){let __this=this;this.__symbol.exists((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,result:data.result}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}isProcessedAsync(){return this.__symbol.isProcessedAsync()}
/**
         * Destroys the current symbol object.
         * @preserve (Part of the public API)
         */destroy(){this.__symbol.destroy()}
/**
         * Reads the value of a symbol by name and type.
         * This function throws an exception if the symbol type is not supported.
         * @param name
         * @param type
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static read(name,type){let typeString;switch(type){case SymbolType.Internal:typeString="i";break;case SymbolType.LocalizedText:typeString="l";break;case SymbolType.PartialParam:typeString="pp";break;case SymbolType.Server:typeString="s";break;case SymbolType.TemplateParam:typeString="tp";break;case SymbolType.Control:typeString="ctrl";break;default:throw new TypeError("Unsupported SymbolType="+(TcHmi.SymbolType[type]?TcHmi.SymbolType[type]:type)+".")}let res=void 0,s=new Symbol("%"+typeString+"%"+name+"%/"+typeString+"%");return s.__symbol.isProcessedAsync()?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Symbol] The static function 'TcHmi.Symbol.read(name: string, type: TcHmi.SymbolType)' does no longer support synchronous access to this symbol. Please use the non static function 'TcHmi.Symbol.readEx2(expression: string, callback?: (this: void, data: TcHmi.Symbol.IReadResultObject)' instead."),s.destroy(),res):(s.readEx((function(data){data.error===TcHmi.Errors.NONE&&(res=data.value),s.destroy()})),res)}
/**
         * Reads the value of a symbol by expression.
         * @param expression
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static readEx(expression){let s=new Symbol(expression);if(s.__symbol.isProcessedAsync())return TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Symbol] The static function 'TcHmi.Symbol.readEx(expression: string)' does no longer support synchronous access to this symbol. Please use the non static function 'TcHmi.Symbol.readEx2(expression: string, callback?: (this: void, data: TcHmi.Symbol.IReadResultObject)' instead."),void s.destroy();let res=s.read();return s.destroy(),res}
/**
         * Reads the value of a symbol by expression and raises a callback with the result.
         * @param expression
         * @param callback
         * @template T Type of the read value.
         * @preserve (Part of the public API)
         */static readEx2(expression,callback){let s=new Symbol(expression),destroy=s.readEx((function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,response:data.response,details:data.details}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,details:data.details}),s&&s.destroy(),s=null}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Writes the value of a symbol by name and type.
         * This function throws an exception if the symbol type is not supported.
         * @param name
         * @param type
         * @param value
         * @param callback
         * @template T Type of the write value.
         * @preserve (Part of the public API)
         */static write(name,type,value,callback){let typeString;switch(type){case SymbolType.Internal:typeString="i";break;case SymbolType.LocalizedText:typeString="l";break;case SymbolType.PartialParam:typeString="pp";break;case SymbolType.Server:typeString="s";break;case SymbolType.TemplateParam:typeString="tp";break;case SymbolType.Control:typeString="ctrl";break;default:throw new TypeError("Unsupported SymbolType="+(TcHmi.SymbolType[type]?TcHmi.SymbolType[type]:type)+".")}let s=new Symbol("%"+typeString+"%"+name+"%/"+typeString+"%"),destroy=s.write(value,(function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,response:data.response,details:data.details}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,details:data.details}),s&&s.destroy(),s=null}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Writes the value of a symbol by expression.
         * @param expression
         * @param value
         * @param callback
         * @template T Type of the write value.
         * @preserve (Part of the public API)
         */static writeEx(expression,value,callback){let s=new Symbol(expression),destroy=s.write(value,(function(data){Symbol.isIServerReadResultObject(data)?TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,response:data.response,details:data.details}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,value:data.value,details:data.details}),null==s||s.destroy(),s=null}));return()=>{null==destroy||destroy(),destroy=null}}
/**
         * Resolves the schema of the current symbol.
         * @param expression
         * @param callback
         * @preserve (Part of the public API)
         */static resolveSchema(expression,callback){let s=new Symbol(expression);s.resolveSchema((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,schema:data.schema}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details}),s.destroy()}))}
/**
       * Resolves a dictionary of attributes from the underlying schema.
       * @param expression
       * @param callback
       * @preserve (Part of the public API)
       */static resolveAttributes(expression,callback){let s=new Symbol(expression);s.resolveAttributes(data=>{TcHmi.Callback.callSafeEx(callback,this,data),s.destroy()})}
/**
         * Resolves an attribute by name from the underlying schema.
         * @param name
         * @param callback
         * @preserve (Part of the public API)
         */static resolveAttribute(expression,name,callback){let s=new Symbol(expression);s.resolveAttribute(name,data=>{TcHmi.Callback.callSafeEx(callback,this,data),s.destroy()})}
/**
       * @param callback
        * @preserve (Part of the public API)
        */static exists(expression,callback){let s=new Symbol(expression);s.exists((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,result:data.result}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details}),s.destroy()}))}
/**
         * Returns true if the expression is a valid symbol expression
         * @param expression
         * @preserve (Part of the public API)
         */static isSymbolExpression(expression){if("string"!=typeof expression)return!1;const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpression);return null!=exprMatch&&0===exprMatch.index}
/**
        * Returns true if expression is escaped with $ in opening expression tag before type token.
        * Example:
        *    %$i%... -> true
        *    %i%...  -> false
        * @param expression
        * @preserve (Part of the public API)
        */static isSymbolExpressionEscaped(expression){if("string"!=typeof expression)return!1;const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpressionEscaped);return null!=exprMatch&&0===exprMatch.index}
/**
        * Will remove one escape level from expression and return it.
        * @param expression
        * @preserve (Part of the public API)
        */static escapeSymbolExpression(expression){const exprMatch=expression.match(TcHmi.SymbolExpression.RegExpExpressionEscaped);return null!=exprMatch&&0===exprMatch.index?expression.replace("$",""):expression}static isIServerReadResultObject(data){return void 0!==data.response}}let SymbolType;TcHmi.Symbol=Symbol,function(Symbol){Symbol.ObjectResolver=
/**
        * @preserve (Part of the public API)
        */
class{constructor(obj){this.__obj=obj}__resolve(obj,callback){const clone=tchmi_clone_object(obj);let details,error=TcHmi.Errors.NONE;const symbolInfoByExpression=new Map;let pending=0;const process=function(){pending>0||(error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(clone)}):TcHmi.Callback.callSafeEx(callback,null,{error:error,details:details}))},read=function(symbolInfo){void 0===symbolInfo.value&&(pending++,symbolInfo.obj.readEx((function(data){if(data.error===TcHmi.Errors.NONE){symbolInfo.value=data.value;for(const[obj,keys]of symbolInfo.refs)for(const key of keys)obj&&null!=key&&(obj[key]=symbolInfo.value,resolveSymbolInfo(obj,key,obj[key]));for(const symbolInfo of symbolInfoByExpression.values())read(symbolInfo);pending>0&&pending--,process()}else{if(error=TcHmi.Errors.ERROR,details||(details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.Symbol.ObjectResolver"}),data.details){details.errors||(details.errors=[]);let exists=!1;for(let i=0,ii=details.errors.length;i<ii;i++)if(tchmi_equal(details.errors[i],data.details)){exists=!0;break}exists||details.errors.push(data.details)}pending>0&&pending--,process()}})))},resolveSymbolInfo=function(o,k,value){if(value)if("object"==typeof value)if(Array.isArray(value))for(let i=0,ii=value.length;i<ii;i++)resolveSymbolInfo(value,i,value[i]);else{if(value&&value.objectType&&"Symbol"===value.objectType)return;for(let key in value)resolveSymbolInfo(value,key,value[key])}else if("string"==typeof value){if(!o)return;if(null==k)return;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let symbolInfoNew=null,symbolInfo=symbolInfoByExpression.get(value);if(symbolInfo){void 0!==symbolInfo.value&&(o[k]=symbolInfo.value);let ref=symbolInfo.refs.get(o);ref?ref.push(k):symbolInfo.refs.set(o,[k])}else{let symbol=new TcHmi.Symbol(value),refs=new Map;refs.set(o,[k]),symbolInfoNew={obj:symbol,refs:refs},symbolInfoByExpression.set(value,symbolInfoNew)}}else isSymbolExpressionEscaped&&(o[k]=TcHmi.Symbol.escapeSymbolExpression(value))}};if(resolveSymbolInfo(null,null,clone),symbolInfoByExpression.size>0)for(const symbolInfo of symbolInfoByExpression.values())read(symbolInfo);else process();return function(){for(const symbolInfo of symbolInfoByExpression.values())symbolInfo.obj.destroy();symbolInfoByExpression.clear()}}
/**
            * Resolves all symbol expression refs in the current object.
            * @param callback
            * @preserve (Part of the public API)
            */resolve(callback){return"object"==typeof this.__obj&&null!==this.__obj?this.__resolve(this.__obj,callback):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:this.__obj}),function(){})}__watch(obj,callback){let clone=tchmi_clone_object(obj),errorsBySymbolInfo=new Map;const symbolInfosByRef=new Map,symbolInfoByExpression=new Map;let last,pending=0,destroy=function(){for(const symbolInfo of symbolInfoByExpression.values())symbolInfo.unwatch&&(symbolInfo.unwatch(),symbolInfo.unwatch=void 0),symbolInfo.obj&&(symbolInfo.obj.destroy(),symbolInfo.obj=void 0);symbolInfoByExpression.clear(),symbolInfosByRef.clear()};const process=function(){if(pending>0)return;let error=TcHmi.Errors.NONE,details=void 0;for(const errorDetails of errorsBySymbolInfo.values())if(error=TcHmi.Errors.ERROR,details||(details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.Symbol.ObjectResolver"}),errorDetails){details.errors||(details.errors=[]);let exists=!1;for(let i=0,ii=details.errors.length;i<ii;i++)if(tchmi_equal(details.errors[i],errorDetails)){exists=!0;break}exists||details.errors.push(errorDetails)}if(error===TcHmi.Errors.NONE){if(tchmi_equal(last,clone))return;last=tchmi_clone_object(clone),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(clone),destroy:destroy})}else TcHmi.Callback.callSafeEx(callback,null,{error:error,details:details,destroy:destroy})},watch=function(symbolInfo){symbolInfo.obj&&(symbolInfo.active||(symbolInfo.active=!0,pending++,symbolInfo.unwatch=symbolInfo.obj.watch((function(data){var _a,_b;if(symbolInfo.obj)if(data.error===TcHmi.Errors.NONE){if(errorsBySymbolInfo.has(symbolInfo.obj)&&errorsBySymbolInfo.delete(symbolInfo.obj),symbolInfo.refs){let removeableSymbolInfo=null,removeableExpressions=[],removeableRefs=[],resolveableRefs=[];symbolInfo.value=data.value;for(const[obj,keys]of symbolInfo.refs)for(let i=0,ii=keys.length;i<ii;i++){let key=keys[i];if(null!=key&&obj){let ref=obj[key];if(obj[key]=symbolInfo.value,"object"==typeof ref&&null!=ref){let symbolInfos2=symbolInfosByRef.get(ref);if(symbolInfos2)for(let i=0,ii=symbolInfos2.length;i<ii;i++){let symbolInfo2=symbolInfos2[i];if(symbolInfo2&&symbolInfo2.refs&&symbolInfo2.obj&&(symbolInfo2.refs.delete(ref),0===symbolInfo2.refs.size)){removeableExpressions.push(symbolInfo2.obj.getExpression().toString()),removeableRefs.push(ref),removeableSymbolInfo=symbolInfo2;break}}}resolveableRefs.push({o:obj,k:key,ref:obj[key]})}}if(removeableExpressions){for(let i=0,ii=removeableExpressions.length;i<ii;i++){let removeabelExpression=removeableExpressions[i];removeabelExpression&&symbolInfoByExpression.delete(removeabelExpression)}removeableExpressions=[]}if(removeableRefs){for(let i=0,ii=removeableRefs.length;i<ii;i++){let remvoeableRef=removeableRefs[i];remvoeableRef&&symbolInfosByRef.delete(remvoeableRef)}removeableRefs=[]}if(removeableSymbolInfo&&(null===(_a=removeableSymbolInfo.unwatch)||void 0===_a||_a.call(removeableSymbolInfo),removeableSymbolInfo.unwatch=void 0,null===(_b=removeableSymbolInfo.obj)||void 0===_b||_b.destroy()),resolveableRefs){for(let i=0,ii=resolveableRefs.length;i<ii;i++){let resolveableRef=resolveableRefs[i];resolveableRef&&resolveSymbolInfo(resolveableRef.o,resolveableRef.k,resolveableRef.ref)}resolveableRefs=[]}for(const symbolInfo of symbolInfoByExpression.values())watch(symbolInfo);pending>0&&!1===symbolInfo.initialized&&pending--,symbolInfo.initialized=!0,process()}}else pending>0&&!1===symbolInfo.initialized&&pending--,symbolInfo.initialized=!0,data.details?errorsBySymbolInfo.set(symbolInfo.obj,data.details):errorsBySymbolInfo.set(symbolInfo.obj,{code:data.error,message:TcHmi.Errors[data.error],reason:"Got an error while watching "+symbolInfo.obj.getExpression().toString(),domain:"TcHmi.Symbol"}),process()}))))};let resolveSymbolInfo=function(o,k,value){if(value)if("object"==typeof value)if(Array.isArray(value))for(let i=0,ii=value.length;i<ii;i++)resolveSymbolInfo(value,i,value[i]);else{if(value&&value.objectType&&"Symbol"===value.objectType)return;for(let key in value)resolveSymbolInfo(value,key,value[key])}else if("string"==typeof value){if(!o)return;if(null==k)return;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let symbolInfoNew=null,symbolInfo=symbolInfoByExpression.get(value);if(symbolInfo){void 0!==symbolInfo.value&&(o[k]=symbolInfo.value);let ref=symbolInfo.refs.get(o);ref?ref.push(k):symbolInfo.refs.set(o,[k])}else{let symbol=new TcHmi.Symbol(value),refs=new Map;refs.set(o,[k]),symbolInfoNew={obj:symbol,refs:refs,active:!1,initialized:!1},symbolInfoByExpression.set(value,symbolInfoNew)}let symbolInfo2=symbolInfosByRef.get(o);symbolInfoNew&&(symbolInfo2?symbolInfo2.push(symbolInfoNew):symbolInfosByRef.set(o,[symbolInfoNew]))}else isSymbolExpressionEscaped&&(o[k]=TcHmi.Symbol.escapeSymbolExpression(value))}};if(resolveSymbolInfo(null,null,clone),symbolInfoByExpression.size>0)for(const symbolInfo of symbolInfoByExpression.values())watch(symbolInfo);else process();return destroy}
/**
             * Watches for changes of symbol expressions in the current object und returns the object with updated values.
             * @param callback
             * @preserve (Part of the public API)
             */watch(callback){return"object"==typeof this.__obj&&null!==this.__obj?this.__watch(this.__obj,callback):(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:this.__obj}),function(){})}
/**
             * Destroys the current object.
             * @preserve (Part of the public API)
             */destroy(){this.__obj=null}}}(Symbol=TcHmi.Symbol||(TcHmi.Symbol={})),function(SymbolType){SymbolType[SymbolType.Invalid=0]="Invalid",SymbolType[SymbolType.Server=10]="Server",SymbolType[SymbolType.Internal=20]="Internal",SymbolType[SymbolType.LocalizedText=30]="LocalizedText",SymbolType[SymbolType.PartialParam=40]="PartialParam",SymbolType[SymbolType.TemplateParam=50]="TemplateParam",SymbolType[SymbolType.Function=60]="Function",SymbolType[SymbolType.Control=70]="Control"}(SymbolType=TcHmi.SymbolType||(TcHmi.SymbolType={}))}(TcHmi||(TcHmi={})),function(TcHmi){class SymbolExpression{constructor(expression){if(this.__path=null,this.__pathTokens=null,this.__type=TcHmi.SymbolType.Invalid,this.__options={},TcHmi.System.isParameterTypeInvalid(expression,"expression",{type:"string",required:"valueNeeded"}))throw new Error("The expression of a new TcHmi.SymbolExpression needs to be a string.");this.__expression=expression;let expressionMatch=expression.match(SymbolExpression.RegExpExpression);if(null!=expressionMatch&&3===expressionMatch.length){switch(this.__tag=expressionMatch[1],this.__tag){case"s":this.__type=TcHmi.SymbolType.Server;break;case"i":this.__type=TcHmi.SymbolType.Internal;break;case"l":this.__type=TcHmi.SymbolType.LocalizedText;break;case"pp":this.__type=TcHmi.SymbolType.PartialParam;break;case"tp":this.__type=TcHmi.SymbolType.TemplateParam;break;case"f":this.__type=TcHmi.SymbolType.Function;break;case"ctrl":this.__type=TcHmi.SymbolType.Control;break;default:this.__type=TcHmi.SymbolType.Invalid}switch(this.__tag){case"s":case"i":case"l":case"f":this.__content=this.__expression.substr(3,this.__expression.length-7);break;case"pp":case"tp":this.__content=this.__expression.substr(4,this.__expression.length-9);break;case"ctrl":this.__content=this.__expression.substr(6,this.__expression.length-13)}let expressionTokens=expressionMatch[2].match(SymbolExpression.RegExpExpressionGroupByPipe);if(null!=expressionTokens&&expressionTokens.length>0){if(this.__type!==TcHmi.SymbolType.Server&&this.__type!==TcHmi.SymbolType.Function){let firstBracketPos=expressionTokens[0].indexOf("["),firstColonPos=expressionTokens[0].indexOf("::"),splitPos=-1;splitPos=-1===firstBracketPos?firstColonPos:-1===firstColonPos||firstBracketPos<firstColonPos?firstBracketPos:firstColonPos,-1!==splitPos?(this.__name=expressionTokens[0].substring(0,splitPos),this.__path=expressionTokens[0].substring(splitPos),this.__pathTokens=TcHmi.System.resolveSymbolPathToTokenArray(this.__path)):(this.__name=expressionTokens[0],this.__path=null,this.__pathTokens=null)}else this.__name=expressionTokens[0];if(this.__type!==TcHmi.SymbolType.Function)for(let i=1,len=expressionTokens.length;i<len;i++){if(this.__type===TcHmi.SymbolType.Server){let matchInterval=/^(?:Interval\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchInterval&&0!==matchInterval.length&&(this.__options.Interval=parseInt(matchInterval[1],10));let matchTimeout=/^(?:Timeout\s*=)\s*(\d+)\s*$/i.exec(expressionTokens[i]);null!==matchTimeout&&0!==matchTimeout.length&&(this.__options.Timeout=parseInt(matchTimeout[1],10));let matchParallel=/^(?:Parallel\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);if(null!==matchParallel&&0!==matchParallel.length){let parallel=!1;switch(matchParallel[1].toLowerCase()){case"true":parallel=!0;break;case"false":parallel=!1}this.__options.Parallel=parallel}}let matchBindingMode=/^(?:BindingMode\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchBindingMode&&0!==matchBindingMode.length&&(this.__options.BindingMode=matchBindingMode[1]);let matchBindingEvent=/^(?:BindingEvent\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchBindingEvent&&0!==matchBindingEvent.length&&(this.__options.BindingEvent||(this.__options.BindingEvent=matchBindingEvent[1]),this.__options.BindingEvents||(this.__options.BindingEvents=[]),this.__options.BindingEvents.push(matchBindingEvent[1]));let matchSubscriptionMode=/^(?:SubscriptionMode\s*=)\s*([a-zA-Z]+)\s*$/i.exec(expressionTokens[i]);null!==matchSubscriptionMode&&0!==matchSubscriptionMode.length&&(this.__options.SubscriptionMode=matchSubscriptionMode[1])}}}}
/**
        * Returns the expression as string.
        * @preserve (Part of the public API)
        */toString(){return this.__expression}
/**
         * @preserve (Part of the public API)
         */getContent(){return this.__content}
/**
        * @preserve (Part of the public API)
         */getTag(){return this.__tag}getName(){return this.__name}
/**
         * @preserve (Part of the public API)
         */getPath(){return this.__path}
/**
         * @preserve (Part of the public API)
         */getPathTokens(){return this.__pathTokens}
/**
         * @preserve (Part of the public API)
         */getType(){return this.__type}
/**
         * @preserve (Part of the public API)
         */getOptions(){return this.__options}}SymbolExpression.RegExpExpressionGroupByPipe=/([^|()]+|[(](['][^']*[']|["][^"]*["]|[^)])*[)])+/g,SymbolExpression.RegExpExpression=new RegExp("^\\%[$]*(s|i|l|pp|tp|f|ctrl)\\%([^]*)\\%/\\1\\%$"),SymbolExpression.RegExpExpressionEscaped=new RegExp("^\\%[$]+(s|i|l|pp|tp|f|ctrl)\\%([^]*)\\%/\\1\\%$"),TcHmi.SymbolExpression=SymbolExpression}(TcHmi||(TcHmi={})),function(TcHmi){class TcSpeech{
/**
         * (Re-)Starts the rtc connection to TwinCAT speech engine.
         * @param options This option can override all setting from tchmiconfig.json and more
         * @param callback Gets notification when opening connection failed.
         * @preserve (Part of the public API)
         */
static openConnection(options={},callback){if(!(TcHmi.System.isParameterTypeInvalid(options.confidenceThreshold,"options.confidenceThreshold",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.defaultVolume,"options.defaultVolume",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.enableMicrophone,"options.enableMicrophone",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.enableSpeaker,"options.enableSpeaker",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.sinkConstraints,"options.sinkConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback)||TcHmi.System.isParameterTypeInvalid(options.sourceConstraints,"options.sourceConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback))){if(TcHmi.System.Services.tcSpeechManager)return TcHmi.System.Services.tcSpeechManager.openConnection(options,callback);{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to open connection. System not ready.",domain:"TcHmi.TcSpeech"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}}
/**
         * Closes an active connection to TwinCAT speech engine.
         * @param options Can target a specific remote TwinCAT speech engine
         * @param callback A callback to get feedback
         * @preserve (Part of the public API)
         */static closeConnection(options={},callback){if(!TcHmi.System.isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)){if(TcHmi.System.Services.tcSpeechManager)return TcHmi.System.Services.tcSpeechManager.closeConnection(options,callback);{const errorDetail={code:TcHmi.Errors.E_SYSTEM_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_SYSTEM_NOT_READY],reason:"Unable to close connection. System not ready.",domain:"TcHmi.TcSpeech"};TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail})}}}
/**
         * Sets the volume (between 0 and 1) of speech output on this device.
         * @param valueNew new volume. Will be capped between 0 and 1.
         * @preserve (Part of the public API)
         */static setVolume(valueNew){if(TcHmi.System.Services.tcSpeechManager)return TcHmi.System.Services.tcSpeechManager.setVolume(valueNew);TcHmi.Log.error("[Source=Framework, Module=TcHmi.TcSpeech] Unable to set volume. System not ready.")}}TcHmi.TcSpeech=TcSpeech,function(TcSpeech){let AudioEntityPriority;TcSpeech.SpeechSynthesis=class{constructor(text,options){this.text=text,this.options=options}
/**
             * Starting output of text. The connection must be open at this point and we have to have enableSpeaker.
             * The callback will get a guid which can be used to stop or request status of the speech synthesis.
             * @param callback The callback will get a guid which can be used to stop or request status of the speech synthesis.
             * @preserve (Part of the public API)
             */start(callback){TcHmi.System.Services.tcSpeechManager?TcHmi.System.Services.tcSpeechManager.speechSynthesisStart(this.text,this.options,data=>{this.__guid=data.guid,TcHmi.Callback.callSafe(callback,null,data)}):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}
/**
             * Request the state (queued, playing, stopped) of a given speech synthesis call.
             * @param guid guid for the request. Can be fetched from the callback of speechSynthesisStart
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
            */getStatus(callback){TcHmi.System.Services.tcSpeechManager?this.__guid?TcHmi.System.Services.tcSpeechManager.speechSynthesisGetStatus(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}}):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}
/**
             * Stops a given speech synthesis call.
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
             */stop(callback){TcHmi.System.Services.tcSpeechManager?this.__guid?TcHmi.System.Services.tcSpeechManager.speechSynthesisStop(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}}):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"System not ready."}})}},function(AudioEntityPriority){AudioEntityPriority[AudioEntityPriority.Low=5]="Low",AudioEntityPriority[AudioEntityPriority.Normal=10]="Normal",AudioEntityPriority[AudioEntityPriority.High=15]="High"}(AudioEntityPriority=TcSpeech.AudioEntityPriority||(TcSpeech.AudioEntityPriority={}))}(TcSpeech=TcHmi.TcSpeech||(TcHmi.TcSpeech={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * @preserve (Part of the public API)
    */
class Theme{
/**
         * Returns the active theme.
        * @preserve (Part of the public API)
         */
static get(){return TcHmi.System.Services.themeManager?TcHmi.System.Services.themeManager.getTheme():"Base"}
/**
         * Sets the active theme.
        * @preserve (Part of the public API)
         */static set(valueNew){return TcHmi.System.Services.themeManager?TcHmi.System.isParameterTypeInvalid(valueNew,"valueNew",{type:"string",required:"valueNeeded",minStringLength:1})?TcHmi.Errors.E_PARAMETER_INVALID:TcHmi.System.Services.themeManager.setTheme(valueNew,!0):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Theme] Setting theme failed. System not ready."),TcHmi.Errors.E_SYSTEM_NOT_READY)}
/**
         * Returns all registered themes of the project.
        * @preserve (Part of the public API)
         */static getRegisteredThemes(){return Object.keys(TcHmi.System.config.themes)}}TcHmi.Theme=Theme,function(Theme){Theme.Properties=
/**
         * Control property related API
         * @preserve (Part of the public API)
         */
class{
/**
            * Parses every source of implicit properties and returns this or null
            * Can have different value after the event onThemeDataChanged.
            * The order of resources are
            * 1) control class
            * 2) theme definition of the control type in project
            * 3) theme definition in control
            * 4) defaultValueInternal in Description.json of the control
            * @param control Control which needs the resource
            * @param propertyName name of the property
            * @template T Type of the default value
            * @preserve (Part of the public API)
            */
static getDefaultValue(control,propertyName){return TcHmi.System.Services.themeManager?control instanceof TcHmi.Controls.System.baseTcHmiControl==!1||TcHmi.System.isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:TcHmi.System.Services.themeManager.getTheme(),value:null}:TcHmi.System.Services.themeManager.getDefaultPropertyValue(control,propertyName):{error:TcHmi.Errors.ERROR,origin:"system",originThemeName:"",value:null}}
/**
             * Sets the default value of a property and change it (if needed) on theme change.
             * @param control
             * @param propertyName
             * @returns returns an Error code
             * @preserve (Part of the public API)
             */static setThemeValue(control,propertyName){if(control instanceof TcHmi.Controls.System.baseTcHmiControl==!1)return TcHmi.Errors.E_PARAMETER_INVALID;if(TcHmi.System.isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1}))return TcHmi.Errors.E_PARAMETER_INVALID;if(!TcHmi.System.Services.themeManager||!TcHmi.System.Services.controlManager)return TcHmi.Log.error("[Source=Framework, Module=TcHmi.Theme] System not ready."),TcHmi.Errors.E_SYSTEM_NOT_READY;let error=TcHmi.System.Services.controlManager.setControlProperty(control,propertyName,null);return error?error.code:TcHmi.Errors.NONE}};Theme.Resources=
/**
         * Control resource related API
         * @preserve (Part of the public API)
         */
class{
/**
            * Gets a themed resource.
            * Parses every source of properties and returns this or null
            * Can have different value after the event onThemeDataChanged.
            * The order of resources are
            * 1) control class
            * 2) theme definition of the control type in project
            * 3) theme definition in control

            * @param control Control which needs the resource
            * @param resourceName name of the resource
            * @returns returns the resource or null
            * @template T Type of the value
            * @preserve (Part of the public API)
            */
static get(control,resourceName){return TcHmi.System.Services.themeManager?control instanceof TcHmi.Controls.System.baseTcHmiControl==!1||TcHmi.System.isParameterTypeInvalid(resourceName,"resourceName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:TcHmi.System.Services.themeManager.getTheme(),value:null}:TcHmi.System.Services.themeManager.getThemeResource(control,resourceName):{error:TcHmi.Errors.ERROR,origin:"system",originThemeName:"",value:null}}static resolveBasePath(control,resource){let url;if("control"===resource.origin){let module=TcHmi.System.Data.Modules.controls.map.get(control.getType());url=module&&module.error===TcHmi.Errors.NONE?module.package.basePath+"/"+module.manifestData.basePath+"/Themes/"+resource.originThemeName+"/":module&&module.error!==TcHmi.Errors.NONE?"ControlModuleHasError/":"controlNotFoundInSystemCache/"}else url="/Themes/"+resource.originThemeName+"/";return url}}}(Theme=TcHmi.Theme||(TcHmi.Theme={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.TopMostLayer=
/**
    * Provides a layer to show elements above the normal visualization
    * @preserve (Part of the public API)
    */
class{
/**
        * Appends the elements to the top layer above the normal visualization
        * A reference to the element should be kept to be able to call remove() function
        * The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
        * Your element could have style="min-width:50%;min-height:50%;"
        * @param control control which requests this
        * @param element jQuery Collection with exactly one element which should be moved to TopMostLayer
        * @param options Optional options
        * @returns success of the add
        * @preserve (Part of the public API)
        */
static add(control,element,options){return!(!control||!TcHmi.System.Services.topMostLayer)&&((!options||!(TcHmi.System.isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&TcHmi.System.Services.topMostLayer.add(control,element,options))}
/**
         * Removes the element from the top layer and returns it for later use by the caller
         * If the element is not inside the TopMostLayer it will be returned without change.
         * @param control control which requests this
         * @param element jQuery Collection with the element which should be removed from TopMostLayer
         * @returns jQuery Collection
         * @preserve (Part of the public API)
         */static remove(control,element){return control&&TcHmi.System.Services.topMostLayer?TcHmi.System.Services.topMostLayer.remove(control,element,!1):element}
/**
        * Appends the elements to the top layer above the normal visualization (not control namespaced)
        * A reference to the element should be kept to be able to call remove() function
        * The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
        * Your element could have style="min-width:50%;min-height:50%;"
        * @param element jQuery Collection with exactly one element which should be moved to TopMostLayer
        * @param options Optional options
        * @returns success of the add
        * @preserve (Part of the public API)
        */static addEx(element,options){return!!TcHmi.System.Services.topMostLayer&&((!options||!(TcHmi.System.isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||TcHmi.System.isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&TcHmi.System.Services.topMostLayer.add(globalThis,element,options))}
/**
         * Removes the element from the top layer and returns it for later use by the caller (not control namespaced)
         * If the element is not inside the TopMostLayer it will be returned without change.
         * @param element jQuery Collection with the element which should be removed from TopMostLayer
         * @returns jQuery Collection
         * @preserve (Part of the public API)
         */static removeEx(element){return TcHmi.System.Services.topMostLayer?TcHmi.System.Services.topMostLayer.remove(globalThis,element,!1):element}}}(TcHmi||(TcHmi={})),function(TcHmi){let Type;!function(Type){let Schema;Type.getSchema=function(typeName){return TcHmi.System.Services.typeManager?TcHmi.System.Services.typeManager.getSchema(typeName):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Type] Getting Schema failed. System not ready."),null)},function(Schema){Schema.resolveDefault=function(schema){return TcHmi.System.Services.typeManager?TcHmi.System.Type.Schema.resolveDefault(schema):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.Type] Resolving default failed. System not ready."),null)}}(Schema=Type.Schema||(Type.Schema={}))}(Type=TcHmi.Type||(TcHmi.Type={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * Allows converting of values from any type to any type if types are compatible.
    * @preserve (Part of the public API)
    */
class ValueConverter{constructor(){}
/**
         * Converts a value to {Object/Array} and returns the {Object/Array} or null if the type of value is not compatible to {Object/Array}.
         * No content check will be done!
         * @param value The value to convert.
         * @param defaultValue The fallback value (null if not given)
         * @template T Type of the resulting object.
         * @preserve (Part of the public API)
         */static toObject(value,defaultValue=null){let res=defaultValue;if("string"==typeof value&&""!==value)try{res=JSON.parse(value)}catch(e){}else"object"==typeof value&&null!==value&&(res=value);return res}
/**
         * Converts a value to {string} and returns the {string} or null if the type of value is not compatible to {string}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to string (null if not given)
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toString(value,defaultValue=null){let res=defaultValue;switch(typeof value){case"boolean":case"number":res=value.toString();break;case"object":null!==value&&value instanceof TcHmi.Controls.System.baseTcHmiControl!=!0&&value instanceof Element!=!0&&(res=JSON.stringify(value));break;case"string":res=value}return res}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toDimensionUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.DimensionUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toAngleUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.AngleUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toBorderStyleValue(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.BorderStyleValueList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontStyle(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontStyleList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontSizeUnit(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontSizeUnitList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toFontWeight(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.FontWeightList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toHorizontalAlignment(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.HorizontalAlignmentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toScaleModeString(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.ScaleModeStringList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeMode(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.SizeModeList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toSizeModeWithContent(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.SizeModeWithContentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVerticalAlignment(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.VerticalAlignmentList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toVisibility(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.VisibilityList,defaultValue)}
/**
         * Converts a value to enum value and returns the string or null if the type of value is not compatible to the enum.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns Returns the string or null if the type of value is not compatible to the enum.
         * @preserve (Part of the public API)
         */static toToggleState(value,defaultValue){return ValueConverter.toEnum(value,ValueConverter.ToggleStateList,defaultValue)}
/**
         * Converts a value to fontFamily value and returns the string or null if the type of value is not compatible to {string}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns or null if the type of value is not compatible to string.
         * @preserve (Part of the public API)
         */static toFontFamily(value,defaultValue){return ValueConverter.toString(value,defaultValue)}static __parseFloatStrict(value){return/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(value)?parseFloat(value):NaN}
/**
         * Converts a value to {number}
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to number (null if not given)
         * @returns Returns a string or defaultValue if the type of value is not compatible.
         * @preserve (Part of the public API)
         */static toNumber(value,defaultValue=null){let res=defaultValue;switch(typeof value){case"string":res=ValueConverter.__parseFloatStrict(value),isNaN(res)&&"NaN"!==value&&(res=defaultValue);break;case"boolean":switch(value){case!0:res=1;break;case!1:res=0}break;case"number":res=value}return res}
/**
         * Converts a value to {boolean} and returns the {boolean} or null if the type of value is not compatible to {boolean}.
         * @param value The value to convert.
         * @param defaultValue Value which should be returned if value is not compatible to boolean (null if not given)
         * @preserve (Part of the public API)
         */static toBoolean(value,defaultValue=null){let res=defaultValue;switch(typeof value){case"string":switch(value.toLowerCase()){case"true":res=!0;break;case"false":res=!1}break;case"number":switch(value){case 1:res=!0;break;case 0:res=!1}break;case"boolean":res=value}return res}
/**
         * Converts a value to enum {number} and returns the enum {number} or null if the type of value is not compatible to enum {Object}.
         * @param value The value to convert.
         * @param .
         * @param defaultValue Value which should be returned if value is not compatible with the enum (null if not given)
         * @returns number
         * @preserve (Part of the public API)
         */static toEnum(value,enumType,defaultValue=null){let res=defaultValue;switch(typeof value){case"string":if(""===value)break;const numValue=parseInt(value,10);isNaN(numValue)?(res=enumType[value],void 0===res&&(res=enumType[value.toLowerCase()]),void 0===res&&(res=enumType[value.toUpperCase()]),void 0===res&&(res=defaultValue)):res=this.toEnum(numValue,enumType,defaultValue);break;case"number":void 0!==enumType[value]&&(res=value);break;case"boolean":res=this.toEnum(this.toNumber(value),enumType,defaultValue)}return res}
/**
         * Converts a value to the best effort value related to schema addressed by its by name or null if no schema related type is matching or schema is unknown.
         * @param value
         * @param typeName
         * @preserve (Part of the public API)
         */static toType(value,typeName,options){const schema=TcHmi.System.Services.typeManager.getSchema(typeName);return null===schema?null:ValueConverter.toSchemaType(value,schema,options)}
/**
         * Converts a value to the best effort value related to schema addressed by its by name or null if no schema related type is matching or schema is unknown. Returns an result object for error detection.
         * @param value
         * @param typeName
         * @preserve (Part of the public API)
         */static toTypeEx(value,typeName,options){const schemaRes=TcHmi.System.Services.typeManager.getSchemaEx(typeName);if(schemaRes.error!==TcHmi.Errors.NONE)return{error:schemaRes.error,value:null,details:{code:schemaRes.error,message:TcHmi.Errors[schemaRes.error],domain:"TcHmi.ValueConverter",reason:"Schema resolving failed.",errors:schemaRes.details?[schemaRes.details]:void 0}};const valueRes=ValueConverter.toSchemaType(value,schemaRes.schema,options);return{error:TcHmi.Errors.NONE,value:valueRes}}
/**
         * Converts a value to the best effort value related to schema or null if no schema related type is matching.
         * @param value
         * @param schema
         * @preserve (Part of the public API)
         */static toSchemaType(value,schema,options){if(null==value)return null;if(null==schema)return null;if(options&&options.resolveFunctionWriteValue&&schema.writeValue)return this.toSchemaType(value,schema.writeValue,options.convertDirection?{convertDirection:options.convertDirection}:void 0);let typeOfValue=typeof value;if(options&&options.convertDirection===ValueConverter.ConvertDirection.Backward){let rules=TcHmi.System.Type.Schema.resolveTypeConversionRules(schema);if(rules){let res,keys=[];rules.forEach((value,key)=>{keys.push(key)});for(let i=0,ii=keys.length;i<ii;i++){let key=keys[i];if(!key)continue;let rule=rules.get(key);if("string"===key){if(res=ValueConverter.toString(value),rule&&rule.enum&&rule.enum.includes(res))break;res=void 0}}if(void 0!==res)return res}}else{let rules=TcHmi.System.Type.Schema.resolveTypeConversionRules(schema),rule=null==rules?void 0:rules.get(typeOfValue);if(rule)switch(rule.convert){case"number":return ValueConverter.toNumber(value);case"string":return ValueConverter.toString(value);case"boolean":return ValueConverter.toBoolean(value)}}let schemaType=TcHmi.System.Type.Schema.resolveType(schema);if("string"!=typeof schemaType&&!Array.isArray(schemaType))return null;if(Array.isArray(schemaType)){if("string"===typeOfValue||"number"===typeOfValue||"boolean"===typeOfValue||"object"===typeOfValue){if(-1!==schemaType.indexOf(typeOfValue))return value;for(let i=0,ii=schemaType.length;i<ii;i++){let res;switch(schemaType[i]){case"object":case"array":res=ValueConverter.toObject(value);break;case"string":res=ValueConverter.toString(value);break;case"integer":case"number":res=ValueConverter.toNumber(value);break;case"boolean":res=ValueConverter.toBoolean(value);break;default:res=null}if(null!==res)return res}}}else switch(schemaType){case"object":case"array":return ValueConverter.toObject(value);case"string":return ValueConverter.toString(value);case"integer":case"number":return ValueConverter.toNumber(value);case"boolean":return ValueConverter.toBoolean(value)}return null}}ValueConverter.AngleUnitList={deg:"deg",rad:"rad",turn:"turn",grad:"grad"},ValueConverter.BorderStyleValueList={Solid:"Solid",Dashed:"Dashed",Dotted:"Dotted",None:"None"},ValueConverter.DimensionUnitList={px:"px","%":"%"},ValueConverter.FontSizeUnitList={px:"px","%":"%",em:"em",rem:"rem"},ValueConverter.FontStyleList={Normal:"Normal",Italic:"Italic",Oblique:"Oblique",Auto:"Auto"},ValueConverter.FontWeightList={Normal:"Normal",Bold:"Bold",Auto:"Auto"},ValueConverter.HorizontalAlignmentList={Left:"Left",Center:"Center",Right:"Right"},ValueConverter.ScaleModeStringList={None:"None",ScaleToFill:"ScaleToFill",ScaleToFit:"ScaleToFit",ScaleToFitWidth:"ScaleToFitWidth",ScaleToFitHeight:"ScaleToFitHeight"},ValueConverter.SizeModeList={Value:"Value",Parent:"Parent"},ValueConverter.SizeModeWithContentList={Value:"Value",Parent:"Parent",Content:"Content"},ValueConverter.ToggleStateList={Normal:"Normal",Active:"Active"},ValueConverter.VerticalAlignmentList={Top:"Top",Center:"Center",Bottom:"Bottom"},ValueConverter.VisibilityList={Visible:"Visible",Hidden:"Hidden",Collapsed:"Collapsed"},TcHmi.ValueConverter=ValueConverter,function(ValueConverter){let ConvertDirection;!function(ConvertDirection){ConvertDirection[ConvertDirection.Forward=0]="Forward",ConvertDirection[ConvertDirection.Backward=1]="Backward"}(ConvertDirection=ValueConverter.ConvertDirection||(ValueConverter.ConvertDirection={}))}(ValueConverter=TcHmi.ValueConverter||(TcHmi.ValueConverter={}))}(TcHmi||(TcHmi={})),function(TcHmi){TcHmi.View=
/**
    * Provides functions to set partials as view.
    * @preserve (Part of the public API)
    */
class{
/**
         * Loads a view partial into the dom.
         * @param url
         * @param callback
         * @preserve (Part of the public API)
         */
static load(url,callback=null){if(!0===TCHMI_DESIGNER)TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.View] Loading an additional view level element in designer context is not allowed and therefore blocked."),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.E_NOT_ALLOWED});else if(TcHmi.System.Services.viewManager){if(TcHmi.System.isParameterTypeInvalid(url,"url",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.View",callback))return;TcHmi.System.Services.viewManager.loadView(url,callback)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.View] Loading view failed. System not ready."),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR})}
/**
         * Returns the current view object.
         * @preserve (Part of the public API)
         */static get(){return!0===TCHMI_DESIGNER?(TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.View] Accessing a view level element is not allowed in designer context and therefore blocked."),null):TcHmi.System.Services.viewManager?TcHmi.System.Services.viewManager.getView():(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.View] Getting view failed. System not ready."),null)}}}(TcHmi||(TcHmi={}));const __tchmi_is_instanced_object=function(obj){if(null===obj||"object"!=typeof obj)return!1;void 0===__tchmi_is_instanced_object.__objectPrototype&&(__tchmi_is_instanced_object.__objectPrototype=Object.getPrototypeOf({})),void 0===__tchmi_is_instanced_object.__arrayPrototype&&(__tchmi_is_instanced_object.__arrayPrototype=Object.getPrototypeOf([]));let proto=Object.getPrototypeOf(obj);return null!==proto&&proto!==__tchmi_is_instanced_object.__objectPrototype&&proto!==__tchmi_is_instanced_object.__arrayPrototype};
/**
 * Clones the data {Object} in param obj and returns a clone of it.
 * Do not use this function to create clones of objects which contain functions or are based on a prototype definition!
 * String, null, undefined are returned directly as they are immutable / handled by value.
 * @param obj The object to clone.
 * @param options Options to define what should be cloned and how it should be cloned.
 * @returns Clone of param obj.
 * @template T defines the type of the target object
 * @preserve (Part of the public API)
 */function tchmi_clone_object(obj,options){let functionFound=!1,clone=function(value){let result,valueType=typeof value;if("function"===valueType)return functionFound=!0,null;if(value instanceof Map&&(null==options?void 0:options.cloneMaps)){let result=new Map;for(const[key,member]of value)result.set(options.cloneMaps.deepCloneKeys?tchmi_clone_object(key,options):key,options.cloneMaps.deepCloneValues?tchmi_clone_object(member,options):member);return result}if(value instanceof Set&&(null==options?void 0:options.cloneSets)){let result=new Set;for(const member of value)result.add(options.cloneSets.deepCloneValues?tchmi_clone_object(member,options):member);return result}if(value instanceof Date&&(null==options?void 0:options.cloneDates))return new Date(value.valueOf());if(null===value||"object"!==valueType||__tchmi_is_instanced_object(value))return value;if(Array.isArray(value)){result=new Array(value.length);for(let i in value)if(result[i]=clone(value[i]),functionFound)return null}else{result={};for(let key in value)if(result[key]=clone(value[key]),functionFound)return null}return result},objClone=clone(obj);return functionFound?obj:objClone}
/*
 * Unify a path string.
 * Replace all backslashes with slashes, replace multiple slashes with single slashes except ://, remove leading slash.
 * @param path The path.
 * @returns Unified path.
 * @preserve (Part of the public API)
 */function tchmi_path(path){if("string"==typeof path){let tokens=path.replace(/\\+/g,"/").split("/");for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];if(""===token)tokens.splice(i,1),i--;else if("."===token)tokens.splice(i,1),i--;else if(".."===token){let tokenprev=tokens[i-1];tokenprev&&".."!==tokenprev&&(tokens.splice(i,1),tokens.splice(i-1,1),i-=2)}}return tokens.join("/")}return path}
/**
* Converts a String to a valid CSS id pattern by escaping all reserved characters.
* @param id The target id.
* @returns Converted id.
* @preserve (Part of the public API)
*/function tchmi_css_escape_selector(id){if("string"!=typeof id)return id;if(CSS&&CSS.escape)return CSS.escape(id);let codeUnit,length=id.length,index=-1,result="",firstCodeUnit=id.charCodeAt(0);for(;++index<length;)codeUnit=id.charCodeAt(index),result+=0!==codeUnit?codeUnit>=1&&codeUnit<=31||127===codeUnit||0===index&&codeUnit>=48&&codeUnit<=57||1===index&&codeUnit>=48&&codeUnit<=57&&45===firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!==index||1!==length||45!==codeUnit)&&(codeUnit>=128||45===codeUnit||95===codeUnit||codeUnit>=48&&codeUnit<=57||codeUnit>=65&&codeUnit<=90||codeUnit>=97&&codeUnit<=122)?id.charAt(index):"\\"+id.charAt(index):"�";return result}
/**
 * tchmi_escape_regex
 * @param text
 * @preserve (Part of the public API)
 */function tchmi_escape_regex(text){return"string"!=typeof text&&"function"==typeof text.toString&&(text=text.toString()),text.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tchmi_format_string(formatString,...args){let formattedString="",index=0;for(let i=0,ii=formatString.length;i<ii;i++)if("{"===formatString[i])if("{"===formatString[i+1])formattedString+="{",i++;else{let end=formatString.indexOf("}",i),placeholder=formatString.substring(i+1,end),regEx=/(?:([0-9]\d*)\||\(([^\)]+)\))?(\+)?(0|'[^|])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/.exec(placeholder);if(null!==regEx){let regExDescription={placeholder:regEx[0],parameterIndex:regEx[1],key:regEx[2],sign:regEx[3],charToAddBefore:regEx[4],align:regEx[5],lengthToAdd:regEx[6],decimal:regEx[7],type:regEx[8]},indexNow=index;if(null===regEx[8]||void 0===regEx[0]){formattedString+=regEx[1],i=end,index++;continue}null!==regExDescription.parameterIndex&&void 0!==regExDescription.parameterIndex&&(indexNow=parseInt(regExDescription.parameterIndex,10));let arg=args[indexNow],decimal=null!==regEx?parseInt(regExDescription.decimal,10):void 0;switch(regExDescription.type){case"d":case"i":case"u":arg=parseInt(arg,10);break;case"o":arg=parseInt(arg,10).toString(8);break;case"x":arg=parseInt(arg,10).toString(16);break;case"X":arg=parseInt(arg,10).toString(16).toUpperCase();break;case"f":arg=decimal?parseFloat(arg).toFixed(decimal):parseFloat(arg);break;case"e":arg=decimal?parseFloat(arg).toExponential(decimal):parseFloat(arg).toExponential();break;case"g":arg=decimal?String(Number(arg.toPrecision(decimal))):parseFloat(arg);break;case"s":arg=null===arg?"null":void 0===arg?"undefined":TcHmi.ValueConverter.toString(arg,""),arg=decimal?arg.substring(0,decimal):arg;break;case"b":arg=parseInt(arg,10).toString(2);break;case"t":arg=TcHmi.ValueConverter.toBoolean(arg),null===arg&&(arg=void 0),arg=decimal?arg.substring(0,decimal):arg;break;case"T":arg=null===arg?"null":typeof arg,arg=decimal?arg.substring(0,decimal):arg;break;case"v":arg=null===arg?"null":void 0===arg?"undefined":arg.valueOf(),arg=decimal?arg.substring(0,decimal):arg;break;case"j":arg=JSON.stringify(arg,null,regExDescription.lengthToAdd?parseInt(regExDescription.lengthToAdd,10):0)}if(/[j]/.exec(regExDescription.type))formattedString+=arg;else{let isPositive,sign,isNumber=/[d-g,i]/.test(regExDescription.type);isNumber&&(isPositive=arg>=0),!isNumber||isPositive&&!regExDescription.sign||isNaN(arg)?sign="":(sign=isPositive?"+":"",arg=arg.toString().replace(regExDescription.sign,""));let char=regExDescription.charToAddBefore?"0"===regExDescription.charToAddBefore?"0":regExDescription.charToAddBefore.charAt(1):" ",charLength=parseInt(regExDescription.lengthToAdd,10)-(sign+arg).length,charToAdd=regExDescription.lengthToAdd&&charLength>0?Array(charLength+1).join(char):"";formattedString+=regExDescription.align?sign+arg+charToAdd:"0"===char?sign+charToAdd+arg:charToAdd+sign+arg}index++,i=end}else{let onlyNumber=/([0-9]\d*)/.exec(placeholder);if(null!==onlyNumber){formattedString+=args[onlyNumber[0]],i=end}}}else"}"===formatString[i]?"}"===formatString[i+1]&&(formattedString+="}",i++):formattedString+=formatString[i];return formattedString}
/**
 * @preserve (Part of the public API)
 */var TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi,TcHmi;function gIsolatedEval_TcHmi_System_FunctionExpression_Results(s,resSE,resFCE){return eval(s)}function gIsolatedEval_TcHmi_System_FunctionExpression(s){return eval(s)}function gIsolatedEval_TcHmi_System_TriggerManager_JavaScriptAction(ctx,s){return eval(s)}function gIsolatedEval_TcHmi_System_TriggerManager_ConditionExpressionsResult(s,results){return eval(s)}!function(TcHmi){let IFunction,Endianness,PartialType,Trigger;TcHmi.isSolidColor=function(colorObject){return null!=colorObject&&"string"==typeof colorObject.color},TcHmi.isLinearGradientColor=function(colorObject){if(null==colorObject)return!1;let angle=colorObject.angle;return!(!Array.isArray(colorObject.stopPoints)||"number"!=typeof angle&&("string"!=typeof angle||isNaN(parseFloat(angle))))},TcHmi.isBackground=
/**
     * Checks if the parameter is a TcHmi.Background
     * @param obj
     * @preserve (Part of the public API)
     */
function(obj){return null!=obj&&(void 0!==obj.color&&void 0!==obj.image&&void 0!==obj.imageWidth&&void 0!==obj.imageWidthUnit&&void 0!==obj.imageHeight&&void 0!==obj.imageHeightUnit&&void 0!==obj.imageHorizontalAlignment&&void 0!==obj.imageVerticalAlignment&&void 0!==obj.imagePadding)},TcHmi.isTranslate=
/**
     * Checks if the parameter is a TcHmi.checkTransform
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Translate"===transformObject.transformType},TcHmi.isRotate=
/**
     * Checks if the parameter is a TcHmi.Rotate
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Rotate"===transformObject.transformType},TcHmi.isScale=
/**
     * Checks if the parameter is a TcHmi.Scale
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Scale"===transformObject.transformType},TcHmi.isSkew=
/**
     * Checks if the parameter is a TcHmi.Skew
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Skew"===transformObject.transformType},TcHmi.isOrigin=
/**
     * Checks if the parameter is a TcHmi.Origin
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Origin"===transformObject.transformType},TcHmi.isPerspective=
/**
     * Checks if the parameter is a TcHmi.Perspective
     * @param transformObject
     * @preserve (Part of the public API)
     */
function(transformObject){return!!transformObject&&"Perspective"===transformObject.transformType},function(IFunction){IFunction.isStaticValue=function(value){return!!value&&"StaticValue"===value.objectType},IFunction.isSymbol=function(value){return!!value&&"Symbol"===value.objectType},IFunction.isEventDataObject=function(value){return!!value&&"EventDataObject"===value.objectType},IFunction.isFunctionExpression=function(value){return!!value&&"FunctionExpression"===value.objectType}}(IFunction=TcHmi.IFunction||(TcHmi.IFunction={})),function(Endianness){Endianness[Endianness.LittleEndian=0]="LittleEndian",Endianness[Endianness.BigEndian=1]="BigEndian"}(Endianness=TcHmi.Endianness||(TcHmi.Endianness={})),TcHmi.isComparison=function(value){if(!value)return!1;let comparison=value;return["==","!=","<",">","<=",">=","contains","contains not","== [ignore case]","!= [ignore case]","contains [ignore case]","contains not [ignore case]"].includes(comparison.comparator)&&(["string","number","boolean"].includes(typeof comparison.value)||comparison.value instanceof Date||null===comparison.value)},TcHmi.isLogicOperator=function(value){if(!value)return!1;let logic=value.logic;return"AND"===logic||"OR"===logic},function(PartialType){PartialType[PartialType.Invalid=0]="Invalid",PartialType[PartialType.View=1]="View",PartialType[PartialType.Content=2]="Content",PartialType[PartialType.UserControl=3]="UserControl"}(PartialType=TcHmi.PartialType||(TcHmi.PartialType={})),function(Trigger){Trigger.isCondition=function(obj){return"Condition"===obj.objectType},Trigger.isSwitchCase=function(obj){return"SwitchCase"===obj.objectType},Trigger.isControlApiFunction=function(obj){return"ControlApiFunction"===obj.objectType},Trigger.isWriteToSymbol=function(obj){return"WriteToSymbol"===obj.objectType},Trigger.isComment=function(obj){return"Comment"===obj.objectType},Trigger.isFunction=function(obj){return null!==obj&&"Function"===obj.objectType},Trigger.isJavaScript=function(obj){return"JavaScript"===obj.objectType},Trigger.isActionTemplate=function(obj){return"ActionTemplate"===obj.objectType},Trigger.isFunctionExpression=function(obj){return null!==obj&&"FunctionExpression"===obj.objectType},Trigger.isControlAttributeBindingTarget=function(obj){return"ControlAttributeBindingTarget"===obj.objectType}}(Trigger=TcHmi.Trigger||(TcHmi.Trigger={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let ControlAttributeType,ControlAttributeValueType;!function(ControlAttributeType){ControlAttributeType[ControlAttributeType.Invalid=0]="Invalid",ControlAttributeType[ControlAttributeType.General=1]="General",ControlAttributeType[ControlAttributeType.Control=2]="Control",ControlAttributeType[ControlAttributeType.UserControlParameter=3]="UserControlParameter"}(ControlAttributeType=System.ControlAttributeType||(System.ControlAttributeType={})),function(ControlAttributeValueType){ControlAttributeValueType[ControlAttributeValueType.Invalid=0]="Invalid",ControlAttributeValueType[ControlAttributeValueType.Simple=1]="Simple",ControlAttributeValueType[ControlAttributeValueType.Complex=2]="Complex"}(ControlAttributeValueType=System.ControlAttributeValueType||(System.ControlAttributeValueType={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){
/**
    * For internal use only. Do not use or manipulate resources from within TcHmi.System in your code.
    * @preserve (Part of the public API)
    */
let System;!function(System){System.resolveControlHierarchy=function(ctrl,pctrl=null){let childrenHierarchyArr=[];if("function"==typeof ctrl.getChildren){const cc=ctrl.getChildren();for(let i=0,ii=cc.length;i<ii;i++)childrenHierarchyArr.push(TcHmi.System.resolveControlHierarchy(cc[i],ctrl))}return{ctrl:ctrl,children_hierarchy:childrenHierarchyArr,pctrl:pctrl}},System.resolveAttributesFromControlElement=function(elem){let res={error:TcHmi.Errors.NONE,value:{}};const controlId=elem.getAttribute("data-tchmi-target-user-control"),controlType=elem.getAttribute("data-tchmi-type");let cj=controlId?TcHmi.System.Data.Caches.partialCompositeConfigCache.get(tchmi_path(controlId.replace(".usercontrol",".usercontrol.json"))):void 0,elemChildren=elem.children;for(let i=0;i<elemChildren.length;i++){let elemChild=elemChildren[i];if(elemChild.hasAttribute("data-tchmi-target-attribute")&&"application/json"===elemChild.getAttribute("type")){const attrName=elemChild.getAttribute("data-tchmi-target-attribute");let value=null;try{value=JSON.parse(elemChild.innerHTML.replace(/\\\\n/g,"\\\\\\n").replace(/\\\\r/g,"\\\\\\r").replace(/\\\\t/g,"\\\\\\t").replace(/\\n/g,"\\\\n").replace(/\\r/g,"\\\\r").replace(/\\t/g,"\\\\t"))}catch(e){if(elemChild.innerHTML.trim().length){res.error=TcHmi.Errors.ERROR;let error={code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"Parsing json of attribute: '"+attrName+"' failed with exception: '"+e+"'.",domain:"TcHmi.System"};res.details?(res.details.errors||(res.details.errors=[]),res.details.errors.push(error)):res.details={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System",errors:[error]}}}let meta={name:attrName,value:value,valueType:System.ControlAttributeValueType.Complex,type:System.ControlAttributeType.General,descr:TcHmi.System.Services.controlManager.getDescriptionAttributeByName(controlType,attrName)};if(null!==meta.descr&&(meta.type=System.ControlAttributeType.Control),cj&&cj.parameters)for(let j=0,jj=cj.parameters.length;j<jj;j++)cj.parameters[j].name.toLowerCase()===meta.name.toLowerCase()&&(meta.descr=cj.parameters[j],null!==meta.descr&&(meta.type=System.ControlAttributeType.UserControlParameter));res.value[meta.name]=meta}}for(let i2=0;i2<elem.attributes.length;i2++){let elementAttribute=elem.attributes[i2],meta={name:elementAttribute.name,value:elementAttribute.value,type:System.ControlAttributeType.Invalid,valueType:System.ControlAttributeValueType.Simple,descr:TcHmi.System.Services.controlManager.getDescriptionAttributeByName(controlType,elementAttribute.name)};if(null!==meta.descr&&(meta.type=System.ControlAttributeType.Control),null!=cj&&void 0!==cj.parameters&&null!==cj.parameters)for(let j=0,jj=cj.parameters.length;j<jj;j++)cj.parameters[j].name===meta.name&&(meta.descr=cj.parameters[j],null!==meta.descr&&(meta.type=System.ControlAttributeType.UserControlParameter));res.value[meta.name]=meta}return res},System.__unload=function(evt){TcHmi.System.isUnloaded||(TcHmi.System.isUnloaded=!0,TcHmi.EventProvider.raise("System.disableCommunication"),!TCHMI_DESIGNER&&evt&&console.info("["+(new Date).toISOString()+"][Info] [Source=Framework, Module=TcHmi] Deactivated HMI because the browser opens a new page or reloads."))},System.resolveQualifiedName=function(name,namespace){return null!=namespace&&""!==namespace?namespace+"."+name:name},System.parseIdFromHtml=function(markup){let state=2,idStartIdx=0,idEndIdx=0;for(let charIdx=0;charIdx<markup.length;charIdx++){switch(markup[charIdx]){case"i":1===state&&(state=3);break;case"d":3===state?state=4:6===state||7===state||(state=2);break;case"=":4===state&&(state=5);break;case"'":5===state?(state=6,idStartIdx=charIdx+1):6===state&&(idEndIdx=charIdx);break;case'"':5===state?(state=7,idStartIdx=charIdx+1):7===state&&(idEndIdx=charIdx);break;case"<":case">":state=1;break;case" ":case"\t":case"\r":case"\n":4===state||5===state||(state=1);break;default:3===state?state=0:6===state||7===state||(state=2)}if(idEndIdx)break}if(idEndIdx)return markup.slice(idStartIdx,idEndIdx)},System.resolveSymbolPathToTokenArray=function(path){let res=[],t=path.split("::");for(let i=0,ii=t.length;i<ii;i++){let token=t[i],temp="";for(let j=0,jj=token.length;j<jj;j++){let c=token[j];"["===c&&temp.length>0?(res.push(temp),temp="",temp+=c):"]"===c?(temp+=c,res.push(temp),temp=""):(temp+=c,j===jj-1&&temp.length>0&&res.push(temp))}}return res},System.tchmi_utf8str_base64decode=function(input){try{return decodeURIComponent(Array.prototype.map.call(window.atob(input),(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)})).join(""))}catch(e){return null}},System.tchmi_utf8str_base64encode=function(input){try{return window.btoa(encodeURIComponent(input).replace(/%([0-9A-F]{2})/g,(function(match,p1){return String.fromCharCode(parseInt("0x"+p1,16))})))}catch(e){return null}},System.resolveElementStyleDimensions=function(j){let clone=j.clone(),tempDiv=document.createElement("div"),helper=$(tempDiv);helper.css("display","none"),helper.append(clone),TcHmi.System.SharedResources.jqBody.append(helper);const s=window.getComputedStyle(clone[0],null);let res={width:s.width?s.width:"auto",height:s.height?s.height:"auto",top:s.top?s.top:"auto",left:s.left?s.left:"auto",right:s.right?s.right:"auto",bottom:s.bottom?s.bottom:"auto"};return helper.remove(),res},System.toCamelCase=function(text){let res="";if(null==text||""===text)return res;let s=text;for(let i=0,ii=s.length;i<ii;i++){let c=s[i];0!==i?"-"===s[i-1]?res+=c.toUpperCase():"-"!==c&&(res+=c):res+=c.toUpperCase()}return res},System.toDashCase=function(text){let res="";if(null==text||""===text)return res;let s=text;for(let i=0,ii=s.length;i<ii;i++){let c=s[i];"-"!==c&&c.toUpperCase()===c&&i>0?res+="-"+c:res+=c}return res.toLowerCase()},System.compareISO8601ServerCommandDateTimeStrings=function(a,b){if(a.length===b.length)return a<b?-1:a>b?1:0;{let aDate=new Date(a),bDate=new Date(b);if(aDate<bDate)return-1;if(aDate>bDate)return 1;{let aSubSeconds=null,aIndex1=a.indexOf("."),aIndex2=a.indexOf("Z");if(aIndex1>-1&&aIndex2>-1&&(aSubSeconds=a.substring(aIndex1+1,aIndex2)),aSubSeconds&&aSubSeconds.length<6)for(let i=0,ii=6-aSubSeconds.length;i<ii;i++)aSubSeconds+="0";let bSubSeconds=null,bIndex1=b.indexOf("."),bIndex2=b.indexOf("Z");if(bIndex1>-1&&bIndex2>-1&&(bSubSeconds=b.substring(bIndex1+1,bIndex2)),bSubSeconds&&bSubSeconds.length<6)for(let i=0,ii=6-bSubSeconds.length;i<ii;i++)bSubSeconds+="0";return null!==aSubSeconds&&null!==bSubSeconds&&aSubSeconds<bSubSeconds?-1:null!==aSubSeconds&&null!==bSubSeconds&&aSubSeconds>bSubSeconds?1:0}}},System.isParameterTypeInvalid=function(parameter,parameterName,options,domain,callback){const callCallback=reason=>{const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:reason};return domain&&(errorDetail.domain=domain),TcHmi.Callback.callSafeEx(callback,null,{error:errorDetail.code,details:errorDetail}),errorDetail},checkOne=variable=>typeof variable!==options.type?callCallback("Parameter "+parameterName+" has type "+typeof variable+", but must have type "+options.type):"string"===options.type&&"number"==typeof options.minStringLength&&variable.length<options.minStringLength&&callCallback("String parameter "+parameterName+" has length of "+variable.length+", but must have at least "+options.minStringLength);if(void 0!==parameter||"undefinedOk"!==options.required&&"fullOptional"!==options.required){if(null!==parameter||"nullOk"!==options.required&&"fullOptional"!==options.required){if(null==parameter)return callCallback("Required parameter "+parameterName+" must not be "+parameter);if(!0===options.expectArray){if(Array.isArray(parameter)){if("number"==typeof options.minArrayLength&&parameter.length<options.minArrayLength)return callCallback("Array parameter "+parameterName+" has "+parameter.length+" items, but must have at least "+options.minStringLength);if(options.type){for(let item of parameter){const itemIsInvalid=checkOne(item);if(itemIsInvalid)return itemIsInvalid}return!1}return!1}return callCallback("Parameter "+parameterName+" must be an array")}return!1===options.expectArray&&Array.isArray(parameter)?callCallback("Parameter "+parameterName+" must not be an array"):checkOne(parameter)}return!1}return!1}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let SharedResources;SharedResources=System.SharedResources||(System.SharedResources={})}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Services,Data;!function(Services){let Engineering;Engineering=Services.Engineering||(Services.Engineering={})}(Services=System.Services||(System.Services={})),function(Data){let Modules,Registrations,Caches;Data.packages=new Map,function(Modules){Modules.controls={map:new Map,array:[],urlMap:new Map},Modules.functions={map:new Map,array:[]}}(Modules=Data.Modules||(Data.Modules={})),function(Registrations){Registrations.controls={map:new Map,array:[]},Registrations.functions={map:new Map,array:[]}}(Registrations=Data.Registrations||(Data.Registrations={})),function(Caches){Caches.templateMarkupCache=new Map,Caches.partialMarkupCache=new Map,Caches.partialCompositeConfigCache=new Map}(Caches=Data.Caches||(Data.Caches={})),Data.isKeepAlivePartial=new Map,Data.isLoadSyncContent=new Map,Data.isPreloadBindingPartial=new Map}(Data=System.Data||(System.Data={})),System.config={basePath:"",scaleMode:"None",startupView:"",activeTheme:"Base",themes:{},tcHmiServer:{websocketIntervalTime:500,websocketSystemTimeout:6e4,websocketTimeout:6e4},symbols:{internal:{}},trigger:[],packages:[],views:[],userFunctions:[],userControls:[],content:[],actionTemplates:[],languages:{},keyboardLayouts:[],creatorSettings:{viewport:{defaultHeight:600,defaultWidth:800}},binding:{symbolError:"Ignore"}},System.isInitialized=!1,System.isUnloaded=!1,System.mapControlNamesFromPackageManifestApi0ToApi1=new Map([["tchmi-bar-chart","TcHmi.Controls.Beckhoff.TcHmiBarChart"],["tchmi-button","TcHmi.Controls.Beckhoff.TcHmiButton"],["tchmi-checkbox","TcHmi.Controls.Beckhoff.TcHmiCheckbox"],["tchmi-combobox","TcHmi.Controls.Beckhoff.TcHmiCombobox"],["tchmi-datagrid","TcHmi.Controls.Beckhoff.TcHmiDatagrid"],["tchmi-date-time-picker","TcHmi.Controls.Beckhoff.TcHmiDateTimePicker"],["tchmi-ellipse","TcHmi.Controls.Beckhoff.TcHmiEllipse"],["tchmi-event-grid","TcHmi.Controls.Beckhoff.TcHmiEventGrid"],["tchmi-iframe","TcHmi.Controls.Beckhoff.TcHmiIFrame"],["tchmi-image","TcHmi.Controls.Beckhoff.TcHmiImage"],["tchmi-keyboard","TcHmi.Controls.Beckhoff.TcHmiKeyboard"],["tchmi-line","TcHmi.Controls.Beckhoff.TcHmiLine"],["tchmi-linear-gauge","TcHmi.Controls.Beckhoff.TcHmiLinearGauge"],["tchmi-line-chart","TcHmi.Controls.Beckhoff.TcHmiLineChart"],["tchmi-polygon","TcHmi.Controls.Beckhoff.TcHmiPolygon"],["tchmi-radial-gauge","TcHmi.Controls.Beckhoff.TcHmiRadialGauge"],["tchmi-rectangle","TcHmi.Controls.Beckhoff.TcHmiRectangle"],["tchmi-textblock","TcHmi.Controls.Beckhoff.TcHmiTextblock"],["tchmi-textbox","TcHmi.Controls.Beckhoff.TcHmiTextbox"],["tchmi-timespan-picker","TcHmi.Controls.Beckhoff.TcHmiTimespanPicker"],["tchmi-toggle-button","TcHmi.Controls.Beckhoff.TcHmiToggleButton"],["tchmi-trend-line-chart","TcHmi.Controls.Beckhoff.TcHmiTrendLineChart"],["tchmi-video","TcHmi.Controls.Beckhoff.TcHmiVideo"],["tchmi-container","TcHmi.Controls.System.TcHmiContainer"],["tchmi-container-control","TcHmi.Controls.System.TcHmiContainerControl"],["tchmi-content","TcHmi.Controls.System.TcHmiContent"],["tchmi-control","TcHmi.Controls.System.TcHmiControl"],["tchmi-grid","TcHmi.Controls.System.TcHmiGrid"],["tchmi-html-host","TcHmi.Controls.System.TcHmiHtmlHost"],["tchmi-partial","TcHmi.Controls.System.TcHmiPartial"],["tchmi-region","TcHmi.Controls.System.TcHmiRegion"],["tchmi-user-control","TcHmi.Controls.System.TcHmiUserControl"],["tchmi-user-control-host","TcHmi.Controls.System.TcHmiUserControlHost"]]),System.mapControlNamesFromPackageManifestApi1ToApi0=new Map([["TcHmi.Controls.Beckhoff.TcHmiBarChart","tchmi-bar-chart"],["TcHmi.Controls.Beckhoff.TcHmiButton","tchmi-button"],["TcHmi.Controls.Beckhoff.TcHmiCheckbox","tchmi-checkbox"],["TcHmi.Controls.Beckhoff.TcHmiCombobox","tchmi-combobox"],["TcHmi.Controls.Beckhoff.TcHmiDatagrid","tchmi-datagrid"],["TcHmi.Controls.Beckhoff.TcHmiDateTimePicker","tchmi-date-time-picker"],["TcHmi.Controls.Beckhoff.TcHmiEllipse","tchmi-ellipse"],["TcHmi.Controls.Beckhoff.TcHmiEventGrid","tchmi-event-grid"],["TcHmi.Controls.Beckhoff.TcHmiIFrame","tchmi-iframe"],["TcHmi.Controls.Beckhoff.TcHmiImage","tchmi-image"],["TcHmi.Controls.Beckhoff.TcHmiKeyboard","tchmi-keyboard"],["TcHmi.Controls.Beckhoff.TcHmiLine","tchmi-line"],["TcHmi.Controls.Beckhoff.TcHmiLinearGauge","tchmi-linear-gauge"],["TcHmi.Controls.Beckhoff.TcHmiLineChart","tchmi-line-chart"],["TcHmi.Controls.Beckhoff.TcHmiPolygon","tchmi-polygon"],["TcHmi.Controls.Beckhoff.TcHmiRadialGauge","tchmi-radial-gauge"],["TcHmi.Controls.Beckhoff.TcHmiRectangle","tchmi-rectangle"],["TcHmi.Controls.Beckhoff.TcHmiTextblock","tchmi-textblock"],["TcHmi.Controls.Beckhoff.TcHmiTextbox","tchmi-textbox"],["TcHmi.Controls.Beckhoff.TcHmiTimespanPicker","tchmi-timespan-picker"],["TcHmi.Controls.Beckhoff.TcHmiToggleButton","tchmi-toggle-button"],["TcHmi.Controls.Beckhoff.TcHmiTrendLineChart","tchmi-trend-line-chart"],["TcHmi.Controls.Beckhoff.TcHmiVideo","tchmi-video"],["TcHmi.Controls.System.TcHmiContainer","tchmi-container"],["TcHmi.Controls.System.TcHmiContainerControl","tchmi-container-control"],["TcHmi.Controls.System.TcHmiContent","tchmi-content"],["TcHmi.Controls.System.TcHmiControl","tchmi-control"],["TcHmi.Controls.System.TcHmiGrid","tchmi-grid"],["TcHmi.Controls.System.TcHmiHtmlHost","tchmi-html-host"],["TcHmi.Controls.System.TcHmiPartial","tchmi-partial"],["TcHmi.Controls.System.TcHmiRegion","tchmi-region"],["TcHmi.Controls.System.TcHmiUserControl","tchmi-user-control"],["TcHmi.Controls.System.TcHmiUserControlHost","tchmi-user-control-host"],["TcHmi.Controls.System.TcHmiView","tchmi-view"]])}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let acornSymbolExpressionExtension;!function(acornSymbolExpressionExtension){let tt=acorn.tokTypes,tc=acorn.tokContexts;tc.symbolExpressionOpenTag=new acorn.TokContext("%tag",!1),tc.symbolExpressionCloseTag=new acorn.TokContext("%/tag",!1),tc.symbolExpressionExpression=new acorn.TokContext("%tag%...%/tag%",!0,!0),tt.symbolExpressionTagName=new acorn.TokenType("symbolExpressionTagName"),tt.symbolExpressionSymbolName=new acorn.TokenType("symbolExpressionSymbolName",{beforeExpr:!0}),tt.symbolExpressionOpenTagStart=new acorn.TokenType("symbolExpressionOpenTagStart"),tt.symbolExpressionOpenTagEnd=new acorn.TokenType("symbolExpressionOpenTagEnd"),tt.symbolExpressionCloseTagStart=new acorn.TokenType("symbolExpressionCloseTagStart"),tt.symbolExpressionCloseTagEnd=new acorn.TokenType("symbolExpressionCloseTagEnd"),tt.symbolExpressionOpenTagStart.updateContext=function(){this.context.push(tc.symbolExpressionExpression),this.context.push(tc.symbolExpressionOpenTag),this.exprAllowed=!1},tt.symbolExpressionOpenTagEnd.updateContext=function(prevType){this.context.pop(),this.exprAllowed=!0},tt.symbolExpressionCloseTagStart.updateContext=function(){this.context.pop(),this.context.push(tc.symbolExpressionCloseTag),this.exprAllowed=!1},tt.symbolExpressionCloseTagEnd.updateContext=function(prevType){this.context.pop(),this.exprAllowed=!1};let pp=acorn.Parser.prototype;pp.symbolExpression_readToken=function(){let out="";const chunkStart=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated BEX contents");let ch=this.input.charCodeAt(this.pos);switch(ch){case 37:return this.pos===this.start?this.getTokenFromCode(ch):(out+=this.input.slice(chunkStart,this.pos),this.finishToken(tt.symbolExpressionSymbolName,out));default:++this.pos}}},pp.symbolExpression_readWord=function(){let ch,start=this.pos;do{ch=this.input.charCodeAt(++this.pos)}while(acorn.isIdentifierChar(ch)||45===ch);return this.finishToken(tt.symbolExpressionTagName,this.input.slice(start,this.pos))},pp.symbolExpression_parseString=function(){const value=this.value;return this.next(),value},pp.symbolExpression_parseOpeningTagName=function(){const tagName=this.symbolExpression_parseString();return this.expect(tt.symbolExpressionOpenTagEnd),tagName},pp.symbolExpression_parseClosingTagName=function(){const tagName=this.symbolExpression_parseString();return this.expect(tt.symbolExpressionCloseTagEnd),tagName},pp.symbolExpression_parseElementAt=function(startPos,startLoc){const node=this.startNodeAt(startPos,startLoc);let symbol="";const openingTagName=this.symbolExpression_parseOpeningTagName();let closingTagName="";contents:for(;;)switch(this.type){case tt.symbolExpressionOpenTagStart:this.next();break;case tt.symbolExpressionSymbolName:symbol=this.symbolExpression_parseString();break;case tt.symbolExpressionCloseTagStart:if(this.next(),this.eat(tt.slash)){closingTagName=this.symbolExpression_parseClosingTagName();break contents}default:this.unexpected()}return closingTagName!==openingTagName&&this.raise(node.start,"Expected corresponding closing tag for %/"+openingTagName+"%"),node.passAsSymbol=!1,node.expression=`%${openingTagName}%${symbol}%/${closingTagName}%`,this.options.plugins.symbolExpression.onSymbol&&this.options.plugins.symbolExpression.onSymbol(node),this.finishNode(node,"SymbolExpression")},pp.symbolExpression_parseElement=function(){let startPos=this.start,startLoc=this.startLoc;return this.next(),this.symbolExpression_parseElementAt(startPos,startLoc)},acorn.plugins.symbolExpression=(instance,options)=>{options&&("object"!=typeof options&&(options={}),Array.isArray(options.onSymbol)&&function(){let bindings=options.onSymbol;options.onSymbol=function(binding){return bindings.push(binding)}}(),Array.isArray(options.onCallExpression)&&(()=>{let callExpressions=options.onCallExpression;options.onSymbol=expression=>callExpressions.push(expression)})(),instance.extend("parseExprAtom",(function(inner){return function(refShortHandDefaultPos){return this.type===tt.symbolExpressionSymbolName?this.parseLiteral(this.value):this.type===tt.symbolExpressionOpenTagStart?this.symbolExpression_parseElement():inner.call(this,refShortHandDefaultPos)}})),instance.extend("readToken",(function(inner){return function(code){let context=this.curContext();if(context===tc.symbolExpressionExpression)return 37===code?(++this.pos,this.finishToken(tt.symbolExpressionCloseTagStart)):this.symbolExpression_readToken();if(context===tc.symbolExpressionOpenTag||context===tc.symbolExpressionCloseTag){if(acorn.isIdentifierStart(code))return this.symbolExpression_readWord();if(37===code)return++this.pos,context===tc.symbolExpressionCloseTag?this.finishToken(tt.symbolExpressionCloseTagEnd):this.finishToken(tt.symbolExpressionOpenTagEnd)}return 37===code&&this.exprAllowed?(++this.pos,this.finishToken(tt.symbolExpressionOpenTagStart)):inner.call(this,code)}})),instance.extend("updateContext",(function(inner){return function(prevType){return inner.call(this,prevType)}})),instance.extend("finishNode",(function(inner){return function(node,type){return"CallExpression"===type&&this.options.plugins.symbolExpression.onCallExpression&&this.options.plugins.symbolExpression.onCallExpression(node),inner.call(this,node,type)}})))}}(acornSymbolExpressionExtension=System.acornSymbolExpressionExtension||(System.acornSymbolExpressionExtension={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let Callback;!function(Callback){Callback.callSafeCallbacks1Param=function(callbacks,thisArg,data){let callbackList=[];for(let i=0,ii=callbacks.length;i<ii;i++)callbackList.push(callbacks[i]);for(let innerCallback of callbackList)-1!==callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback,thisArg,data)}}(Callback=System.Callback||(System.Callback={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.InternalSymbolManager=class{constructor(){this.__entries=new Map}add(name,item){let entryEx=item;if(this.__entries.set(name,entryEx),void 0===entryEx.value){let schema=TcHmi.Type.getSchema(item.type);schema&&(entryEx.value=TcHmi.Type.Schema.resolveDefault(schema))}if(entryEx.persist&&"undefined"!=typeof Storage&&window.localStorage){let savedValue=window.localStorage.getItem("TCHMI_INTERNALSYMBOL_"+name);if(null!==savedValue)try{entryEx.value=JSON.parse(savedValue)}catch(e){}}entryEx.callbacks||(entryEx.callbacks=[])}remove(name){this.__entries.delete(name)}update(name,item){let entry=this.__entries.get(name);if(!entry)return;let refresh=!1;tchmi_equal(entry.type,item.type)||(entry.type=item.type,refresh=!0);let value=item.value;if(void 0===value){let schema=TcHmi.Type.getSchema(item.type);schema&&(value=TcHmi.Type.Schema.resolveDefault(schema))}if(tchmi_equal(entry.value,value)||(entry.value=value,refresh=!0),tchmi_equal(entry.persist,item.persist)||(entry.persist=item.persist,refresh=!0),tchmi_equal(entry.readonly,item.readonly)||(entry.readonly=item.readonly,refresh=!0),refresh){let callbackList=[];for(let i=0,ii=entry.callbacks.length;i<ii;i++)callbackList.push(entry.callbacks[i]);for(let innerCallback of callbackList)-1!==entry.callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,value:entry.value,destroy:innerCallback.destroy})}}write(name,value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let dirtyPathsNew=[];if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(dirtyPaths[i]);let entry=this.__entries.get(name);if(entry)if(entry.readonly)TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:"Internal symbol with name="+name+" is readonly.",domain:"TcHmi.System.InternalSymbolManager"}});else if(tchmi_equal(entry.value,value))TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});else{if((!dirtyPaths||0===dirtyPaths.length)&&entry.value&&value&&"object"==typeof entry.value&&"object"==typeof value){const buildDirtyPaths=(o1,o2,path)=>{for(let p in o1)"object"==typeof o1[p]&&"object"==typeof o2[p]?Array.isArray(o1)?buildDirtyPaths(o1[p],o2[p],path+"["+p+"]"):buildDirtyPaths(o1[p],o2[p],path+"::"+p):tchmi_equal(o1[p],o2[p])||(Array.isArray(o1)?dirtyPathsNew.push(path+"["+p+"]"):dirtyPathsNew.push(path+"::"+p))};buildDirtyPaths(entry.value,value,"")}let prevValue=entry.value;if(entry.value=value,entry.persist){if("undefined"!=typeof Storage&&window.localStorage)try{window.localStorage.setItem("TCHMI_INTERNALSYMBOL_"+name,JSON.stringify(entry.value))}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.InternalSymbolManager] An uncaught exception occurred:\n",e)}}else!0===prevValue&&window.localStorage.removeItem("TCHMI_INTERNALSYMBOL_"+name);let callbackList=[];for(let i=0,ii=entry.callbacks.length;i<ii;i++)callbackList[i]=entry.callbacks[i];for(let innerCallback of callbackList)-1!==entry.callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,value:entry.value,dirtyPaths:dirtyPathsNew,destroy:innerCallback.destroy});TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}read(name,callback){let entry=this.__entries.get(name);entry?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:entry.value}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}getType(name,callback){let entry=this.__entries.get(name);entry?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,type:entry.type}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}})}watch(name,callback){let entry=this.__entries.get(name);if(!entry)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:"Internal symbol with name="+name+" does not exist.",domain:"TcHmi.System.InternalSymbolManager"}}),function(){};let destroy=function(){if(!entry)return;let index=entry.callbacks.indexOf(co);-1!==index&&(entry.callbacks.splice(index,1),co.callback=null),entry=void 0},co={callback:callback,destroy:destroy};return entry.callbacks.push(co),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:entry.value,destroy:destroy}),destroy}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.TemplateParamSymbolManager=class{constructor(){this.__entries=new Map}add(name,type,value){let prepValue;if(void 0===value){let schema=TcHmi.Type.getSchema(type);schema&&(prepValue=TcHmi.Type.Schema.resolveDefault(schema))}else prepValue=value;let entry={name:name,type:type,value:prepValue,callbacks:[]};this.__entries.set(name,entry)}remove(name){let entry=this.__entries.get(name);entry&&(entry.value instanceof TcHmi.System.Symbol&&entry.value.destroy(),entry.value=null,this.__entries.delete(name))}get(name){return this.__entries.get(name)}destroy(){this.__entries.forEach(entry=>{entry.value instanceof TcHmi.System.Symbol&&entry.value.destroy()}),this.__entries.clear()}keepAlive(name){let entry=this.__entries.get(name);return!!(entry&&entry.callbacks.length>0)}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let Controls;!function(Controls){let System;!function(System){System.baseTcHmiControl=class{constructor(element,pcElement,attrs){}}}(System=Controls.System||(Controls.System={}))}(Controls=TcHmi.Controls||(TcHmi.Controls={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.AccessManager=class{constructor(){this.__isReady=!1,this.__lastUserInteraction=Date.now(),this.__lastUserInteractionSentToServer=this.__lastUserInteraction,this.__autoLogoffTimeoutID=0,this.__oldName=null,this.__subscriptionId=null,this.__reload=!0,this.__accessCache=new WeakMap,this.__handleServerResponse=data=>{var _a;let userDataChanged=!1,userChanged=!1,userInGroupChanged=!1,websocketClosed=!1;const userConfigOnServer=this.__userConfigOnServer;if(data.error===TcHmi.Errors.E_WEBSOCKET_CLOSED)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Websocket was closed.",websocketClosed=!0,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;else if(data.error===TcHmi.Errors.E_WEBSOCKET_NOT_READY)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Communication not ready.",userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;else if(data.error===TcHmi.Errors.NONE&&data.response&&void 0!==data.response.error)userConfigOnServer.state=1,userConfigOnServer.errorMessage="Unknown Server error: "+data.response.error.message,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0,data.response.error.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE&&(!0===TCHMI_ENGINEERING?userConfigOnServer.errorMessage="Server is not licensed. Please try in a few seconds again.":userConfigOnServer.errorMessage="Server is not licensed.");else if(data.error===TcHmi.Errors.NONE&&data.response){let hasReturnedFromError=!1;1===userConfigOnServer.state&&(hasReturnedFromError=!0),0===userConfigOnServer.state&&(userConfigOnServer.state=1),userConfigOnServer.errorMessage="Got no valid answer.";let responseCommands=data.response.commands;void 0===responseCommands&&(responseCommands=[]);for(let i=0,ii=responseCommands.length;i<ii;i++){const commandGeneric=responseCommands[i];if("GetCurrentUser"===commandGeneric.symbol){let command=commandGeneric;if(void 0!==command.error){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+". Error code: "+command.error.code,userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;break}if(void 0===command.readValue){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+".",userChanged=!0,userDataChanged=!0,userInGroupChanged=!0;break}if(userConfigOnServer.errorMessage="",void 0!==command.readValue.name&&null!==command.readValue.name&&userConfigOnServer.name!==command.readValue.name){if(4===userConfigOnServer.state&&void 0!==userConfigOnServer.name&&null!==userConfigOnServer.name&&"__SystemGuest"===command.readValue.name&&!0===this.__reload)return void window.location.reload();if(!1===this.__reload&&(this.__reload=!0),"ReadWrite"===data.response.requestType&&null!==this.__oldName&&this.__oldName!==command.readValue.name)return userConfigOnServer.state=1,TcHmi.System.Services.dialogManager.showDialog(null,!1),TcHmi.System.Services.dialogManager.updateText("__AccessManager",TcHmi.System.Services.localization.getText("Connection_Recovered_Auth_Invalid",{level:TcHmi.Locale.Level.Engineering})+' <input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location = \'/Logout?Location='+window.location.pathname+"&Name="+encodeURIComponent(TcHmi.System.Services.accessManager.__oldName||"")+"'\">",TcHmi.DialogManager.DialogSeverity.Error),void TcHmi.System.Services.dialogManager.showDialog("__AccessManager",!0,TcHmi.DialogManager.DialogType.Overlay);userChanged=!0,userDataChanged=!0,userConfigOnServer.name=command.readValue.name}if(command.readValue.autoLogoff){const parts=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/.exec(command.readValue.autoLogoff);if(null===parts)break;const years=parseInt(parts[2],10)||0,months=parseInt(parts[3],10)||0,weeks=parseInt(parts[4],10)||0,days=parseInt(parts[5],10)||0,hours=parseInt(parts[6],10)||0,minutes=parseInt(parts[7],10)||0;let newTime=1e3*((parseFloat(parts[8])||0)+60*(minutes+60*(hours+24*(days+30*months+7*weeks)+365*years)));userConfigOnServer.autoLogOffMilliSeconds!==newTime&&(userConfigOnServer.autoLogOffMilliSeconds=newTime,userDataChanged=!0,TcHmi.System.Services.accessManager.__rearmAutoLogoffTimer())}(hasReturnedFromError||void 0!==command.readValue.groups&&!tchmi_equal(userConfigOnServer.userIsInGroups.sort(),command.readValue.groups.sort()))&&(userDataChanged=!0,userInGroupChanged=!0,userConfigOnServer.userIsInGroups=null!==(_a=command.readValue.groups)&&void 0!==_a?_a:[]),void 0!==command.readValue.domain&&userConfigOnServer.domain!==command.readValue.domain&&(userDataChanged=!0,userConfigOnServer.domain=command.readValue.domain),void 0!==command.readValue.session&&userConfigOnServer.session!==command.readValue.session&&(userDataChanged=!0,userConfigOnServer.session=command.readValue.session),void 0!==command.readValue.clientCertificate&&userConfigOnServer.clientCertificate!==command.readValue.clientCertificate&&(userDataChanged=!0,userConfigOnServer.clientCertificate=command.readValue.clientCertificate),void 0!==command.readValue.clientIp&&userConfigOnServer.clientIp!==command.readValue.clientIp&&(userDataChanged=!0,userConfigOnServer.clientIp=command.readValue.clientIp);let serverLocale=command.readValue.locale;serverLocale&&"client"!==serverLocale||(serverLocale=void 0),userConfigOnServer.locale!==serverLocale&&(userConfigOnServer.locale=serverLocale),userConfigOnServer.configLocale!==command.readValue.configLocale&&(userDataChanged=!0,userConfigOnServer.configLocale=command.readValue.configLocale);let serverTimeFormatLocale=command.readValue.timeFormatLocale;serverTimeFormatLocale&&"client"!==serverTimeFormatLocale||(serverTimeFormatLocale=void 0),userConfigOnServer.timeFormatLocale!==serverTimeFormatLocale&&(userDataChanged=!0,userConfigOnServer.timeFormatLocale=serverTimeFormatLocale),userConfigOnServer.configTimeFormatLocale!==command.readValue.configTimeFormatLocale&&(userDataChanged=!0,userConfigOnServer.configTimeFormatLocale=command.readValue.configTimeFormatLocale);let serverTimezone=command.readValue.timeZone;serverTimezone&&"client"!==serverTimezone||(serverTimezone=void 0),userConfigOnServer.timeZone!==serverTimezone&&(userDataChanged=!0,userConfigOnServer.timeZone=serverTimezone),userConfigOnServer.configTimeZone!==command.readValue.configTimeZone&&(userDataChanged=!0,userConfigOnServer.configTimeZone=command.readValue.configTimeZone),TcHmi.Localization.__rebuildLocalizationCache()}else if("IsAuthRequired"===commandGeneric.symbol){let command=commandGeneric;if(void 0!==command.error){userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+". Error code: "+command.error.code;break}if(!0===command.readValue)4!==userConfigOnServer.state&&(userConfigOnServer.state=4,userConfigOnServer.errorMessage="",userDataChanged=!0);else{if(!1!==command.readValue){userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no valid answer for "+command.symbol+".",userDataChanged=!0;break}2!==userConfigOnServer.state&&(userConfigOnServer.state=2,userConfigOnServer.errorMessage="",userDataChanged=!0)}}}4===userConfigOnServer.state&&(userConfigOnServer.name?0===userConfigOnServer.userIsInGroups.length&&(userDataChanged=!0,userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no group membership but should have one."):(userDataChanged=!0,userConfigOnServer.state=1,userConfigOnServer.errorMessage="Got no user login but should have one."))}userDataChanged&&!TcHmi.System.isUnloaded&&this.__handleConfigChanged({user:userChanged,group:userInGroupChanged},websocketClosed)},this.__clearControlAccessCache=(evt,data)=>{this.__accessCache=new WeakMap},this.__updateLastUserinteraction=evt=>{this.__sendHeartbeat(),this.__lastUserInteraction=Date.now()},this.__sendHeartbeat=force=>{const dateNow=Date.now();(this.__userConfigOnServer.autoLogOffMilliSeconds&&dateNow-this.__lastUserInteractionSentToServer>this.__userConfigOnServer.autoLogOffMilliSeconds/2||force)&&(this.__lastUserInteractionSentToServer=dateNow,TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:"Heartbeat"}]},{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout}))},this.__logoutIfNoInteraction=()=>{this.__userConfigOnServer.autoLogOffMilliSeconds&&Date.now()-this.__lastUserInteraction>this.__userConfigOnServer.autoLogOffMilliSeconds&&(TcHmi.Server.logout(),this.__rearmAutoLogoffTimer())},this.__userConfigOnServer={state:0,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"},TcHmi.EventProvider.register("onWebSocketOpened",this.__onWebsocketOpen()),TcHmi.EventProvider.register("onWebSocketClosed",this.__onWebsocketClosed()),TcHmi.EventProvider.register("System.AccessConfigChanged",this.__clearControlAccessCache),TcHmi.EventProvider.register("System.ParentChanged",this.__clearControlAccessCache)}__onWebsocketClosed(){return evt=>{this.__subscriptionId=null,this.__oldName=this.__userConfigOnServer.name,this.__userConfigOnServer={state:1,userIsInGroups:[],name:null,domain:null,locale:void 0,configLocale:"client",timeFormatLocale:void 0,configTimeFormatLocale:"client",timeZone:void 0,configTimeZone:void 0,autoLogOffMilliSeconds:null,session:null,clientCertificate:null,clientIp:"",errorMessage:"",defaultAuthExtension:"TcHmiUserManagement",defaultUserGroup:"__SystemUsers"}}}__onWebsocketOpen(){return evt=>{TcHmi.Server.readSymbol(["DefaultAuthExtension","DefaultUserGroup"],TcHmi.Server.__handleServerResponse({completed:data=>{if(data.error!==TcHmi.Errors.NONE){if(TCHMI_CONSOLE_LOG_LEVEL>=1){const details=data.details;TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.AccessManager] Internal Error. Failed to load DefaultAuthExtension and DefaultUserGroup. Using default TcHmiUserManagement and __SystemUsers: "+TcHmi.Log.buildMessage(details))}}else if(data.results)for(const res of data.results)"DefaultAuthExtension"===res.symbol&&res.value&&res.value!==this.__userConfigOnServer.defaultAuthExtension?this.__userConfigOnServer.defaultAuthExtension=res.value:"DefaultUserGroup"===res.symbol&&res.value&&res.value!==this.__userConfigOnServer.defaultUserGroup&&(this.__userConfigOnServer.defaultUserGroup=res.value);this.subscribe()}}))}}getCurrentUserConfig(){return this.__userConfigOnServer}enableReload(value){this.__reload=value}isReady(){return this.__isReady}unsubscribe(callback){null!==this.__subscriptionId?TcHmi.Server.unsubscribe(this.__subscriptionId,data=>{data.error===TcHmi.Errors.NONE&&(this.__subscriptionId=null),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}subscribe(callback){if(null===this.__subscriptionId){let callbackOnce=callback;this.__subscriptionId=TcHmi.Server.subscribeEx([{symbol:"IsAuthRequired"},{symbol:"GetCurrentUser"}],1e3,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},data=>{this.__handleServerResponse(data),TcHmi.System.Services.localizationManager.processLocale(this.__userConfigOnServer.locale,{level:TcHmi.Locale.Level.Application},data=>{let raiseReadyEvent=!this.__isReady;this.__isReady=!0,TcHmi.Callback.callSafeEx(callbackOnce,this,{error:TcHmi.Errors.NONE}),callbackOnce=void 0,raiseReadyEvent&&TcHmi.EventProvider.raise("System.onAccessManagerReady")})})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}__handleConfigChanged(changed,websocketClosed){if(this.__accessCache=new WeakMap,1===this.__userConfigOnServer.state){const oldDialogOwner=TcHmi.System.Services.dialogManager.getDialogOwner();"__TcHmiMain"!==oldDialogOwner&&"__TcHmiViewAccess"!==oldDialogOwner||TcHmi.System.Services.dialogManager.showDialog(oldDialogOwner,!1),!0!==websocketClosed&&(TcHmi.System.Services.dialogManager.updateText("__AccessManager",TcHmi.System.Services.localization.getText("Loading_User_Config_Failed",{level:TcHmi.Locale.Level.Engineering})+(this.__userConfigOnServer.errorMessage?": "+this.__userConfigOnServer.errorMessage:".")+' <input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location = \'/Logout?Location='+window.location.pathname+"'\">",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Services.dialogManager.showDialog("__AccessManager",!0,TcHmi.DialogManager.DialogType.Overlay)),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.AccessManager] Internal Error. Loading User Login Config from Server failed"+(this.__userConfigOnServer.errorMessage?": "+this.__userConfigOnServer.errorMessage:"."))}if(changed.group){2!==this.__userConfigOnServer.state&&4!==this.__userConfigOnServer.state||TcHmi.EventProvider.raise("onUserInGroupChanged",this.__userConfigOnServer.userIsInGroups);const currentView=TcHmi.System.Services.viewManager.getView();null!==currentView&&currentView.__processAccessConfig()}changed.user&&TcHmi.EventProvider.raise("onUserChanged",this.__userConfigOnServer.name),TcHmi.EventProvider.raise("onUserDataChanged",this.__userConfigOnServer)}checkAccess(control,requestedAccessright){if(!0===TCHMI_DESIGNER)return!0;if(2===this.__userConfigOnServer.state)return!0;if(-1!==this.__userConfigOnServer.userIsInGroups.indexOf("__SystemAdministrators"))return!0;if(1===this.__userConfigOnServer.state)return!1;if(0===this.__userConfigOnServer.state)return null;let accessCacheControlEntry=this.__accessCache.get(control);if(accessCacheControlEntry){const accessCacheAccessrightEntry=accessCacheControlEntry.get(requestedAccessright);if(void 0!==accessCacheAccessrightEntry)return accessCacheAccessrightEntry}else accessCacheControlEntry=new Map,this.__accessCache.set(control,accessCacheControlEntry);let defaultValueInternal=!1,mappedAccessRight=requestedAccessright,recursiveControl=control;do{let foundDeny=!1,virtualControlRightMapping=recursiveControl.getVirtualControlRightMappings(),recursiveCtrlAccessConfig=recursiveControl.getAccessConfig();if(!Array.isArray(virtualControlRightMapping)||!Array.isArray(recursiveCtrlAccessConfig)){recursiveControl=null,defaultValueInternal=!1;break}for(let virtualControlRightMap of virtualControlRightMapping)if(virtualControlRightMap.controlRight===mappedAccessRight){mappedAccessRight=virtualControlRightMap.virtualControlRight;break}for(const AccessRightsEntry of recursiveCtrlAccessConfig)if(AccessRightsEntry.accessright===mappedAccessRight&&-1!==this.__userConfigOnServer.userIsInGroups.indexOf(AccessRightsEntry.group)){if("Allow"===AccessRightsEntry.permission)return accessCacheControlEntry.set(requestedAccessright,!0),!0;if("Deny"===AccessRightsEntry.permission)foundDeny=!0;else if("Inherit"!==AccessRightsEntry.permission)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.AccessManager] Access check failed on control "+control.getId()+": Invalid config found! Access rejected!"),!1}if(!0===foundDeny)return accessCacheControlEntry.set(requestedAccessright,!1),!1;{let recursiveControlType=recursiveControl.getType(),accessDefinition=TcHmi.System.Services.controlManager.getDescriptionAccessByName(recursiveControlType,mappedAccessRight);if(null===accessDefinition&&"function"==typeof recursiveControl.getDescriptionAccessByName&&(accessDefinition=recursiveControl.getDescriptionAccessByName(mappedAccessRight)),null===accessDefinition||!0!==accessDefinition.defaultValueInternal&&!1!==accessDefinition.defaultValueInternal||(defaultValueInternal=accessDefinition.defaultValueInternal),null===recursiveControl.getParent()){if("TcHmi.Controls.System.TcHmiView"===recursiveControlType){recursiveControl=null;break}return accessCacheControlEntry.set(requestedAccessright,null),null}recursiveControl=recursiveControl.getParent()}}while(null!==recursiveControl);return accessCacheControlEntry.set(requestedAccessright,defaultValueInternal),defaultValueInternal}__rearmAutoLogoffTimer(){if(4!==this.__userConfigOnServer.state||null===this.__userConfigOnServer.autoLogOffMilliSeconds||0===this.__userConfigOnServer.autoLogOffMilliSeconds)return;window.clearTimeout(this.__autoLogoffTimeoutID);const passiveEventOptions={passive:!0,capture:!0};document.removeEventListener("keydown",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("mousemove",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("mousedown",this.__updateLastUserinteraction,passiveEventOptions),document.removeEventListener("touchstart",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("keydown",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("mousemove",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("mousedown",this.__updateLastUserinteraction,passiveEventOptions),document.addEventListener("touchstart",this.__updateLastUserinteraction,passiveEventOptions);let newDelay=this.__lastUserInteraction+this.__userConfigOnServer.autoLogOffMilliSeconds-Date.now();newDelay<0?this.__logoutIfNoInteraction():(newDelay>2147483647&&(newDelay=2147483647),this.__autoLogoffTimeoutID=window.setTimeout(this.__logoutIfNoInteraction,newDelay))}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.AnimationProvider=class{constructor(){}createAnimationController(animation,statusChangeCallback){return animation.useCss()?new CssAnimationController(animation,statusChangeCallback):new JavaScriptAnimationController(animation,statusChangeCallback)}};class CssAnimationController{constructor(animation,statusChangeCallback){this.__hasStarted=!1,this.__animation=animation,this.__statusChangeCallback=statusChangeCallback,this.__styleManager=System.Services.styleManager}isValid(){return this.__animation.useCss()}run(){let doRun=()=>{if(TcHmi.Controls.get(this.__animation.controlName()))if(this.__animation.state()===TcHmi.Animation.Status.CONFIGURE||this.__animation.state()===TcHmi.Animation.Status.INITIALIZED){this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED);const animName=this.__animation.animationName();this.__getElement().on("animationstart."+animName+".animationcontrol",this.__onAnimationStart()).on("animationiteration."+animName+".animationcontrol",this.__onAnimationIteration()).on("animationend."+animName+".animationcontrol",this.__onAnimationEnd()),this.__writeAnimationToCss()}else this.__animation.state()===TcHmi.Animation.Status.PAUSED&&(this.__setPlayState("running"),this.__hasStarted?this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING):this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED))};this.__animation.state()===TcHmi.Animation.Status.ENDED?(this.reset(doRun),this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED)):doRun()}pause(){this.__animation.state()!==TcHmi.Animation.Status.RUNNING&&this.__animation.state()!==TcHmi.Animation.Status.INITIALIZED||(this.__setPlayState("paused"),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED))}skip(){this.cleanup(!0),this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__getElement().off("animationstart."+this.__animation.animationName()+".animationcontrol").off("animationiteration."+this.__animation.animationName()+".animationcontrol").off("animationend."+this.__animation.animationName()+".animationcontrol")}reset(callback){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]||void 0===styles[selector]["animation-name"])return void requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()})});let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex){for(let i=0,ii=styles[selector]["animation-name"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-name"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,"reset"),styles[selector]["animation-name"][i]=animPropertyArray.join(", ")}for(let i=0,ii=styles[selector]["animation-play-state"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-play-state"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,"paused"),styles[selector]["animation-play-state"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(void 0!==TcHmi.Controls.get(this.__animation.controlName())){for(let i=0,ii=styles[selector]["animation-name"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-name"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,this.__animation.animationName()),styles[selector]["animation-name"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles),this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE)}"function"==typeof callback&&callback()})}),this.__hasStarted=!1}else requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()})})}cleanup(skip=!1){let progressPoint=null;if("forwards"===this.__animation.fillMode()||"both"===this.__animation.fillMode()||skip)switch(this.__animation.direction()){case"normal":progressPoint=1;break;case"reverse":progressPoint=0;break;case"alternate":progressPoint=this.__animation.iterationCount()%2==0?0:1;break;case"alternate-reverse":progressPoint=this.__animation.iterationCount()%2==0?1:0}let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]||void 0===styles[selector]["animation-name"])return;let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex&&(deleteAnimationProperty("animation-name"),deleteAnimationProperty("animation-duration"),deleteAnimationProperty("animation-delay"),deleteAnimationProperty("animation-iteration-count"),deleteAnimationProperty("animation-direction"),deleteAnimationProperty("animation-timing-function"),deleteAnimationProperty("animation-fill-mode"),deleteAnimationProperty("animation-play-state"),delete styles["@keyframes "+this.__animation.animationName()],this.__styleManager.writeStyles(this.__animation.controlName(),styles),null!==progressPoint)){let keyframes=this.__animation.keyframes().filter(keyframe=>keyframe.progressPoint===progressPoint);if(0===keyframes.length)return;let newStyles=keyframes[0].styles;TcHmi.StyleProvider.setSimpleElementStyle(this.__getElement(),newStyles)}function deleteAnimationProperty(property){if(void 0!==styles[selector][property])for(let i=0,ii=styles[selector][property].length;i<ii;i++){let animPropertyArray=styles[selector][property][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1),styles[selector][property][i]=animPropertyArray.join(", ")}}}__writeAnimationToCss(run=!0){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());void 0===styles[selector]&&(styles[selector]={});let animationIndex=-1;if(void 0!==styles[selector]["animation-name"]){let names=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()}));animationIndex=names.indexOf(this.__animation.animationName())}function insertAnimationProperty(property,value){if(void 0===styles[selector][property])styles[selector][property]=[value];else for(let i=0,ii=styles[selector][property].length;i<ii;i++){let animPropertyArray=splitOutsideOfBraces(styles[selector][property][i],",").map((function(n){return n.trim()}));-1===animationIndex?animPropertyArray.push(value):animPropertyArray.splice(animationIndex,1,value),styles[selector][property][i]=animPropertyArray.join(", ")}}function splitOutsideOfBraces(value,token){let startindex=0,braceCounter=0,res=[];for(let i=0,ii=value.length;i<ii;i++)switch(value.charAt(i)){case"(":braceCounter++;break;case")":braceCounter>0&&braceCounter--;break;case token:0===braceCounter&&i>startindex&&res.push(value.substring(startindex,i).trim()),startindex=i+1}return(0===value.length||startindex<value.length)&&res.push(value.substring(startindex).trim()),res}insertAnimationProperty("animation-name",this.__animation.animationName()),insertAnimationProperty("animation-duration",this.__animation.duration()+"ms"),insertAnimationProperty("animation-delay",this.__animation.delay()+"ms"),insertAnimationProperty("animation-iteration-count",this.__animation.iterationCount().toString()),insertAnimationProperty("animation-direction",this.__animation.direction()),insertAnimationProperty("animation-timing-function",this.__animation.timingFunction()),insertAnimationProperty("animation-fill-mode",this.__animation.fillMode()),insertAnimationProperty("animation-play-state",run?"running":"paused");let cssKeyframes={},keyframes=this.__animation.keyframes();for(let i=0,ii=keyframes.length;i<ii;i++)cssKeyframes[100*keyframes[i].progressPoint+"%"]=keyframes[i].styles;styles["@keyframes "+this.__animation.animationName()]=cssKeyframes,this.__styleManager.writeStyles(this.__animation.controlName(),styles)}__setPlayState(playState){let selector=this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()),styles=this.__styleManager.getExistingStyleOverwrites(this.__animation.controlName());if(void 0===styles[selector]["animation-name"])return;let animationIndex=styles[selector]["animation-name"][0].split(",").map((function(n){return n.trim()})).indexOf(this.__animation.animationName());if(-1!==animationIndex){for(let i=0,ii=styles[selector]["animation-play-state"].length;i<ii;i++){let animPropertyArray=styles[selector]["animation-play-state"][i].split(",").map((function(n){return n.trim()}));animPropertyArray.splice(animationIndex,1,playState),styles[selector]["animation-play-state"][i]=animPropertyArray.join(", ")}this.__styleManager.writeStyles(this.__animation.controlName(),styles)}}__onAnimationStart(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&(this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING),this.__animation.eventHandlers().filter(handler=>"animationstart"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event})))}}__onAnimationIteration(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&this.__animation.eventHandlers().filter(handler=>"animationiteration"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event}))}}__onAnimationEnd(){return event=>{const animationEvent=event.originalEvent;animationEvent.animationName===this.__animation.animationName()&&(this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__getElement().off("animationstart."+this.__animation.animationName()+".animationcontrol").off("animationiteration."+this.__animation.animationName()+".animationcontrol").off("animationend."+this.__animation.animationName()+".animationcontrol"),this.__animation.cleanup()&&this.cleanup(),this.__animation.eventHandlers().filter(handler=>"animationend"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:animationEvent.animationName,elapsedTime:animationEvent.elapsedTime,JQueryEvent:event})))}}__getElement(){return $(this.__styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()))}}System.CssAnimationController=CssAnimationController;class JavaScriptAnimationController{constructor(animation,statusChangeCallback){this.__animatedStyles={},this.__initialStyles={},this.__animationFrameID=null,this.__start=null,this.__started=0,this.__iteration=0,this.__elapsedTime=0,this.__resetToInitial=!0,this.__delayTimer=null,this.__animation=animation,this.__statusChangeCallback=statusChangeCallback,this.__element=$(System.Services.styleManager.expandSelector(this.__animation.selector(),this.__animation.controlName()))}isValid(){return!this.__animation.useCss()}run(){if(this.__animation.state()===TcHmi.Animation.Status.CONFIGURE||this.__animation.state()===TcHmi.Animation.Status.ENDED){this.__animationRunner=this.__getAnimationRunner(),this.__iteration=0,this.__start=null,this.__elapsedTime=0,this.__resetToInitial=!0,this.__animation.delay()>0?this.__delayTimer=new Timer(()=>{this.__animationRunner&&(this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner),this.__delayTimer=null)},this.__animation.delay()):this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner),this.__statusChangeCallback(TcHmi.Animation.Status.INITIALIZED),this.__animatedStyles={};let keyframes=this.__animation.keyframes();for(let i=0,ii=keyframes.length;i<ii;i++)for(let key in keyframes[i].styles)keyframes[i].styles.hasOwnProperty(key)&&(void 0===this.__animatedStyles[key]&&(this.__animatedStyles[key]=[]),this.__animatedStyles[key].push({progressPoint:keyframes[i].progressPoint,values:keyframes[i].styles[key].map(value=>this.__parseKeyframeStyle(value))}));let initialStyles=TcHmi.StyleProvider.getSimpleElementStyle(this.__element);this.__initialStyles={};for(let key in this.__animatedStyles)if(this.__animatedStyles.hasOwnProperty(key)){if(this.__animatedStyles[key].sort((a,b)=>a.progressPoint-b.progressPoint),0!==this.__animatedStyles[key][0].progressPoint||1!==this.__animatedStyles[key][this.__animatedStyles[key].length-1].progressPoint)throw new Error("Start and end keyframes with progress points 0 and 1 must be defined for all animated properties.");this.__initialStyles[key]=initialStyles&&void 0!==initialStyles[key]?initialStyles[key]:null}let fillMode=this.__animation.fillMode();if("backwards"===fillMode||"both"===fillMode)switch(this.__animation.direction()){case"normal":case"alternate":TcHmi.StyleProvider.setSimpleElementStyle(this.__element,keyframes.filter(keyframe=>0===keyframe.progressPoint)[0].styles);break;case"reverse":case"alternate-reverse":TcHmi.StyleProvider.setSimpleElementStyle(this.__element,keyframes.filter(keyframe=>1===keyframe.progressPoint)[0].styles)}}else this.__animation.state()===TcHmi.Animation.Status.PAUSED&&(null!==this.__delayTimer?this.__delayTimer.resume():this.__animationRunner&&(this.__animationFrameID=window.requestAnimationFrame(this.__animationRunner)))}pause(){this.__animation.state()===TcHmi.Animation.Status.RUNNING?(null!==this.__animationFrameID&&window.cancelAnimationFrame(this.__animationFrameID),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED)):this.__animation.state()===TcHmi.Animation.Status.INITIALIZED&&null!==this.__delayTimer&&(this.__delayTimer.pause(),this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED))}skip(){this.__animation.state()!==TcHmi.Animation.Status.ENDED&&(null!==this.__animationFrameID&&window.cancelAnimationFrame(this.__animationFrameID),this.cleanup(!0),this.__statusChangeCallback(TcHmi.Animation.Status.ENDED))}reset(callback){if(this.__resetToInitial&&this.__animation.state()!==TcHmi.Animation.Status.CONFIGURE)for(let key in this.__initialStyles)this.__initialStyles.hasOwnProperty(key)&&TcHmi.StyleProvider.setSimpleElementStyle(this.__element,key,this.__initialStyles[key]);this.__statusChangeCallback(TcHmi.Animation.Status.CONFIGURE),"function"==typeof callback&&callback()}cleanup(skip=!1){let progressPoint=null;if("forwards"===this.__animation.fillMode()||"both"===this.__animation.fillMode()||skip)switch(this.__animation.direction()){case"normal":progressPoint=1;break;case"reverse":progressPoint=0;break;case"alternate":progressPoint=this.__animation.iterationCount()%2==0?0:1;break;case"alternate-reverse":progressPoint=this.__animation.iterationCount()%2==0?1:0}null===progressPoint?TcHmi.StyleProvider.setSimpleElementStyle(this.__element,this.__initialStyles):TcHmi.StyleProvider.setSimpleElementStyle(this.__element,this.__animation.keyframes().filter(keyframe=>keyframe.progressPoint===progressPoint)[0].styles)}__parseKeyframeStyle(value){let numberAndUnitMatch=/^(-?\d*\.?\d+)(?:%|px)?$/.exec(value);if(null!==numberAndUnitMatch)return[parseFloat(numberAndUnitMatch[1]),value.substring(numberAndUnitMatch[1].length)];let parsed=[],hexColorRegEx=/#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}/g,hexColorMatch=hexColorRegEx.exec(value);for(;null!==hexColorMatch;){let hexString=hexColorMatch[0].slice(1);parsed.push({value:Color.fromHexString(hexString),replaceIndex:hexColorMatch.index,replaceLength:hexColorMatch[0].length}),hexColorMatch=hexColorRegEx.exec(value)}let rgbaColorRegEx=/rgba?\( *(-?\d+) *, *(-?\d+) *, *(-?\d+) *(?:, *(-?\d*\.?\d+) *)?\)/g,rgbaColorMatch=rgbaColorRegEx.exec(value);for(;null!==rgbaColorMatch;){let r=parseInt(rgbaColorMatch[1],10),g=parseInt(rgbaColorMatch[2],10),b=parseInt(rgbaColorMatch[3],10),a=rgbaColorMatch[4]?parseFloat(rgbaColorMatch[4]):1;parsed.push({value:Color.fromRgb(r,g,b,a),replaceIndex:rgbaColorMatch.index,replaceLength:rgbaColorMatch[0].length}),rgbaColorMatch=rgbaColorRegEx.exec(value)}let hslaColorRegEx=/hsla?\( *(-?\d*\.?\d+) *, *(-?\d*\.?\d+)% *, *(-?\d*\.?\d+)% *(?:, *(-?\d*\.?\d+) *)?\)/g,hslaColorMatch=hslaColorRegEx.exec(value);for(;null!==hslaColorMatch;){let h=parseFloat(hslaColorMatch[1]),s=parseFloat(hslaColorMatch[2])/100,l=parseFloat(hslaColorMatch[3])/100,a=hslaColorMatch[4]?parseFloat(hslaColorMatch[4]):1;parsed.push({value:Color.fromHsl(h,s,l,a),replaceIndex:hslaColorMatch.index,replaceLength:hslaColorMatch[0].length}),hslaColorMatch=hslaColorRegEx.exec(value)}let res=[];if(parsed.length>0){parsed.sort((a,b)=>a.replaceIndex-b.replaceIndex);for(let i=parsed.length-1,ii=0;i>=ii;i--){let start=parsed[i].replaceIndex+parsed[i].replaceLength,end=i<parsed.length-1?parsed[i+1].replaceIndex:void 0;start!==end&&start<value.length&&res.unshift(value.substring(start,end)),res.unshift(parsed[i].value)}parsed[0].replaceIndex>0&&res.unshift(value.substring(0,parsed[0].replaceIndex-1))}else res.push(value);let numberRegex=/-?\d*\.?\d+/;for(let i=0,ii=res.length;i<ii;i++){let item=res[i];if("string"==typeof item){let numberMatch=numberRegex.exec(item);if(null!==numberMatch){let replace=[],iIncrement=0;numberMatch.index>0&&(replace.push(item.substring(0,numberMatch.index)),ii++,iIncrement++),replace.push(parseFloat(numberMatch[0])),numberMatch.index+numberMatch[0].length<item.length&&(replace.push(item.substring(numberMatch.index+numberMatch[0].length)),ii++),res.splice(i,1,...replace),i+=iIncrement}}}return res}__getTimingFunction(){let tf=this.__animation.timingFunction();if("function"==typeof tf)return tf;function createCubicBezier(x1,y1,x2,y2){let points=[{x:0,y:0},{x:x1,y:y1},{x:x2,y:y2},{x:1,y:1}];return x=>{function reduce(points,t){let reduced=[];for(let i=0;i<points.length-1;i++){let x=points[i].x+(points[i+1].x-points[i].x)*t,y=points[i].y+(points[i+1].y-points[i].y)*t;reduced.push({x:x,y:y})}return 1===reduced.length?reduced[0]:reduce(reduced,t)}let point={x:0,y:0},t=.5,lowerBound=0,upperBound=1;for(let i=0;i<10;i++){if(point=reduce(points,t),Math.abs(point.x-x)<5e-4)return point.y;point.x<x?lowerBound=t:upperBound=t,t=lowerBound+(upperBound-lowerBound)/2}return point.y}}function createSteps(count,startLeft){let step=1/count;return t=>startLeft?Math.ceil(t/step)*step:Math.floor(t/step)*step}switch(tf){case"linear":return t=>t;case"ease":return createCubicBezier(.25,.1,.25,1);case"ease-in":return createCubicBezier(.42,0,1,1);case"ease-out":return createCubicBezier(0,0,.58,1);case"ease-in-out":return createCubicBezier(.42,0,.58,1);case"step-start":return createSteps(1,!0);case"step-end":return createSteps(1,!1);default:let bezierMatch=/cubic-bezier\( *(1(?:.0+)?|0|0?\.\d+) *, *(-?\d*\.?\d+) *, *(1(?:.0+)?|0|0?\.\d+) *, *(-?\d*\.?\d+) *\)/.exec(tf);if(null!==bezierMatch)return createCubicBezier(parseFloat(bezierMatch[1]),parseFloat(bezierMatch[2]),parseFloat(bezierMatch[3]),parseFloat(bezierMatch[4]));let stepMatch=/steps\( *([1-9][0-9]*) *(?:, *(start|end) *)?\)/.exec(tf);if(null!==stepMatch)return createSteps(parseInt(stepMatch[1],10),"start"===stepMatch[2])}return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.AnimationProvider] Unknown timing function ${tf}.`),createCubicBezier(.25,.1,.25,1)}__getAnimationRunner(){let directionFunction,duration=this.__animation.duration(),timingFunction=this.__getTimingFunction();switch(this.__animation.direction()){case"normal":directionFunction=progress=>progress;break;case"reverse":directionFunction=progress=>1-progress;break;case"alternate":directionFunction=progress=>this.__iteration%2==0?progress:1-progress;break;case"alternate-reverse":directionFunction=progress=>this.__iteration%2==0?1-progress:progress}let doRun=timestamp=>{if(null===this.__start)this.__started=this.__start=timestamp,this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING),this.__animation.eventHandlers().filter(handler=>"animationstart"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:0}));else if(this.__animation.state()===TcHmi.Animation.Status.PAUSED){let pausedTime=timestamp-this.__elapsedTime-this.__start;this.__start+=pausedTime,this.__started+=pausedTime,this.__statusChangeCallback(TcHmi.Animation.Status.RUNNING)}this.__elapsedTime=timestamp-this.__start;let progress=this.__elapsedTime/duration;progress=directionFunction(progress);let styles={};for(let key in this.__animatedStyles)if(this.__animatedStyles.hasOwnProperty(key)){let keyframes=this.__getBorderingKeyframes(key,progress);if(1===keyframes.length)styles[key]=keyframes[0].values.map(value=>value.join(""));else{let interFrameProgress=(progress-keyframes[0].progressPoint)/(keyframes[1].progressPoint-keyframes[0].progressPoint);styles[key]=this.__interpolate(keyframes[0].values,keyframes[1].values,timingFunction(interFrameProgress))}}try{TcHmi.StyleProvider.setSimpleElementStyle(this.__element,styles)}catch(ex){return void this.__statusChangeCallback(TcHmi.Animation.Status.PAUSED)}if(progress>=0&&progress<=1)this.__animationFrameID=window.requestAnimationFrame(doRun);else{this.__iteration++;let iterationCount=this.__animation.iterationCount();"infinite"===iterationCount||this.__iteration<iterationCount?(this.__start=timestamp,this.__animationFrameID=window.requestAnimationFrame(doRun),this.__animation.eventHandlers().filter(handler=>"animationiteration"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:(timestamp-this.__started)/1e3}))):(this.__animationFrameID=null,this.__statusChangeCallback(TcHmi.Animation.Status.ENDED),this.__animation.cleanup()&&(this.__resetToInitial=!1),this.cleanup(),this.__animation.eventHandlers().filter(handler=>"animationend"===handler.name).forEach(handler=>handler.callback({error:TcHmi.Errors.NONE,animationName:this.__animation.animationName(),elapsedTime:(timestamp-this.__started)/1e3})))}};return doRun}__getBorderingKeyframes(style,progress){let styles=this.__animatedStyles[style];for(let i=0,ii=styles.length;i<ii;i++){if(styles[i].progressPoint===progress)return[styles[i]];if(styles[i].progressPoint>progress)return i<1?[styles[i]]:[styles[i-1],styles[i]]}return[styles[styles.length-1]]}__interpolate(start,end,progress){let res=[];function numInterpolate(start,end){return start+(end-start)*progress}for(let i=0,ii=Math.min(start.length,end.length);i<ii;i++){let interpolated=[];for(let j=0,jj=Math.max(start[i].length,end[i].length);j<jj;j++){let startValue=start[i][j],endValue=end[i][j],startType=typeof startValue,endType=typeof endValue;if(void 0===startValue){switch(endType){case"string":startValue=endValue;break;case"number":startValue=0;break;case"object":startValue=Color.fromRgb(0,0,0,0)}startType=endType}if(void 0===endValue){switch(startType){case"string":endValue=startValue;break;case"number":endValue=0;break;case"object":endValue=Color.fromRgb(0,0,0,0)}endType=startType}if(startType!==endType||"string"===startType)interpolated.push(progress<.5?startValue:endValue);else switch(startType){case"number":interpolated.push(numInterpolate(startValue,endValue));break;case"object":interpolated.push(Color.fromRgb(numInterpolate(startValue.red,endValue.red),numInterpolate(startValue.green,endValue.green),numInterpolate(startValue.blue,endValue.blue),numInterpolate(startValue.alpha,endValue.alpha)))}}res.push(interpolated.join(""))}return res}}System.JavaScriptAnimationController=JavaScriptAnimationController;class Timer{constructor(callback,delay){this.__timerId=0,this.__start=0,this.__callback=callback,this.__remaining=delay,this.resume()}pause(){window.clearTimeout(this.__timerId),this.__remaining-=Date.now()-this.__start}resume(){this.__start=Date.now(),window.clearTimeout(this.__timerId),this.__timerId=window.setTimeout(this.__callback,this.__remaining)}}class Color{constructor(red,green,blue,alpha){function clamp(num,min,max){return num<=min?min:num>=max?max:num}this.red=Math.round(clamp(red,0,255)),this.green=Math.round(clamp(green,0,255)),this.blue=Math.round(clamp(blue,0,255)),this.alpha=clamp(alpha,0,1)}static fromRgb(r,g,b,a=1){return new Color(r,g,b,a)}static fromHsl(h,s,l,a=1){function clamp(num,min,max){return num<=min?min:num>=max?max:num}let r,g,b;if(h=clamp(h%360/360,0,1),s=clamp(s,0,1),l=clamp(l,0,1),0===s)r=g=b=l;else{let hue2rgb=(p,q,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+6*(q-p)*t:t<.5?q:t<2/3?p+(q-p)*(2/3-t)*6:p),q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=hue2rgb(p,q,h+1/3),g=hue2rgb(p,q,h),b=hue2rgb(p,q,h-1/3)}return new Color(255*r,255*g,255*b,a)}static fromHexString(hex){return 3===hex.length&&(hex=hex.replace(/./g,"$&$&")),new Color(parseInt(hex.substr(0,2),16),parseInt(hex.substr(2,2),16),parseInt(hex.substr(4,2),16),1)}toString(){return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){class Binding{constructor(expression,propertyName,control){if(this.__diagGUID="",this.__stateOld=Binding.State.Invalid,this.__destroyWatch=null,this.__destroyRead=null,this.__destroyHostPreloadingBindingsWatch=null,this.__lockWriteToControl=!1,this.__lockWatchError=!1,this.__lockLastWriteError=!1,this.__pendingWriteCount=0,this.__latestWrite=!1,this.__forwardWriteToSymbolResponse=!1,this.__pendingForceReadRequestId=null,this.__resumeLock=!1,this.__resumeStage=0,this.__resume=()=>{var _a,_b,_c,_d,_e,_f,_g,_h,_j;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume called."),this.__resumeLock)TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Pending lock.");else if(this.__control)if(this.__symbol){if(0===this.__resumeStage){if(!this.__control.getIsInitialized())return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_b=this.__control)||void 0===_b?void 0:_b.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Control is not initialized."));let isAttached=this.__control.getIsAttached();if(this.__state!==Binding.State.Initializing&&this.__state!==Binding.State.Preloading&&this.__state!==Binding.State.Initialized&&this.__state!==Binding.State.Suspended||!this.__symbol)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted because binding is neither in state 'Initializing', 'Initialized' or 'Suspended'. Current state is '"+this.__state+"'."));if(this.__state===Binding.State.Initialized&&!isAttached)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted because binding is already in state 'Initialized' and control is not attached to dom."));if(isAttached)this.__stateOld=this.__state,this.__state=Binding.State.Resuming,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_e=this.__control)||void 0===_e?void 0:_e.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume switches state to 'Resuming'.");else if(this.__preload&&(this.__stateOld=this.__state,this.__state=Binding.State.Preloading,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_f=this.__control)||void 0===_f?void 0:_f.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume switches state to 'Preloading'."),this.__partial&&"TcHmi.Controls.System.TcHmiUserControl"===this.__partial.getType())){const host=this.__partial.getParent();if(host){let hostId=host.getId();this.__resumeLock=!0;const waitForPreloadingBindings=host=>{if(!(TcHmi.System.Services.bindingManager.getPreloadingBindingsByControl(host).size>0))return this.__resumeLock=!1,this.__resumeStage=1,void this.__resume();this.__destroyHostPreloadingBindingsWatch=TcHmi.System.Services.bindingManager.watchPreloadingBindingsByControl(host,data=>{var _a;if(0===data.result.size)return null===(_a=data.destroy)||void 0===_a||_a.call(data),this.__destroyHostPreloadingBindingsWatch&&(this.__destroyHostPreloadingBindingsWatch=null),this.__resumeLock=!1,this.__resumeStage=1,void this.__resume()})};return host.getIsInitialized()?void waitForPreloadingBindings(host):void TcHmi.EventProvider.register(hostId+".System.onInitialized",()=>{waitForPreloadingBindings(host)})}}this.__resumeStage=1}if(1===this.__resumeStage){if(this.__resumeStage=0,this.__state===Binding.State.Preloading)return this.__readCallback=this.__onReadCallback(),void this.__symbol.read(this.__readCallback);if(this.__state===Binding.State.Resuming){if(this.__attrSchema&&"TcHmi.Symbol"===this.__attrSchema.frameworkInstanceOf)return this.__stateOld=this.__state,this.__state=Binding.State.Ready,this.__procWatchState(),this.__writeToControl(new TcHmi.Symbol(this.__symbol.getExpression().toString())),void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_g=this.__control)||void 0===_g?void 0:_g.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished."));if(this.__propertyName){const expr=this.__symbol.getExpression();let bindingMode=expr.getOptions().BindingMode,attrType=TcHmi.System.Services.controlManager.getAttributeTypeByPropertyName(this.__control,this.__propertyName);if("TwoWay"===bindingMode||!bindingMode&&attrType===System.ControlAttributeType.UserControlParameter||!bindingMode&&this.__attr&&"TwoWay"===this.__attr.defaultBindingMode){let bindingEvents=expr.getOptions().BindingEvents;if(bindingEvents)for(let i=0,ii=bindingEvents.length;i<ii;i++){let bindingEvent=bindingEvents[i];this.__onBindingEventDestroyCallbacks.push(TcHmi.EventProvider.register(this.__control.getId()+"."+bindingEvent,this.__onBindingEvent()))}else this.__onPropertyChangedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".onPropertyChanged<"+this.__propertyName+">",this.__onPropertyChanged())}this.__watchCallback=this.__onWatchCallback(),this.__destroyWatch=this.__symbol.watch(this.__watchCallback)}return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_h=this.__control)||void 0===_h?void 0:_h.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished."))}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_j=this.__control)||void 0===_j?void 0:_j.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume finished.")}}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Binding is already destroyed.");else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __resume aborted. Binding is already destroyed.")},this.__suspend=()=>{var _a,_b;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __suspend called."),this.__destroyWatch&&(this.__destroyWatch(),this.__destroyWatch=null),this.__watchCallback=null,null!==this.__onPropertyChangedDestroyCallback&&(this.__onPropertyChangedDestroyCallback(),this.__onPropertyChangedDestroyCallback=null),this.__onBindingEventDestroyCallbacks)for(;this.__onBindingEventDestroyCallbacks.length>0;){let onBindingEventDestroyCallback=this.__onBindingEventDestroyCallbacks.shift();null==onBindingEventDestroyCallback||onBindingEventDestroyCallback(),onBindingEventDestroyCallback=void 0}this.__stateOld=this.__state,this.__state=Binding.State.Suspended,this.__procWatchState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_b=this.__control)||void 0===_b?void 0:_b.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __suspend finished.")},this.__state=Binding.State.Invalid,this.__onControlInitializedDestroyCallback=null,this.__onControlAttachedDestroyCallback=null,this.__onControlDetachedDestroyCallback=null,this.__onBindingEventDestroyCallbacks=[],this.__onPropertyChangedDestroyCallback=null,this.__watchCallback=null,this.__readCallback=null,TCHMI_CONSOLE_LOG_LEVEL>=4&&(this.__diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor called with:",{expression:expression,propertyName:propertyName,control:control}),!expression){let message="Invalid value: '"+expression+"' for parameter: 'expression'.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}if(!propertyName){let message="Invalid value: '"+propertyName+"' for parameter: 'propertyName'.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}if(!control){let message="Invalid value: '"+control+"' for parameter: 'control'.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}this.__expression=expression,this.__propertyName=propertyName,this.__control=control,this.__stateOld=this.__state,this.__state=Binding.State.Initializing,this.__preload=!1,this.__partial=null;let parent=this.__control.getParent();for(;null!==parent;){let parentType=parent.getType();if(("TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType||"TcHmi.Controls.System.TcHmiUserControl"===parentType)&&(this.__partial||(this.__partial=parent),"TcHmi.Controls.System.TcHmiView"===parentType||"TcHmi.Controls.System.TcHmiContent"===parentType)){let partialUrl=tchmi_path(parent.getElement()[0].getAttribute("data-tchmi-partial-url"));if(partialUrl&&!0===TcHmi.System.Data.isPreloadBindingPartial.get(partialUrl)){this.__preload=!0;break}}parent=parent.getParent()}this.__symbol=new System.Symbol(expression);let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(this.__control,this.__propertyName);if(!attr){let message="The attribute property name: '"+this.__propertyName+"' does not exist for control: '"+control.getId()+"'.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null==control?void 0:control.getId())+", Property="+propertyName+", Symbol="+expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new Error(message)}this.__attr=attr,this.__attrSchema=TcHmi.System.Services.typeManager.getSchema(this.__attr.type),this.__onControlInitializedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onInitialized",this.__resume),this.__onControlAttachedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onAttached",this.__resume),this.__onControlDetachedDestroyCallback=TcHmi.EventProvider.register(this.__control.getId()+".System.onDetached",this.__suspend),this.__stateWatcher=new Set}destroy(){var _a,_b;if(this.__state===Binding.State.Destroyed)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called and aborted because object is already marked as destroyed."));let diagControlId=null===(_a=this.__control)||void 0===_a?void 0:_a.getId(),diagPropertyName=this.__propertyName,diagSymbolExpression=null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString();if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+diagControlId+", Property="+diagPropertyName+", Symbol="+diagSymbolExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called."),this.__propertyName=null,this.__control=null,this.__destroyRead&&(this.__destroyRead(),this.__destroyRead=null),this.__readCallback=null,this.__destroyWatch&&(this.__destroyWatch(),this.__destroyWatch=null),this.__watchCallback=null,this.__symbol&&(this.__symbol.destroy(),this.__symbol=null),this.__destroyHostPreloadingBindingsWatch&&(this.__destroyHostPreloadingBindingsWatch(),this.__destroyHostPreloadingBindingsWatch=null),null!==this.__onPropertyChangedDestroyCallback&&(this.__onPropertyChangedDestroyCallback(),this.__onPropertyChangedDestroyCallback=null),this.__onBindingEventDestroyCallbacks)for(;this.__onBindingEventDestroyCallbacks.length>0;){let onBindingEventDestroyCallback=this.__onBindingEventDestroyCallbacks.shift();null==onBindingEventDestroyCallback||onBindingEventDestroyCallback(),onBindingEventDestroyCallback=void 0}null!==this.__onControlInitializedDestroyCallback&&(this.__onControlInitializedDestroyCallback(),this.__onControlInitializedDestroyCallback=null),null!==this.__onControlAttachedDestroyCallback&&(this.__onControlAttachedDestroyCallback(),this.__onControlAttachedDestroyCallback=null),null!==this.__onControlDetachedDestroyCallback&&(this.__onControlDetachedDestroyCallback(),this.__onControlDetachedDestroyCallback=null),this.__stateOld=this.__state,this.__state=Binding.State.Destroyed,this.__procWatchState(),this.__stateWatcher.clear(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+diagControlId+", Property="+diagPropertyName+", Symbol="+diagSymbolExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy finished.")}getExpression(){return this.__expression}getSymbol(){return this.__symbol}getPropertyName(){return this.__propertyName}getControl(){return this.__control}getState(){return this.__state}getPreload(){return this.__preload}getPartial(){return this.__partial}__onBindingEvent(){return()=>{var _a,_b,_c;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __onBindingEvent called."),this.__state===Binding.State.Ready){if(!this.__lockWatchError&&this.__control&&void 0!==this.__control[this.__attr.propertyGetterName]){let value=this.__control[this.__attr.propertyGetterName].call(this.__control);if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] __onBindingEvent aborted because of '__lockWriteToControl'."));this.__writeToSymbol(tchmi_clone_object(value))}}else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_b=this.__control)||void 0===_b?void 0:_b.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onBindingEvent because Binding is not in state 'Ready'.")}}__onPropertyChanged(){return(e,data)=>{var _a,_b,_c,_d;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onPropertyChanged"),this.__state===Binding.State.Ready)if(data){if(!this.__lockWatchError&&this.__control&&void 0!==this.__control[this.__attr.propertyGetterName]){let value=this.__control[this.__attr.propertyGetterName].call(this.__control);if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onPropertyChanged aborted because of '__lockWriteToControl'."));this.__writeToSymbol(tchmi_clone_object(value),data.dirtyPaths)}}else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onPropertyChanged aborted because 'data' is not defined.");else TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_b=this.__control)||void 0===_b?void 0:_b.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __onPropertyChanged aborted because Binding is not in state 'Ready'.")}}__onWatchCallback(){return data=>{var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r;let guid="";if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol=",null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback called with:",{data:data}),null!==this.__pendingForceReadRequestId&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback release pending forced read request with id: '"+this.__pendingForceReadRequestId+"'."),TcHmi.Server.releaseRequest(this.__pendingForceReadRequestId),this.__pendingForceReadRequestId=null),this.__state!==Binding.State.Ready&&this.__state!==Binding.State.Resuming)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because state is neither 'Ready' or 'Resuming'."));if(!this.__symbol)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_e=this.__control)||void 0===_e?void 0:_e.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because symbol object is not defined."));const expr=this.__symbol.getExpression();if(expr&&expr.getType()===TcHmi.SymbolType.Server&&this.__lockLastWriteError)TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_f=this.__control)||void 0===_f?void 0:_f.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because of '__lockLastWriteError'.");else{if(expr&&expr.getType()===TcHmi.SymbolType.Server&&this.__pendingWriteCount>0)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_g=this.__control)||void 0===_g?void 0:_g.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because '__pendingWriteCount>0'. __pendingWriteCount: '"+this.__pendingWriteCount+"'."),void(this.__forwardWriteToSymbolResponse=!0);if(expr&&data.error===TcHmi.Errors.NONE)if(this.__state===Binding.State.Resuming&&(this.__stateOld=this.__state,this.__state=Binding.State.Ready,this.__procWatchState()),this.__lockWatchError=!1,!TCHMI_DESIGNER&&this.__latestWrite&&expr.getType()===TcHmi.SymbolType.Server)if(data.processedStart&&data.processedEnd)if(this.__latestWriteProcessedStart&&this.__latestWriteProcessedEnd){let symbolName=expr.getName();1===System.compareISO8601ServerCommandDateTimeStrings(data.processedStart,this.__latestWriteProcessedEnd)?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_h=this.__control)||void 0===_h?void 0:_h.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback calls __writeToControl because watch tick data is newer than last server write."),this.__writeToControl(data.value,data.dirtyPaths)):1===System.compareISO8601ServerCommandDateTimeStrings(this.__latestWriteProcessedStart,data.processedEnd)?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_j=this.__control)||void 0===_j?void 0:_j.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because server read has ended before last server write has started. Data is outdated."):symbolName?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_l=this.__control)||void 0===_l?void 0:_l.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback forces read from server because last write and watch callback were processed at roughly the same time."),this.__pendingForceReadRequestId=TcHmi.Server.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:symbolName}]},data=>{var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol=",null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback forced read finished with:",{data:data}),this.__pendingForceReadRequestId=null,data.error!==TcHmi.Errors.NONE){let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";return data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message))}let response=data.response;if(void 0===response)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.System.Binding"})));if(response&&response.error)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_e=this.__control)||void 0===_e?void 0:_e.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Binding",errors:[response.error]})));let command,commands=response.commands;if(!commands)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_f=this.__control)||void 0===_f?void 0:_f.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"})));for(let i=0,ii=commands.length;i<ii;i++){let command2=commands[i];if(command2&&command2.symbol===symbolName){command=command2;break}}if(!command)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_g=this.__control)||void 0===_g?void 0:_g.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:"Missing command for symbol: '"+symbolName+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"})));if(command.error)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_h=this.__control)||void 0===_h?void 0:_h.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:"Error in command for symbol: '"+symbolName+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[command.error]})));if(void 0===command.readValue)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_j=this.__control)||void 0===_j?void 0:_j.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Server responds with error: "+TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:"Missing property: 'readValue' in command for symbol: '"+symbolName+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"})));let value=command.readValue;this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value)?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_k=this.__control)||void 0===_k?void 0:_k.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because of '__lockWriteToControl'."):(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_l=this.__control)||void 0===_l?void 0:_l.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback calls __writeToControl with forced read data."),this.__writeToControl(value))})):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_k=this.__control)||void 0===_k?void 0:_k.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted Symbol Expression is not valid.")}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_m=this.__control)||void 0===_m?void 0:_m.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Missing property 'processedStart' or 'processedEnd' in response.");else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_o=this.__control)||void 0===_o?void 0:_o.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Missing property 'processedStart' or 'processedEnd' in response.");else{let value=data.value;if(this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,value))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_p=this.__control)||void 0===_p?void 0:_p.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because of '__lockWriteToControl'."));this.__writeToControl(value,data.dirtyPaths)}else{this.__lockWatchError=!0;let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_q=this.__control)||void 0===_q?void 0:_q.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";if(data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message),this.__lockWriteToControl&&tchmi_equal(this.__lockWriteToControlValue,null))return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_r=this.__control)||void 0===_r?void 0:_r.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onWatchCallback aborted because of '__lockWriteToControl'."));"Reset"===TcHmi.System.config.binding.symbolError&&this.__writeToControl(null)}}}}__onReadCallback(){return data=>{var _a,_b,_c,_d;let guid="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol=",null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onReadCallback called with:",{data:data}),this.__state===Binding.State.Preloading?this.__symbol?data.error===TcHmi.Errors.NONE||"Reset"!==TcHmi.System.config.binding.symbolError?(this.__writeToControl(data.value,data.dirtyPaths),this.__stateOld=this.__state,this.__state=Binding.State.Initialized,this.__procWatchState()):this.__writeToControl(null):TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onReadCallback aborted because symbol object is not defined."):TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"] __onReadCallback aborted because state is not 'Reading'.")}}__writeToSymbol(value,dirtyPaths){var _a,_b,_c;if(null===dirtyPaths&&(dirtyPaths=void 0),void 0===value)return;if(!this.__symbol)return;let guid="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(guid=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol=",null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol called with:",{value:value,dirtyPaths:dirtyPaths}),null!==this.__pendingForceReadRequestId&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol release pending forced read request with id: '"+this.__pendingForceReadRequestId+"'."),TcHmi.Server.releaseRequest(this.__pendingForceReadRequestId),this.__pendingForceReadRequestId=null,this.__forwardWriteToSymbolResponse=!0),this.__pendingWriteCount++,this.__symbol.writeEx(value,dirtyPaths,data=>{var _a,_b,_c,_d,_e;if(this.__pendingWriteCount--,data.error===TcHmi.Errors.NONE){if(!this.__symbol)return;this.__symbol.getExpression().getType()===TcHmi.SymbolType.Server&&(this.__latestWrite=!0,data.processedStart&&data.processedEnd?(this.__latestWriteProcessedStart=data.processedStart,this.__latestWriteProcessedEnd=data.processedEnd):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] Missing property 'processedStart' or 'processedEnd' in response."),this.__lockLastWriteError=!0),!this.__lockLastWriteError&&0===this.__pendingWriteCount&&this.__forwardWriteToSymbolResponse?(this.__writeToControl(data.value,dirtyPaths),this.__forwardWriteToSymbolResponse=!1):this.__lockLastWriteError?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_b=this.__control)||void 0===_b?void 0:_b.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol aborted because of '__lockLastWriteError'."):this.__pendingWriteCount>0?TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol aborted because '__pendingWriteCount>0'. __pendingWriteCount: '"+this.__pendingWriteCount+"'."):this.__forwardWriteToSymbolResponse||TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+", FunctionScopeGuid="+guid+"]  __writeToSymbol aborted because '__forwardWriteToSymbolResponse===false'."))}else{let message="[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_e=this.__control)||void 0===_e?void 0:_e.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] ";data.details?message+=TcHmi.Log.buildMessage(data.details):message+=TcHmi.Log.buildMessage({code:data.error,message:TcHmi.Errors[data.error]}),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message)}})}__writeToControl(value,dirtyPaths){var _a,_b,_c,_d,_e,_f,_g,_h,_j;if(null===dirtyPaths&&(dirtyPaths=void 0),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_a=this.__control)||void 0===_a?void 0:_a.getId())+", Property="+this.__propertyName+", Symbol=",null===(_b=this.__symbol)||void 0===_b?void 0:_b.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl called with:",{value:value,dirtyPaths:dirtyPaths}),void 0===value)return;if(!this.__control)return;let error;this.__lockWriteToControl=!0,this.__lockWriteToControlValue=tchmi_clone_object(value);try{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_c=this.__control)||void 0===_c?void 0:_c.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl calling attribute setter."),error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(this.__control,this.__attr,tchmi_clone_object(value),dirtyPaths),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_d=this.__control)||void 0===_d?void 0:_d.getId())+", Property="+this.__propertyName+", Symbol=",null===(_e=this.__symbol)||void 0===_e?void 0:_e.getExpression().toString(),", ObjectScopeDiagGUID="+this.__diagGUID+"]  __writeToControl calling attribute finished with:",{error:error})}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_f=this.__control)||void 0===_f?void 0:_f.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] An uncaught exception occurred in setter function of attribute with propertyName="+this.__propertyName+" of control="+(null===(_g=this.__control)||void 0===_g?void 0:_g.getId())+":\n",e)}finally{this.__lockWriteToControl=!1,this.__lockWriteToControlValue=void 0}error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_h=this.__control)||void 0===_h?void 0:_h.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage(error),"\n",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Binding, Control="+(null===(_j=this.__control)||void 0===_j?void 0:_j.getId())+", Property="+this.__propertyName+", Symbol="+this.__expression+"] "+TcHmi.Log.buildMessage(error)))}__procWatchState(){for(const stateWatcher of this.__stateWatcher.keys())TcHmi.Callback.callSafeEx(stateWatcher.callback,this,{error:TcHmi.Errors.NONE,binding:this,state:this.__state,stateOld:this.__stateOld,destroy:stateWatcher.destroy})}watchState(callback){const destroy=()=>{watcher&&this.__stateWatcher.delete(watcher)},watcher={callback:callback,destroy:destroy};return this.__stateWatcher.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,binding:this,state:this.__state,stateOld:this.__stateOld,destroy:destroy}),destroy}}System.Binding=Binding,function(Binding){let State;!function(State){State[State.Invalid=0]="Invalid",State[State.Initializing=100]="Initializing",State[State.Resuming=200]="Resuming",State[State.Preloading=300]="Preloading",State[State.Initialized=400]="Initialized",State[State.Ready=500]="Ready",State[State.Suspended=600]="Suspended",State[State.Destroyed=700]="Destroyed"}(State=Binding.State||(Binding.State={}))}(Binding=System.Binding||(System.Binding={}))}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){System.BindingManager=class{constructor(){this.__bindingsByControl=new WeakMap,this.__bindingsPreloading=new Set,this.__bindingsPreloadingByPartial=new Map,this.__bindingsPreloadingByControl=new Map,this.__watchStateDestroyByBinding=new WeakMap,this.__watcherPreloadingBindings=new Set,this.__watcherPreloadingBindingsByPartial=new Set,this.__watcherPreloadingBindingsByControl=new Set,this.__onBindingWatchState=data=>{let partial=data.binding.getPartial();if(!partial)return;let control=data.binding.getControl();if(!control)return;let procCashing=(partial,control)=>{var _a;if(data.state===System.Binding.State.Initialized&&data.stateOld===System.Binding.State.Preloading){let bProcPreloading=!1,bProcPreloadingByPartial=!1,bProcPreloadingByControl=!1;this.__bindingsPreloading.has(data.binding)&&(this.__bindingsPreloading.delete(data.binding),bProcPreloading=!0);let bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial);bindingsPreloadingByPartial&&(bindingsPreloadingByPartial.delete(data.binding),0===bindingsPreloadingByPartial.size&&this.__bindingsPreloadingByPartial.delete(partial),bProcPreloadingByPartial=!0);let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);bindingsPreloadingByControl&&(bindingsPreloadingByControl.delete(data.binding),0===bindingsPreloadingByControl.size&&this.__bindingsPreloadingByControl.delete(control),bProcPreloadingByControl=!0),bProcPreloading&&this.__procWatchPreloadingBindings(),bProcPreloadingByPartial&&this.__procWatchPreloadingBindingsByPartial(),bProcPreloadingByControl&&this.__procWatchPreloadingBindingsByControl(),null===(_a=data.destroy)||void 0===_a||_a.call(data),this.__watchStateDestroyByBinding.delete(data.binding)}};if(procCashing(partial,control),"TcHmi.Controls.System.TcHmiUserControl"===partial.getType()){let parent=partial.getParent();for(;null!==parent;){let parentType=parent.getType();"TcHmi.Controls.System.TcHmiView"!==parentType&&"TcHmi.Controls.System.TcHmiContent"!==parentType||procCashing(parent,control),parent=parent.getParent()}}}}__procWatchPreloadingBindings(){for(const watcher of this.__watcherPreloadingBindings.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindings(),destroy:watcher.destroy})}__procWatchPreloadingBindingsByPartial(){for(const watcher of this.__watcherPreloadingBindingsByPartial.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByPartial(watcher.partial),destroy:watcher.destroy})}__procWatchPreloadingBindingsByControl(){for(const watcher of this.__watcherPreloadingBindingsByControl.keys())TcHmi.Callback.callSafeEx(watcher.callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByControl(watcher.control),destroy:watcher.destroy})}getPreloadingBindings(){return new Set(this.__bindingsPreloading)}getPreloadingBindingsByPartial(partial){return new Set(this.__bindingsPreloadingByPartial.get(partial))}getPreloadingBindingsByControl(control){return new Set(this.__bindingsPreloadingByControl.get(control))}watchPreloadingBindings(callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindings.delete(watcher)},watcher={callback:callback,destroy:destroy};return this.__watcherPreloadingBindings.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindings(),destroy:destroy}),destroy}watchPreloadingBindingsByPartial(partial,callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindingsByPartial.delete(watcher)},watcher={partial:partial,callback:callback,destroy:destroy};return this.__watcherPreloadingBindingsByPartial.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByPartial(partial),destroy:destroy}),destroy}watchPreloadingBindingsByControl(control,callback){const destroy=()=>{watcher&&this.__watcherPreloadingBindingsByControl.delete(watcher)},watcher={control:control,callback:callback,destroy:destroy};return this.__watcherPreloadingBindingsByControl.add(watcher),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:this.getPreloadingBindingsByControl(control),destroy:destroy}),destroy}getBinding(propertyName,control){let res=null,controlMap=this.__bindingsByControl.get(control);if(void 0===controlMap)return res;if(!TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName))return res;let b=controlMap.get(propertyName);return void 0===b||(res=b),res}getBindingsByControl(control){return this.__bindingsByControl.get(control)}createBinding(expression,propertyName,control){this.removeBinding(propertyName,control,!1);let controlMap=this.__bindingsByControl.get(control);void 0===controlMap&&(controlMap=new Map,this.__bindingsByControl.set(control,controlMap));let b=new System.Binding(expression,propertyName,control);if(b.getPreload()){this.__bindingsPreloading.add(b);let bindingsPreloadingByPartial,partial=b.getPartial();partial&&(bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial),bindingsPreloadingByPartial||(bindingsPreloadingByPartial=new Set,this.__bindingsPreloadingByPartial.set(partial,bindingsPreloadingByPartial)),bindingsPreloadingByPartial.add(b));let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);bindingsPreloadingByControl||(bindingsPreloadingByControl=new Set,this.__bindingsPreloadingByControl.set(control,bindingsPreloadingByControl)),bindingsPreloadingByControl.add(b),this.__procWatchPreloadingBindings(),this.__procWatchPreloadingBindingsByPartial(),this.__procWatchPreloadingBindingsByControl();let destroyWatch=b.watchState(this.__onBindingWatchState);this.__watchStateDestroyByBinding.set(b,destroyWatch)}return controlMap.set(propertyName,b),b.__resume(),b}removeBinding(propertyName,control,bResetSetter=!0){let controlMap=this.__bindingsByControl.get(control);if(void 0===controlMap)return;let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(!attr)return;let b=controlMap.get(propertyName);if(!b)return;controlMap.delete(propertyName),b.destroy();let destroyWatchState=this.__watchStateDestroyByBinding.get(b);destroyWatchState&&(destroyWatchState(),destroyWatchState=void 0);let partial=b.getPartial();if(partial){let bindingsPreloadingByPartial=this.__bindingsPreloadingByPartial.get(partial);bindingsPreloadingByPartial&&(bindingsPreloadingByPartial.delete(b),0===bindingsPreloadingByPartial.size&&this.__bindingsPreloadingByPartial.delete(partial),this.__procWatchPreloadingBindingsByPartial())}let bindingsPreloadingByControl=this.__bindingsPreloadingByControl.get(control);if(bindingsPreloadingByControl&&(bindingsPreloadingByControl.delete(b),0===bindingsPreloadingByControl.size&&this.__bindingsPreloadingByControl.delete(control),this.__procWatchPreloadingBindingsByControl()),this.__bindingsPreloading.has(b)&&(this.__bindingsPreloading.delete(b),this.__procWatchPreloadingBindings()),bResetSetter){let error;try{error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,null)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.BindingManager] An uncaught exception occurred in setter function of attribute with propertyName="+propertyName+" of control="+(null==control?void 0:control.getId())+":\n",e)}error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.BindingManager] "+TcHmi.Log.buildMessage(error))}}}}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){class ControlManager{constructor(){if(this.__controls=new Map,this.__controlsGeoMap=new Map,this.__controlsPresavedGeoMap=new WeakMap,this.__controlsToRecheckAfterInteraction=new Set,this.__iframesSet=new Set,this.__recheckControlsAfterInteraction=()=>{this.checkControlGeometry({delayUserEvents:!1,force:!0,geos:this.__controlsToRecheckAfterInteraction}),this.__controlsToRecheckAfterInteraction.clear()},this.__usercontrolAttrDescrByPropertyName=new Map,this.__usercontrolAttrDescrBySetterName=new Map,this.__usercontrolAttrDescrByGetterName=new Map,this.resolveUcAttributes=()=>{this.__usercontrolAttrDescrByPropertyName.clear(),this.__usercontrolAttrDescrBySetterName.clear(),this.__usercontrolAttrDescrByGetterName.clear(),TcHmi.System.Data.Caches.partialCompositeConfigCache.forEach((config,ucJsonPath)=>{if(config&&config.parameters){let UCdescrByPropertyName=new Map;this.__usercontrolAttrDescrByPropertyName.set(ucJsonPath,UCdescrByPropertyName);let UCdescrBySetterName=new Map;this.__usercontrolAttrDescrBySetterName.set(ucJsonPath,UCdescrBySetterName);let UCdescrByGetterName=new Map;this.__usercontrolAttrDescrByGetterName.set(ucJsonPath,UCdescrByGetterName);const parameters=config.parameters;for(let i=0,ii=parameters.length;i<ii;i++)UCdescrByPropertyName.set(parameters[i].propertyName,parameters[i]),parameters[i].propertySetterName&&UCdescrBySetterName.set(parameters[i].propertySetterName,parameters[i]),parameters[i].propertyGetterName&&UCdescrByGetterName.set(parameters[i].propertyGetterName,parameters[i])}})},this.__onAttributeMutation=(mutations,observer)=>{var _a;let geos=new Map;for(const mutation of mutations){let node=mutation.target;if(node.nodeType===Node.ELEMENT_NODE){let geo=this.__controlsGeoMap.get(node.id);geo&&!geos.has(node.id)&&(geo.isDirty=!0,geos.set(node.id,geo));const controlElement=node.closest("div[id][data-tchmi-type]");if(!(null===(_a=TcHmi.Controls.get(null==controlElement?void 0:controlElement.id))||void 0===_a?void 0:_a.getIsAttached()))continue;let cnodes=node.querySelectorAll("div[id][data-tchmi-type]");for(const childNode of cnodes){let childGeo=this.__controlsGeoMap.get(childNode.id);childGeo&&!geos.has(childNode.id)&&(childGeo.isDirty=!0,geos.set(childNode.id,childGeo))}}}this.checkControlGeometry({geos:geos})},this.__forceDetachList=[],this.__delayedDomMutations=new Set,this.__delayedDomMutationTimeoutId=0,this.__onDomMutation=mutations=>{for(let mutation of mutations)this.__delayedDomMutations.add(mutation);let ControlManager___onDomMutation=()=>{var _a;if(this.__delayedDomMutationTimeoutId=0,0===this.__delayedDomMutations.size)return;let domChanged=!1;const ctrlsAttachedSet=new Set,ctrlsDetachedSet=new Set,ctrlsAttached=[],ctrlsDetached=[];let ctrlsDelayedMoved=[],ctrlsDelayedResized=[];const publishGeometry=ctrl=>{if(!ctrl)return;if(ctrl.getElement().length<1)return;const ctrlName=ctrl.getId();let geo={ctrl:ctrl,layoutData:{moved:!1,movedLocal:!1,resized:!1,bounds:{leftGlobal:null,topGlobal:null,offsetLeft:null,offsetTop:null,width:null,height:null},computedStyles:{left:"",top:"",right:"",bottom:"",width:"",height:""}},isDirty:!0};if(ctrl.__getKeepAlive()){let geoOld=this.__controlsPresavedGeoMap.get(ctrl);geoOld&&(geo=geoOld)}this.__controlsGeoMap.set(ctrlName,geo);let delayedEvents=this.checkControlGeometry({geos:geo,delayUserEvents:!0});ctrlsDelayedMoved=ctrlsDelayedMoved.concat(delayedEvents.skippedMovedEventList),ctrlsDelayedResized=ctrlsDelayedResized.concat(delayedEvents.skippedResizedEventList)},detach=(ctrl,force)=>{if(!ctrl)return;const ctrlName=ctrl.getId();let geo=this.__controlsGeoMap.get(ctrlName);if(!geo)return;if(geo.ctrl.__getKeepAlive()&&this.__controlsPresavedGeoMap.set(geo.ctrl,geo),this.__controlsGeoMap.delete(ctrlName),!geo.ctrl)return;let inDom,ctrlElem=ctrl.getElement();if(!(ctrlElem.length<1)&&(inDom=void 0!==ctrlElem[0].isConnected?ctrlElem[0].isConnected:!!document.getElementById(ctrlName),!0===force&&(inDom=!1),!1===inDom&&!0===ctrl.getIsAttached())){ctrl.__setLifeCycleState(40),TcHmi.EventProvider.raise("System.onPrevControlDetached",ctrl),TcHmi.EventProvider.raise(ctrlName+".System.onPrevDetached",ctrl);try{ctrl.__detach()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Control __detach of "+ctrl.getId()+" failed with exception:\n",e)}ctrlsDetached.push(ctrl),domChanged=!0}},attach=ctrl=>{if(!ctrl)return;let ctrlElem=ctrl.getElement();if(ctrlElem.length<1)return;const ctrlName=ctrl.getId();let inDom;if(inDom=void 0!==ctrlElem[0].isConnected?ctrlElem[0].isConnected:!!document.getElementById(ctrlName),!0===inDom&&!1===ctrl.getIsAttached()){ctrl.__setLifeCycleState(30),TcHmi.EventProvider.raise("System.onPrevControlAttached",ctrl),TcHmi.EventProvider.raise(ctrlName+".System.onPrevAttached",ctrl);try{ctrl.__attach()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Control __attach of "+ctrlName+" failed with exception:\n",e)}ctrlsAttached.push(ctrl),domChanged=!0}},saveNewState=(controlId,newStateAttached)=>{newStateAttached?(ctrlsDetachedSet.delete(controlId),ctrlsAttachedSet.add(controlId)):newStateAttached||(ctrlsDetachedSet.add(controlId),ctrlsAttachedSet.delete(controlId))},procIFrameAdded=node=>{this.__iframesSet.has(node)||(this.__iframesSet.add(node),TcHmi.EventProvider.raise("System.onIFrameElementAdded",node))},procIFrameRemoved=node=>{this.__iframesSet.has(node)&&(this.__iframesSet.delete(node),TcHmi.EventProvider.raise("System.onIFrameElementRemoved",node))};this.__delayedDomMutations.forEach(mutation=>{this.__delayedDomMutations.delete(mutation);for(let j=0,jj=mutation.removedNodes.length;j<jj;j++){let node=mutation.removedNodes[j];if(node.nodeType!==Node.ELEMENT_NODE)continue;let controlNodeChilds=node.querySelectorAll("div[id][data-tchmi-type]");for(let k=0,kk=controlNodeChilds.length;k<kk;k++)saveNewState(controlNodeChilds[k].id,!1);node.id&&node.hasAttribute("data-tchmi-type")&&saveNewState(node.id,!1);let iframeNodeChilds=node.querySelectorAll("iframe");for(let k=0,kk=iframeNodeChilds.length;k<kk;k++)procIFrameRemoved(iframeNodeChilds[k]);node instanceof HTMLIFrameElement&&procIFrameRemoved(node)}for(let j=0,jj=mutation.addedNodes.length;j<jj;j++){let node=mutation.addedNodes[j];if(node.nodeType!==Node.ELEMENT_NODE)continue;node.id&&node.hasAttribute("data-tchmi-type")&&saveNewState(node.id,!0),this.__attributeMutationObserver.observe(node,{attributes:!0,attributeFilter:["style","class"],subtree:!0});let controlNodeChilds=node.querySelectorAll("div[id][data-tchmi-type]");for(let k=0,kk=controlNodeChilds.length;k<kk;k++)saveNewState(controlNodeChilds[k].id,!0);let iframeNodeChilds=node.querySelectorAll("iframe");for(let k=0,kk=iframeNodeChilds.length;k<kk;k++)procIFrameAdded(iframeNodeChilds[k]);node instanceof HTMLIFrameElement&&procIFrameAdded(node)}});for(const ctrl of this.__forceDetachList)detach(ctrl,!0);this.__forceDetachList=[];for(const ctrlName of ctrlsDetachedSet)detach(TcHmi.Controls.get(ctrlName),!1);for(const ctrlName of ctrlsAttachedSet)publishGeometry(TcHmi.Controls.get(ctrlName));for(const ctrlName of ctrlsAttachedSet)attach(TcHmi.Controls.get(ctrlName));ctrlsDelayedResized.length&&TcHmi.EventProvider.raise("System.onControlsResized",ctrlsDelayedResized),ctrlsDelayedMoved.length&&TcHmi.EventProvider.raise("System.onControlsMoved",ctrlsDelayedMoved);for(const ctrl of ctrlsDelayedMoved){const ctrlId=ctrl.getId();TcHmi.EventProvider.raise(ctrlId+".onMoved",ctrl,{movedLocal:null===(_a=this.__controlsGeoMap.get(ctrlId))||void 0===_a?void 0:_a.layoutData.movedLocal})}for(const ctrl of ctrlsDelayedResized)TcHmi.EventProvider.raise(ctrl.getId()+".onResized",ctrl);ctrlsDelayedResized=[],ctrlsDelayedMoved=[],domChanged&&this.checkControlGeometry(),0!==ctrlsDetached.length&&TcHmi.EventProvider.raise("System.onPrevControlsDetached",ctrlsDetached),0!==ctrlsAttached.length&&TcHmi.EventProvider.raise("System.onPrevControlsAttached",ctrlsAttached)};this.__delayedDomMutationTimeoutId||(this.__delayedDomMutationTimeoutId=setTimeout(ControlManager___onDomMutation))},"function"==typeof Proxy){let __this=this;TcHmi.control=new Proxy(TcHmi.control,{get:function(target,name){return __this.__controls.get(name)},ownKeys:function(target){return Array.from(__this.__controls.keys())},getOwnPropertyDescriptor:function(target,key){return{enumerable:!0,configurable:!0}}})}this.__domMutationObserver=new MutationObserver(this.__onDomMutation),this.__domMutationObserver.observe(document.body,{childList:!0,subtree:!0}),this.__attributeMutationObserver=new MutationObserver(this.__onAttributeMutation),window.addEventListener("resize",this.__onWindowResized()),TcHmi.EventProvider.register("System.onUserControlConfigCreated",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onUserControlConfigChanged",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onUserControlConfigRemoved",this.resolveUcAttributes),TcHmi.EventProvider.register("System.onControlSizeParameterChanged",this.__recheckControlsAfterInteraction),TcHmi.EventProvider.register("System.onControlPositionParameterChanged",this.__recheckControlsAfterInteraction)}__onWindowResized(){return e=>{this.checkControlGeometry({force:!0})}}forceDetach(ctrl){ctrl&&this.__forceDetachList.push(ctrl)}checkControlGeometry(options){var _a,_b;let geos=this.__controlsGeoMap;options&&options.geos&&(geos=options.geos);let delayUserEvents=!1;options&&options.delayUserEvents&&(delayUserEvents=options.delayUserEvents);let force=!1;if(options&&options.force&&(force=options.force),TCHMI_DESIGNER&&(!0===(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.controlResizeManager)||void 0===_a?void 0:_a.getControlResizing())||!0===(null===(_b=TcHmi.System.Services.Engineering.designerModeManager.controlMoveManager)||void 0===_b?void 0:_b.getControlMoveActive()))){if(geos instanceof Map||geos instanceof Set)for(const geo of geos.values())this.__controlsToRecheckAfterInteraction.add(geo);else this.__controlsToRecheckAfterInteraction.add(geos);return{skippedResizedEventList:[],skippedMovedEventList:[]}}let __this=this,resized=[],moved=[],skippedMoved=[],skippedResized=[],checkOne=function(geo){if(!force&&!geo.isDirty)return;let gctrl=geo.ctrl;if(!gctrl)return;if(gctrl.getIsDestroyed())return;let gElem=gctrl.getElement()[0],boundingRect=gElem.getBoundingClientRect();geo.layoutData.computedStyles=TcHmi.StyleProvider.getComputedElementStyle(gElem,["left","top","right","bottom","width","height"]);let offsetLeft=gElem.offsetLeft,offsetTop=gElem.offsetTop,parentCtrl=gctrl.getParent();if(parentCtrl)if("TcHmi.Controls.System.TcHmiGrid"!==parentCtrl.getType()){let computedStyle=TcHmi.StyleProvider.getComputedElementStyle(parentCtrl.getElement()[0],["border-left-width","border-top-width"]);offsetLeft+=parseFloat(computedStyle["border-left-width"]),offsetTop+=parseFloat(computedStyle["border-top-width"])}else{const gridElem=gctrl.getElement()[0].parentElement.parentElement;let computedGridCellStyle=TcHmi.StyleProvider.getComputedElementStyle(gridElem,["border-left-width","padding-left","border-top-width","padding-top"]);offsetLeft+=parseFloat(computedGridCellStyle["border-left-width"])+parseFloat(computedGridCellStyle["padding-left"]),offsetTop+=parseFloat(computedGridCellStyle["border-top-width"])+parseFloat(computedGridCellStyle["padding-top"])}let inject=!1;__this.__checkResize(geo.layoutData,boundingRect.width,boundingRect.height)&&(geo.layoutData.resized=!0,resized.push(geo),inject=!0);let eMoved=__this.__checkMoved(geo.layoutData,boundingRect.left,boundingRect.top,offsetTop,offsetLeft);0!==eMoved&&(geo.layoutData.moved=!0,geo.layoutData.movedLocal=1===eMoved,moved.push(geo),inject=!0),inject&&gctrl.__injectRenderedDimensions(geo.layoutData),geo.isDirty=!1};geos instanceof Map||geos instanceof Set?geos.forEach(checkOne):checkOne(geos);for(let i=0,ii=resized.length;i<ii;i++){let rgeo=resized[i];TcHmi.EventProvider.raise(rgeo.ctrl.getId()+".System.onPrevResized",rgeo),delayUserEvents?skippedResized.push(rgeo.ctrl):(TcHmi.EventProvider.raise(rgeo.ctrl.getId()+".onResized",rgeo.ctrl),TcHmi.EventProvider.raise("System.onControlsResized",[rgeo.ctrl]))}for(let i=0,ii=moved.length;i<ii;i++){let mgeo=moved[i];TcHmi.EventProvider.raise(mgeo.ctrl.getId()+".System.onPrevMoved",mgeo),delayUserEvents?skippedMoved.push(mgeo.ctrl):(TcHmi.EventProvider.raise(mgeo.ctrl.getId()+".onMoved",mgeo.ctrl,{movedLocal:mgeo.layoutData.movedLocal}),TcHmi.EventProvider.raise("System.onControlsMoved",[mgeo.ctrl]))}return{skippedResizedEventList:skippedResized,skippedMovedEventList:skippedMoved}}checkControlGeometryByControl(control){let geo=this.__controlsGeoMap.get(control.getId());geo&&this.checkControlGeometry({geos:geo})}__checkResize(geo,width,height){let bResized=!1;return width=Math.round(width),height=Math.round(height),null===geo.bounds.width&&null===geo.bounds.height?(geo.bounds.width=width,geo.bounds.height=height,bResized=!0):geo.bounds.width===width&&geo.bounds.height===height||(geo.bounds.width=width,geo.bounds.height=height,bResized=!0),bResized}__checkMoved(geo,documentTop,documentLeft,offsetTop,offsetLeft){let moved=0;return null===geo.bounds.topGlobal&&null===geo.bounds.leftGlobal||geo.bounds.offsetTop!==offsetTop||geo.bounds.offsetLeft!==offsetLeft?(geo.bounds.topGlobal=documentTop,geo.bounds.leftGlobal=documentLeft,geo.bounds.offsetTop=offsetTop,geo.bounds.offsetLeft=offsetLeft,moved=1):geo.bounds.topGlobal===documentTop&&geo.bounds.leftGlobal===documentLeft||(geo.bounds.topGlobal=documentTop,geo.bounds.leftGlobal=documentLeft,geo.bounds.offsetTop=offsetTop,geo.bounds.offsetLeft=offsetLeft,moved=2),moved}getControlsCache(){return this.__controls}static _procConstructor(module,element,pcElement,attrs){if(module.reg&&module.reg.ctrlConstructor)try{if(module.reg.nativeEs6Control)return new module.reg.ctrlConstructor(element,pcElement,attrs);{let nativeES6control=Reflect.construct(module.reg.nearestEs6Constructor,[element,pcElement,attrs],module.reg.ctrlConstructor);return module.reg.ctrlConstructor.apply(nativeES6control,[element,pcElement,attrs]),nativeES6control}}catch(e){return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Constructor of control of type: '"+element.attr("data-tchmi-type")+"' and with id: '"+element.attr("id")+"' has thrown an exception:\n",e))}}static _procPrevinit(co){try{return co.__previnit(),!0}catch(e){try{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Function: '__previnit' of control of type: '"+co.getType()+"' and with id: '"+co.getId()+"' has thrown an exception:\n",e),co.destroy()}catch(e2){}return!1}}static _procInit(co){try{return co.__init(),!0}catch(e){try{TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Function: '__init' of control of type: '"+co.getType()+"' and with id: '"+co.getId()+"' has thrown an exception:\n",e),co.destroy()}catch(e2){}return!1}}setControlProperty(control,propertyName,valueNew,dirtyPaths){let attribute=this.getAttributeByPropertyName(control,propertyName);if(!attribute){let reason="";return propertyName&&(reason=`Missing attribute description of attribute property: ${propertyName} for control type: ${control.getType()}.`),{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:reason,domain:"TcHmi.System.ControlManager"}}return attribute.readOnly?{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:`Property: ${propertyName} of control type: ${control.getType()} is readonly.`,domain:"TcHmi.System.ControlManager"}:attribute.propertySetterName?this.setControlPropertyByAttribute(control,attribute,valueNew,dirtyPaths):{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:`Missing propertySetterName in configuration of attribute property: ${propertyName} of control type: ${control.getType()}.`,domain:"TcHmi.System.ControlManager"}}setControlPropertyByAttribute(control,attribute,valueNew,dirtyPaths){let attributeSetter=control[attribute.propertySetterName];if("function"!=typeof attributeSetter)return{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Missing implementation of setter function: ${attribute.propertySetterName} for attribute property: ${attribute.propertyName} of control type: ${control.getType()}.`,domain:"TcHmi.System.ControlManager"};let watchNeeded=!1,prepValue={error:TcHmi.Errors.NONE,value:valueNew};if(null===valueNew){const themeValue=System.Services.themeManager.getDefaultPropertyValue(control,attribute.propertyName);"tchmi:framework#/definitions/Path"===attribute.type&&"string"==typeof themeValue.value&&themeValue.value.length>0?prepValue.value=TcHmi.Theme.Resources.resolveBasePath(control,themeValue)+themeValue.value:prepValue.value=themeValue.value,watchNeeded=!0}if(prepValue=TcHmi.ValueConverter.toTypeEx(prepValue.value,attribute.type),null===prepValue.value&&(null!==prepValue.value||null!==valueNew))return this.setControlPropertyByAttribute(control,attribute,null),{code:TcHmi.Errors.E_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_VALUE_INVALID],reason:`Unable to convert value of type: ${typeof valueNew} to type: ${attribute.type} for attribute property: ${attribute.propertyName} of control of type: ${control.getType()} with id: ${control.getId()}.`,domain:"TcHmi.System.ControlManager",errors:prepValue.details?[prepValue.details]:void 0};try{attributeSetter.call(control,prepValue.value,dirtyPaths)}catch(e){return{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:`An uncaught exception occurred in setter function ${attribute.propertySetterName} of attribute property ${attribute.propertyName} of control of type ${control.getType()} with id ${control.getId()}`,exception:e,domain:"TcHmi.System.ControlManager"}}return watchNeeded?System.Services.themeManager.watchAttributeDefaults(control,attribute.propertyName):System.Services.themeManager.unwatchAttributeDefaults(control,attribute.propertyName),{code:TcHmi.Errors.NONE,message:TcHmi.Errors[TcHmi.Errors.NONE],domain:"TcHmi.System.ControlManager"}}destruct(control){const controlId=control.getId();this.__controlsGeoMap.has(controlId)&&this.__controlsGeoMap.delete(controlId),this.__controlsPresavedGeoMap.has(control)&&this.__controlsPresavedGeoMap.delete(control),this.__controls.has(controlId)?(this.__controls.delete(controlId),"function"!=typeof Proxy&&delete TcHmi.control[controlId]):TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ControlManager] Unable to destroy control with id="+controlId+" because its already destroyed!")}compile(elem,parent,options){var _a,_b;const controlType=elem.getAttribute("data-tchmi-type");if(!controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing required attribute=data-tchmi-type in html="+elem.outerHTML+"."));const controlId=elem.id;if(!controlId)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing required attribute=id in html="+elem.outerHTML+"."));let module=TcHmi.System.Data.Modules.controls.map.get(controlType);if(!module)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to compile control. Missing meta data for control type: '"+controlType+"'."));if(module.error!==TcHmi.Errors.NONE||!module.reg){if(TCHMI_CONSOLE_LOG_LEVEL>=1){let message="[Source=Framework, Module=TcHmi.System.ControlManager] "+TcHmi.Log.buildMessage(module.errorDetails);TcHmi.Log.error(message)}return}if(module.reg.error!==TcHmi.Errors.NONE){if(TCHMI_CONSOLE_LOG_LEVEL>=1){let message="[Source=Framework, Module=TcHmi.System.ControlManager] "+TcHmi.Log.buildMessage(module.reg.errorDetails);TcHmi.Log.error(message)}return}TCHMI_DESIGNER&&options&&!0===options.designerIgnore&&elem.setAttribute("data-tchmi-designer-ignore","");let pcElement=$(elem.cloneNode(!0));if(TCHMI_DESIGNER){let purl=null;if("TcHmi.Controls.System.TcHmiUserControl"===controlType)purl=tchmi_path(elem.getAttribute("data-tchmi-partial-url"));else{let rootUc=null;if(parent){let temp=parent;for(;temp;){if("TcHmi.Controls.System.TcHmiUserControl"===temp.getType()){rootUc=temp;break}temp=temp.getParent()}}rootUc&&(purl=tchmi_path(rootUc.getElement()[0].getAttribute("data-tchmi-partial-url")))}if(purl&&purl===tchmi_path(TCHMI_TARGET_PARTIAL)){let markup=elem.outerHTML;let exprsPartialParam=new TcHmi.System.SymbolExpressionParser(markup).resolveExpressionsBySymbolType(TcHmi.SymbolType.PartialParam);if(exprsPartialParam){for(let i=0,ii=exprsPartialParam.length;i<ii;i++){let expr=exprsPartialParam[i];markup=markup.replace(new RegExp(tchmi_escape_regex(""+expr.toString()),"g"),`%pp%TCHMI_TARGET_DESIGNER_PARTIALPARAM::${expr.getContent()}%/pp%`)}let tempDiv=document.createElement("div");tempDiv.innerHTML=markup,elem=tempDiv.firstElementChild}}}let attrs=TcHmi.System.resolveAttributesFromControlElement(elem);if(!TCHMI_ENGINEERING&&attrs.error!==TcHmi.Errors.NONE){let message="[Source=Framework, Module=TcHmi.System.ControlManager] Error while parsing attributes of control: '"+controlId+"'. Details: "+TcHmi.Log.buildMessage(attrs.details);TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(message)}elem.textContent="";let existingCo=this.__controls.get(controlId);if(void 0!==existingCo){const existingControlPartialUrl=existingCo.getElement().attr("data-tchmi-partial-url");return void(!TcHmi.System.isInitialized&&existingControlPartialUrl&&existingControlPartialUrl===elem.getAttribute("data-tchmi-partial-url")||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to create instance of control. The id: '"+controlId+"' does already exist."))}let co=ControlManager._procConstructor(module,$(elem),pcElement,attrs.value);if(void 0===co)return;if(parent||co.__setParent(null),this.__controls.set(controlId,co),"function"!=typeof Proxy&&(TcHmi.control[controlId]=co),parent){let pos=options?options.pos:void 0;parent.__addChild(co,pos)}if(null===(_a=module.descriptionExpanded)||void 0===_a?void 0:_a.inheritedTemplate){let template=TcHmi.System.Data.Caches.templateMarkupCache.get(module.descriptionExpanded.inheritedTemplate);if(void 0!==template){let tempDiv=document.createElement("div");tempDiv.innerHTML=template.replace(/{Id}/g,controlId);let templateElem=tempDiv.firstElementChild;if(templateElem){let __this=this,recCompTemplate=function(e){let eChildren=e.children;for(let i=0,ii=eChildren.length;i<ii;i++){let eChild=eChildren[i];if(eChild.hasAttribute("data-tchmi-type")){let cco=__this.compile(eChild,co,{designerIgnore:!0});co.__addChild(cco)}else eChild.hasChildNodes()&&recCompTemplate(eChild)}};recCompTemplate(templateElem),elem.appendChild(templateElem)}}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Template markup for control type: '"+co.getType()+"' is not available.")}if(!0!==ControlManager._procPrevinit(co))return this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId]);const settedProperties=new Set,destroySettedPropertyWatch=TcHmi.EventProvider.register(controlId+".onPropertyChanged",(e,data)=>{data.propertyName&&settedProperties.add(data.propertyName)});for(let htmlAttrName in attrs.value){let controlAttribute=attrs.value[htmlAttrName];if(void 0===controlAttribute.descr||null===controlAttribute.descr)continue;if(settedProperties.add(controlAttribute.descr.propertyName),"data-tchmi-trigger"===htmlAttrName)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(controlAttribute.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(controlAttribute.value);if(!0===controlAttribute.descr.readOnly);else if(isSymbolExpression&&!isSymbolExpressionEscaped)this.setControlPropertyByAttribute(co,controlAttribute.descr,null),TcHmi.System.Services.bindingManager.createBinding(controlAttribute.value,controlAttribute.descr.propertyName,co);else{let prepValue=controlAttribute.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));let error=this.setControlPropertyByAttribute(co,controlAttribute.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: '"+controlAttribute.descr.propertyName+"' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: '"+controlAttribute.descr.propertyName+"' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error)))}}destroySettedPropertyWatch(),TcHmi.Engineering.ErrorPane.remove(controlId+".requiredAttributeMissing");const descriptionAttributes=null!==(_b=this.getDescriptionAttributes(controlType))&&void 0!==_b?_b:[];for(let possibleControlAttr of descriptionAttributes){if(possibleControlAttr.readOnly)continue;if(settedProperties.has(possibleControlAttr.propertyName))continue;if(possibleControlAttr.requiredOnCompile)return TcHmi.Engineering.ErrorPane.add(controlId+".requiredAttributeMissing","Error compiling control id="+controlId+" type="+co.getType()+". Attribute "+possibleControlAttr.propertyName+" is required but has not been set in HTML.",TcHmi.Engineering.ErrorPane.MessageType.Error),this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId]);let error=this.setControlPropertyByAttribute(co,possibleControlAttr,null);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: '"+possibleControlAttr.propertyName+"' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: '"+possibleControlAttr.propertyName+"' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error)))}System.Services.themeManager.startAttributeSetterWatcher(co);let controlAttributeTrigger=attrs.value["data-tchmi-trigger"];if(null!=controlAttributeTrigger&&void 0!==controlAttributeTrigger.descr&&null!==controlAttributeTrigger.descr){let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(controlAttributeTrigger.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(controlAttributeTrigger.value);if(!0===controlAttributeTrigger.descr.readOnly);else if(isSymbolExpression&&!isSymbolExpressionEscaped)TcHmi.System.Services.bindingManager.createBinding(controlAttributeTrigger.value,controlAttributeTrigger.descr.propertyName,co);else{let prepValue=controlAttributeTrigger.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));let error=this.setControlPropertyByAttribute(co,controlAttributeTrigger.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: 'Trigger' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] Failed to set property: 'Trigger' of control: '"+controlId+"'."+TcHmi.Log.buildMessage(error)))}}return co.__setLifeCycleState(15),!0!==ControlManager._procInit(co)?(this.__controls.delete(controlId),void("function"!=typeof Proxy&&delete TcHmi.control[controlId])):co}__resolveDescriptionTypes(module){if(!module.descriptionExpanded||!module.description)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Internal error. DescriptionExpanded or Description not found."));module.descriptionExpanded.inheritedTypes=[];let base=module.descriptionExpanded.base;if(null!=base){let baseModule=TcHmi.System.Data.Modules.controls.map.get(base);if(!baseModule)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Base control: '"+base+"' of control: '"+module.descriptionExpanded.name+"' not found."));if(baseModule.error!==TcHmi.Errors.NONE)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Control module: '"+base+"' contains errors:"+TcHmi.Log.buildMessage(baseModule.errorDetails)));this.__resolveDescriptionTypes(baseModule);let baseInhertedTypes=this.getDescriptionTypes(base);for(let i=0,ii=baseInhertedTypes.length;i<ii;i++){let bitype=baseInhertedTypes[i];module.descriptionExpanded.inheritedTypes.indexOf(bitype)<0&&module.descriptionExpanded.inheritedTypes.push(bitype);let bitypeLegacy=System.mapControlNamesFromPackageManifestApi1ToApi0.get(bitype);bitypeLegacy&&module.descriptionExpanded.inheritedTypes.indexOf(bitypeLegacy)<0&&module.descriptionExpanded.inheritedTypes.push(bitypeLegacy)}}let type=TcHmi.System.resolveQualifiedName(module.description.name,module.description.namespace);module.descriptionExpanded.inheritedTypes.push(type);let legacyType=System.mapControlNamesFromPackageManifestApi1ToApi0.get(type);legacyType&&module.descriptionExpanded.inheritedTypes.push(legacyType)}__resolveDescriptionInheritance(module){if(!module.descriptionExpanded||!module.description)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Internal error. DescriptionExpanded or Description not found."));let baseAttrs=[],baseAccess=[],baseFunctions=[],baseEvents=[],baseLanguages={};module.descriptionExpanded.inheritedAttributes=[],module.descriptionExpanded.inheritedAttributesNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertyNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap=new Map,module.descriptionExpanded.inheritedAttributesPropertySetterNameMap=new Map,module.descriptionExpanded.inheritedAccess=[],module.descriptionExpanded.inheritedFunctions=[],module.descriptionExpanded.inheritedEvents=[],module.descriptionExpanded.inheritedLanguages={};let base=module.descriptionExpanded.base;if(null!=base){let baseModule=TcHmi.System.Data.Modules.controls.map.get(base);if(!baseModule)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Base control: '"+module.descriptionExpanded.base+"' of control: '"+module.descriptionExpanded.name+"' not found."));if(baseModule.error!==TcHmi.Errors.NONE||!baseModule.descriptionExpanded)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Control module: '"+base+"' contains errors:"+TcHmi.Log.buildMessage(module.errorDetails)));this.__resolveDescriptionInheritance(baseModule);let baseInheritedAttributes=baseModule.descriptionExpanded.inheritedAttributes;if(void 0!==baseInheritedAttributes)for(let i=0,ii=baseInheritedAttributes.length;i<ii;i++)!1!==baseInheritedAttributes[i].heritable&&baseAttrs.push(baseInheritedAttributes[i]);let baseInheritedAccess=baseModule.descriptionExpanded.inheritedAccess;void 0!==baseInheritedAccess&&0!==baseInheritedAccess.length&&(baseAccess=baseAccess.concat(baseInheritedAccess));let baseInheritedFunctions=baseModule.descriptionExpanded.inheritedFunctions;void 0!==baseInheritedFunctions&&0!==baseInheritedFunctions.length&&(baseFunctions=baseFunctions.concat(baseInheritedFunctions));let baseInheritedEvents=baseModule.descriptionExpanded.inheritedEvents;void 0!==baseInheritedEvents&&0!==baseInheritedEvents.length&&(baseEvents=baseEvents.concat(baseInheritedEvents));let baseInheritedLanguages=baseModule.descriptionExpanded.inheritedLanguages;if(null!=baseInheritedLanguages)for(let key in baseInheritedLanguages)baseLanguages[key]=baseInheritedLanguages[key]}let attributes=tchmi_clone_object(module.descriptionExpanded.attributes);null==attributes&&(attributes=[]);for(let i=0,ii=baseAttrs.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=attributes.length;j<jj;j++)if(attributes[j].name.toLowerCase()===baseAttrs[i].name.toLowerCase()){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedAttributes.push(baseAttrs[i])}module.descriptionExpanded.inheritedAttributes=module.descriptionExpanded.inheritedAttributes.concat(attributes);for(let k=0,kk=module.descriptionExpanded.inheritedAttributes.length;k<kk;k++){let attr=module.descriptionExpanded.inheritedAttributes[k];module.descriptionExpanded.inheritedAttributesNameMap.set(attr.name.toLowerCase(),attr),attr.propertyName?module.descriptionExpanded.inheritedAttributesPropertyNameMap.set(attr.propertyName.toLowerCase(),attr):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertyName entry. Handling this attribute will not work.'),attr.propertyGetterName?module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap.set(attr.propertyGetterName.toLowerCase(),attr):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertyGetterName entry. Handling this attribute will not work.'),attr.propertySetterName?module.descriptionExpanded.inheritedAttributesPropertySetterNameMap.set(attr.propertySetterName.toLowerCase(),attr):attr.readOnly||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.ControlManager] Description.json of control type "'+module.descriptionExpanded.displayName+'" attribute "'+attr.name+'" has no propertySetterName entry. Handling this attribute will not work.')}let access=module.descriptionExpanded.access;null==access&&(access=[]);for(let i=0,ii=baseAccess.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=access.length;j<jj;j++)if(access[j].name===baseAccess[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedAccess.push(baseAccess[i])}0!==access.length&&(module.descriptionExpanded.inheritedAccess=module.descriptionExpanded.inheritedAccess.concat(access));let functions=module.descriptionExpanded.functions;null==functions&&(functions=[]);for(let i=0,ii=baseFunctions.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=functions.length;j<jj;j++)if(functions[j].name===baseFunctions[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedFunctions.push(baseFunctions[i])}0!==functions.length&&(module.descriptionExpanded.inheritedFunctions=module.descriptionExpanded.inheritedFunctions.concat(functions));let events=module.descriptionExpanded.events;null==events&&(events=[]);for(let i=0,ii=baseEvents.length;i<ii;i++){let bOverwriteExists=!1;for(let j=0,jj=events.length;j<jj;j++)if(events[j].name===baseEvents[i].name){bOverwriteExists=!0;break}!1===bOverwriteExists&&module.descriptionExpanded.inheritedEvents.push(baseEvents[i])}0!==events.length&&(module.descriptionExpanded.inheritedEvents=module.descriptionExpanded.inheritedEvents.concat(events));let languages=module.descriptionExpanded.languages;null==languages&&(languages={});for(let keyBase in baseLanguages){let bOverwriteExists=!1;for(let keyCurrent in languages)if(keyCurrent===keyBase){bOverwriteExists=!0;break}!1===bOverwriteExists&&(module.descriptionExpanded.inheritedLanguages[keyBase]=baseLanguages[keyBase])}if(0!==events.length)for(let key in languages)module.descriptionExpanded.inheritedLanguages[key]=languages[key]}__resolveInheritanceHierarchy(module){if(!module||module.error!==TcHmi.Errors.NONE||!module.descriptionExpanded)return null;const newEntry={controlType:TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace),children:[]};if(module.descriptionExpanded.base){let findInheritanceBaseObj=(controlType,level)=>{if(!level){if(!module.descriptionExpanded)return null;let baseModule=TcHmi.System.Data.Modules.controls.map.get(module.descriptionExpanded.base);return this.__resolveInheritanceHierarchy(baseModule)}if(controlType===level.controlType)return level;for(let iterator=0;iterator<level.children.length;iterator++){let childEntry=level.children[iterator],subtreeHit=findInheritanceBaseObj(controlType,childEntry);if(subtreeHit)return subtreeHit}return null},inheritanceBaseObj=findInheritanceBaseObj(module.descriptionExpanded.base,this.__inheritanceHierarchyTree);if(inheritanceBaseObj){for(let iterator=0;iterator<inheritanceBaseObj.children.length;iterator++){let childEntry=inheritanceBaseObj.children[iterator];if(childEntry.controlType===TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace))return childEntry}inheritanceBaseObj.children.push(newEntry)}else{let baseModule=TcHmi.System.Data.Modules.controls.map.get(module.descriptionExpanded.base),inheritanceNewBaseObj=this.__resolveInheritanceHierarchy(baseModule);if(!inheritanceNewBaseObj)return null;inheritanceNewBaseObj.children.push(newEntry)}}else{if(this.__inheritanceHierarchyTree)return this.__inheritanceHierarchyTree;this.__inheritanceHierarchyTree=newEntry}return newEntry}__resolveTemplateInheritation(module){if(!(module&&module.descriptionExpanded&&module.manifestData&&module.package))return;let resolve=function(type){let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.manifestData&&module.package)return module.descriptionExpanded.template?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.descriptionExpanded.template):resolve(module.descriptionExpanded.base)};if(module.descriptionExpanded.template){let templateKey=tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.descriptionExpanded.template);module.descriptionExpanded.inheritedTemplate=templateKey}else module.descriptionExpanded.inheritedTemplate=resolve(module.descriptionExpanded.base)}__validateDescriptionAttributes(module){var _a,_b,_c;if(module&&module.description)for(const attribute of module.description.attributes){const res=TcHmi.System.Services.typeManager.getSchemaEx(attribute.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ControlManager] Attribute "+attribute.propertyName+" of control "+System.resolveQualifiedName(null!==(_b=null===(_a=module.description)||void 0===_a?void 0:_a.name)&&void 0!==_b?_b:"",null===(_c=module.description)||void 0===_c?void 0:_c.namespace)+" uses invalid data type "+attribute.type+": "+TcHmi.Log.buildMessage(res.details))}}resolveDescriptionInheritation(){try{let __this=this,modulesSorted=tchmi_clone_object(TcHmi.System.Data.Modules.controls.array);modulesSorted.sort((a,b)=>{var _a,_b,_c,_d;return(null===(_a=a.descriptionExpanded)||void 0===_a?void 0:_a.base)===(null===(_b=b.descriptionExpanded)||void 0===_b?void 0:_b.name)?1:(null===(_c=b.descriptionExpanded)||void 0===_c?void 0:_c.base)===(null===(_d=a.descriptionExpanded)||void 0===_d?void 0:_d.name)?-1:0});for(let i=0,ii=modulesSorted.length;i<ii;i++){let module=modulesSorted[i];module&&module.descriptionExpanded&&!module.descriptionExpanded.inheritationResolved&&(__this.__resolveDescriptionTypes(module),__this.__resolveDescriptionInheritance(module),__this.__resolveInheritanceHierarchy(module),__this.__resolveTemplateInheritation(module),module.descriptionExpanded.inheritationResolved=!0)}}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ControlManager] resolveDescriptionInheritation failed with exception:\n",e)}}getInheritanceTree(){return this.__inheritanceHierarchyTree}getDescription(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded?module.descriptionExpanded:null}getDescriptionTypes(type){if(!type)return[];let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedTypes?module.descriptionExpanded.inheritedTypes:[]}isRegisteredDescriptionType(type){return!!type&&TcHmi.System.Data.Modules.controls.map.has(type)}getDescriptionPath(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.package&&module.manifestData?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.manifestData.descriptionFile):null}getDescriptionAttributes(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedAttributes?module.descriptionExpanded.inheritedAttributes:null}getDescriptionAccess(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&module.descriptionExpanded.inheritedAccess?module.descriptionExpanded.inheritedAccess:null}getDescriptionAttributeByName(type,name){if(!type||!name)return null;const lowerName=name.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesNameMap.get(lowerName);return res||null}return null}getDescriptionAttributeByPropertyName(type,propertyName){if(!type||!propertyName)return null;const lowerName=propertyName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertyNameMap.get(lowerName);return res||null}return null}getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName){let UCEntry=this.__usercontrolAttrDescrByPropertyName.get(ucConfigUrl);if(!UCEntry)return null;let res=UCEntry.get(propertyName);return res||null}getDescriptionAttributeByPropertySetterName(type,propertySetterName){if(!type||!propertySetterName)return null;const lowerName=propertySetterName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertySetterNameMap.get(lowerName);return res||null}return null}getDescriptionAttributeByPropertyGetterName(type,propertyGetterName){if(!type||!propertyGetterName)return null;const lowerName=propertyGetterName.toLowerCase();let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedAttributesPropertyGetterNameMap.get(lowerName);return res||null}return null}getDescriptionLanguages(type){if(!type)return null;let module=TcHmi.System.Data.Modules.controls.map.get(type);if(module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded){let res=module.descriptionExpanded.inheritedLanguages;return res||null}return null}getAttributeByPropertyName(control,propertyName){if(!propertyName)return null;let type=control.getType(),attr=this.getDescriptionAttributeByPropertyName(type,propertyName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){let targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json"));if(attr=this.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName),attr)return attr}}return null}getAttributeTypeByPropertyName(control,propertyName){if(!control)return System.ControlAttributeType.Invalid;let type=control.getType(),attr=this.getDescriptionAttributeByPropertyName(type,propertyName);if(attr)return System.ControlAttributeType.Control;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){let targetUserControl=control.getTargetUserControl();if(targetUserControl){const ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json"));if(attr=this.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName),attr)return System.ControlAttributeType.UserControlParameter}}return System.ControlAttributeType.Invalid}getAttributeByPropertySetterName(control,propertySetterName){if(!control)return null;let type=control.getType(),attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertySetterName(type,propertySetterName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){let targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCEntry=this.__usercontrolAttrDescrBySetterName.get(ucConfigUrl);if(UCEntry){let UCattr=UCEntry.get(propertySetterName);if(UCattr)return UCattr}}}return null}getAttributeByPropertyGetterName(control,propertyGetterName){if(!control)return null;let type=control.getType(),attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertyGetterName(type,propertyGetterName);if(attr)return attr;if("TcHmi.Controls.System.TcHmiUserControlHost"===type){let targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCEntry=this.__usercontrolAttrDescrByGetterName.get(ucConfigUrl);if(UCEntry){let UCattr=UCEntry.get(propertyGetterName);if(UCattr)return UCattr}}}return null}getDescriptionAccessByName(type,name){let res=null;if(!name)return null;let access=this.getDescriptionAccess(type);if(null!=access)for(let i=0,ii=access.length;i<ii;i++){let acc=access[i];if(acc.name===name){res=acc;break}}return res}}System.ControlManager=ControlManager}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.DialogManager=class{constructor(){this.__currentDialogType=0,this.__dialogOwner=null;let tempDivOverlayDialogContainerr=document.createElement("div");tempDivOverlayDialogContainerr.innerHTML='<div id="tchmi-overlaysystemdialog-container" class="tchmi-box"><div id="tchmi-overlaysystemdialog-background" class="tchmi-box"></div><div class="tchmi-overlaysystemdialog-message tchmi-box"></div><input id="tchmi-overlaysystemdialog-dismissbutton" type="button" value="Close" style="display:none;"></input></div>',this.__elementOverlayDialogContainer=tempDivOverlayDialogContainerr.firstElementChild;const interceptInteraction=function(evt){evt.stopPropagation()};let backgroundElement=this.__elementOverlayDialogContainer.querySelector("#tchmi-overlaysystemdialog-background");if(!backgroundElement)throw new SyntaxError("Internal error. Did not found tchmi-overlaysystemdialog-background element.");let eventOptions={passive:!1,capture:!1};backgroundElement.addEventListener("mousedown",interceptInteraction,eventOptions),backgroundElement.addEventListener("click",interceptInteraction,eventOptions),backgroundElement.addEventListener("mouseup",interceptInteraction,eventOptions),backgroundElement.addEventListener("touchstart",interceptInteraction,eventOptions),backgroundElement.addEventListener("touchend",interceptInteraction,eventOptions)}showDialog(dialogOwner,bVisibility,dialogType=TcHmi.DialogManager.DialogType.Overlay,options){if((!options||!0!==options.force)&&null!==dialogOwner&&null!==this.__dialogOwner&&this.__dialogOwner!==dialogOwner)return!1;if(this.__dialogOwner=dialogOwner,!0===bVisibility){if(this.__currentDialogType=dialogType,dialogType===TcHmi.DialogManager.DialogType.Overlay){const elementDissmissButton=this.__elementOverlayDialogContainer.querySelector("#tchmi-overlaysystemdialog-dismissbutton");options&&!0===options.cancelable?(elementDissmissButton.addEventListener("click",()=>{TcHmi.System.Services.dialogManager.showDialog(null,!1)}),elementDissmissButton.style.display=""):elementDissmissButton.style.display="none",document.body&&!document.body.contains(this.__elementOverlayDialogContainer)&&document.body.appendChild(this.__elementOverlayDialogContainer)}}else!1===bVisibility&&(this.__elementOverlayDialogContainer.parentElement&&this.__elementOverlayDialogContainer.parentElement.removeChild(this.__elementOverlayDialogContainer),this.__dialogOwner=null);return!0}updateText(dialogOwner,newHtmlContent,severity=TcHmi.DialogManager.DialogSeverity.Info){if(null!==dialogOwner&&null!==this.__dialogOwner&&this.__dialogOwner!==dialogOwner)return!1;this.__dialogOwner=dialogOwner;let elementMessage=this.__elementOverlayDialogContainer.querySelector(".tchmi-overlaysystemdialog-message");switch(elementMessage&&(elementMessage.innerHTML=newHtmlContent),elementMessage.style.display=newHtmlContent?"":"none",severity){case TcHmi.DialogManager.DialogSeverity.Info:this.__elementOverlayDialogContainer.classList.remove("tchmi-overlaysystemdialog-error");break;case TcHmi.DialogManager.DialogSeverity.Error:this.__elementOverlayDialogContainer.classList?this.__elementOverlayDialogContainer.classList.add("tchmi-overlaysystemdialog-error"):this.__elementOverlayDialogContainer.className+=" tchmi-overlaysystemdialog-error"}return!0}getDialogOwner(){return this.__dialogOwner}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.SplashScreen=class{constructor(){this.__isVisibile=!1;let tempDivSplashScreenContainer=document.createElement("div");tempDivSplashScreenContainer.innerHTML='<div id="tchmi-splash-container">   <div class="tchmi-splash-content-container">       <div class="tchmi-splash-stage-progress-container"><div class="tchmi-splash-stage-progress"></div></div>       <div class="tchmi-splash-stage-info">Loading...</div>       <div class="tchmi-splash-version-info">Version: ?.?.?.?</div>   </div></div>',this.__elementSplashScreenContainer=tempDivSplashScreenContainer.firstElementChild,this.__elementSplashScreenContainer?(this.__elementSplashProgress=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-stage-progress"),this.__elementSplashInfo=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-stage-info"),this.__elementVersionInfo=this.__elementSplashScreenContainer.querySelector(".tchmi-splash-version-info")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.SplashScreen] Internal error. Did not found tchmi-splash-container element.")}isVisible(){return this.__isVisibile}updateVersionInfo(message){this.__elementVersionInfo&&(this.__elementVersionInfo.innerText=message)}updateStageInfo(message){this.__elementSplashInfo&&(this.__elementSplashInfo.innerText=message)}updateStageProgress(progress){this.__elementSplashProgress&&(this.__elementSplashProgress.style.width=progress.toString()+"%")}show(){this.__isVisibile||TcHmi.System.isInitialized||document.body&&this.__elementSplashScreenContainer&&!document.body.contains(this.__elementSplashScreenContainer)&&(this.__elementSplashScreenContainer.parentElement&&this.__elementSplashScreenContainer.parentElement.removeChild(this.__elementSplashScreenContainer),document.body.appendChild(this.__elementSplashScreenContainer),this.__isVisibile=!0,TcHmi.EventProvider.raise("System.onSplashScreenShow"))}hide(){var _a;this.__isVisibile&&((null===(_a=this.__elementSplashScreenContainer)||void 0===_a?void 0:_a.parentElement)&&this.__elementSplashScreenContainer.parentElement.removeChild(this.__elementSplashScreenContainer),this.__isVisibile=!1,TcHmi.EventProvider.raise("System.onSplashScreenHide"))}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){class Filter{constructor(logic){this.__comparisons=[],this.__subfilters=[],this.__parent=null,this.__logic=logic}static parse(data,schema){if(void 0===data)throw new Error("Filter must not be undefined");if(schema&&("array"!==schema.type||!schema.items))throw new Error("Filter schema must describe an array.");if(!data||0===data.length)return new Filter("AND");if(!Array.isArray(data))throw new Error("Filter must be an array.");if(1===data.length){let item=data[0];if(TcHmi.isComparison(item)){let result=new Filter("AND");return schema&&(item=this.__parseComparison(item,schema)),result.__comparisons.push(item),result}if(Array.isArray(item))return this.parse(item,schema);throw new Error("Invalid filter. Expected comparison or nested filter at position 0.")}let first=data[0],second=data[1];if(!TcHmi.isLogicOperator(second))throw new Error("Invalid filter. Expected logic operator at position 1.");let addExpressionToTree=(tree,expression,positionInArray)=>{if(TcHmi.isComparison(expression))schema&&(expression=this.__parseComparison(expression,schema)),tree.__comparisons.push(expression);else{if(!Array.isArray(expression))throw new Error(`Invalid filter. Expected comparison or nested filter at position ${positionInArray}.`);tree.__subfilters.push(this.parse(expression,schema))}},root=new Filter(second.logic);addExpressionToTree(root,first,0);let current=root,currentExpression=null,expecting="comparison";for(let i=2,ii=data.length;i<ii;i++)switch(expecting){case"comparison":currentExpression=data[i],expecting="logic";break;case"logic":let logicOperator=data[i];if(!TcHmi.isLogicOperator(logicOperator))throw new Error(`Invalid filter. Expected logic operator at position ${i}.`);let logic=logicOperator.logic;if(logic===current.__logic)addExpressionToTree(current,currentExpression,i-1);else if("OR"===logic)if(addExpressionToTree(current,currentExpression,i-1),current.__parent&&current.__parent.__logic===logic)current=current.__parent;else{let orTree=new Filter(logic);orTree.__subfilters.push(current),orTree.__parent=current.__parent,current.__parent=orTree,null===orTree.__parent&&(root=orTree),current=orTree}else if("AND"===logic){let andTree=new Filter(logic);addExpressionToTree(andTree,currentExpression,i-1),andTree.__parent=current,current.__subfilters.push(andTree),current=andTree}expecting="comparison"}if("comparison"===expecting)throw new Error("Filter must not end with a logic operator.");return addExpressionToTree(current,currentExpression,data.length-1),root}test(candidate,key=""){for(let i=0,ii=this.__comparisons.length;i<ii;i++){let result=this.__resolveComparison(this.__comparisons[i],candidate,key);if(result&&"OR"===this.__logic)return!0;if(!result&&"AND"===this.__logic)return!1}for(let i=0,ii=this.__subfilters.length;i<ii;i++){let result=this.__subfilters[i].test(candidate,key);if(result&&"OR"===this.__logic)return!0;if(!result&&"AND"===this.__logic)return!1}return"AND"===this.__logic}static __parseComparison(comparison,schema){comparison=tchmi_clone_object(comparison);let findSchema=subschema=>{var _a;if(subschema.oneOf)for(let i=0,ii=subschema.oneOf.length;i<ii;i++){let res=findSchema(subschema.oneOf[i]);if(res)return res}else if(subschema.anyOf)for(let i=0,ii=subschema.anyOf.length;i<ii;i++){let res=findSchema(subschema.anyOf[i]);if(res)return res}else if("object"===subschema.type&&subschema.properties){if(subschema.properties.path){if("string"!==subschema.properties.path.type)return null;if(null===(_a=subschema.required)||void 0===_a?void 0:_a.includes("path")){if(!comparison.path)return null;if(subschema.properties.path.enum&&-1===subschema.properties.path.enum.indexOf(comparison.path))return null}}return subschema.properties.comparator&&subschema.properties.comparator.enum&&-1!==subschema.properties.comparator.enum.indexOf(comparison.comparator)&&(subschema.properties.value&&subschema.properties.value.type===typeof comparison.value)?subschema:null}return null},comparisonSchema=null;if(Array.isArray(schema.items))for(let i=0,ii=schema.items.length;i<ii;i++){let res=findSchema(schema.items[i]);if(res){comparisonSchema=res;break}}else schema.items&&(comparisonSchema=findSchema(schema.items));if(comparisonSchema&&comparisonSchema.properties&&"date-time"===comparisonSchema.properties.value.format&&"string"==typeof comparison.value){let date=new Date(comparison.value);if(isNaN(date.getTime()))throw new Error(`Filter contains an invalid date: "${comparison.value}".`);comparison.value=new Date(comparison.value)}return comparison}__resolveComparison(comparison,datum,key){const[left,right]=this.__getValues(comparison,datum,key);if(void 0===left)return!1;switch(comparison.comparator){case"==":return this.__resolveEquals(left,right);case"!=":return this.__resolveEqualsNot(left,right);case"<":return this.__resolveLessThan(left,right);case">":return this.__resolveGreaterThan(left,right);case"<=":return this.__resolveLessThanOrEquals(left,right);case">=":return this.__resolveGreaterThanOrEquals(left,right);case"contains":return this.__resolveContains(left,right);case"contains not":return this.__resolveContainsNot(left,right);case"== [ignore case]":return this.__resolveEqualsIgnoreCase(left,right);case"!= [ignore case]":return this.__resolveEqualsNotIgnoreCase(left,right);case"contains [ignore case]":return this.__resolveContainsIgnoreCase(left,right);case"contains not [ignore case]":return this.__resolveContainsNotIgnoreCase(left,right)}}__resolveEquals(left,right){return"number"==typeof left&&"number"==typeof right?left===right||Math.abs(left-right)<=Filter.__floatEpsilon:left===right}__resolveEqualsNot(left,right){return!this.__resolveEquals(left,right)}__resolveLessThan(left,right){if("number"==typeof left&&"number"==typeof right)return right-left>Filter.__floatEpsilon;throw new Error(`Cannot compare ${typeof left} with ${typeof right} using <.`)}__resolveGreaterThan(left,right){if("number"==typeof left&&"number"==typeof right)return left-right>Filter.__floatEpsilon;throw new Error(`Cannot compare ${typeof left} with ${typeof right} using >.`)}__resolveLessThanOrEquals(left,right){return!this.__resolveGreaterThan(left,right)}__resolveGreaterThanOrEquals(left,right){return!this.__resolveLessThan(left,right)}__resolveContains(left,right){if("string"==typeof left&&"string"==typeof right)return-1!==left.indexOf(right);if("object"==typeof left&&null!==left){const items=Array.isArray(left)?left:Object.keys(left);for(const item of items)if(this.__resolveEquals(...this.__convert(item,right)))return!0;return!1}throw new Error(`Cannot compare ${typeof left} with ${typeof right} using contains.`)}__resolveContainsNot(left,right){return!this.__resolveContains(left,right)}__resolveEqualsIgnoreCase(left,right){if("string"==typeof left&&"string"==typeof right)return left.toLowerCase()===right.toLowerCase();throw new Error(`Cannot compare ${typeof left} with ${typeof right} using == [ignore case].`)}__resolveEqualsNotIgnoreCase(left,right){return!this.__resolveEqualsIgnoreCase(left,right)}__resolveContainsIgnoreCase(left,right){if("string"==typeof left&&"string"==typeof right)return-1!==left.toLowerCase().indexOf(right.toLowerCase());throw new Error(`Cannot compare ${typeof left} with ${typeof right} using contains [ignore case].`)}__resolveContainsNotIgnoreCase(left,right){return!this.__resolveContainsIgnoreCase(left,right)}__getValues(comparison,datum,key){const[left,right]=this.__convert(this.__followPath(comparison,datum,key),comparison.value,comparison);return[left,right]}__followPath(comparison,datum,key){let left=datum;if(comparison.path&&"{value}"!==comparison.path)if("{key}"===comparison.path)left=key;else{let propertyPath=System.resolveSymbolPathToTokenArray(comparison.path);for(let i=0,ii=propertyPath.length;i<ii;i++){let token=propertyPath[i],isArrayToken=!1;if(token.match(/\[.*\]/)&&(token=token.slice(1,-1),isArrayToken=!0),Array.isArray(left)&&isArrayToken){let index=parseInt(token,10);left=left[isNaN(index)?token:index.toString()]}else{if("object"!=typeof left)throw new Error(`Could not read property ${token} of type ${typeof left}`);left=left[token]}}}return left}__convert(left,right,comparison){let cache=!1;if(typeof right!=typeof left)if("string"==typeof right){const isoDateTimeRegex=/^[1-2]\d{3}(-?)[0-1]\d\1[0-3]\d(?:T[0-2]\d(?:(:?)[0-5]\d(?:\2[0-5]\d)?)?(?:[.,]\d+)?(?:Z|[+-][0-1]\d(?::?[0-5]\d)?)?)?$/;switch(typeof left){case"boolean":"true"===right.toLowerCase()?(right=!0,cache=!0):"false"===right.toLowerCase()&&(right=!1,cache=!0);break;case"number":if(/^[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?$/.test(right)){let converted=parseFloat(right);Number.isNaN(converted)||(right=converted,cache=!0)}break;case"object":if(left instanceof Date&&isoDateTimeRegex.test(right)){let converted=new Date(right);Number.isNaN(converted.getTime())||(right=converted,cache=!0)}else null===left&&("null"===right.toLowerCase()?(right=null,cache=!0):isoDateTimeRegex.test(right)&&0===new Date(right).getTime()&&(right=null))}}else void 0!==(null==comparison?void 0:comparison.originalValue)&&typeof left==typeof comparison.originalValue&&(right=comparison.originalValue);else right instanceof Date&&0===right.getTime()&&null===left&&(right=null);return cache&&comparison&&(comparison.originalValue=comparison.value,comparison.value=right),left instanceof Date&&right instanceof Date&&(left=left.getTime(),right=right.getTime()),[left,right]}}Filter.__floatEpsilon=Math.pow(2,-23),System.Filter=Filter}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.FunctionExpression=class{constructor(functionExpression,enableWatchMode=!1){this.__isDestroyed=!1,this.__symbolExpressions=[],this.__functionCallExpressions=[],this.__watchMap=new Map,this.__callbacks=[],this.__expression=functionExpression,this.__enableWatchMode=enableWatchMode;try{this.__originalAst=acorn.parse(functionExpression,{plugins:{symbolExpression:{onSymbol:this.__symbolExpressions,onCallExpression:callExpression=>{let functionName=this.__resolveCallExpressionName(callExpression.callee);const module=TcHmi.System.Data.Modules.functions.map.get(functionName);if(module)if(module.error===TcHmi.Errors.NONE){let fnDescr=module.description,argoffset=0;if(!fnDescr){let error={code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+this.__expression+'", Missing description file (*.function.json) for function with registered name: "'+functionName+'".',domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}if(fnDescr&&!fnDescr.function){let error={code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+this.__expression+'", Invalid description file(*.function.json) for function with registered name: "'+functionName+'".Missing  property: "function".',domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}if(fnDescr&&fnDescr.function&&!0===fnDescr.function.injectContextObject&&argoffset++,fnDescr&&fnDescr.function&&void 0!==callExpression.arguments&&null!==callExpression.arguments)for(let i=0,ii=callExpression.arguments.length;i<ii;i++)if("SymbolExpression"===callExpression.arguments[i].type&&fnDescr&&fnDescr.function&&fnDescr.function.arguments){let descr;if(i+argoffset<fnDescr.function.arguments.length?descr=fnDescr.function.arguments[i+argoffset]:(descr=fnDescr.function.arguments[fnDescr.function.arguments.length-1],!0!==descr.restParameter&&(descr=void 0)),descr){let typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);typeSchema&&"TcHmi.Symbol"===typeSchema.frameworkInstanceOf&&(callExpression.arguments[i].passAsSymbol=!0)}}this.__functionCallExpressions.push(callExpression)}else this.__error||(this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression"}),module.errorDetails&&(this.__error.errors?this.__error.errors.push(module.errorDetails):this.__error.errors=[module.errorDetails])}}}})}catch(e){let error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:'An uncaught exception occurred in target function expression "'+this.__expression+'".',exception:e,domain:"TcHmi.System.FunctionExpression"};this.__error?this.__error.errors?this.__error.errors.push(error):this.__error.errors=[error]:this.__error={code:TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_PARSER_ERROR],reason:'Target function expression: "'+this.__expression+'", At least one error occurred while parsing the function expression.',domain:"TcHmi.System.FunctionExpression",errors:[error]}}enableWatchMode&&!this.__error&&(this.__fillWatchMap(),this.__doWatch())}__resolveCallExpressionName(expression){let res="";return"MemberExpression"===expression.type?(res+=this.__resolveCallExpressionName(expression.object),res+=".",res+=this.__resolveCallExpressionName(expression.property)):"Identifier"===expression.type&&(res+=expression.name),res}__fillWatchMap(){let __this=this;for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++)expression=this.__symbolExpressions[i],__this.__watchMap.has(expression.expression)||__this.__watchMap.set(expression.expression,{symbol:new System.Symbol(expression.expression),ready:!1,error:TcHmi.Errors.NONE});var expression}__doWatch(){for(let watchObj of this.__watchMap.values())watchObj.destroy=watchObj.symbol.watch(this.__onSubSymbolWatch())}__onSubSymbolWatch(){let __this=this;return function(data){let expr=this.getExpression();if(!expr)return;let watchObj=__this.__watchMap.get(expr.toString());if(!watchObj)return;data.error===TcHmi.Errors.NONE?(watchObj.value=data.value,watchObj.error=null,watchObj.details=void 0,watchObj.ready=!0):(watchObj.value=null,watchObj.error=data.error,watchObj.details=data.details,watchObj.ready=!0);let ready=!0;for(const watchObj of __this.__watchMap.values())if(watchObj&&!1===watchObj.ready){ready=!1;break}if(ready){let bContextLock=!1;__this.execute({success:function(result){if(bContextLock)return;bContextLock=!0;let callbackList=[];for(let i=0,ii=__this.__callbacks.length;i<ii;i++)callbackList.push(__this.__callbacks[i]);for(let co of callbackList)-1!==__this.__callbacks.indexOf(co)&&TcHmi.Callback.callSafeEx(co.callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(result),destroy:co.destroy})},error:function(error,details){if(bContextLock)return;bContextLock=!0;let callbackList=[];for(let i=0,ii=__this.__callbacks.length;i<ii;i++)callbackList.push(__this.__callbacks[i]);for(let co of callbackList)-1!==__this.__callbacks.indexOf(co)&&TcHmi.Callback.callSafeEx(co.callback,__this,{error:error,details:details,destroy:co.destroy})}})}}}execute(ctx,skipCallbackWithSyncValue=!1){if(this.__error)return ctx.error(this.__error.code,this.__error),{error:TcHmi.Errors.NONE};let __this=this,resultsSymbolExpressions=[],resultsFunctionCallExpressions=[];if(TCHMI_DESIGNER){let abort=!1;if(this.__symbolExpressions)for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++){let expr=new TcHmi.SymbolExpression(this.__symbolExpressions[i].expression);if(!expr||expr.getType()===TcHmi.SymbolType.Invalid){abort=!0;break}if(expr.getType()===TcHmi.SymbolType.Server){abort=!0;break}}if(abort)return ctx.success(null),{error:TcHmi.Errors.NONE}}let syncResultValue,syncResultSet=!1,executeReturned=!1;const subCtx={success:result=>{if(!executeReturned&&skipCallbackWithSyncValue)return syncResultValue=result,void(syncResultSet=!0);ctx.success(result)},error:ctx.error};const resolveFunctionCallExpressions=function(ctx){let next=function(i){let bContextLock=!1;!function(ctx,callExpression){if(!callExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression"});let name=__this.__resolveCallExpressionName(callExpression.callee),args=[],module=TcHmi.System.Data.Modules.functions.map.get(name);if(!module)return void ctx.error(TcHmi.Errors.E_MODULE_MISSING,{code:TcHmi.Errors.E_MODULE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_MISSING],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression"});if(module.error!==TcHmi.Errors.NONE)return void ctx.error(TcHmi.Errors.E_MODULE_ERROR,{code:TcHmi.Errors.E_MODULE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_MODULE_ERROR],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression",errors:module.errorDetails?[module.errorDetails]:void 0});if(!module.description)return void ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_DESCRIPTION],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression"});if(!module.reg||!module.reg.func)return void ctx.error(TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,{code:TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_MISSING_FUNCTION_REFERENCE],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression"});let res,argoffset=0;if("Asynchronous"===module.description.function.waitMode){if(!0!==module.description.function.injectContextObject)return void ctx.error(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],reason:'Target function expression: "'+__this.__expression+'", Invalid configuration for hmi function with name='+name+". Setting waitMode=Asynchronous and injectContextObject="+module.description.function.injectContextObject+" is an invalid function configuration. Please define a context object if you want to use waitMode=Asynchronous.",domain:"TcHmi.System.FunctionExpression"});{let bContextLock=!1;args.unshift({success:function(result){bContextLock||(bContextLock=!0,ctx.success(result))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))}}),argoffset++}}else!0===module.description.function.injectContextObject&&(args.unshift({}),argoffset++);for(let i=0,ii=callExpression.arguments.length;i<ii;i++){let descr=null;if(module&&module.error===TcHmi.Errors.NONE)if(i+argoffset<module.description.function.arguments.length)descr=module.description.function.arguments[i+argoffset];else if(descr=module.description.function.arguments[module.description.function.arguments.length-1],!0!==descr.restParameter)return void ctx.error(TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING,{code:TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_RESTPARAMETER_DEFINITION_MISSING],domain:"TcHmi.System.FunctionExpression"});if(!descr)return void ctx.error(TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,{code:TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_INVALID_CONFIGURATION],domain:"TcHmi.System.FunctionExpression"});let typeSchema=TcHmi.System.Services.typeManager.getSchema(descr.type);if(!typeSchema)return void ctx.error(TcHmi.Errors.E_UNKNOWN_TYPE,{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],domain:"TcHmi.System.FunctionExpression"});let ceArgStart=callExpression.arguments[i].start,ceArgEnd=callExpression.arguments[i].end,expression=__this.__expression.substr(ceArgStart,ceArgEnd-ceArgStart),isSymbolExpression=TcHmi.Symbol.isSymbolExpression(expression),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(expression);if(isSymbolExpression&&!isSymbolExpressionEscaped){let value;for(let j=0,jj=__this.__symbolExpressions.length;j<jj;j++){let expr=__this.__symbolExpressions[j],exprStart=expr.start,exprEnd=expr.end;if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){value=resultsSymbolExpressions[j],expr.handled=!0;break}}if("TcHmi.Symbol"===typeSchema.frameworkInstanceOf){if(!(value instanceof TcHmi.Symbol))return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=value}else{let cvalue=TcHmi.ValueConverter.toSchemaType(value,typeSchema);if(null===cvalue&&null!==value)return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],reason:'Target function expression: "'+__this.__expression+'", Unable to cast value: "'+value+'" of type: "'+typeof value+'" for parameter: "'+descr.name+'" of function: "'+TcHmi.System.resolveQualifiedName(module.description.function.name,module.description.function.namespace)+'" to type "'+descr.type+'".',domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=cvalue}}else{let prepExpression=expression;isSymbolExpressionEscaped&&(prepExpression=TcHmi.Symbol.escapeSymbolExpression(prepExpression));let value,expressionTokens=prepExpression.split("");for(let j=0,jj=__this.__symbolExpressions.length;j<jj;j++){let expr=__this.__symbolExpressions[j],exprStart=expr.start,exprEnd=expr.end,exprStartFixed=exprStart-ceArgStart,exprEndFixed=exprStartFixed+(exprEnd-exprStart);if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){for(let k=exprStartFixed,kk=exprEndFixed;k<kk;k++)expressionTokens[k]="";"string"==typeof resultsSymbolExpressions[j]?expressionTokens[exprStartFixed]=`'${resultsSymbolExpressions[j]}'`:expressionTokens[exprStartFixed]=resultsSymbolExpressions[j],expr.handled=!0}}for(let j=0,jj=__this.__functionCallExpressions.length;j<jj;j++){let expr=__this.__functionCallExpressions[j],exprStart=expr.start,exprEnd=expr.end,exprStartFixed=exprStart-ceArgStart,exprEndFixed=exprStartFixed+(exprEnd-exprStart);if(exprStart>=ceArgStart&&exprEnd<=ceArgEnd){for(let k=exprStartFixed,kk=exprEndFixed;k<kk;k++)expressionTokens[k]="";"string"==typeof resultsFunctionCallExpressions[j]?expressionTokens[exprStartFixed]=`'${resultsFunctionCallExpressions[j]}'`:expressionTokens[exprStartFixed]=resultsFunctionCallExpressions[j],expr.handled=!0}}let s="";for(let j=0,jj=expressionTokens.length;j<jj;j++)s+=expressionTokens[j];s+="\n//# sourceURL=TcHmi_System_FunctionExpression_resolveExpression_Eval";try{value=gIsolatedEval_TcHmi_System_FunctionExpression(s)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+__this.__expression.toString(),exception:e,domain:"TcHmi.System.FunctionExpression"})}let cvalue=TcHmi.ValueConverter.toSchemaType(value,typeSchema);if(null===cvalue&&null!==value)return void ctx.error(TcHmi.Errors.E_TYPE_INVALID,{code:TcHmi.Errors.E_TYPE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TYPE_INVALID],reason:'Target function expression: "'+__this.__expression+'", Unable to cast value: "'+value+'" of type: "'+typeof value+'" for parameter: "'+descr.name+'" of function: "'+module.description.function.name+'" to type: "'+descr.type+'".',domain:"TcHmi.System.FunctionExpression"});args[i+argoffset]=cvalue}}try{res=module.reg.func(...args)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+__this.__expression.toString(),exception:e,domain:"TcHmi.System.FunctionExpression"})}"Asynchronous"===module.description.function.waitMode||ctx.success(res)}({success:function(result){bContextLock||(bContextLock=!0,resultsFunctionCallExpressions[i]=result,i+1<__this.__functionCallExpressions.length?next(i+1):ctx.success())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))}},__this.__functionCallExpressions[i])};__this.__functionCallExpressions.length>0?next(0):ctx.success()};let bContextLock=!1;return function(ctx){let next=function(i){let symbolExpression=__this.__symbolExpressions[i],bContextLock=!1;!function(ctx,symbolExpression){if(symbolExpression){if(!symbolExpression.passAsSymbol){if(!0===__this.__enableWatchMode){let watchObj=__this.__watchMap.get(symbolExpression.expression);return watchObj?watchObj.error?void ctx.error(watchObj.error,watchObj.details):void ctx.success(tchmi_clone_object(watchObj.value)):void ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Internal Error: Did not found "+__this.__expression+" in __watchMap",domain:"TcHmi.System.FunctionExpression"})}{let symbol=new TcHmi.System.Symbol(symbolExpression.expression);return void symbol.read((function(data){data.error?ctx.error(data.error,data.details):ctx.success(data.value),null==symbol||symbol.destroy(),symbol=null}))}}{let ref=new TcHmi.Symbol(symbolExpression.expression);ctx.success(ref)}}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression,domain:"TcHmi.System.FunctionExpression"})}({success:function(result){bContextLock||(bContextLock=!0,resultsSymbolExpressions[i]=result,i+1<__this.__symbolExpressions.length?next(i+1):ctx.success())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))}},symbolExpression)};__this.__symbolExpressions.length>0?next(0):ctx.success()}({success:function(result1){if(bContextLock)return;bContextLock=!0;let bContextLock2=!1;resolveFunctionCallExpressions({success:function(result2){if(bContextLock2)return;bContextLock2=!0;let bContextLock3=!1;!function(ctx){let result,expressionTokens=__this.__expression.split("");for(let i=0,ii=__this.__symbolExpressions.length;i<ii;i++){let expr=__this.__symbolExpressions[i];if(expr&&!expr.handled){let fill=[];for(let j=0,jj=expr.end-expr.start;j<jj;j++)fill.push("");expressionTokens.splice(expr.start,expr.end-expr.start,...fill),expressionTokens[expr.start]="resSE["+i+"]"}}for(let i=0,ii=__this.__functionCallExpressions.length;i<ii;i++){let expr=__this.__functionCallExpressions[i];if(expr&&!expr.handled){let fill=[];for(let j=0,jj=expr.end-expr.start;j<jj;j++)fill.push("");expressionTokens.splice(expr.start,expr.end-expr.start,...fill),expressionTokens[expr.start]="resFCE["+i+"]"}}try{let s="";for(let j=0,jj=expressionTokens.length;j<jj;j++)s+=expressionTokens[j];s+="\n//# sourceURL=TcHmi_System_FunctionExpression_resolveExpression_Results_Eval",result=gIsolatedEval_TcHmi_System_FunctionExpression_Results(s,resultsSymbolExpressions,resultsFunctionCallExpressions)}catch(e){return void ctx.error(TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_FUNCTION_EXPRESSION_EXCEPTION],reason:'Target function expression "'+__this.__expression+'" throwed the Exception: "'+e+'"',domain:"TcHmi.System.FunctionExpression"})}ctx.success(result)}({success:function(result3){bContextLock3||(bContextLock3=!0,subCtx.success(result3))},error:function(error,details){bContextLock3||(bContextLock3=!0,subCtx.error(error,details))}})},error:function(error,details){bContextLock2||(bContextLock2=!0,subCtx.error(error,details))}})},error:function(error,details){bContextLock||(bContextLock=!0,subCtx.error(error,details))}}),executeReturned=!0,syncResultSet&&skipCallbackWithSyncValue?{value:syncResultValue,error:TcHmi.Errors.E_FUNCTION_HANDLED_VIA_RETURN_VALUE}:{error:TcHmi.Errors.NONE}}watch(callback){if(!0===this.__isDestroyed)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,destroy:function(){},details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Function Expression already destroyed",domain:"TcHmi.System.FunctionExpression"}}),function(){};if(!1===this.__enableWatchMode)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,destroy:function(){},details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Function Expression has no watch mode",domain:"TcHmi.System.FunctionExpression"}}),function(){};let __this=this,destroy=function(){let index=__this.__callbacks.indexOf(co);-1!==index&&__this.__callbacks.splice(index,1)},co={callback:callback,destroy:destroy};this.__callbacks.push(co);let ready=!0;for(const watchObj of __this.__watchMap.values())if(watchObj&&!1===watchObj.ready){ready=!1;break}if(ready){let bContextLock=!1,result=this.execute({success:function(result){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(result),destroy:destroy}))},error:function(error,details){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,this,{error:error,details:details,destroy:destroy}))}},!0);result.error===TcHmi.Errors.E_FUNCTION_HANDLED_VIA_RETURN_VALUE&&TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(result.value),destroy:destroy})}return destroy}__resolveProcessedWaitMode(){let res="Synchronous";if(this.__processedWaitMode)return res=this.__processedWaitMode,res;if(this.__isDestroyed)throw new Error("Object was already destroyed.");if("Synchronous"===res)for(let i=0,ii=this.__symbolExpressions.length;i<ii;i++){let symbolExpression=this.__symbolExpressions[i],expr=new TcHmi.SymbolExpression(symbolExpression.expression),type=expr.getType();if(type===TcHmi.SymbolType.Server){res="Asynchronous";break}if(type===TcHmi.SymbolType.Function){const content=expr.getContent();if(!content)continue;let func=new TcHmi.System.FunctionExpression(content);if(func.isProcessedAsync()){res="Asynchronous",func.destroy();break}func.destroy()}}return this.__processedWaitMode=res,res}isProcessedAsync(){return"Asynchronous"===this.__resolveProcessedWaitMode()}destroy(){!0!==this.__isDestroyed&&(!0===this.__enableWatchMode&&(this.__watchMap.forEach((watchObj,key)=>{watchObj.destroy&&watchObj.destroy(),watchObj.symbol.destroy()}),this.__watchMap.clear()),this.__isDestroyed=!0)}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.StyleManager=class{constructor(){this.__styleOverwriteCache=new Map,TcHmi.EventProvider.register("System.onPrevControlsAttached",this.__onPrevControlsAttached()),TcHmi.EventProvider.register("System.onPrevControlsDetached",this.__onPrevControlsDetached()),TcHmi.EventProvider.register("onControlDestroyed",this.__onControlDestroyed())}__onPrevControlsAttached(){return(event,ctrls)=>{this.writeStylesFromCache(ctrls)}}__onPrevControlsDetached(){return(event,ctrls)=>{this.removeStylesFromDom(ctrls)}}__onControlDestroyed(){return(event,control)=>{if(!control)return;let styleCacheEntry=this.__styleOverwriteCache.get(control);if(styleCacheEntry){const styleElem=styleCacheEntry[0].elementInHead;null!==styleElem&&document.head.removeChild(styleElem),this.__styleOverwriteCache.delete(control)}}}__getElementStyle(element,propertyName,computedStyle=!1){let htmlSvgElement,elemStyleDef,res={};if(!element||"object"!=typeof element)return res;if(void 0!==element.length){if(!element[0])return res;htmlSvgElement=element[0]}else htmlSvgElement=element;if(elemStyleDef=computedStyle?window.getComputedStyle(htmlSvgElement):htmlSvgElement.style,elemStyleDef&&elemStyleDef.getPropertyValue)if(null!=propertyName){if("string"==typeof propertyName){let value=elemStyleDef.getPropertyValue(propertyName);value&&(res[propertyName]=value)}else if(Array.isArray(propertyName))for(let propertyArrayCounter=0;propertyArrayCounter<propertyName.length;propertyArrayCounter++){let singlePropery=propertyName[propertyArrayCounter],singleValue=elemStyleDef.getPropertyValue(singlePropery);singleValue&&(res[singlePropery]=singleValue)}}else if(void 0!==elemStyleDef.length&&0!==elemStyleDef.length)for(let allStyleCounter=0;allStyleCounter<elemStyleDef.length;allStyleCounter++){let styleName=elemStyleDef[allStyleCounter];res[styleName]=elemStyleDef.getPropertyValue(styleName)}return res}__setSimpleElementStyle(element,property,value=null){let htmlSvgElements;if(element&&"object"==typeof element){if(void 0!==element.length){if(!element[0])return;htmlSvgElements=element}else htmlSvgElements=[element];for(let elemenCounter=0,elemLength=htmlSvgElements.length;elemenCounter<elemLength;elemenCounter++){const elemStyleDef=htmlSvgElements[elemenCounter].style;if(elemStyleDef&&elemStyleDef.removeProperty&&elemStyleDef.setProperty){if("string"==typeof property)if("string"==typeof value&&""!==value)elemStyleDef.setProperty(property,value);else if(Array.isArray(value))for(let propertyArrayCounter=0;propertyArrayCounter<value.length;propertyArrayCounter++)elemStyleDef.setProperty(property,value[propertyArrayCounter]);else elemStyleDef.removeProperty(property);else if(null!==property)for(const key in property)if(property.hasOwnProperty(key)){const keyProperty=property[key];if("string"==typeof keyProperty&&""!==keyProperty)elemStyleDef.setProperty(key,keyProperty);else if(Array.isArray(keyProperty))for(let propertyArrCounter=0;propertyArrCounter<keyProperty.length;propertyArrCounter++)elemStyleDef.setProperty(key,keyProperty[propertyArrCounter]);else elemStyleDef.removeProperty(key)}}else htmlSvgElements[elemenCounter].nodeType===Node.ELEMENT_NODE?htmlSvgElements[elemenCounter].id?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Element with the id "+htmlSvgElements[elemenCounter].id+" has no CSSStyleDeclaration in this browser."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Element of type "+htmlSvgElements[elemenCounter].nodeName+" has no CSSStyleDeclaration in this browser."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.StyleManager] Internal error: Setting style for Elements of type "+htmlSvgElements[elemenCounter].nodeName+" not supported.")}}}writeStylesFromCache(ctrls){let df=document.createDocumentFragment();for(let i=0,ii=ctrls.length;i<ii;i++){let control=ctrls[i],styleCacheEntry=this.__styleOverwriteCache.get(control);if(styleCacheEntry)for(let i=0;i<styleCacheEntry.length;i++){if(!styleCacheEntry[i].strCss)continue;let styleElement=document.createElement("style");styleElement.type="text/css",styleElement.className=styleCacheEntry[i].strClass,styleElement.appendChild(document.createTextNode(styleCacheEntry[i].strCss)),df.appendChild(styleElement),styleCacheEntry[i].elementInHead=styleElement}}df.childElementCount&&document.head.appendChild(df)}removeStylesFromDom(ctrls){for(let i=0,ii=ctrls.length;i<ii;i++){let control=ctrls[i],styleCacheEntry=this.__styleOverwriteCache.get(control);if(!styleCacheEntry)continue;let themeOverwrite=styleCacheEntry[0].elementInHead;null!==themeOverwrite&&(document.head.removeChild(themeOverwrite),styleCacheEntry[0].elementInHead=null)}}getExistingStyleOverwrites(controlName){const ctrl=TcHmi.Controls.get(controlName);if(!ctrl)return{};let cssText="";const styleElement=this.__styleOverwriteCache.get(ctrl)||[{strClass:"",strCss:""}];for(let i=0;i<styleElement.length;i++)-1!==styleElement[i].strClass.indexOf("overwrite")&&(cssText+=styleElement[i].strCss);return this.__deserializeCss(cssText)}__deserializeCss(cssText){let result={},index=0,charsetIndex=(cssText=this.__removeComments(cssText.trim())).indexOf("@charset",index);for(;-1!==charsetIndex;){let charsetString=this.__splitOutsideOfBraces(cssText.substring(charsetIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(charsetString),index=charsetIndex+charsetString.length+1,charsetIndex=cssText.indexOf("@charset",index)}let importIndex=cssText.indexOf("@import",index);for(;-1!==importIndex;){let importString=this.__splitOutsideOfBraces(cssText.substring(importIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(importString),index=importIndex+importString.length+1,importIndex=cssText.indexOf("@import",index)}let namespaceIndex=cssText.indexOf("@namespace",index);for(;-1!==namespaceIndex;){let namespaceString=this.__splitOutsideOfBraces(cssText.substring(namespaceIndex),";")[0];void 0===result["@-rules"]&&(result["@-rules"]=[]),result["@-rules"].push(namespaceString),index=namespaceIndex+namespaceString.length+1,namespaceIndex=cssText.indexOf("@namespace",index)}function mergeDuplicateSelectors(existingStyles,declarations){for(let property in declarations)if(declarations.hasOwnProperty(property)){let decl=declarations[property];if(void 0===existingStyles[property])existingStyles[property]=decl;else for(let i=0,ii=decl.length;i<ii;i++)-1===existingStyles[property].indexOf(decl[i])&&existingStyles[property].push(decl[i])}return existingStyles}for(;index<cssText.length;){let openBraceIndex=cssText.indexOf("{",index),closeBraceIndex=this.__findMatchingBrace(cssText,openBraceIndex),selector=cssText.substring(index,openBraceIndex).trim(),declarationBlock=cssText.substring(openBraceIndex+1,closeBraceIndex);if(selector.startsWith("@")){let atRuleSets=this.__deserializeCss(declarationBlock);if(void 0===result[selector])result[selector]=atRuleSets;else for(let atSelector in atRuleSets)atRuleSets.hasOwnProperty(atSelector)&&(void 0===result[selector][atSelector]?result[selector][atSelector]=atRuleSets[atSelector]:result[selector][atSelector]=mergeDuplicateSelectors(result[selector][atSelector],atRuleSets[atSelector]))}else{let declarations=this.__getDeclarations(declarationBlock);void 0===result[selector]?result[selector]=declarations:result[selector]=mergeDuplicateSelectors(result[selector],declarations)}index=closeBraceIndex+1}return result}__getDeclarations(declarationBlock){let result={},declarations=this.__splitOutsideOfBraces(declarationBlock,";");for(let i=0,ii=declarations.length;i<ii;i++){let splitIndex=declarations[i].indexOf(":");if(splitIndex>-1){let property=declarations[i].substring(0,splitIndex).trim().toLowerCase(),value=declarations[i].substring(splitIndex+1).trim();void 0===result[property]?result[property]=[value]:-1===result[property].indexOf(value)&&result[property].push(value)}}return result}__removeComments(cssText){if(-1===cssText.indexOf("/*"))return cssText;let result="",inComment=!1;function addToResult(s){inComment||(result+=s)}for(let i=0,ii=cssText.length;i<ii;i++){let char=cssText.charAt(i);switch(char){case"/":i+1<ii&&"*"===cssText.charAt(i+1)&&(inComment=!0,i++),addToResult(char);break;case"*":addToResult(char),i+1<ii&&"/"===cssText.charAt(i+1)&&(inComment=!1,i++);break;case'"':case"'":const closeQuoteIndex=this.__findMatchingQuote(cssText,i);closeQuoteIndex>i&&(addToResult(cssText.substring(i,closeQuoteIndex+1)),i=closeQuoteIndex);break;default:addToResult(char)}}return result}__getExistingStyleOverwritesForSelector(existingStyleOverwrites,selector){let rulesets=existingStyleOverwrites;return rulesets[selector]||(rulesets[selector]={}),rulesets[selector]}getStyle(controlName,selector,propertyName){if(!selector){const tco=TcHmi.Controls.get(controlName);if(void 0!==tco&&0!==tco.getElement().length){if(null==propertyName)return;return[TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),propertyName)[propertyName]]}}selector=this.expandSelector(selector,controlName);let existingStyles=this.getExistingStyleOverwrites(controlName),existingStylesForSelector=this.__getExistingStyleOverwritesForSelector(existingStyles,selector);if(void 0!==existingStylesForSelector)return null!=propertyName?existingStylesForSelector[propertyName]:existingStylesForSelector}writeStyles(controlName,styles){let cssText=this.__serializeCss(styles),control=TcHmi.Controls.get(controlName);if(!control)return;let cacheEntry=this.__styleOverwriteCache.get(control);if(void 0===cacheEntry)cacheEntry=[{strClass:"tchmi-theme overwrite "+controlName,strCss:cssText,elementInHead:null}],this.__styleOverwriteCache.set(control,cacheEntry);else{let styleUpdated=!1;for(let i=0;i<cacheEntry.length;i++)if(-1!==cacheEntry[i].strClass.indexOf("overwrite")){cacheEntry[i].strCss=cssText,styleUpdated=!0;break}styleUpdated||cacheEntry.push({strClass:"tchmi-theme overwrite "+controlName,strCss:cssText,elementInHead:null})}for(let i=0;i<cacheEntry.length;i++)if(-1!==cacheEntry[i].strClass.indexOf("overwrite"))if(null===cacheEntry[i].elementInHead){if(!control||!control.getIsAttached()||!cacheEntry[i].strClass)continue;let styleElement=document.createElement("style");styleElement.className=cacheEntry[i].strClass,styleElement.appendChild(document.createTextNode(cacheEntry[i].strCss)),document.head.appendChild(styleElement),cacheEntry[i].elementInHead=styleElement}else cacheEntry[i].elementInHead.innerHTML=cacheEntry[i].strCss}__serializeCss(styles){let cssText="";function writeDeclarations(selector,declarations,indent=""){cssText+=indent+selector+" {\n";for(let property in declarations){const decl=declarations[property];if(declarations.hasOwnProperty(property)&&null!=decl&&"@-rules"!==property)if(selector.startsWith("@"))writeDeclarations(property,decl,indent+"\t");else for(let i=0,ii=decl.length;i<ii;i++)void 0!==decl[i]&&null!==decl[i]&&""!==decl[i]&&(cssText+=indent+"\t"+property+": "+decl[i]+";\n")}cssText+=indent+"}\n\n"}if(void 0!==styles["@-rules"])for(let i=0,ii=styles["@-rules"].length;i<ii;i++)cssText+=styles["@rules"][i]+";\n";cssText+="\n";for(let selector in styles)styles.hasOwnProperty(selector)&&void 0!==styles[selector]&&null!==styles[selector]&&"@-rules"!==selector&&0!==Object.keys(styles[selector]).length&&writeDeclarations(selector,styles[selector]);return cssText=cssText.trim(),cssText}expandSelector(selector,prefix){(prefix=tchmi_css_escape_selector(prefix)).startsWith(".")||prefix.startsWith("#")||(prefix="#"+prefix);let selectorParts=this.__splitOutsideOfBraces(selector,",",["(","["]);for(let i=0,ii=selectorParts.length;i<ii;i++)-1===selectorParts[i].indexOf(prefix)&&(-1===selectorParts[i].indexOf("%id%")?selectorParts[i]=prefix+" "+selectorParts[i]:selectorParts[i]=selectorParts[i].replace("%id%",prefix));return selectorParts.join(", ").trim()}__splitOutsideOfBraces(value,token,openingBraceChars=["("]){let startindex=0,res=[];for(let i=0,ii=value.length;i<ii;i++){let char=value.charAt(i);if(-1!==openingBraceChars.indexOf(char)){let closingBraceIndex=this.__findMatchingBrace(value,i);closingBraceIndex>i&&(i=closingBraceIndex)}else if('"'===char||"'"===char){let closingQuoteIndex=this.__findMatchingQuote(value,i);closingQuoteIndex>i&&(i=closingQuoteIndex)}else char===token&&(i>startindex&&res.push(value.substring(startindex,i).trim()),startindex=i+1)}return(0===value.length||startindex<value.length)&&res.push(value.substring(startindex).trim()),res}__findMatchingBrace(value,openBraceIndex){let openingBrace=value.charAt(openBraceIndex),closingBrace="";switch(openingBrace){case"(":closingBrace=")";break;case"{":closingBrace="}";break;case"[":closingBrace="]";break;case"<":closingBrace=">";break;default:return-1}let braceCounter=0;for(let i=openBraceIndex+1,ii=value.length;i<ii;i++)switch(value.charAt(i)){case openingBrace:braceCounter++;break;case closingBrace:if(0===braceCounter)return i;braceCounter--;break;case'"':case"'":const closingQuoteIndex=this.__findMatchingQuote(value,i);closingQuoteIndex>0&&(i=closingQuoteIndex)}return-1}__findMatchingQuote(value,openQuoteIndex){let quoteChar=value.charAt(openQuoteIndex);for(let i=openQuoteIndex+1,ii=value.length;i<ii;i++)switch(value.charAt(i)){case"\\":i++;break;case quoteChar:return i}return-1}processGenericStyle(controlName,selector,property,value=null){if(!selector){const tco=TcHmi.Controls.get(controlName);if(void 0!==tco&&0!==tco.getElement().length){if(null==property)return;return void TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),property,value)}}selector=this.expandSelector(selector,controlName);let existingStyles=this.getExistingStyleOverwrites(controlName),existingStylesForSelector=this.__getExistingStyleOverwritesForSelector(existingStyles,selector);if("string"==typeof property)"string"==typeof value?""===value?delete existingStylesForSelector[property]:existingStylesForSelector[property]=[value]:null===value?delete existingStylesForSelector[property]:existingStylesForSelector[property]=value;else if(null!=property)for(const key in property)if(property.hasOwnProperty(key)){const keyProperty=property[key];"string"==typeof keyProperty?""===keyProperty?delete existingStylesForSelector[key]:existingStylesForSelector[key]=[keyProperty]:null===keyProperty?delete existingStylesForSelector[key]:existingStylesForSelector[key]=keyProperty}this.writeStyles(controlName,existingStyles)}processBackground(element,valueNew){let styles={};if(valueNew){let hasImage=!1,hasGradient=!1,insertImage=()=>{let imageString=null,gradientString=null,existingStyle=TcHmi.StyleProvider.getSimpleElementStyle(element,"background-image")["background-image"],existingImages=[];if(void 0!==existingStyle&&(existingImages=this.__splitOutsideOfBraces(existingStyle,",")),void 0!==valueNew.image?imageString=null!==valueNew.image&&""!==valueNew.image?`url("${valueNew.image}")`:null:existingImages.length>0&&existingImages[0].startsWith("url(")&&(imageString=existingImages[0]),void 0!==valueNew.color)gradientString=null!==valueNew.color?TcHmi.isLinearGradientColor(valueNew.color)?TcHmi.StyleProvider.resolveLinearGradientColorAsCssValue(valueNew.color):"none":null;else if(existingImages.length>0){let existingGradient=existingImages.length>1?existingImages[1]:existingImages[0];(existingGradient.startsWith("linear-gradient(")||existingGradient.startsWith("radial-gradient("))&&(gradientString=existingGradient)}if(hasImage=null!==imageString,hasGradient=null!==gradientString&&"none"!==gradientString,null===imageString&&null===gradientString)existingImages.length>0&&(styles["background-image"]=null);else{let images=[];hasImage&&images.push(imageString),(hasGradient||"none"===gradientString&&!hasImage&&null!==styles["background-color"])&&images.push(gradientString),styles["background-image"]=images.length>0?images:null}},insertSize=()=>{if(hasImage){let width="auto",height="auto";if(void 0!==valueNew.imageWidth&&null!==valueNew.imageWidth&&(width=valueNew.imageWidth+(valueNew.imageWidthUnit||"px")),void 0!==valueNew.imageHeight&&null!==valueNew.imageHeight&&(height=valueNew.imageHeight+(valueNew.imageHeightUnit||"px")),void 0!==valueNew.imagePadding&&null!==valueNew.imagePadding){if("%"===valueNew.imageWidthUnit&&valueNew.imageWidth){let widthSubtractor="";valueNew.imagePadding.left>0&&(widthSubtractor+=" - "+valueNew.imagePadding.left*(valueNew.imageWidth?valueNew.imageWidth/100:1)+(valueNew.imagePadding.leftUnit||"px")),valueNew.imagePadding.right>0&&(widthSubtractor+=" - "+valueNew.imagePadding.right*(valueNew.imageWidth?valueNew.imageWidth/100:1)+(valueNew.imagePadding.rightUnit||"px")),""!==widthSubtractor&&(width=`calc(${width}${widthSubtractor})`)}if("%"===valueNew.imageHeightUnit&&valueNew.imageHeight){let heightSubtractor="";valueNew.imagePadding.top>0&&(heightSubtractor+=" - "+valueNew.imagePadding.top*(valueNew.imageHeight?valueNew.imageHeight/100:1)+(valueNew.imagePadding.topUnit||"px")),valueNew.imagePadding.bottom>0&&(heightSubtractor+=" - "+valueNew.imagePadding.bottom*(valueNew.imageHeight?valueNew.imageHeight/100:1)+(valueNew.imagePadding.bottomUnit||"px")),""!==heightSubtractor&&(height=`calc(${height}${heightSubtractor})`)}}styles["background-size"]=[width+" "+height],hasGradient&&styles["background-size"].push("auto auto")}else styles["background-size"]=null},insertPosition=()=>{if(hasImage){let posX="50%",posY="50%";switch(valueNew.imageHorizontalAlignment){case"Left":posX="0%";break;case"Center":posX="50%";break;case"Right":posX="100%"}switch(valueNew.imageVerticalAlignment){case"Top":posY="0%";break;case"Center":posY="50%";break;case"Bottom":posY="100%"}if(void 0!==valueNew.imagePadding&&null!==valueNew.imagePadding){let posXModifier="";valueNew.imagePadding.left>0&&"Right"!==valueNew.imageHorizontalAlignment&&(posXModifier+=" + "+valueNew.imagePadding.left*("Center"===valueNew.imageHorizontalAlignment?.5:1)+(valueNew.imagePadding.leftUnit||"px")),valueNew.imagePadding.right>0&&"Left"!==valueNew.imageHorizontalAlignment&&(posXModifier+=" - "+valueNew.imagePadding.right*("Center"===valueNew.imageHorizontalAlignment?.5:1)+(valueNew.imagePadding.rightUnit||"px")),""!==posXModifier&&(posX=`calc(${posX}${posXModifier})`);let posYModifier="";valueNew.imagePadding.top>0&&"Bottom"!==valueNew.imageVerticalAlignment&&(posYModifier+=" + "+valueNew.imagePadding.top*("Center"===valueNew.imageVerticalAlignment?.5:1)+(valueNew.imagePadding.topUnit||"px")),valueNew.imagePadding.bottom>0&&"Top"!==valueNew.imageVerticalAlignment&&(posYModifier+=" - "+valueNew.imagePadding.bottom*("Center"===valueNew.imageVerticalAlignment?.5:1)+(valueNew.imagePadding.bottomUnit||"px")),""!==posYModifier&&(posY=`calc(${posY}${posYModifier})`)}styles["background-position"]=[posX+" "+posY],hasGradient&&styles["background-position"].push("50% 50%")}else styles["background-position"]=null},insertCssImageProp=(name,value)=>{hasImage?(styles[name]=[value],hasGradient&&styles[name].push(value)):styles[name]=null};(()=>{if(void 0!==valueNew.color)if(TcHmi.isSolidColor(valueNew.color)){let resolvedColor=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew.color);styles["background-color"]=null!==resolvedColor?[resolvedColor]:null}else styles["background-color"]=null})(),insertImage(),insertSize(),insertPosition(),insertCssImageProp("background-repeat","no-repeat"),insertCssImageProp("background-attachment","scroll"),insertCssImageProp("background-clip","border-box"),insertCssImageProp("background-origin","padding-box")}else{let names=["color","image","size","position","repeat","origin","clip","attachment"];for(let i=0,ii=names.length;i<ii;i++)styles["background-"+names[i]]=null}let stylesToWrite={};for(let key in styles)if(styles.hasOwnProperty(key)){const style=styles[key];stylesToWrite[key]=style?style.join(", "):null}TcHmi.StyleProvider.setSimpleElementStyle(element,stylesToWrite)}processFillColor(element,valueNew){let SvgElements;if(element&&"object"==typeof element){if(void 0!==element.length){if(!element[0])return;SvgElements=element}else SvgElements=[element];for(let elemenCounter=0,elemLength=SvgElements.length;elemenCounter<elemLength;elemenCounter++){const SvgElement=SvgElements[elemenCounter];if(!(SvgElement instanceof SvgElement.ownerDocument.defaultView.SVGElement))continue;let defsParent=SvgElement.ownerSVGElement||SvgElement,defs=defsParent.querySelector("defs");if(defs){let oldId="",oldFill=TcHmi.StyleProvider.getSimpleElementStyle(SvgElement,"fill").fill;if(oldFill){oldId=oldFill.replace(/url\('?"?\#|'?"?\)/g,"");let currentGradientList=defs.querySelectorAll("linearGradient.tchmi-styleprovider-linear-gradient");for(let iterator=0;iterator<currentGradientList.length;iterator++){let currentGradient=currentGradientList[iterator];if(oldId===currentGradient.id){currentGradient.parentElement.removeChild(currentGradient);break}}}}else TcHmi.isLinearGradientColor(valueNew)&&(defs=SvgElement.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),defsParent.insertBefore(defs,defsParent.firstElementChild));if(valueNew){if(TcHmi.isSolidColor(valueNew))SvgElement.style.fill=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew);else if(TcHmi.isLinearGradientColor(valueNew)){let gradientColor=valueNew,gradient=SvgElement.ownerDocument.createElementNS("http://www.w3.org/2000/svg","linearGradient");gradient.setAttribute("x1","0"),gradient.setAttribute("y1","1"),gradient.setAttribute("x2","0"),gradient.setAttribute("y2","0"),gradient.classList.add("tchmi-styleprovider-linear-gradient"),gradient.id="tchmi-styleprovider-"+tchmi_create_guid(),gradient.setAttribute("gradientTransform","rotate("+gradientColor.angle+", 0.5, 0.5)");for(let i=0,ii=gradientColor.stopPoints.length;i<ii;i++){let stopPoint=gradientColor.stopPoints[i];if(void 0===stopPoint.stop||null===stopPoint.stop)if(0===i)stopPoint.stop="0%";else if(i===ii-1)stopPoint.stop="100%";else{let previous=0;gradientColor.stopPoints[i-1].stop&&(previous=parseFloat(gradientColor.stopPoints[i-1].stop));let j,next=null;for(j=i+1;j<gradientColor.stopPoints.length;j++){let localStop=gradientColor.stopPoints[j].stop;if(null!=localStop){next=parseFloat(localStop);break}}null===next&&(next=100,j--);let unit="";gradientColor.stopPoints[i-1].stop&&(unit=gradientColor.stopPoints[i-1].stop.replace(/[0-9\.]/g,"")),stopPoint.stop=previous+(next-previous)/(j-i)+unit}let stop=document.createElementNS("http://www.w3.org/2000/svg","stop");stop.setAttribute("offset",stopPoint.stop),stop.setAttribute("stop-color",stopPoint.color),gradient.appendChild(stop)}null==defs||defs.appendChild(gradient),SvgElement.style.fill="url(#"+gradient.id+")"}}else SvgElement.style.fill=""}}}processStrokeColor(element,valueNew){TcHmi.isSolidColor(valueNew)?TcHmi.StyleProvider.setSimpleElementStyle(element,"stroke",TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew)):TcHmi.StyleProvider.setSimpleElementStyle(element,"stroke",null)}processTextColor(element,valueNew){TcHmi.isSolidColor(valueNew)?TcHmi.StyleProvider.setSimpleElementStyle(element,"color",TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew)):TcHmi.StyleProvider.setSimpleElementStyle(element,"color",null)}processBorderColor(element,valueNew){let styles={};if(TcHmi.isSolidColor(valueNew))styles["border-color"]=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew),styles["border-image-source"]=null,styles["border-image-slice"]=null;else if(TcHmi.isLinearGradientColor(valueNew))styles["border-image-source"]=TcHmi.StyleProvider.resolveLinearGradientColorAsCssValue(valueNew),styles["border-image-slice"]="1",styles["border-color"]=null;else{let names=["color","image","image-source","image-slice"];for(let i=0,ii=names.length;i<ii;i++)styles["border-"+names[i]]=null}TcHmi.StyleProvider.setSimpleElementStyle(element,styles)}processBorderWidth(element,valueNew){const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value=valueNew[sides[i]];newCss["border-"+sides[i]+"-width"]=null==value?"":value+"px"}else newCss["border-"+sides[i]+"-width"]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBorderRadius(element,valueNew){const sides=["topLeft","topRight","bottomRight","bottomLeft"],cssSides=["top-left","top-right","bottom-right","bottom-left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value=valueNew[sides[i]],unit=valueNew[sides[i]+"Unit"];unit=unit||"px",newCss[`border-${cssSides[i]}-radius`]=null==value?"":value+unit}else newCss[`border-${cssSides[i]}-radius`]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBorderStyle(element,valueNew){const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++)if(valueNew){let value,originalValue=valueNew[sides[i]];switch(originalValue){case"Solid":case"Dotted":case"Dashed":case"None":value=originalValue.toLowerCase();break;default:value=""}newCss[`border-${sides[i]}-style`]=value}else newCss[`border-${sides[i]}-style`]="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processBoxShadow(element,valueNew){if(valueNew)if(0===valueNew.length)TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow","none");else{let shadows=[];for(let i=0,ii=valueNew.length;i<ii;i++){let shadow="";valueNew[i].inset&&(shadow+="inset "),valueNew[i].offsetX?shadow+=valueNew[i].offsetX+(valueNew[i].offsetXUnit||"px")+" ":shadow+="0px ",valueNew[i].offsetY?shadow+=valueNew[i].offsetY+(valueNew[i].offsetYUnit||"px")+" ":shadow+="0px ",valueNew[i].blur?shadow+=valueNew[i].blur+(valueNew[i].blurUnit||"px")+" ":shadow+="0px ",valueNew[i].spread?shadow+=valueNew[i].spread+(valueNew[i].spreadUnit||"px")+" ":shadow+="0px ",TcHmi.isSolidColor(valueNew[i].color)?shadow+=TcHmi.StyleProvider.resolveSolidColorAsCssValue(valueNew[i].color):shadow+="transparent",shadows.push(shadow)}TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow",shadows.join(", "))}else TcHmi.StyleProvider.setSimpleElementStyle(element,"box-shadow",null)}processFontFamily(element,valueNew){TcHmi.StyleProvider.setSimpleElementStyle(element,"font-family",valueNew)}processFontSize(element,valueNew,unitNew){null==valueNew?TcHmi.StyleProvider.setSimpleElementStyle(element,"font-size",null):TcHmi.StyleProvider.setSimpleElementStyle(element,"font-size",valueNew+unitNew)}processFontStyle(element,valueNew){let value;switch(valueNew){case"Normal":case"Italic":case"Oblique":value=valueNew.toLowerCase();break;case"Auto":default:value=null}TcHmi.StyleProvider.setSimpleElementStyle(element,"font-style",value)}processFontWeight(element,valueNew){let value;switch(valueNew){case"Normal":case"Bold":value=valueNew.toLowerCase();break;case"Auto":default:value=null}TcHmi.StyleProvider.setSimpleElementStyle(element,"font-weight",value)}processVisibility(element,valueNew){let newCss={};switch(valueNew){case"Collapsed":newCss.display="none",newCss.visibility="";break;case"Hidden":newCss.display="",newCss.visibility="hidden";break;case"Visible":default:newCss.display="",newCss.visibility=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentHorizontalAlignment(element,valueNew){let newCss={};switch(valueNew){case"Center":newCss.display="flex",newCss["justify-content"]="center";break;case"Right":newCss.display="flex",newCss["justify-content"]="flex-end";break;case"Left":newCss.display="flex",newCss["justify-content"]="flex-start";break;default:newCss.display="",newCss["justify-content"]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentVerticalAlignment(element,valueNew){let newCss={};switch(valueNew){case"Center":newCss.display="flex",newCss["align-items"]="center";break;case"Bottom":newCss.display="flex",newCss["align-items"]="flex-end";break;case"Top":newCss.display="flex",newCss["align-items"]="flex-start";break;default:newCss.display="",newCss["align-items"]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processContentPadding(element,valueNew){var _a;const sides=["top","right","bottom","left"];let newCss={};for(let i=0,ii=sides.length;i<ii;i++){const valueToWrite=null==valueNew?void 0:valueNew[sides[i]];if(valueToWrite){let value=valueToWrite,unit=null!==(_a=null==valueNew?void 0:valueNew[sides[i]+"Unit"])&&void 0!==_a?_a:"px";newCss["padding-"+sides[i]]=null==value?"":value+unit}else newCss["padding-"+sides[i]]=""}TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}processTransform(element,valueNew,order){var _a,_b;let newCss={};if(void 0===order&&(newCss={"transform-origin":"","-webkit-transform-origin":"",perspective:"","-webkit-perspective":"","perspective-origin":"","-webkit-perspective-origin":""}),valueNew){let newTransforms;newTransforms=Array.isArray(valueNew)?valueNew:[valueNew];let newTransformStrings=[];for(let i=0,ii=newTransforms.length;i<ii;i++){let transformString="",newTransform=newTransforms[i];switch(newTransform.transformType){case"Translate":newTransform.x=newTransform.x||0,newTransform.xUnit=newTransform.xUnit||"px",newTransform.y=newTransform.y||0,newTransform.yUnit=newTransform.yUnit||"px",newTransform.z=newTransform.z||0,newTransform.zUnit=newTransform.zUnit||"px",transformString="translate3d("+newTransform.x+newTransform.xUnit+", "+newTransform.y+newTransform.yUnit+", "+newTransform.z+newTransform.zUnit+")";break;case"Rotate":transformString=void 0===newTransform.vector?"rotate(":`rotate3d(${newTransform.vector.x}, ${newTransform.vector.y}, ${newTransform.vector.z}, `,transformString+=newTransform.angle+(void 0!==newTransform.angleUnit?newTransform.angleUnit:"deg"),transformString+=")";break;case"Scale":transformString="scale3d(",transformString+=(void 0!==newTransform.x?newTransform.x:1)+", ",transformString+=(void 0!==newTransform.y?newTransform.y:1)+", ",transformString+=void 0!==newTransform.z?newTransform.z:1,transformString+=")";break;case"Skew":const angles=[null!==(_a=newTransform.xAngle)&&void 0!==_a?_a:0,null!==(_b=newTransform.yAngle)&&void 0!==_b?_b:0],angleUnits=[newTransform.xAngleUnit,newTransform.xAngleUnit];for(let j=0,jj=angles.length;j<jj;j++)switch(angleUnits[j]){case"grad":angles[j]=angles[j]*(Math.PI/200);break;case"turn":angles[j]=angles[j]*(Math.PI/.5);break;case"rad":break;case"deg":default:angles[j]=angles[j]*(Math.PI/180)}transformString=`matrix(1, ${Math.tan(angles[1])}, ${Math.tan(angles[0])}, 1, 0, 0)`;break;case"Origin":void 0===newTransform.x&&(newTransform.x=50,newTransform.xUnit="%"),void 0===newTransform.y&&(newTransform.y=50,newTransform.yUnit="%"),void 0===newTransform.z&&(newTransform.z=0,newTransform.zUnit=void 0),newCss["-webkit-transform-origin"]=newTransform.x+(void 0!==newTransform.xUnit?newTransform.xUnit:"px")+" "+newTransform.y+(void 0!==newTransform.yUnit?newTransform.yUnit:"px")+" "+newTransform.z+(void 0!==newTransform.zUnit?newTransform.zUnit:"px"),newCss["transform-origin"]=newCss["-webkit-transform-origin"];break;case"Perspective":newCss["-webkit-perspective"]=newTransform.distance+(void 0!==newTransform.distanceUnit?newTransform.distanceUnit:"px"),newCss.perspective=newCss["-webkit-perspective"],void 0!==newTransform.origin&&(void 0===newTransform.origin.x&&(newTransform.origin.x=50,newTransform.origin.xUnit="%"),void 0===newTransform.origin.y&&(newTransform.origin.y=50,newTransform.origin.yUnit="%"),newCss["-webkit-perspective-origin"]=newTransform.origin.x+(void 0!==newTransform.origin.xUnit?newTransform.origin.xUnit:"px")+" "+newTransform.origin.y+(void 0!==newTransform.origin.yUnit?newTransform.origin.yUnit:"px"),newCss["perspective-origin"]=newCss["-webkit-perspective-origin"])}newTransformStrings.push(transformString)}newCss["-webkit-transform"]=newTransformStrings.join(" "),newCss.transform=newCss["-webkit-transform"]}else newCss["-webkit-transform"]="",newCss.transform="";TcHmi.StyleProvider.setSimpleElementStyle(element,newCss)}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Type;!function(Type){class SharedCache{}SharedCache.Raw=new Map,SharedCache.Resolved=new Map,Type.SharedCache=SharedCache;Type.TypeManager=class{constructor(){this.__error=TcHmi.Errors.NONE,this.__watching=!1,this.__subscrId=null,this.__subscrCommands=[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"general"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"framework"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"server"}},{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"GetDefinitions",writeValue:{resolve:"None",type:"project"}}],this.__hasCalledInitCallbackOnce=!1,this.__typesInitializing={general:!0,server:!0,framework:!0,project:!0},TcHmi.EventProvider.register("onWebSocketOpened",this.__onWebSocketOpened()),TcHmi.EventProvider.register("onWebSocketClosed",this.__onWebSocketClosed())}__onWebSocketOpened(){let __this=this;return function(event,data){!0===__this.__hasCalledInitCallbackOnce&&__this.__error!==TcHmi.Errors.NONE&&(__this.__error=TcHmi.Errors.NONE,__this.doWatchSchemaDefinitions())}}__onWebSocketClosed(){let __this=this;return function(event,data){__this.__error=TcHmi.Errors.E_WEBSOCKET_NOT_READY}}__cacheRawSchemaDefinitions(rv,filename){void 0!==rv.definitions&&SharedCache.Raw.set(filename,rv)}__processGetDefinitionsResponse(data){if(this.__error!==TcHmi.Errors.NONE)return{code:this.__error,message:TcHmi.Errors[this.__error],domain:"TcHmi.System.Type.TypeManager"};if(!data)return{code:TcHmi.Errors.ERROR,reason:"Failed to resolve types due to invalid response. Missing data.",domain:"TcHmi.System.Type.TypeManager"};if(data.error!==TcHmi.Errors.NONE)return data.details?data.details:{code:data.error};let response=data.response;if(!response)return{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:"TcHmi.System.Type.TypeManager"};if(response.error)return{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,reason:"Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Type.TypeManager",errors:[response.error]};let commands=response.commands;if(!commands)return{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Type.TypeManager"};let bUpdateCase=!(Object.keys(this.__typesInitializing).length>0);for(let i=0,ii=commands.length;i<ii;i++){let command=commands[i];if(!command)return{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:"Missing command for symbol: 'GetDefinitions' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Type.TypeManager"};if(command.error)return{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,reason:"Error in command for symbol: 'GetDefinitions' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Type.TypeManager",errors:[command.error]};let wv=command.writeValue;if(!wv){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Type.TypeManager] Failed to resolve type due to invalid response command for symbol="+command.symbol+". Missing writeValue property.");continue}if(!wv.type){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Type.TypeManager] Failed to resolve type due to invalid response command for symbol="+command.symbol+". Missing type property in writeValue.");continue}let rv=command.readValue;if(rv)switch(wv.type){case"general":this.__cacheRawSchemaDefinitions(rv,wv.type),delete this.__typesInitializing.general;break;case"framework":this.__cacheRawSchemaDefinitions(rv,wv.type),delete this.__typesInitializing.framework;break;case"server":this.__cacheRawSchemaDefinitions(rv,wv.type),delete this.__typesInitializing.server;break;case"project":this.__cacheRawSchemaDefinitions(rv,wv.type),delete this.__typesInitializing.project}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Type.TypeManager] Failed to resolve types for namespace="+wv.type+" due to invalid response command for symbol="+command.symbol+". Missing readValue property.")}let missingTypes=Object.keys(this.__typesInitializing);if(missingTypes.length>0)return{code:TcHmi.Errors.ERROR,reason:"Failed to resolve type definitions for namespace="+missingTypes.join(", "),domain:"TcHmi.System.Type.TypeManager"};if(bUpdateCase){let toResolve=[];SharedCache.Resolved.forEach((value,key)=>{toResolve.push(key)}),SharedCache.Resolved.clear();for(let i=0,ii=toResolve.length;i<ii;i++){let typeId=toResolve[i],res=this.getSchemaEx(typeId);res.error===TcHmi.Errors.NONE&&(TcHmi.EventProvider.raise("System.onTypeDefinitionChanged<"+typeId+">",{typeId:typeId,typeSchema:res.schema}),TcHmi.EventProvider.raise("System.onTypeDefinitionChanged",{typeId:typeId,typeSchema:res.schema}))}}return{code:TcHmi.Errors.NONE}}doWatchSchemaDefinitions(callback){if(this.__watching)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,reason:"Multiple calls to watch for type definition change detected.",domain:"TcHmi.System.Type.TypeManager"}});if(!1===TcHmi.Server.isWebsocketReady())return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,reason:"Websocket connection not ready.",domain:"TcHmi.System.Type.TypeManager"}});let __this=this,interval=5e3;TCHMI_ENGINEERING&&(interval=1e3),this.__watching=!0,this.__subscrId=TcHmi.Server.subscribeEx(this.__subscrCommands,interval,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},(function(data){let error=__this.__processGetDefinitionsResponse(data);__this.__hasCalledInitCallbackOnce||(TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}),__this.__hasCalledInitCallbackOnce=!0)}))}doForceSchemaDefinitions(callback){let __this=this;TcHmi.Server.requestEx({requestType:"ReadWrite",commands:this.__subscrCommands},{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},(function(data){let error=__this.__processGetDefinitionsResponse(data);TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error})}))}getSchema(id){let res=this.getSchemaEx(id);return res.error===TcHmi.Errors.NONE&&res.schema?res.schema:null}getSchemaEx(id){let res;try{res=Schema.Helper.__resolveRawSchemaDefinition(id,null,new Map)}catch(e){res={error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the resolving datatype schema",exception:e,domain:"TcHmi.System.Type.TypeManager"}}}return res}};class Schema{static resolveRefs(schema,filename){return filename||(filename=null),Schema.Helper.__resolveRawSchema(schema,filename,new Map).schema}static resolveType(schema){if(schema.convert)return;let schemaType=schema.type;if(!schemaType){let schemaOf=schema.oneOf;if(schemaOf||(schemaOf=schema.anyOf),schemaOf){schemaType=[];for(let i=0,ii=schemaOf.length;i<ii;i++){let s=schemaOf[i];if(!s.convert){let type2=Schema.resolveType(s);if(Array.isArray(type2))for(let j=0,jj=type2.length;j<jj;j++)-1===schemaType.indexOf(type2[j])&&schemaType.push(type2[j]);else type2&&-1===schemaType.indexOf(type2)&&schemaType.push(type2)}}0===schemaType.length?schemaType=void 0:1===schemaType.length&&(schemaType=schemaType[0])}else schemaType=["string","number","object","boolean","integer","array","null"]}return schemaType}static resolveTypeConversionRules(schema){let res=new Map;if(schema.type&&"string"==typeof schema.type){let schemaConvert=schema.convert;schemaConvert&&res.set(schema.type,{convert:schemaConvert,enum:schema.enum})}else if(schema.type&&Array.isArray(schema.type)){let schemaConvert=schema.convert;if(schemaConvert)for(let i=0,ii=schema.type.length;i<ii;i++)res.set(schema.type[i],{convert:schemaConvert,enum:schema.enum})}else{let schemaOf=schema.oneOf;if(schemaOf||(schemaOf=schema.anyOf),schemaOf)for(let i=0,ii=schemaOf.length;i<ii;i++){let rules=Schema.resolveTypeConversionRules(schemaOf[i]);rules&&rules.forEach((value,key)=>{res.set(key,value)})}else{let schemaType=["string","number","object","boolean","integer","array","null"],schemaConvert=schema.convert;if(schemaConvert)for(let i=0,ii=schemaType.length;i<ii;i++)res.set(schemaType[i],{convert:schemaConvert,enum:schema.enum})}}return res}static resolveDefault(schema){if(!schema)return null;let targetType,rules=Schema.resolveTypeConversionRules(schema);if(schema.default)return tchmi_clone_object(TcHmi.ValueConverter.toSchemaType(schema.default,schema));if(schema.type)if(Array.isArray(schema.type)){let firstType=schema.type[0];firstType&&(targetType=firstType)}else targetType=schema.type;if(targetType&&rules){let targetRule=rules.get(targetType);targetRule&&targetRule.convert&&(targetType=targetRule.convert)}switch(targetType){case"object":{let res={},properties=schema.properties;if(properties)for(let property in properties){let propertySchema=properties[property];res[property]=Schema.resolveDefault(propertySchema)}return res}case"array":{let res=[],items=schema.items;if(items&&schema.minItems){let itemSchema;itemSchema=Array.isArray(items)?items[0]:items;let value=Schema.resolveDefault(itemSchema);for(let i=0;i<schema.minItems;i++)res.push(value)}return res}case"string":return"";case"integer":case"number":return 0;case"boolean":return!1}return schema.oneOf?Schema.resolveDefault(schema.oneOf[0]):schema.anyOf?Schema.resolveDefault(schema.anyOf[0]):null}}Type.Schema=Schema,function(Schema){class Helper{static __resolveRawSchemaDefinitionPart(obj,filename,path,$refPath){filename?$refPath.set("tchmi:"+filename+"#"+path,null):$refPath.set("#"+path,null);let keys=Object.keys(obj);for(let i=0,ii=keys.length;i<ii;i++){let key=keys[i],prop=obj[key];if(key&&prop){if("$ref"===key){let resolvedSchema,bAbort=!1;if($refPath.has(prop))bAbort=!0;else if(0===prop.indexOf("#")){let propPathSanitized="tchmi:"+filename+prop;$refPath.has(propPathSanitized)&&(bAbort=!0)}if(bAbort)return resolvedSchema=obj,{error:TcHmi.Errors.NONE,part:resolvedSchema};if(SharedCache.Resolved.has(prop)&&(resolvedSchema=SharedCache.Resolved.get(prop)),!resolvedSchema){let $refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)});let res=this.__resolveRawSchemaDefinition(prop,filename,$refPathNew);if(!res||res.error!==TcHmi.Errors.NONE)return res;resolvedSchema=res.schema}let clone=tchmi_clone_object(resolvedSchema);return clone.id=prop,{error:TcHmi.Errors.NONE,part:clone}}if("allOf"===key){let resolvedSchema={};for(let i=0,ii=prop.length;i<ii;i++){let entry=prop[i],$refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)});let newPath=path+"/allOf/"+i;$refPathNew.set("tchmi:"+filename+"#"+path,null);let res=this.__resolveRawSchemaDefinitionPart(entry,filename,newPath,$refPathNew);if(res.error!==TcHmi.Errors.NONE||!res.part)return res;let partKeys=Object.keys(res.part);for(let j=0,jj=partKeys.length;j<jj;j++){let key=partKeys[j];resolvedSchema[key]=res.part[key]}}return{error:TcHmi.Errors.NONE,part:resolvedSchema}}if("object"==typeof prop){let $refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)});let newPath=path+"/"+key;$refPathNew.set("tchmi:"+filename+"#"+path,null);let res=this.__resolveRawSchemaDefinitionPart(prop,filename,newPath,$refPathNew);if(res.error!==TcHmi.Errors.NONE)return res;obj[key]=res.part}}}return{error:TcHmi.Errors.NONE,part:obj}}static __resolveRawSchemaDefinition(id,filename,$refPath){let schema=SharedCache.Resolved.get(id);if(schema)return{error:TcHmi.Errors.NONE,schema:schema};if(id.startsWith("tchmi:")){let sharpIndex=id.indexOf("#");if(-1===sharpIndex)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:"Reference id: '"+id+"' is not valid. Missing '#'.",domain:"TcHmi.System.Type.TypeManager"}};let filename=id.substr(6,sharpIndex-6);if(!filename)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:"Reference id: '"+id+"' is not valid. Missing name of file between 'tchmi:' and '#'.",domain:"TcHmi.System.Type.TypeManager"}};let file=SharedCache.Raw.get(filename);if(!file)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE],reason:"Can't find file for filename: '"+filename+"' like targeted within ref: '"+id+"'.",domain:"TcHmi.System.Type.TypeManager"}};let path=id.substr(sharpIndex+2,id.length-sharpIndex+2),pathTokens=path.split("/"),rawSchemaByPath=file;for(let i=0;i<pathTokens.length&&rawSchemaByPath;i++){rawSchemaByPath=rawSchemaByPath[pathTokens[i]]}if(!rawSchemaByPath)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:"Can't find definition for path: '"+path+"' in file: '"+filename+"' like targeted within ref: '"+id+"'.",domain:"TcHmi.System.Type.TypeManager"}};let rawSchemaByPathClone=tchmi_clone_object(rawSchemaByPath),$refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)}),$refPathNew.set(id,null);let res=Helper.__resolveRawSchemaDefinitionPart(rawSchemaByPathClone,filename,"/"+path,$refPathNew);return res.error===TcHmi.Errors.NONE&&res.part?(res.part.id=id,SharedCache.Resolved.set(id,res.part),{error:TcHmi.Errors.NONE,schema:res.part}):res}if(id.startsWith("#")&&filename){let sharpIndex=id.indexOf("#");if(-1===sharpIndex)return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:"Reference id: '"+id+"' is not valid. Missing '#'.",domain:"TcHmi.System.Type.TypeManager"}};let file=SharedCache.Raw.get(filename);if(!file)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_FILE],reason:"Can't find file for filename: '"+filename+"' like targeted within ref: '"+id+"'.",domain:"TcHmi.System.Type.TypeManager"}};let path=id.substr(sharpIndex+2,id.length-sharpIndex+2),pathTokens=path.split("/"),rawSchemaByPath=file;for(let i=0;i<pathTokens.length&&rawSchemaByPath;i++){rawSchemaByPath=rawSchemaByPath[pathTokens[i]]}if(!rawSchemaByPath)return{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:"Can't find definition for path: '"+path+"' in file: '"+filename+"' like targeted within ref: '"+id+"'.",domain:"TcHmi.System.Type.TypeManager"}};let rawSchemaByPathClone=tchmi_clone_object(rawSchemaByPath),newId=file.id+id.replace("#","/");newId=newId.replace(/\/\//g,"/"),rawSchemaByPathClone.id=newId;let $refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)}),$refPathNew.set(id,null);let res=Helper.__resolveRawSchemaDefinitionPart(rawSchemaByPathClone,filename,"/"+path,$refPathNew);return res.error===TcHmi.Errors.NONE&&res.part?{error:TcHmi.Errors.NONE,schema:res.part}:res}return{error:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_REF_ID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_REF_ID],reason:"Reference id: '"+id+"' is not valid.",domain:"TcHmi.System.Type.TypeManager"}}}static __resolveRawSchema(schema,filename,$refPath){let schemaClone=tchmi_clone_object(schema),$refPathNew=new Map;$refPath.forEach((value,key)=>{$refPathNew.set(key,value)});let res=Helper.__resolveRawSchemaDefinitionPart(schemaClone,filename,"",$refPathNew);return res.error===TcHmi.Errors.NONE&&res.part?(filename&&res.part&&res.part.id&&-1===res.part.id.indexOf("tchmi:")&&(res.part.id="tchmi:"+filename+res.part.id),{error:TcHmi.Errors.NONE,schema:res.part}):res}}Schema.Helper=Helper}(Schema=Type.Schema||(Type.Schema={}))}(Type=System.Type||(System.Type={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){let SymbolState;!function(SymbolState){SymbolState[SymbolState.Invalid=0]="Invalid",SymbolState[SymbolState.Ready=10]="Ready",SymbolState[SymbolState.Destroyed=20]="Destroyed"}(SymbolState=System.SymbolState||(System.SymbolState={}));class Symbol{constructor(expression){if(this.__diagGUID="",this.__state=SymbolState.Invalid,this.__schema=null,this.__destroyTypeDefinitionChanged=null,TCHMI_CONSOLE_LOG_LEVEL>=4&&(this.__diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, ObjectScopeDiagGUID="+this.__diagGUID+"] constructor called with:",{expression:expression}),this.__expression=new TcHmi.SymbolExpression(expression),this.__expression.getType()===TcHmi.SymbolType.Invalid){let message="Expression: '"+expression+"' is not a valid symbol expression.";throw TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+expression+", ObjectScopeDiagGUID="+this.__diagGUID+"] constructor failed with: "+message),new SyntaxError(message)}this.__state=SymbolState.Ready}static resolveServerSymbolSchemaCache(callback){let __this=this;TcHmi.Server.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:"ListSymbols"}]},null,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error!==TcHmi.Errors.NONE)TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details});else if(data.results&&data.results.length){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,__this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})},success:data=>{let rv=data.results[0].value;if(rv){for(let symbol in rv){let SCHEMA=rv[symbol].SCHEMA;if(SCHEMA){let res=TcHmi.System.Type.Schema.Helper.__resolveRawSchema(SCHEMA,null,new Map);res.error===TcHmi.Errors.NONE&&(__this.__SERVER_SYMBOL_SCHEMA_CACHE[symbol]=res.schema)}}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING,details:{code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],reason:"ListSymbols has no valid content.",domain:"TcHmi.System.Symbol"}})}}))}__onTypeDefinitionChanged(){let __this=this;return function(e,data){__this.__schema=null;let rootSchema=TcHmi.System.Services.typeManager.getSchema(data.typeId);rootSchema&&__this.resolveSubSchema(rootSchema,__this.__expression.getPathTokens(),(function(data){data.error===TcHmi.Errors.NONE&&data.schema&&(__this.__schema=tchmi_clone_object(data.schema))}))}}getExpression(){return this.__expression}getState(){return this.__state}isDestroyed(){return this.__state===SymbolState.Destroyed}isReady(){return this.__state===SymbolState.Ready}isProcessedAsync(){const symbolType=this.__expression.getType();if(symbolType===TcHmi.SymbolType.Server)return!0;if(symbolType===TcHmi.SymbolType.Function){const content=this.__expression.getContent();if(!content)return!1;const fnc=new System.FunctionExpression(content),result=fnc.isProcessedAsync();return fnc.destroy(),result}return!1}destroy(){if(this.isDestroyed())return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called and aborted because object is already marked as destroyed."));let diagExpression=this.__expression.toString();TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+diagExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy called."),this.__destroyTypeDefinitionChanged&&(this.__destroyTypeDefinitionChanged(),this.__destroyTypeDefinitionChanged=null),this.__state=SymbolState.Destroyed,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+diagExpression+", ObjectScopeDiagGUID="+this.__diagGUID+"] destroy finished.")}__readSubValue(obj,pathTokens,callback){if(!obj||"object"!=typeof obj)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because current value is not a valid object. Are all default values and written values valid for this schema?",domain:"TcHmi.System.Symbol"}});let p=obj,pTokens=tchmi_clone_object(pathTokens),pathDone="",pToken=pTokens.shift();for(;;){let isArrayToken=!1;if(pToken&&pToken.startsWith("[")&&pToken.endsWith("]")&&(isArrayToken=!0,pToken=pToken.replace("[","").replace("]","")),!pToken||void 0===p[pToken])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because the token: '"+pToken+"' does not exist below path: '"+this.__expression.getName()+pathDone+"' in current value.",domain:"TcHmi.System.Symbol"}});if(!(pTokens.length>0))break;p=p[pToken],pathDone+=isArrayToken?"["+pToken+"]":"::"+pToken,pToken=pTokens.shift()}void 0!==p[pToken]?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:p[pToken]}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because the token: '"+pToken+"' does not exist below path: '"+this.__expression.getName()+pathDone+"' in current value.",domain:"TcHmi.System.Symbol"}})}__writeSubValue(obj,value,pathTokens,callback){if(!obj||"object"!=typeof obj)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because current value is not a valid object. Are all default values and written values valid for this schema?",domain:"TcHmi.System.Symbol"}});let p=obj,pTokens=tchmi_clone_object(pathTokens),pathDone="",pToken=pTokens.shift();for(;;){let isArrayToken=!1;if(pToken&&pToken.startsWith("[")&&pToken.endsWith("]")&&(isArrayToken=!0,pToken=pToken.replace("[","").replace("]","")),!pToken||void 0===p[pToken])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because the token: '"+pToken+"' does not exist below path: '"+this.__expression.getName()+pathDone+"' in current value.",domain:"TcHmi.System.Symbol"}});if(!(pTokens.length>0))break;p=p[pToken],pathDone+=isArrayToken?"["+pToken+"]":"::"+pToken,pToken=pTokens.shift()}void 0!==p[pToken]?(p[pToken]=value,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Failed to read value by path because the token: '"+pToken+"' does not exist below path: '"+this.__expression.getName()+pathDone+"' in current value.",domain:"TcHmi.System.Symbol"}})}resolveSubSchema(schema,pathTokens,callback){let res=schema,pathDone="";if(!pathTokens||0===pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:res});if(null==res||"object"!=typeof res)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID],reason:this.__expression.toString()+": Failed to read schema because there is no valid schema.",domain:"TcHmi.System.Symbol"}});let pTokens=tchmi_clone_object(pathTokens);for(;pTokens.length>0;){let pToken=pTokens.shift();if(res&&"TcHmi.Controls.System.TcHmiControl"===res.frameworkInstanceOf)if(res.frameworkUserControlConfig){let attr=TcHmi.System.Services.controlManager.getUserControlConfigAttributeByPropertyName(res.frameworkUserControlConfig,pToken);if(!attr){res=null;break}if(res=TcHmi.Type.getSchema(attr.type),0===pTokens.length)break}else{let attr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertyName(res.frameworkControlType,pToken);if(!attr){res=null;break}if(res=TcHmi.Type.getSchema(attr.type),0===pTokens.length)break}if(res&&"TcHmi.Controls.System.TcHmiControl"===res.frameworkInstanceOf)continue;let pTokenTokens=[],chars=pToken.split(""),idx=0;for(;chars.length>0;){let c=chars.shift();"["===c&&void 0!==pTokenTokens[idx]&&pTokenTokens[idx].length>0&&idx++,void 0===pTokenTokens[idx]&&(pTokenTokens[idx]=""),pTokenTokens[idx]=pTokenTokens[idx]+c,"]"===c&&idx++}let bHit=!1;for(;pTokenTokens.length>0;){let pTokenToken=pTokenTokens.shift();if(pTokenToken.match(/\[*.\]/g)){if(res&&void 0!==res.items&&"object"==typeof res.items&&!Array.isArray(res.items)){res=res.items,bHit=!0,pathDone+="["+pToken+"]";continue}}else if(res&&void 0!==res.properties&&"object"==typeof res.properties&&!1===Array.isArray(res.properties)){if(void 0!==res.properties[pTokenToken]){res=res.properties[pTokenToken],bHit=!0,pathDone+="::"+pToken;continue}}else{if(res&&!0===res.additionalProperties&&!res.patternProperties){res=TcHmi.Type.getSchema("tchmi:general#/definitions/Any"),bHit=!0,pathDone+="::"+pToken;continue}if(res&&res.patternProperties&&"object"==typeof res.patternProperties&&!1===Array.isArray(res.patternProperties))for(let pattern in res.patternProperties)if(pToken.match(pattern)){let patternSchema=res.patternProperties[pattern];if(patternSchema&&"object"==typeof patternSchema){res=patternSchema,bHit=!0,pathDone+="::"+pToken;continue}}if(res&&"object"==typeof res.additionalProperties&&!1===Array.isArray(res.additionalProperties)){res=res.additionalProperties,bHit=!0,pathDone+="::"+pToken;continue}}}if(!1===bHit)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID_PATH,details:{code:TcHmi.Errors.E_SCHEMA_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID_PATH],reason:this.__expression.toString()+": Failed to read schema by path because token: '"+pToken+"' does not exist below path: '"+pathDone+"' in schema with id: '"+schema.id+"'.",domain:"TcHmi.System.Symbol"}})}null!=res&&"object"==typeof res?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:res}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SCHEMA_INVALID,details:{code:TcHmi.Errors.E_SCHEMA_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_INVALID],reason:this.__expression.toString()+": Failed to read schema by path because there is no valid schema below path: '"+pathDone+"' in schema with id: '"+schema.id+"'.",domain:"TcHmi.System.Symbol"}})}resolveSanitizedPath(tokens){let res="";for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];token.startsWith("[")?res+=token:res+="::"+token}return res}resolveSchema(callback){var _a;let __this=this;if(null!==this.__schema)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:this.__schema});let t=this.__expression.getType();if(t===TcHmi.SymbolType.Server){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let schema,resolve=()=>{if(schema=Symbol.__SERVER_SYMBOL_SCHEMA_CACHE[name],!schema){let baseName,basePathTokens=null,expressionMatch=__this.__expression.toString().match(TcHmi.SymbolExpression.RegExpExpression);if(null!=expressionMatch&&3===expressionMatch.length){let expressionTokens=expressionMatch[2].match(TcHmi.SymbolExpression.RegExpExpressionGroupByPipe);if(null!=expressionTokens&&expressionTokens.length>0){let firstBracketPos=expressionTokens[0].indexOf("["),firstColonPos=expressionTokens[0].indexOf("::"),splitPos=-1;if(splitPos=-1===firstBracketPos?firstColonPos:-1===firstColonPos||firstBracketPos<firstColonPos?firstBracketPos:firstColonPos,-1!==splitPos){baseName=expressionTokens[0].substring(0,splitPos);const basePath=expressionTokens[0].substring(splitPos);basePathTokens=System.resolveSymbolPathToTokenArray(basePath)}else baseName=expressionTokens[0]}}let baseSchema=baseName?Symbol.__SERVER_SYMBOL_SCHEMA_CACHE[baseName]:void 0;baseSchema&&__this.resolveSubSchema(baseSchema,basePathTokens,(function(data){data&&data.error===TcHmi.Errors.NONE&&(schema=data.schema)}))}},finish=()=>schema?(this.__schema=schema,this.__destroyTypeDefinitionChanged&&(this.__destroyTypeDefinitionChanged(),this.__destroyTypeDefinitionChanged=null),this.__schema.id&&(this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+this.__schema.id+">",this.__onTypeDefinitionChanged())),void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,schema:schema})):(__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,details:{code:TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION,message:TcHmi.Errors[TcHmi.Errors.E_SCHEMA_UNKNOWN_DEFINITION],reason:__this.__expression.toString()+": Unknown definition for expression",domain:"TcHmi.System.Symbol"}}));resolve(),schema?finish():Symbol.resolveServerSymbolSchemaCache(data=>{resolve(),finish()})}else{if(t!==TcHmi.SymbolType.Internal){if(t===TcHmi.SymbolType.LocalizedText){let schema=TcHmi.System.Services.typeManager.getSchema("tchmi:general#/definitions/String");return schema?(this.__schema=schema,void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.Function)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Resolving Schema for function expressions is not supported",domain:"TcHmi.System.Symbol"}});if(t===TcHmi.SymbolType.Control){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=this.__expression.getPathTokens(),control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"}});let propertyName=null;if(pathTokens&&pathTokens.length>0){let pathTokensPrepared=tchmi_clone_object(pathTokens);propertyName=pathTokensPrepared.shift();const attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Resolving Schema for expression failed. Control attribute was not found.",domain:"TcHmi.System.Symbol"}});{let rootSchema=TcHmi.System.Services.typeManager.getSchema(attr.type);return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokensPrepared,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+attr.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Resolving subschema failed",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}}return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.PartialParam){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let propertyName,designerParam,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),searchAttr=null;if(!pathTokens)return void("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}}));if(propertyName=pathTokens.shift(),"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find control instance with id: "+name+".",domain:"TcHmi.System.Symbol"}});searchAttr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName)}else{if(designerParam=propertyName?null===(_a=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager)||void 0===_a?void 0:_a.get(propertyName):void 0,!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});searchAttr=designerParam.descr}if(null==searchAttr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find property: "+propertyName+".",domain:"TcHmi.System.Symbol"}});const attr=searchAttr;let rootSchema=TcHmi.System.Services.typeManager.getSchema(attr.type);return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+attr.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}if(t===TcHmi.SymbolType.TemplateParam){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const pathTokens=this.__expression.getPathTokens(),entry=System.Services.templateParamSymbolManager.get(name);if(!entry||!entry.type)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}});let rootSchema=TcHmi.System.Services.typeManager.getSchema(entry.type);return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+entry.type+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown symbol type",domain:"TcHmi.System.Symbol"}})}return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": Unknown symbol type",domain:"TcHmi.System.Symbol"}})}{const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:__this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(!TcHmi.System.Services.internalSymbolManager)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYSTEM_NOT_READY,details:{code:TcHmi.Errors.E_SYSTEM_NOT_READY,reason:__this.__expression.toString()+": Parser was unable to resolve the name of the symbol. System not ready.",domain:"TcHmi.System.Symbol"}});let pathTokens=this.__expression.getPathTokens();TcHmi.System.Services.internalSymbolManager.getType(name,(function(data){if(data.error===TcHmi.Errors.NONE&&data.type){let rootSchemaType=data.type,rootSchema=TcHmi.System.Services.typeManager.getSchema(rootSchemaType);return rootSchema?void __this.resolveSubSchema(rootSchema,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let schema=tchmi_clone_object(data.schema);return schema?(__this.__schema=schema,__this.__destroyTypeDefinitionChanged&&(__this.__destroyTypeDefinitionChanged(),__this.__destroyTypeDefinitionChanged=null),__this.__destroyTypeDefinitionChanged=TcHmi.EventProvider.register("System.onTypeDefinitionChanged<"+rootSchemaType+">",__this.__onTypeDefinitionChanged()),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,schema:__this.__schema})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_UNKNOWN_TYPE,details:{code:TcHmi.Errors.E_UNKNOWN_TYPE,message:TcHmi.Errors[TcHmi.Errors.E_UNKNOWN_TYPE],reason:__this.__expression.toString()+": Unknown type",domain:"TcHmi.System.Symbol"}})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error resolving type",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0}})}))}}}resolveAttributes(callback){this.resolveSchema(data=>{data.error===TcHmi.Errors.NONE?data.schema&&data.schema.attributes?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,attributes:tchmi_clone_object(data.schema.attributes)}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,attributes:{}}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})})}resolveAttribute(name,callback){this.resolveAttributes(data=>{data.error===TcHmi.Errors.NONE?data.attributes&&void 0!==data.attributes[name]?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,name:name,value:tchmi_clone_object(data.attributes[name])}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN_ATTRIBUTE],reason:this.__expression.toString()+": Failed to resolve attributes",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})})}read(callback){let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read called.");let destroy=null,t=this.__expression.getType();if(t===TcHmi.SymbolType.Server)destroy=this.__readSymbolTypeServer(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.Internal)this.__readSymbolTypeInternal(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.LocalizedText)this.__readSymbolTypeLocalizedText(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.Function)this.__readSymbolTypeFunction(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.Control)this.__readSymbolTypeControl(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.PartialParam)this.__readSymbolTypePartialParam(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else if(t===TcHmi.SymbolType.TemplateParam)this.__readSymbolTypeTemplateParam(data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",{data:data}),TcHmi.Callback.callSafeEx(callback,this,data)});else{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:this.__expression.toString()+": Failed to read from unsupported symbol type",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}return()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] read destroy called."),destroy&&destroy()}}__readSymbolTypeServer(callback){let __this=this,symbol=this.__expression.getName();if(!symbol)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),()=>{};if(TCHMI_DESIGNER)return this.resolveSchema(data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let value=TcHmi.Type.Schema.resolveDefault(data.schema);TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:value})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}),()=>{};{let message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:symbol}]},timeout=this.__expression.getOptions().Timeout,parallel=__this.__expression.getOptions().Parallel;parallel||(parallel=!1);let requestId=TcHmi.Server.requestEx(message,{timeout:timeout,parallel:parallel},(function(e){if(e.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:e.error,details:e.details});let response=e.response;if(void 0===response)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_INVALID_RESPONSE,details:{code:TcHmi.Errors.E_SERVER_INVALID_RESPONSE,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_INVALID_RESPONSE],reason:__this.__expression.toString()+": Missing response from server.",domain:"TcHmi.System.Symbol"},response:response});if(response&&response.error&&response.error)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:__this.__expression.toString()+": Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[response.error]},response:response});let commands=response.commands;if(!commands)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:__this.__expression.toString()+": Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"},response:response});let command=commands[0];if(command)return command.error?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+": Error in command for symbol: '"+symbol+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[command.error]},value:command.readValue,response:response}):void __this.resolveSchema(data=>{if(data.error===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(command.readValue,data.schema);if(null===prepValue&&null!==command.readValue){let reason,value=command.readValue,schema=data.schema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"},value:command.readValue,response:response})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:prepValue,response:response})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Resolving schema failed.",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},value:command.readValue,response:response})});TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:__this.__expression.toString()+": Missing command for symbol: '"+symbol+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"},response:response})}));return()=>{TcHmi.Server.releaseRequest(requestId)}}}__readSymbolTypeInternal(callback){const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let __this=this;System.Services.internalSymbolManager.read(name,(function(data){if(data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();return pathTokens&&pathTokens.length>0?void __this.__readSubValue(data.value,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)})}TcHmi.Callback.callSafeEx(callback,__this,{error:data.error})}))}__readSymbolTypeLocalizedText(callback){let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Control' localization symbol expressions must be in the form: 'Control::[Control-Type]::[Key]'.",domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Function' localization symbol expressions must be in the form: 'Function::[Function-Name]::[Key]'.",domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Framework' localization symbol expressions must be in the form: 'Framework::[Key]'.",domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Path tokens are allowed only if the localization symbol expression starts with one of the following tokens: 'Application', 'Control', 'Function' or 'Framework'.",domain:"TcHmi.System.Symbol"}});if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Explicit 'Application' localization symbol expressions must be in the form: 'Application::[Key]'.",domain:"TcHmi.System.Symbol"}});localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name and namespace of the symbol.",domain:"TcHmi.System.Symbol"}});let text=System.Services.localizationManager.getText(localizationNamespace,name);if(null!=text)try{return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:text})}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+": An uncaught exception occurred in the callback for the read operation",exception:e,domain:"TcHmi.System.Symbol"}})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Failed to resolve localized text for this expression.",domain:"TcHmi.System.Symbol"}})}__readSymbolTypeFunction(callback){let __this=this;const content=this.__expression.getContent();if(!content)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the content of the symbol.",domain:"TcHmi.System.Symbol"}});let func=new System.FunctionExpression(content),bContextLock=!1;func.execute({success:function(result){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:result}),func.destroy())},error:function(error,details){bContextLock||(bContextLock=!0,TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": could not read function value",domain:"TcHmi.System.Symbol",errors:details?[details]:void 0}}),func.destroy())}})}__readSymbolTypeControl(callback){let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),control=TcHmi.Controls.get(name);if(control){if(null!==pathTokens){let propertyName;pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift());let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control attribute with propertyName: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});let res=tchmi_clone_object(control[attr.propertyGetterName].call(control));if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(res instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for attribute: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});let controlId=res.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");return void subSymbol.read((function(dataSubSymbol){dataSubSymbol.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Error reading subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}})}))}return void this.__readSubValue(res,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:res})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:control})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"}})}__readSymbolTypePartialParam(callback){var _a;let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let res,propertyName,designerParam,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),attr=null;if(pathTokens)if(propertyName=pathTokens.shift(),propertyName){if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let control=TcHmi.Controls.get(name);if(!control)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"}});if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName),null==attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control attribute with propertyName: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});try{res=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:this.__expression.toString()+": An uncaught exception occurred in the callback for the read operation",exception:e,domain:"TcHmi.System.Symbol"}})}}else{if(designerParam=null===(_a=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager)||void 0===_a?void 0:_a.get(propertyName),!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});if(attr=designerParam.descr,!attr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control attribute with propertyName: '"+name+"'.",domain:"TcHmi.System.Symbol"}});res=designerParam.value}if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(res||"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(!res)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for parameter: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});{if(!(res instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:__this.__expression.toString()+": Missing control instance for parameter: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});let controlId=res.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.read((function(dataSubSymbol){dataSubSymbol&&dataSubSymbol.error!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Failed to read subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value)})}))}}else this.resolveSchema(data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let defaultValue=System.Type.Schema.resolveDefault(data.schema),res={error:TcHmi.Errors.NONE,value:defaultValue};TcHmi.Callback.callSafeEx(callback,__this,res)}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Missing schema of the symbol.",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0}})});return}this.__readSubValue(res,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(res)})}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}});else"TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}})}__readSymbolTypeTemplateParam(callback){let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=System.Services.templateParamSymbolManager.get(name);if(entry&&entry.type){if(!(entry.value instanceof TcHmi.SymbolExpression))return pathTokens&&pathTokens.length>0?void __this.__readSubValue(entry.value,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value)});{let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%";let entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString);entrySymbolNew.read((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value)}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details}),null==entrySymbolNew||entrySymbolNew.destroy(),entrySymbolNew=null}))}}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}})}write(value,callback){let destroy=this.writeEx(value,void 0,callback);return()=>{destroy&&destroy()}}writeEx(value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx called with:",{value:value,dirtyPaths:dirtyPaths});let destroy=null;switch(this.__expression.getType()){case TcHmi.SymbolType.Server:destroy=this.__writeSymbolTypeServer(value,dirtyPaths,(data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)});break;case TcHmi.SymbolType.Internal:this.__writeSymbolTypeInternal(value,dirtyPaths,(data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)});break;case TcHmi.SymbolType.LocalizedText:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": LocalizedText symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}break;case TcHmi.SymbolType.Function:{let res={error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:this.__expression.toString()+": Function symbols are readonly.",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}break;case TcHmi.SymbolType.Control:this.__writeSymbolTypeControl(value,dirtyPaths,(data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)});break;case TcHmi.SymbolType.PartialParam:this.__writeSymbolTypePartialParam(value,dirtyPaths,(data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)});break;case TcHmi.SymbolType.TemplateParam:this.__writeSymbolTypeTemplateParam(value,dirtyPaths,(data,meta)=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",{data:data}),meta&&meta.equal&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished without error because of data equality."),TcHmi.Callback.callSafeEx(callback,this,data)});break;default:{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:this.__expression.toString()+": Failed to write unsupported symbol type",domain:"TcHmi.System.Symbol"}};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx finished with:",res),TcHmi.Callback.callSafeEx(callback,this,res)}}return()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] writeEx destroy called."),destroy&&destroy()}}__writeSymbolTypeServer(value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),()=>{};if(TCHMI_DESIGNER)return this.resolveSchema(data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let value=TcHmi.Type.Schema.resolveDefault(data.schema);TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:value})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}),()=>{};{let newValue=tchmi_clone_object(value),destroyed=!1,requestId=null;return this.resolveSchema((function(dataResolveSchema){var _a;if(destroyed)return;if(__this.__state!==SymbolState.Ready)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_STATE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_STATE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_STATE_INVALID],reason:"Symbol is not ready",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});if(dataResolveSchema.error!==TcHmi.Errors.NONE||!__this.__schema)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Could not resolve Schema.",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let errorDetails,message={requestType:"ReadWrite",commands:[]},error=TcHmi.Errors.NONE,schema=__this.__schema;if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++){let subschema,subschemaErrorDetails,subvalue,path=dirtyPaths[i],pathTokens=System.resolveSymbolPathToTokenArray(path),subschemaError=TcHmi.Errors.NONE;__this.resolveSubSchema(schema,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?subschema=tchmi_clone_object(data.schema):(subschemaError=data.error,subschemaErrorDetails=data.details)}));let subvalueErrorDetails,subvalueError=TcHmi.Errors.NONE;if(__this.__readSubValue(newValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?subvalue=tchmi_clone_object(data.value):(subvalueError=data.error,subvalueErrorDetails=data.details)})),subschemaError===TcHmi.Errors.NONE&&subvalueError===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(subvalue,subschema,{convertDirection:TcHmi.ValueConverter.ConvertDirection.Backward});if(null===prepValue&&null!==subvalue){let reason,value=subvalue,schema=subschema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",error=TcHmi.Errors.E_SYMBOL_VALUE_INVALID,errorDetails||(errorDetails={code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"})}else message.commands.push({commandOptions:["SendErrorMessage"],symbol:name+path,writeValue:prepValue})}else error=TcHmi.Errors.ERROR,errorDetails||(errorDetails={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Sub schema or sub value error.",domain:"TcHmi.System.Symbol"}),subschemaError!==TcHmi.Errors.NONE&&(errorDetails.errors||(errorDetails.errors=[]),subschemaErrorDetails?errorDetails.errors.push(subschemaErrorDetails):errorDetails.errors.push({code:subschemaError,message:TcHmi.Errors[subschemaError],reason:__this.__expression.toString()+": Sub schema error.",domain:"TcHmi.System.Symbol"})),subvalueError!==TcHmi.Errors.NONE&&(errorDetails.errors||(errorDetails.errors=[]),subvalueErrorDetails?errorDetails.errors.push(subvalueErrorDetails):errorDetails.errors.push({code:subvalueError,message:TcHmi.Errors[subvalueError],reason:__this.__expression.toString()+": Sub value error.",domain:"TcHmi.System.Symbol"}))}else{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema,{convertDirection:TcHmi.ValueConverter.ConvertDirection.Backward,resolveFunctionWriteValue:!0});if(null===prepValue&&null!==newValue){let reason,value=newValue;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",error=TcHmi.Errors.E_SYMBOL_VALUE_INVALID,errorDetails||(errorDetails={code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"})}else message.commands.push({commandOptions:["SendErrorMessage"],symbol:name,writeValue:prepValue})}if(error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:error,details:errorDetails});let timeout=__this.__expression.getOptions().Timeout,parallel=null!==(_a=__this.__expression.getOptions().Parallel)&&void 0!==_a&&_a;requestId=TcHmi.Server.requestEx(message,{timeout:timeout,parallel:parallel},(function(dataRequest){if(dataRequest.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:dataRequest.error,details:dataRequest.details});let response=dataRequest.response;if(!response)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:__this.__expression.toString()+": Missing response from server.",domain:"TcHmi.System.Symbol"}});if(response&&response.error&&response.error)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,details:{code:TcHmi.Errors.E_SERVER_RESPONSE_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_ERROR],reason:__this.__expression.toString()+": Error in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[response.error]},response:response});let commands=response.commands;if(commands){if(dirtyPaths){let processedStart,processedEnd,errors=[];for(let i=0,ii=commands.length;i<ii;i++){let command=commands[i];if(command.error){errors.push({code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+": Error in command for symbol: '"+name+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[command.error]});continue}(!processedStart||command.processedStart&&-1===System.compareISO8601ServerCommandDateTimeStrings(command.processedStart,processedStart))&&(processedStart=command.processedStart),(!processedEnd||command.processedEnd&&1===System.compareISO8601ServerCommandDateTimeStrings(command.processedEnd,processedEnd))&&(processedEnd=command.processedEnd);let path=command.symbol.replace(name,""),pathTokens=System.resolveSymbolPathToTokenArray(path);__this.__writeSubValue(newValue,command.readValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE||(data.details?errors.push(data.details):errors.push({code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in writing a subvalue for symbol: '"+name+"'.",domain:"TcHmi.System.Symbol"}))}))}return errors.length>0?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Error while processing command for symbol: '"+name+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:errors},response:response}):processedStart&&processedEnd?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:newValue,processedStart:processedStart,processedEnd:processedEnd,response:response}):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:newValue,response:response})}{let command=commands[0];return command?command.error?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],reason:__this.__expression.toString()+": Error in command for symbol: '"+name+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol",errors:[command.error]},response:response}):void(command.processedStart&&command.processedEnd?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:command.readValue,processedStart:command.processedStart,processedEnd:command.processedEnd,response:response}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:command.readValue,response:response})):void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMAND_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMAND_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_MISSING],reason:__this.__expression.toString()+": Missing command for symbol: '"+name+"' in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"},response:response})}}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,details:{code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:__this.__expression.toString()+": Missing commands in response from server with id: '"+response.id+"'.",domain:"TcHmi.System.Symbol"},response:response})}))})),()=>{destroyed=!0,null!=requestId&&TcHmi.Server.releaseRequest(requestId)}}}__writeSymbolTypeInternal(value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens();this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let schema=__this.__schema,newValue=tchmi_clone_object(value),dirtyPathsNew=[];if(path&&pathTokens&&pathTokens.length>0){if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(path+dirtyPaths[i]);else dirtyPathsNew.push(path);System.Services.internalSymbolManager.read(name,(function(dataRead){if(dataRead.error===TcHmi.Errors.NONE){let currentSubValue,currentSubValueErrorDetails,currentCloneValue=tchmi_clone_object(dataRead.value),currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: '"+name+"'.",domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}if(tchmi_equal(currentSubValue,prepValue))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0});__this.__writeSubValue(currentCloneValue,prepValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?System.Services.internalSymbolManager.write(name,currentCloneValue,dirtyPathsNew,(function(dataWrite){TcHmi.Callback.callSafeEx(callback,__this,{error:dataWrite.error,details:dataWrite.details})})):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}else TcHmi.Callback.callSafeEx(callback,__this,{error:dataRead.error})}))}else{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}System.Services.internalSymbolManager.write(name,prepValue,void 0,(function(data){TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}}))}__writeSymbolTypeControl(value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let pathTokens=tchmi_clone_object(this.__expression.getPathTokens());const control=TcHmi.Controls.get(name);if(control)if(null!==pathTokens){let propertyName;pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift());const attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(null==attr)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find attribute with property name: '"+propertyName+"' in control: '"+control.getId()+"'.",domain:"TcHmi.System.Symbol"}});if(attr.readOnly&&0===pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:__this.__expression.toString()+": Writing to readonly symbol is not allowed. Symbol is readonly because attribute with property name: '"+propertyName+"' in control: '"+control.getId()+"' is readonly.",domain:"TcHmi.System.Symbol"}});this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let currentValue,schema=__this.__schema,newValue=tchmi_clone_object(value);try{currentValue=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:__this.__expression.toString()+": An uncaught exception occurred in the getter call for preparation of the write operation",exception:e,domain:"TcHmi.System.Symbol"}})}let currentCloneValue=tchmi_clone_object(currentValue);if(!attr.readOnly||__tchmi_is_instanced_object(currentCloneValue)){if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(currentCloneValue instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: '"+attr.propertyName+"'.",domain:"TcHmi.System.Symbol"}});{let controlId=currentCloneValue.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+__this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.writeEx(value,dirtyPaths,(function(dataSubSymbol){dataSubSymbol.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:this.__expression.toString()+": Failed to write subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}})}))}return}{let currentSubValue,dirtyPathsNew=[];if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens)+dirtyPaths[i]);else dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens));let currentSubValueErrorDetails,currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error while writing sub value.",domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentSubValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,currentCloneValue,dirtyPathsNew);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}}if(!tchmi_equal(currentCloneValue,newValue)){let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,tchmi_clone_object(prepValue));return void(error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}))}TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0})}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_READONLY,details:{code:TcHmi.Errors.E_SYMBOL_READONLY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_READONLY],reason:__this.__expression.toString()+": Writing to readonly symbol is not allowed. Symbol is readonly because attribute with property name: '"+propertyName+"' in control: '"+control.getId()+"' is readonly.",domain:"TcHmi.System.Symbol"}})}))}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_NOT_ALLOWED,details:{code:TcHmi.Errors.E_NOT_ALLOWED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_ALLOWED],reason:__this.__expression.toString()+": Writing on control instance symbol is not allowed.",domain:"TcHmi.System.Symbol"}});else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"}})}__writeSymbolTypePartialParam(value,dirtyPaths,callback){var _a;null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});let searchPropertyName,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),searchAttr=null;if(!pathTokens)return void("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: UserControlHost::Parameter",domain:"TcHmi.System.Symbol"}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",domain:"TcHmi.System.Symbol"}}));if(searchPropertyName=pathTokens.shift(),!searchPropertyName)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}});const propertyName=searchPropertyName;let designerParam,control;if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(control=TcHmi.Controls.get(name),!control)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"}});searchAttr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName)}else{if(designerParam=null===(_a=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager)||void 0===_a?void 0:_a.get(propertyName),!designerParam)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"}});searchAttr=designerParam.descr}if(!searchAttr)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control attribute with propertyName: '"+name+"'.",domain:"TcHmi.System.Symbol"}});const attr=searchAttr;this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema for expression",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let currentValue,schema=__this.__schema,newValue=tchmi_clone_object(value);if(control)try{currentValue=control[attr.propertyGetterName].call(control)}catch(e){return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_EXCEPTION,details:{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:__this.__expression.toString()+": An uncaught exception occurred in the getter call for preparation of the write operation",exception:e,domain:"TcHmi.System.Symbol"}})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});currentValue=designerParam.value}let currentCloneValue=tchmi_clone_object(currentValue);if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){if(!(currentCloneValue instanceof TcHmi.Controls.System.baseTcHmiControl))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"}});{let controlId=currentCloneValue.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+controlId+__this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.writeEx(value,dirtyPaths,(function(dataSubSymbol){dataSubSymbol&&dataSubSymbol.error!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:__this.__expression.toString()+": Failed to write to subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0}}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}))}return}{let currentSubValue,dirtyPathsNew=[];if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens)+dirtyPaths[i]);else dirtyPathsNew.push(__this.resolveSanitizedPath(pathTokens));let currentSubValueErrorDetails,currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: '"+name+"'.",domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentSubValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE)if(control){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,currentCloneValue,dirtyPathsNew);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});designerParam.value=currentCloneValue,TcHmi.EventProvider.raise("System.onDesignerUserControlParameterChanged<"+propertyName+">"),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}}{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}if(tchmi_equal(currentCloneValue,prepValue))return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0});if(control){let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(control,attr,prepValue);error&&error.code!==TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:error.code,details:error}):TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}else{if(!designerParam)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("Internal Error: Invalid code path. Found no control and no designer parameter."),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Internal Error: Invalid code path. Found no control and no designer parameter.",domain:"TcHmi.System.Symbol"}});designerParam.value=currentCloneValue,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}return}}))}__writeSymbolTypeTemplateParam(value,dirtyPaths,callback){null===dirtyPaths&&(dirtyPaths=void 0);let __this=this;const name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}});const path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=System.Services.templateParamSymbolManager.get(name);if(entry&&entry.type)if(entry.value instanceof TcHmi.SymbolExpression){let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%";let entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString);entrySymbolNew.writeEx(value,dirtyPaths,(function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details}),null==entrySymbolNew||entrySymbolNew.destroy(),entrySymbolNew=null}))}else this.resolveSchema((function(dataResolveSchema){if(dataResolveSchema&&dataResolveSchema.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema",domain:"TcHmi.System.Symbol",errors:dataResolveSchema.details?[dataResolveSchema.details]:void 0}});let schema=__this.__schema,newValue=tchmi_clone_object(value),currentValue=tchmi_clone_object(entry.value),currentCloneValue=tchmi_clone_object(currentValue);if(path&&pathTokens&&pathTokens.length>0){let currentSubValue,dirtyPathsNew=[];if(dirtyPaths)for(let i=0,ii=dirtyPaths.length;i<ii;i++)dirtyPathsNew.push(path+dirtyPaths[i]);else dirtyPathsNew.push(path);let currentSubValueErrorDetails,currentSubValueError=TcHmi.Errors.NONE;if(__this.__readSubValue(currentCloneValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?currentSubValue=tchmi_clone_object(data.value):(currentSubValueError=data.error,currentSubValueErrorDetails=data.details?data.details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Error in reading a subvalue for symbol: '"+name+"'.",domain:"TcHmi.System.Symbol"})})),currentSubValueError)return void TcHmi.Callback.callSafeEx(callback,__this,{error:currentSubValueError,details:currentSubValueErrorDetails});let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentSubValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):void __this.__writeSubValue(currentCloneValue,prepValue,pathTokens,(function(data){data.error===TcHmi.Errors.NONE?(entry.value=currentCloneValue,TcHmi.System.Callback.callSafeCallbacks1Param(entry.callbacks,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value),dirtyPaths:dirtyPathsNew}),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details})}))}{let prepValue=TcHmi.ValueConverter.toSchemaType(newValue,schema);if(null===prepValue&&null!==newValue){let reason,value=newValue;return reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".",void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"}})}return tchmi_equal(currentCloneValue,prepValue)?void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE},{equal:!0}):(entry.value=prepValue,TcHmi.System.Callback.callSafeCallbacks1Param(entry.callbacks,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(entry.value)}),void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE}))}}));else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}})}watch(callback){var _a;let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+this.__expression.toString()+", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch called.");let destroySubWatch,functionExpression,entrySymbolNew,__this=this,destroyOnPropertyChanged=null,destroyOnControlInitialized=null,destroyOnControlDestroyed=null,destroyDesignerSymbolDataSourceChanged=null,t=this.__expression.getType(),destroy=function(){switch(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Symbol, Expression="+__this.__expression.toString()+", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch destroy called."),t){case TcHmi.SymbolType.Server:case TcHmi.SymbolType.Internal:case TcHmi.SymbolType.LocalizedText:destroySubWatch&&(destroySubWatch(),destroySubWatch=null);break;case TcHmi.SymbolType.Function:destroySubWatch&&(destroySubWatch(),destroySubWatch=null),functionExpression&&(functionExpression.destroy(),functionExpression=null);break;case TcHmi.SymbolType.Control:null!==destroyOnControlInitialized&&(destroyOnControlInitialized(),destroyOnControlInitialized=null),null!==destroyOnControlDestroyed&&(destroyOnControlDestroyed(),destroyOnControlDestroyed=null),null!==destroyOnPropertyChanged&&(destroyOnPropertyChanged(),destroyOnPropertyChanged=null);break;case TcHmi.SymbolType.PartialParam:null!==destroyOnPropertyChanged&&(destroyOnPropertyChanged(),destroyOnPropertyChanged=null),null!==destroyDesignerSymbolDataSourceChanged&&(destroyDesignerSymbolDataSourceChanged(),destroyDesignerSymbolDataSourceChanged=null);break;case TcHmi.SymbolType.TemplateParam:let name=__this.__expression.getName();if(name){let entry=System.Services.templateParamSymbolManager.get(name);entry&&entry.value instanceof TcHmi.SymbolExpression&&(System.Services.templateParamSymbolManager.keepAlive(name)||System.Services.templateParamSymbolManager.remove(name))}destroySubWatch&&(destroySubWatch(),destroySubWatch=null),entrySymbolNew&&(entrySymbolNew.destroy(),entrySymbolNew=null)}};if(t===TcHmi.SymbolType.Server)TCHMI_DESIGNER?this.read(data=>{data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:data.value,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:data.details,destroy:destroy})}):destroySubWatch=TcHmi.System.Services.serverManager.watch(this.__expression,dataWatch=>{if(destroySubWatch||(destroySubWatch=dataWatch.destroy),dataWatch.error!==TcHmi.Errors.NONE){let res={error:dataWatch.error,details:{code:dataWatch.error,message:TcHmi.Errors[dataWatch.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:dataWatch.details?[dataWatch.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}this.resolveSchema(dataSchema=>{if(dataSchema.error===TcHmi.Errors.NONE){let prepValue=TcHmi.ValueConverter.toSchemaType(dataWatch.value,dataSchema.schema);if(null===prepValue&&null!==dataWatch.value){let reason,value=dataWatch.value,schema=dataSchema.schema;reason="object"==typeof value&&__tchmi_is_instanced_object(value)?__this.__expression.toString()+": Value of type: 'Instance of "+value.constructor+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":"object"==typeof value?__this.__expression.toString()+": Value: '"+JSON.stringify(value)+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".":__this.__expression.toString()+": Value: '"+value+"' of type: '"+typeof value+"' can't be converted to type schema"+(schema&&schema.id?": '"+schema.id+"'":"")+".";let res={error:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,details:{code:TcHmi.Errors.E_SYMBOL_VALUE_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_VALUE_INVALID],reason:reason,domain:"TcHmi.System.Symbol"},destroy:destroy,value:dataWatch.value};return dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.NONE,value:prepValue,destroy:destroy};return dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:dataSchema.error,details:{code:dataSchema.error,message:TcHmi.Errors[dataSchema.error],reason:__this.__expression.toString()+": Resolving schema failed.",domain:"TcHmi.System.Symbol",errors:dataSchema.details?[dataSchema.details]:void 0},destroy:destroy};return void 0!==dataWatch.value&&(res.value=dataWatch.value),dataWatch.response&&(res.response=dataWatch.response),dataWatch.processedStart&&dataWatch.processedEnd&&(res.processedStart=dataWatch.processedStart,res.processedEnd=dataWatch.processedEnd),void TcHmi.Callback.callSafeEx(callback,__this,res)}})});else if(t===TcHmi.SymbolType.Internal){const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;destroySubWatch=TcHmi.System.Services.internalSymbolManager.watch(name,(function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();if(pathTokens&&pathTokens.length>0){let proc=!1;if(data.dirtyPaths){let pathSanitized=__this.resolveSanitizedPath(pathTokens);for(let i=0,ii=data.dirtyPaths.length;i<ii;i++){if(data.dirtyPaths[i].startsWith(pathSanitized)){proc=!0;break}}}else proc=!0;return void(proc&&__this.__readSubValue(data.value,pathTokens,(function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:data.details,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}})))}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.LocalizedText){let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(namespaceToken)if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Control' localization symbol expressions must be in the form: 'Control::[Control-Type]::[Key]'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Function' localization symbol expressions must be in the form: 'Function::[Function-Name]::[Key]'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": 'Framework' localization symbol expressions must be in the form: 'Framework::[Key]'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Path tokens are allowed only if the localization symbol expression starts with one of the following tokens: 'Application', 'Control', 'Function' or 'Framework'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;if(1!==pathTokens.length)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:this.__expression.toString()+": Explicit 'Application' localization symbol expressions must be in the form: 'Application::[Key]'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}else;}else name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Could not parse name and namespace.",domain:"TcHmi.System.Symbol"}}),destroy;destroySubWatch=TcHmi.System.Services.localizationManager.watchText(localizationNamespace,name,{level:TcHmi.Locale.Level.Application},(function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.text),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch expression",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.Function){const content=this.__expression.getContent();if(!content)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the content of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;functionExpression=new TcHmi.System.FunctionExpression(content,!0),destroySubWatch=functionExpression.watch((function(data){if(destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE){let pathTokens=__this.__expression.getPathTokens();if(pathTokens&&pathTokens.length>0){let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+': Reading by path is not supported on symbols of type "Function".',domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else{if(t===TcHmi.SymbolType.Control){let name=__this.__expression.getName();if(!name){let res={error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:__this.__expression.toString()+": Expression does not contain a valid name token.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}let control=TcHmi.Controls.get(name),controlWasAvailable=!1;control&&(controlWasAvailable=!0);let proc=()=>{let propertyName,pathTokens=tchmi_clone_object(__this.__expression.getPathTokens()),pathSanitized="";if(!control){if(controlWasAvailable)return;{let res={error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find control instance with name: '"+name+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}if(pathTokens&&pathTokens.length>0&&(propertyName=pathTokens.shift(),pathTokens.length>0&&(pathSanitized=__this.resolveSanitizedPath(pathTokens))),propertyName){let attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName);if(!attr){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find attribute definition for property: '"+propertyName+"' of control: '"+name+"' of type: '"+control.getType()+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}if(!attr.propertyGetterName){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:__this.__expression.toString()+": Can't find valid 'propertyGetterName' in attribute definition for property: '"+propertyName+"' of control: '"+name+"' of type: '"+control.getType()+"'. Please check Description.json.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}destroyOnPropertyChanged=TcHmi.EventProvider.register(name+".onPropertyChanged<"+attr.propertyName+">",(function(e,data){if(!data)return;let doWork=!1,dirtyPaths=data.dirtyPaths;if(pathSanitized&&dirtyPaths&&dirtyPaths.length>0)for(let j=0,jj=dirtyPaths.length;j<jj;j++){dirtyPaths[j].startsWith(pathSanitized)&&(doWork=!0)}else doWork=!0;doWork&&__this.read((function(data){if(data.error===TcHmi.Errors.NONE){if(dirtyPaths){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPaths,destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}{let res={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))}))}this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))};return destroyOnControlInitialized=TcHmi.EventProvider.register(name+".onInitialized",(e,data)=>{control=data,control&&(controlWasAvailable=!0),proc()}),destroyOnControlDestroyed=TcHmi.EventProvider.register(name+".onDestroyed",(e,data)=>{control=void 0,proc()}),proc(),destroy}if(t===TcHmi.SymbolType.PartialParam){const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;let propertyName,designerParam,control,pathTokens=tchmi_clone_object(this.__expression.getPathTokens()),attr=null,pathSanitized="";if(!pathTokens){let res={error:TcHmi.Errors.E_INVALID,details:{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the token of the symbol.",domain:"TcHmi.System.Symbol"},destroy:destroy};return res.details.reason+="TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name?" is not a valid PartialParameter. Expected: UserControlHost::Parameter":" is not a valid PartialParameter. Expected: TCHMI_TARGET_DESIGNER_PARTIALPARAM::Parameter",TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(propertyName=pathTokens.shift(),pathTokens.length>0&&(pathSanitized=__this.resolveSanitizedPath(pathTokens)),!propertyName)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+" has no valid control property",domain:"TcHmi.System.Symbol"}}),destroy;if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){if(control=TcHmi.Controls.get(name),!control){let res={error:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INSTANCE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find control instance with id: '"+name+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(attr=TcHmi.System.Services.controlManager.getAttributeByPropertyName(control,propertyName),!attr){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:__this.__expression.toString()+": Can't find attribute definition for property: '"+propertyName+"' of control: '"+name+"' of type: '"+control.getType()+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}if(!attr.propertyGetterName){let res={error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_INVALID_CONFIGURATION],reason:__this.__expression.toString()+": Can't find valid 'propertyGetterName' in attribute definition for property: '"+propertyName+"' of control: '"+name+"' of type: '"+control.getType()+"'. Please check Description.json.",domain:"TcHmi.System.Symbol"},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res),destroy}destroyOnPropertyChanged=TcHmi.EventProvider.register(name+".onPropertyChanged<"+attr.propertyName+">",(function(e,data){if(!data)return;let doWork=!1,dirtyPaths=data.dirtyPaths;if(pathSanitized&&dirtyPaths&&dirtyPaths.length>0)for(let j=0,jj=dirtyPaths.length;j<jj;j++){dirtyPaths[j].startsWith(pathSanitized)&&(doWork=!0)}else doWork=!0;doWork&&__this.read((function(data){if(data.error!==TcHmi.Errors.NONE){let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to write",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}if(dirtyPaths){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),dirtyPaths:dirtyPaths,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}))}else{if(destroyDesignerSymbolDataSourceChanged=TcHmi.EventProvider.register("System.onDesignerUserControlParameterChanged<"+propertyName+">",(function(e){__this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}{let res={error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}}))})),designerParam=null===(_a=TcHmi.System.Services.Engineering.designerModeManager.userControlParameterManager)||void 0===_a?void 0:_a.get(propertyName),!designerParam)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+propertyName,domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy;if(attr=designerParam.descr,!attr)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,details:{code:TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_ATTRIBUTE_NOT_FOUND],reason:this.__expression.toString()+": Can't find control attribute with propertyName: '"+name+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy}),destroy}let isControlSubValue=!1;if(pathTokens&&pathTokens.length>0){let rootSchema=TcHmi.Type.getSchema(attr.type);if(rootSchema&&rootSchema.frameworkInstanceOf&&"TcHmi.Controls.System.TcHmiControl"===rootSchema.frameworkInstanceOf){isControlSubValue=!0;let resControl=null;if(control)resControl=control[attr.propertyGetterName].call(control);else{if(!designerParam)throw new Error("Invalid code path. Found no control and no designer parameter.");resControl=designerParam.value}if(resControl&&resControl instanceof TcHmi.Controls.System.baseTcHmiControl){let resControlId=resControl.getId(),subSymbol=new TcHmi.System.Symbol("%ctrl%"+resControlId+this.resolveSanitizedPath(pathTokens)+"%/ctrl%");subSymbol.watch((function(dataSubSymbol){if(dataSubSymbol.error!==TcHmi.Errors.NONE){let res={error:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,details:{code:TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_SUBSYMBOL_ERROR],reason:__this.__expression.toString()+": Failed to watch subsymbol "+subSymbol.getExpression().toString(),domain:"TcHmi.System.Symbol",errors:dataSubSymbol.details?[dataSubSymbol.details]:void 0},destroy:destroy};return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),void TcHmi.Callback.callSafeEx(callback,__this,res)}let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(dataSubSymbol.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}))}else if("TCHMI_TARGET_DESIGNER_PARTIALPARAM"!==name){let res={error:TcHmi.Errors.E_SYMBOL_INVALID_PATH,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_PATH,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_PATH],reason:__this.__expression.toString()+": Missing control instance for parameter: '"+propertyName+"'.",domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else this.resolveSchema(data=>{if(data.error===TcHmi.Errors.NONE&&data.schema){let defaultValue=System.Type.Schema.resolveDefault(data.schema),res={error:TcHmi.Errors.NONE,value:defaultValue,destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,details:{code:TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_RESOLVE_SCHEMA],reason:__this.__expression.toString()+": Failed to resolve schema",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy})})}}isControlSubValue||this.read((function(data){if(data.error===TcHmi.Errors.NONE){let res={error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}else{let res={error:data.error,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+__this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}))}else if(t===TcHmi.SymbolType.TemplateParam){const name=this.__expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:this.__expression.toString()+": Expression is invalid. Parser was unable to resolve the name of the symbol.",domain:"TcHmi.System.Symbol"}}),destroy;let path=this.__expression.getPath(),pathTokens=this.__expression.getPathTokens(),entry=System.Services.templateParamSymbolManager.get(name);if(!entry||!entry.type)return TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_SYMBOL_UNKNOWN,details:{code:TcHmi.Errors.E_SYMBOL_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_UNKNOWN],reason:__this.__expression.toString()+": Unknown template parameter "+name,domain:"TcHmi.System.Symbol"}}),destroy;if(entry.value instanceof TcHmi.SymbolExpression){entry.callbacks.push(callback);let entrySymbolExpression=entry.value,entrySymbolTag=entrySymbolExpression.getTag(),entrySymbolName=entrySymbolExpression.getName(),entrySymbolPath=entrySymbolExpression.getPath(),entrySymbolExpressionNewString="%"+entrySymbolTag+"%"+entrySymbolName;null!==entrySymbolPath&&(entrySymbolExpressionNewString+=entrySymbolPath),path&&pathTokens&&pathTokens.length>0&&(entrySymbolExpressionNewString+=path),entrySymbolExpressionNewString+="%/"+entrySymbolTag+"%",entrySymbolNew=new TcHmi.System.Symbol(entrySymbolExpressionNewString),destroySubWatch=entrySymbolNew.watch((function(data){destroySubWatch||(destroySubWatch=data.destroy),data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to watch subsymbol "+(null==entrySymbolNew?void 0:entrySymbolNew.getExpression.toString()),domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy})})),this.read((function(data){data.error===TcHmi.Errors.NONE?TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value),destroy:destroy}):TcHmi.Callback.callSafeEx(callback,__this,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:__this.__expression.toString()+": Failed to read",domain:"TcHmi.System.Symbol",errors:data.details?[data.details]:void 0},destroy:destroy})}))}else{let res={error:TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY,details:{code:TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY,message:TcHmi.Errors[TcHmi.Errors.E_SYMBOL_INVALID_DATA_PROVIDER_ENTRY],reason:__this.__expression.toString(),domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}else{let res={error:TcHmi.Errors.E_NOT_SUPPORTED,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:__this.__expression.toString()+": SymbolType: '"+t+"' does not support watching.",domain:"TcHmi.System.Symbol"},destroy:destroy};TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Symbol, Expression=",__this.__expression.toString(),", ObjectScopeDiagGUID="+this.__diagGUID+", LogicalScopeDiagGUID="+diagGUID+"] watch tick with:",res),TcHmi.Callback.callSafeEx(callback,__this,res)}}return destroy}static isServerSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Server}static isInternalSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Internal}static isLocalizedTextSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.LocalizedText}static isPartialParamSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.PartialParam}static isTemplateParamSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.TemplateParam}static isFunctionSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Function}static isControlSymbol(checkSymbol){return!!checkSymbol.getExpression()&&checkSymbol.getExpression().getType()===TcHmi.SymbolType.Control}exists(callback){if(Symbol.isFunctionSymbol(this))TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0});else if(Symbol.isLocalizedTextSymbol(this)){let name,localizationNamespace="TcHmi.System.Localization.Application",pathTokens=tchmi_clone_object(this.__expression.getPathTokens());if(pathTokens&&0!==pathTokens.length){let namespaceToken=this.__expression.getName();if(!namespaceToken)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(namespaceToken.startsWith("Control")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Control<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Function")){if(2!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Function<"+pathTokens.shift()+">",name=pathTokens.shift()}else if(namespaceToken.startsWith("Framework")){if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Framework",name=pathTokens.shift()}else{if(!namespaceToken.startsWith("Application"))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(1!==pathTokens.length)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});localizationNamespace="TcHmi.System.Localization.Application",name=pathTokens.shift()}}else name=this.__expression.getName();if(!name)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});let ns=System.Services.localizationManager.get(localizationNamespace);if(ns){let localization=ns.getLocalization();if(localization&&void 0!==localization[name]&&null!==localization[name])return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1})}else this.read((function(data){if(data.error!==TcHmi.Errors.NONE)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1});if(!Symbol.isServerSymbol(this))return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0});let response=data.response;if(response&&response.commands&&response.commands.length>0){return response.commands[0].error?void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1}):void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!0})}TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,result:!1})}))}}Symbol.__SERVER_SYMBOL_SCHEMA_CACHE={},System.Symbol=Symbol}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.SymbolExpressionParser=class{constructor(text){this.__text=text}loadText(text){this.__text=text}__parseExpressionFromString(text,typeString,res){const typeStringlength=typeString.length,textlength=text.length;for(let pos=0;pos<=textlength;pos++){if("%"!==text[pos])continue;let esccount=0,otag="";if(pos+typeStringlength+2<=textlength)if("$"!==text.substr(pos+1,1))otag=text.substr(pos,typeStringlength+2);else{let temppos=pos+1;for(;temppos+2<=textlength&&"$"===text.substr(temppos,1);)esccount++,temppos++;otag=text.substr(pos,typeStringlength+esccount+2)}let exptag="%";for(let i=0,ii=esccount;i<ii;i++)exptag+="$";if(exptag+=typeString+"%",otag===exptag){let ocount=0,ccount=0,subText=text.substr(pos+otag.length,textlength-(pos+otag.length)),subTextlength=textlength-(pos+otag.length);for(let subPos=0;subPos<=subTextlength;subPos++){if("%"!==subText[subPos])continue;let subOTag="";subPos+typeStringlength+2<=subTextlength&&(subOTag=subText.substr(subPos,typeStringlength+2));let subCTag="";if(subPos+typeStringlength+3<=subTextlength&&(subCTag=subText.substr(subPos,typeStringlength+3)),subCTag==="%/"+typeString+"%"){if(ccount===ocount){let e=text.substr(pos,otag.length+subCTag.length+subPos),se=new TcHmi.SymbolExpression(e);se.getType()!==TcHmi.SymbolType.Invalid&&res.push(se);break}ccount++}else subOTag==="%"+typeString+"%"&&ocount++}}}return res}resolveExpressionsBySymbolType(type){let res=[],typeString=null;switch(type){case TcHmi.SymbolType.Internal:typeString="i";break;case TcHmi.SymbolType.Server:typeString="s";break;case TcHmi.SymbolType.LocalizedText:typeString="l";break;case TcHmi.SymbolType.PartialParam:typeString="pp";break;case TcHmi.SymbolType.TemplateParam:typeString="tp";break;case TcHmi.SymbolType.Control:typeString="ctrl";break;case TcHmi.SymbolType.Function:typeString="f";break;default:return res}return null===typeString?res:this.__text?(res=this.__parseExpressionFromString(this.__text,typeString,res),res.sort((function(a,b){const alength=a.toString().length,blength=b.toString().length;return alength>blength?-1:alength<blength?1:0})),res):res}resolveExpressions(){let res=[];if(null===this.__text||0===this.__text.length)return res;let typeStrings=["i","s","l","pp","tp","ctrl","f"];for(let i=0,ii=typeStrings.length;i<ii;i++)res=this.__parseExpressionFromString(this.__text,typeStrings[i],res);return res.sort((function(a,b){return a.toString().length>b.toString().length?-1:a.toString().length<b.toString().length?1:0})),res}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let ScaleMode;!function(ScaleMode){ScaleMode[ScaleMode.None=0]="None",ScaleMode[ScaleMode.ScaleToFit=1]="ScaleToFit",ScaleMode[ScaleMode.ScaleToFitWidth=2]="ScaleToFitWidth",ScaleMode[ScaleMode.ScaleToFitHeight=3]="ScaleToFitHeight",ScaleMode[ScaleMode.ScaleToFill=4]="ScaleToFill"}(ScaleMode=System.ScaleMode||(System.ScaleMode={}));System.ViewManager=class{constructor(){this.__scaleMode=ScaleMode.None,this.__view=null,this.__animationFrameTimeId=0,this.__viewUrl=null,this.__onSystemSplashScreenHideEvent=null,this.__onViewResizedEventDestroyEvent=null,this.__onViewDestroyedEventDestroyEvent=null,this.__pending=!1,window.addEventListener("resize",this.__onWindowResized())}__onWindowResized(){return()=>{this.__scale()}}__onViewDestroyed(){let __this=this;return function(evt,tco){__this.__view===tco&&(TcHmi.System.SharedResources.jqBody.children().detach(),null!==__this.__onViewResizedEventDestroyEvent&&(__this.__onViewResizedEventDestroyEvent(),__this.__onViewResizedEventDestroyEvent=null),null!==__this.__onViewDestroyedEventDestroyEvent&&(__this.__onViewDestroyedEventDestroyEvent(),__this.__onViewDestroyedEventDestroyEvent=null),__this.__view=null,__this.__viewUrl=null)}}__onViewResized(){return(evt,tco)=>{this.__scaleMode!==ScaleMode.None&&this.__scale()}}__scale(){this.__animationFrameTimeId||window.requestAnimationFrame((function(){TcHmi.System.Services.viewManager.__doScaling()}))}__doScaling(){if(this.__animationFrameTimeId=0,!0===TCHMI_DESIGNER)return;if(!this.__view)return;const elem=this.__view.getElement()[0];if(!elem)return;const rendWidth=this.__view.getRenderedWidth(),rendHeight=this.__view.getRenderedHeight();if(rendHeight&&rendWidth)switch(this.__scaleMode){case ScaleMode.ScaleToFit:{let ratioW=document.body.offsetWidth/rendWidth,ratioH=document.body.offsetHeight/rendHeight,ratio=ratioW>ratioH?ratioH:ratioW;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFitWidth:{let ratio=document.body.offsetWidth/rendWidth;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFitHeight:{let ratio=document.body.offsetHeight/rendHeight;elem.style.transform=`scale(${ratio})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.ScaleToFill:{let ratioW=document.body.offsetWidth/rendWidth,ratioH=document.body.offsetHeight/rendHeight;elem.style.transform=`scale(${ratioW},${ratioH})`,elem.style.transformOrigin="0 0"}break;case ScaleMode.None:elem.style.transform="",elem.style.transformOrigin=""}}setScaleMode(scaleModeStr){let sm=TcHmi.System.ScaleMode.None;switch(scaleModeStr){case"ScaleToFit":sm=TcHmi.System.ScaleMode.ScaleToFit;break;case"ScaleToFitWidth":sm=TcHmi.System.ScaleMode.ScaleToFitWidth;break;case"ScaleToFitHeight":sm=TcHmi.System.ScaleMode.ScaleToFitHeight;break;case"ScaleToFill":sm=TcHmi.System.ScaleMode.ScaleToFill}this.__scaleMode=sm,this.__scale()}getView(){return this.__view}loadView(url,callback=null){if(!0===this.__pending)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+url+" failed because we have already another load pending.",domain:"TcHmi.System.ViewManager"}});const partialUrl=tchmi_path(url);if(this.__viewUrl===partialUrl)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});if(this.__pending=!0,void 0!==this.__view&&null!==this.__view&&(TcHmi.System.SharedResources.jqBody.children().detach(),this.__onSystemSplashScreenHideEvent&&(this.__onSystemSplashScreenHideEvent(),this.__onSystemSplashScreenHideEvent=null),null!==this.__onViewResizedEventDestroyEvent&&(this.__onViewResizedEventDestroyEvent(),this.__onViewResizedEventDestroyEvent=null),null!==this.__onViewDestroyedEventDestroyEvent&&(this.__onViewDestroyedEventDestroyEvent(),this.__onViewDestroyedEventDestroyEvent=null),this.__view.destroy(),this.__view=null,this.__viewUrl=null),!partialUrl)return this.__pending=!1,void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});let __this=this,__proc=function(url,markup,keepAlive){let loadingSpinnerDiv=null;if(!1===TCHMI_DESIGNER&&!TcHmi.System.Services.splashScreen.isVisible()){let loadingSpinnerDivTempDiv=document.createElement("div");loadingSpinnerDivTempDiv.innerHTML='<div class="tchmi-view-loading-spinner-container"><div class="tchmi-view-loading-spinner"><div></div><div></div><div></div><div></div></div></div>',loadingSpinnerDiv=loadingSpinnerDivTempDiv.firstElementChild,loadingSpinnerDiv&&document.body.appendChild(loadingSpinnerDiv)}setTimeout(()=>{let tempDiv=document.createElement("div");tempDiv.innerHTML=markup;const elem=tempDiv.firstElementChild;let errorreason;if(elem?elem.hasAttribute("data-tchmi-type")||(errorreason="First html element is no tchmi control (missing data-tchmi-type attribute)."):errorreason="No valid html elements found.",errorreason||!elem)return void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Compiling "+url+" failed. "+errorreason,domain:"TcHmi.System.ViewManager"}});let vo=TcHmi.Controls.get(elem.id);if(vo||(url===TCHMI_TARGET_PARTIAL&&elem.setAttribute("data-tchmi-creator-partial-key",TCHMI_TARGET_PARTIAL),elem.setAttribute("data-tchmi-partial-url",url),vo=TcHmi.System.Services.controlManager.compile(elem)),!vo)return __this.__pending=!1,void TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Compiling "+url+" failed.",domain:"TcHmi.System.ViewManager"}});if(keepAlive&&vo.__setKeepAlive(!0),__this.__view=vo,__this.__viewUrl=url,__this.__onViewResizedEventDestroyEvent=TcHmi.EventProvider.register(__this.__view.getId()+".onResized",__this.__onViewResized()),__this.__onViewDestroyedEventDestroyEvent=TcHmi.EventProvider.register(__this.__view.getId()+".onDestroyed",__this.__onViewDestroyed()),TcHmi.System.Services.splashScreen.isVisible()||TcHmi.System.SharedResources.jqBody.children().detach(),!0===TCHMI_ENGINEERING&&!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager){let vpSimulator=TcHmi.System.Services.Engineering.designerModeManager.rootControlManager.getViewPortSimulator();vpSimulator.empty(),vpSimulator[0].appendChild(__this.__view.getElement()[0]),document.body.appendChild(vpSimulator[0])}else!TcHmi.System.Services.splashScreen.isVisible()&&loadingSpinnerDiv&&loadingSpinnerDiv.remove(),TcHmi.System.Services.splashScreen.isVisible()&&(__this.__view.getElement()[0].style.opacity="0",__this.__onSystemSplashScreenHideEvent=TcHmi.EventProvider.register("System.onSplashScreenHide",e=>{__this.__onSystemSplashScreenHideEvent&&(__this.__onSystemSplashScreenHideEvent(),__this.__onSystemSplashScreenHideEvent=null),__this.__view&&(__this.__view.getElement()[0].style.opacity="1")})),TcHmi.System.SharedResources.jqBody[0].prepend(__this.__view.getElement()[0]);__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})})},partialMarkup=TcHmi.System.Data.Caches.partialMarkupCache.get(partialUrl),partialMarkupKeepAlive=!1;if(!0===TcHmi.System.Data.isKeepAlivePartial.get(partialUrl)&&(partialMarkupKeepAlive=!0),partialMarkup)__proc(partialUrl,partialMarkup.markup,partialMarkupKeepAlive);else if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(partialUrl,data=>{data.error===TcHmi.Errors.NONE?__proc(partialUrl,data.content,partialMarkupKeepAlive):(__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+partialUrl+" failed.",domain:"TcHmi.System.ViewManager",errors:data.details?[data.details]:void 0}}))});else{let xhr=new XMLHttpRequest;xhr.open("GET",partialUrl+(TCHMI_ENGINEERING?"?preventcache="+Math.random():""));let ViewManager_loadView_getMarkup_success=function(evt){200===xhr.status?(partialMarkupKeepAlive&&TcHmi.System.Data.Caches.partialMarkupCache.set(partialUrl,{markup:xhr.responseText}),__proc(partialUrl,xhr.responseText,partialMarkupKeepAlive)):ViewManager_loadView_getMarkup_error(evt)},ViewManager_loadView_getMarkup_error=function(evt){__this.__pending=!1,TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Loading "+partialUrl+" failed: "+xhr.statusText,domain:"TcHmi.System.ViewManager"}})};xhr.addEventListener("load",ViewManager_loadView_getMarkup_success),xhr.addEventListener("error",ViewManager_loadView_getMarkup_error),xhr.send()}}loadViewObject(view,callback=null){!0!==this.__pending?(this.__pending=!0,void 0!==this.__view&&null!==this.__view&&(TcHmi.System.SharedResources.jqBody.children().detach(),null!==this.__onViewResizedEventDestroyEvent&&(this.__onViewResizedEventDestroyEvent(),this.__onViewResizedEventDestroyEvent=null),null!==this.__onViewDestroyedEventDestroyEvent&&(this.__onViewDestroyedEventDestroyEvent(),this.__onViewDestroyedEventDestroyEvent=null),this.__view.destroy(),this.__view=null,this.__viewUrl=null),this.__view=view,this.__viewUrl=null,this.__onViewResizedEventDestroyEvent=TcHmi.EventProvider.register(this.__view.getId()+".onResized",this.__onViewResized()),this.__onViewDestroyedEventDestroyEvent=TcHmi.EventProvider.register(this.__view.getId()+".onDestroyed",this.__onViewDestroyed()),TcHmi.System.SharedResources.jqBody.children().detach(),!0===TCHMI_ENGINEERING&&!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.rootControlManager?TcHmi.System.SharedResources.jqBody[0].appendChild(TcHmi.System.Services.Engineering.designerModeManager.rootControlManager.getViewPortSimulator().empty()[0].appendChild(this.__view.getElement()[0])):TcHmi.System.SharedResources.jqBody[0].appendChild(this.__view.getElement()[0]),this.__pending=!1,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})):"function"==typeof callback&&callback.call(this,{error:TcHmi.Errors.ERROR})}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.TcSpeechManager=class{constructor(){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;this.__openConnection=!1,this.__restartServerEventListening=()=>{var _a;TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Restarting all event listeners in the speech extension for our socket id "+this.__peerData.localSocketId+". (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),null===(_a=this.__commandDestroyFnc)||void 0===_a||_a.call(this),this.__commandDestroyFnc=TcHmi.Server.Events.registerConsumer([{path:"domain",comparator:"==",value:this.__currentConfig.domain},{logic:"AND"},{path:"name",comparator:"==",value:"COMMAND_RECEIVED"},{logic:"AND"},{path:"payload::RemoteSocketId",comparator:"==",value:this.__peerData.localSocketId}],{subscription:data=>{if(data.error)return;const evt=data.event;if(TcHmi.Server.Events.isPayload(evt)&&evt.payload)switch(evt.payload.Command.Type){case"LogOnClientCommand":if(TCHMI_CONSOLE_LOG_LEVEL>=evt.payload.Command.Severity)switch(evt.payload.Command.Severity){case 1:TcHmi.Log.errorEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 2:TcHmi.Log.warnEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 3:TcHmi.Log.infoEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts);break;case 4:TcHmi.Log.debugEx("[Source=TwinCAT Speech Core]",...evt.payload.Command.MessageParts)}break;case"DetectedCommand":if(evt.payload.Command.Confidence&&!isNaN(this.__currentConfig.confidenceThreshold)&&evt.payload.Command.Confidence<this.__currentConfig.confidenceThreshold){if(TCHMI_CONSOLE_LOG_LEVEL>=3){let numFormatter=new Intl.NumberFormat(TcHmi.Server.getCurrentUserConfig().locale,{style:"decimal",maximumFractionDigits:2});TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Detected event",evt.payload.Command.DetectedCommand," skipped because its confidence",numFormatter.format(evt.payload.Command.Confidence),"is below configured threshold",numFormatter.format(this.__currentConfig.confidenceThreshold))}return}let EventProviderParam={Command:evt.payload.Command.DetectedCommand,Confidence:evt.payload.Command.Confidence,Parameter:evt.payload.Command.Parameter};TcHmi.EventProvider.raise("SpeechOnCommand<"+evt.payload.Command.DetectedCommand+">",EventProviderParam),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Raised event: ","SpeechOnCommand<"+evt.payload.Command.DetectedCommand+">"," with param: ",EventProviderParam);break;case"SpeechSynthesisStatus":TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Received event for ISpeechSynthesisStatus\n",evt.payload.Command);let command=evt.payload.Command,callbackSet=this.__getStatusCallbackQueue.get(evt.payload.Command.Guid);null==callbackSet||callbackSet.forEach(callback=>{TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE,guid:command.Guid,state:command.State})});break;case"Answer":let serverAnswer=evt.payload.Command;TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Read server answer from server event and saving as remoteSdp (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+").",serverAnswer),this.__peerData.remoteSdp=serverAnswer.SDP;let speechServerData={type:"answer",sdp:this.__peerData.remoteSdp};this.__peerConnection.setRemoteDescription(speechServerData).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Set setRemoteDescription without problems. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.remotePendingIceCandidate.length&&(this.__peerData.remotePendingIceCandidate.forEach(icecandidate=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding one remote pending ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")",icecandidate),this.__peerConnection.addIceCandidate(icecandidate).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added pending ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")}).catch(data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding ice candidate failed",data)})}),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested adding "+this.__peerData.remotePendingIceCandidate.length+" pending ice candidates. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") Clearing pending candidates."),this.__peerData.remotePendingIceCandidate=[])}).catch(data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Setting remote description failed",data)});break;case"IceCandidates":evt.payload.Command.Candidates.length&&(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Read "+evt.payload.Command.Candidates.length+" server remote ice from server events."),"have-local-offer"===this.__peerConnection.signalingState?(this.__peerData.remotePendingIceCandidate=this.__peerData.remotePendingIceCandidate.concat(evt.payload.Command.Candidates),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Saved "+evt.payload.Command.Candidates.length+" ice candidates in a pending cache. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")):(evt.payload.Command.Candidates.forEach(icecandidate=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding one remote ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")",icecandidate),this.__peerConnection.addIceCandidate(icecandidate).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added remote ice candidate. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")}).catch(data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Adding ice candidate failed",data)})}),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added all "+evt.payload.Command.Candidates.length+" remote ice candidates. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")));break;default:TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Command ",evt.payload.Command,"from remote id "+evt.payload.RemoteSocketId,"is not supported. Ignoring")}}})},this.__peerData={options:{},callback:null,clientState:0,audioElement:document.createElement("audio"),localSocketId:0,localSdp:"",localIceCandidates:[],remoteSocketId:0,remoteSdp:"",remoteVersion:"",remoteIceCandidate:[],remotePendingIceCandidate:[]},this.__globalEventsRegistered=!1,this.__domainWatchRegistered=0,this.__handlingNewIce=data=>{data.candidate?(this.__peerData.localIceCandidates.push(data.candidate),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got new local ice candidate to transport to the other side (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Will save the candidate for now.")):this.__peerData.remoteSocketId?(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found no more ice candidates to transport to the other side. Sending now."),this.__sendIceCandidates()):TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found "+this.__peerData.localIceCandidates+" ice candidates to transport to the other side. But remoteSocketId is not known right now. Waiting.")},this.__sendIceCandidates=()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending ice candidates",this.__peerData.localIceCandidates),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"IceCandidates",Candidates:this.__peerData.localIceCandidates}},null,this.__writeValueDebugOutput)},this.__handlingNewTrack=data=>{var _a,_b,_c,_d,_e,_f,_g;if(!this.__currentConfig.enableSpeaker)return void(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got remote track, but ignoring because our speaker is disabled."));let track=data.track;if(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got "+data.streams.length+" (track id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState+") streams from the remote side (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") Adding first one to our audio element."),data.track.addEventListener("mute",evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+evt.type+" on remote track fired.")}),data.track.addEventListener("unmute",evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+evt.type+" on remote track fired.")}),this.__peerData.audioElement.readyState===HTMLMediaElement.HAVE_NOTHING&&(this.__peerData.audioElement.pause(),this.__peerData.audioElement=document.createElement("audio"),(null===(_a=this.__peerData.options.sinkConstraints)||void 0===_a?void 0:_a.deviceId)&&this.__peerData.audioElement.setSinkId&&this.__peerData.audioElement.setSinkId(this.__peerData.options.sinkConstraints.deviceId).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Successfully set deviceId to audio element.")}).catch(e=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Failed setting deviceId to audio element:\n",e)})),this.__peerData.audioElement.srcObject=data.streams[0],this.setVolume(this.__currentConfig.defaultVolume),this.__peerData.audioElement.play().catch(data=>{let tryPlay=()=>{this.__peerData.audioElement.paused&&(this.__peerData.audioElement.play().catch(data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Activating audio playback for TwinCAT Speech failed even after user interaction",data)}),TcHmi.TopMostLayer.removeEx(jContainer))},container=document.createElement("div");container.style.padding="20px",container.style.margin="20px",container.style.background="white",container.onclick=tryPlay;let confirmButton=document.createElement("button");confirmButton.innerText=TcHmi.System.Services.localization.getText("OK"),container.append(TcHmi.System.Services.localization.getText("Speech_playing_audio_needs_confirmation")+" ",confirmButton);let jContainer=$(container);TcHmi.TopMostLayer.addEx(jContainer,{centerHorizontal:!0,centerVertical:!0,removeCb:tryPlay})}),navigator.mediaSession&&window.MediaMetadata)try{navigator.mediaSession.metadata=new window.MediaMetadata({album:document.title,title:"TwinCAT Speech Output",artist:"TwinCAT Speech "+this.__peerData.remoteVersion}),null===(_c=(_b=navigator.mediaSession).setActionHandler)||void 0===_c||_c.call(_b,"play",()=>{}),null===(_e=(_d=navigator.mediaSession).setActionHandler)||void 0===_e||_e.call(_d,"pause",()=>{}),null===(_g=(_f=navigator.mediaSession).setActionHandler)||void 0===_g||_g.call(_f,"stop",()=>{this.closeConnection()})}catch(ex){}this.__peerData.clientState=8},this.__handlingNegotiationneeded=data=>{this.__peerData.localIceCandidates=[],TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got negotiationneeded event. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Recreate Offer."),1!==this.__peerData.clientState&&(this.__peerData.clientState=5,this.__clientSignalingStateMachine())},this.__handlingIceError=data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got an ice error",data)},this.closeConnection=(options={},callback)=>{if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else if((null==options?void 0:options.remoteSocketId)&&this.__peerData.remoteSocketId!==options.remoteSocketId){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"No connection with requested socket ID open."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else!this.__peerConnection||"closed"!==this.__peerConnection.connectionState&&"disconnected"!==this.__peerConnection.connectionState||TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Closing connection."),this.__openConnection=!1,this.__peerData.clientState=9,this.__rebuildPeerConnectionObject(),TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE})},this.__clientSignalingStateMachine=()=>{var _a;switch(this.__peerData.clientState){case 2:this.__peerData.clientState=3;case 3:if(200===this.__domainWatchRegistered)return this.__peerData.clientState=4,void this.__clientSignalingStateMachine();if(102===this.__domainWatchRegistered)return void(this.__peerData.clientState=1);this.__domainWatchRegistered=102,this.__peerData.clientState=1,TcHmi.Server.Domains.watch(this.__currentConfig.domain,data=>{var _a,_b,_c,_d;data&&data.error===TcHmi.Errors.NONE&&"Initialized"===(null===(_a=data.value)||void 0===_a?void 0:_a.state)?(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Register own instance and starting RTCPeerConnection."),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Clients.Register",{SpeechApiVersion:1,RemoteSocketId:0,SocketId:0,RegisterDate:(new Date).toISOString(),Version:TcHmi.version.full,AudioSink:this.__currentConfig.enableSpeaker,AudioSource:this.__currentConfig.enableMicrophone,CanOffer:!0,CanAnswer:!1,PotentialLocales:TcHmi.Locale.getRegisteredLocales(),State:"available"},null,TcHmi.Server.__handleServerResponse({error:data=>{var _a;this.__peerData.clientState=10,data.error?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed: "+TcHmi.Log.buildMessage(data.details),"\n",data.response):(null===(_a=data.results)||void 0===_a?void 0:_a.some(data=>data.error!==TcHmi.Errors.NONE))?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed:\n",data.results):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed:\n",data.response);const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"Registering client failed. Aborting."};TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})},success:data=>{if(this.__domainWatchRegistered=200,!data.response.commands[0].readValue){this.__peerData.clientState=10,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registering client failed. Aborting.");const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"Registering client failed. Aborting."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}let oldId=this.__peerData.localSocketId;this.__peerData.localSocketId=data.response.commands[0].readValue.SocketId,TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got our Socket Id: "+this.__peerData.localSocketId),this.__globalEventsRegistered||(this.__globalEventsRegistered=!0,TcHmi.EventProvider.register("onLocaleChanged",this.__registerClientConfig),TcHmi.EventProvider.register("onWebSocketOpened",evt=>{this.__restartServerEventListening()})),oldId!==this.__peerData.localSocketId&&this.__restartServerEventListening(),9!==this.__peerData.clientState&&10!==this.__peerData.clientState&&(this.__peerData.clientState=4,this.__clientSignalingStateMachine())}})),this.__rebuildPeerConnectionObject()):(this.closeConnection(),null===(_b=this.__commandDestroyFnc)||void 0===_b||_b.call(this),this.__commandDestroyFnc=void 0,TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Domain: '"+(null===(_c=this.__currentConfig)||void 0===_c?void 0:_c.domain)+"' is not available. Please make sure the server extension is loaded and the domain name is correct.",TcHmi.Log.buildMessage(null===(_d=data.value)||void 0===_d?void 0:_d.error)))});break;case 4:if(this.__currentConfig.enableMicrophone){if(!navigator.mediaDevices){let reason;reason=window.isSecureContext?"Could not access media devices.":"Could not access media devices. You probably need to access this page via secure HTTPS or localhost.",TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] "+reason),this.__peerData.clientState=10;const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:reason};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.clientState=1;const constraints={audio:null===(_a=this.__peerData.options.sourceConstraints)||void 0===_a||_a,video:!1};navigator.mediaDevices.getUserMedia(constraints).then(localStream=>{let alltracks=localStream.getTracks();TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Got "+alltracks.length+" audio tracks from the microphone (id: "+localStream.id+") (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+"). Adding all tracks to peerConnection now."),alltracks.forEach(track=>{this.__peerConnection.addTrack(track,localStream),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Added microphone track to peerConnection with the id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState)}),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Saving all tracks to peerConnection successful. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=5,this.__clientSignalingStateMachine()}).catch(reason=>{switch(this.__peerData.clientState=10,reason.name){case"NotFoundError":TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed: No microphone was found.");break;case"SecurityError":case"PermissionDeniedError":case"NotAllowedError":TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed: Denied access to microphone.");break;default:TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Capturing audio failed (",reason.name,"):",reason.message)}}),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested microphone from the browser. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")")}else{let myStream=new AudioContext({}).createMediaStreamDestination().stream;myStream.getTracks().forEach(track=>{this.__peerConnection.addTrack(track,myStream),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No microphone requested. Thus added silence/empty track to peerConnection with the id: "+track.id+", kind: "+track.kind+", label: "+track.label+", muted: "+track.muted+", readyState: "+track.readyState)}),this.__peerData.clientState=5,this.__clientSignalingStateMachine()}break;case 5:TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requesting WebRTC offer from the browser (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=1,this.__peerConnection.createOffer().then(offer=>(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Browser created offer. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+") and saving as local description."),this.__peerData.localSdp=offer.sdp,this.__peerData.remoteSdp="","stable"!==this.__peerConnection.signalingState&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] We created an Offer, but peerConnection.signalingState is not in state stable."),this.__peerConnection.setLocalDescription(offer))).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Set local description successful. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.clientState=6,this.__clientSignalingStateMachine()}).catch(data=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Creating offer failed",data),this.__peerData.clientState=10,this.__peerData.localSdp="",this.__peerData.remoteSdp=""});break;case 6:TcHmi.Server.readSymbolEx(this.__currentConfig.domain+".Clients.List",null,TcHmi.Server.__handleServerResponse({error:this.__writeValueDebugOutput,success:data=>{var _a;let readValue=data.response.commands[0].readValue;if(!readValue.length)return TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No registered Speech Clients found! Huh. At least we should have find ourself."),void(this.__peerData.clientState=10);if(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Registered Speech Clients found. Searching a matching server. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),null===(_a=this.__peerData.options)||void 0===_a?void 0:_a.remoteSocketId){const firstMatch=readValue.find(data=>data.CanAnswer&&data.SocketId===this.__peerData.options.remoteSocketId);if(!firstMatch){this.__peerData.clientState=10,TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No speech service with the requested id available on this server.");const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"No speech service with the requested id available on this server."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.remoteSocketId=firstMatch.SocketId,this.__peerData.remoteVersion=firstMatch.Version}else{const firstMatch=readValue.find(data=>data.CanAnswer);if(!firstMatch){this.__peerData.clientState=10,TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] No speech service available on this server.");const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"No speech service available on this server."};return void TcHmi.Callback.callSafe(this.__peerData.callback,null,{error:errorDetail.code,details:errorDetail})}this.__peerData.remoteSocketId=firstMatch.SocketId,this.__peerData.remoteVersion=firstMatch.Version}TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found a matching server with id "+this.__peerData.remoteSocketId+". (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),this.__peerData.localIceCandidates.length&&(TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Found cached local ice candidates. Sending now, as we have now the remoteSocketId."),this.__sendIceCandidates()),TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending active Commands, as we have now the remoteSocketId."),this.__registerClientConfig(),this.__peerData.clientState=7,this.__clientSignalingStateMachine()}}));break;case 7:TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Sending offer to remoteSocketId "+this.__peerData.remoteSocketId+" of server. (connection state is: "+this.__peerConnection.connectionState+", signaling state is: "+this.__peerConnection.signalingState+")"),TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"Offer",SDP:this.__peerData.localSdp}},null,this.__writeValueDebugOutput)}},this.__eventProviderRegistrations=[],this.__eventProviderRegistrationTimeOut=0,this.__registerClientConfig=()=>{var _a;window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=0,this.__peerData.remoteSocketId&&TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".ClientConfigs.Register",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,CurrentCommands:this.__eventProviderRegistrations,CurrentLocales:[null!==(_a=TcHmi.Locale.get())&&void 0!==_a?_a:"en"]},null,TcHmi.Server.__handleServerResponse({completed:this.__writeValueDebugOutput}))},this.__getStatusCallbackQueue=new Map,this.__writeValueDebugOutput=data=>{var _a,_b,_c,_d,_e,_f;data.error?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Writing to server symbol failed: "+TcHmi.Log.buildMessage(data.details),"\n",data.response):(null===(_a=data.results)||void 0===_a?void 0:_a.some(data=>data.error!==TcHmi.Errors.NONE))?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Writing to server symbol failed:\n",data.results):data.response.commands[0].symbol===this.__currentConfig.domain+".Event.Raise"&&(null===(_c=null===(_b=data.response.commands[0].writeValue)||void 0===_b?void 0:_b.Command)||void 0===_c?void 0:_c.Type)?TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Raised Command ",null===(_e=null===(_d=data.response.commands[0].writeValue)||void 0===_d?void 0:_d.Command)||void 0===_e?void 0:_e.Type,"to remote socket id "+(null===(_f=data.response.commands[0].writeValue)||void 0===_f?void 0:_f.RemoteSocketId),"with payload",data.response.commands[0].writeValue):TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Written to server symbol: "+data.response.commands[0].symbol,"writevalue: ",data.response.commands[0].writeValue)},this.__currentConfig={enableMicrophone:null!==(_b=null===(_a=TcHmi.System.config.tcSpeech)||void 0===_a?void 0:_a.enableMicrophone)&&void 0!==_b&&_b,enableSpeaker:null!==(_d=null===(_c=TcHmi.System.config.tcSpeech)||void 0===_c?void 0:_c.enableSpeaker)&&void 0!==_d&&_d,defaultVolume:null!==(_f=null===(_e=TcHmi.System.config.tcSpeech)||void 0===_e?void 0:_e.defaultVolume)&&void 0!==_f?_f:1,confidenceThreshold:null!==(_h=null===(_g=TcHmi.System.config.tcSpeech)||void 0===_g?void 0:_g.confidenceThreshold)&&void 0!==_h?_h:.2,domain:null!==(_k=null===(_j=TcHmi.System.config.tcSpeech)||void 0===_j?void 0:_j.domain)&&void 0!==_k?_k:"TcHmiSpeech"},TCHMI_DESIGNER||(TcHmi.EventProvider.register("System.EventProvider.onRegisterCallback",(e,data)=>{let name=data.name;name.endsWith(">")&&name.startsWith("SpeechOnCommand<")&&this.__addUsedSpeechTrigger(name)}),TcHmi.EventProvider.register("System.EventProvider.onDestroyCallback",(e,data)=>{let name=data.name;name.endsWith(">")&&name.startsWith("SpeechOnCommand<")&&this.__removeUsedSpeechTrigger(name)}),TCHMI_DESIGNER||!this.__currentConfig.enableSpeaker&&!this.__currentConfig.enableMicrophone||TcHmi.EventProvider.register("onInitialized",event=>{event.destroy(),0===this.__peerData.clientState&&this.openConnection()}))}__rebuildPeerConnectionObject(){var _a;null===(_a=this.__peerConnection)||void 0===_a||_a.close();this.__peerConnection=new RTCPeerConnection({iceCandidatePoolSize:5}),this.__peerConnection.addEventListener("icecandidate",this.__handlingNewIce),this.__peerConnection.addEventListener("icecandidateerror",this.__handlingIceError),this.__peerConnection.addEventListener("track",this.__handlingNewTrack),this.__peerConnection.addEventListener("negotiationneeded",this.__handlingNegotiationneeded),this.__peerConnection.addEventListener("signalingstatechange",data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] # >"+data.type+" (connection state is: "+data.target.connectionState+", signaling state is: "+data.target.signalingState+")")}),this.__peerConnection.addEventListener("connectionstatechange",data=>{switch(this.__peerConnection.connectionState){case"disconnected":case"failed":this.__peerData.clientState=10}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] # >"+data.type+" (connection state is: "+data.target.connectionState+", signaling state is: "+data.target.signalingState+")")})}openConnection(options={},callback){var _a;if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}else this.closeConnection(),"string"==typeof options.domain&&(this.__currentConfig.domain=options.domain),"boolean"==typeof options.enableSpeaker&&(this.__currentConfig.enableSpeaker=options.enableSpeaker),"boolean"==typeof options.enableMicrophone&&(this.__currentConfig.enableMicrophone=options.enableMicrophone),"number"==typeof options.defaultVolume&&(this.__currentConfig.defaultVolume=options.defaultVolume),"number"==typeof options.confidenceThreshold&&(this.__currentConfig.confidenceThreshold=options.confidenceThreshold),this.__currentConfig.enableSpeaker||this.__currentConfig.enableMicrophone?(this.__openConnection=!0,this.__peerData.callback=callback,this.__peerData.localSdp="",this.__peerData.remoteSdp="",this.__peerData.remoteSocketId=0,this.__peerData.localIceCandidates=[],this.__peerData.options=options,this.__peerData.clientState=2,(null===(_a=this.__peerData.options.sinkConstraints)||void 0===_a?void 0:_a.deviceId)&&(this.__peerData.audioElement.setSinkId?this.__peerData.audioElement.setSinkId(this.__peerData.options.sinkConstraints.deviceId).then(()=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Successfully set deviceId to audio element.")}).catch(e=>{TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Failed setting deviceId to audio element:\n",e)}):TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Setting deviceId to audio element not possible in this browser.")),this.__clientSignalingStateMachine()):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.NONE})}setVolume(newValue){TCHMI_DESIGNER||isNaN(newValue)||(newValue<0?newValue=0:newValue>1&&(newValue=1),this.__peerData.audioElement.volume=newValue)}__addUsedSpeechTrigger(eventname){if(TCHMI_DESIGNER)return;const commandName=eventname.substring(16,eventname.length-1);this.__eventProviderRegistrations.includes(commandName)||(this.__eventProviderRegistrations.push(commandName),this.__eventProviderRegistrationTimeOut&&window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=window.setTimeout(this.__registerClientConfig,50))}__removeUsedSpeechTrigger(eventname){if(TCHMI_DESIGNER)return;const commandName=eventname.substring(16,eventname.length-1),idx=this.__eventProviderRegistrations.indexOf(commandName);-1!==idx&&(this.__eventProviderRegistrations.splice(idx,1),this.__eventProviderRegistrationTimeOut&&window.clearTimeout(this.__eventProviderRegistrationTimeOut),this.__eventProviderRegistrationTimeOut=window.setTimeout(this.__registerClientConfig,50))}speechSynthesisStart(text,options,callback){var _a;if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!text){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Text to Synthesis has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!this.__currentConfig.enableSpeaker){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TcSpeechManager",reason:"The config did not allowed a speaker, so we can not synthesis text."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!this.__peerData.remoteSocketId){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Connection to Speech has to be up before we can synthesis text."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}const guid=tchmi_create_guid();let prio=null!==(_a=null==options?void 0:options.priority)&&void 0!==_a?_a:TcHmi.TcSpeech.AudioEntityPriority.Normal;if(null===TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisStart",Text:text,Priority:prio,Guid:guid}},null,TcHmi.Server.__handleServerResponse({completed:data=>{TCHMI_CONSOLE_LOG_LEVEL>=3&&TcHmi.Log.infoEx("[Source=Framework, Module=TcHmi.System.TcSpeechManager] Requested start of SpeechSynthesis with id "+guid),TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid,state:"Queued"})}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}speechSynthesisGetStatus(guid,callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!guid){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Guid to get synthesis status has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(null===TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisGetStatus",Guid:guid}},null,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid})},success:data=>{let guidSet=this.__getStatusCallbackQueue.get(guid);guidSet||(guidSet=new Set,this.__getStatusCallbackQueue.set(guid,guidSet)),guidSet.add(callback)}}))){const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}
/**
             * Stops a given speech synthesis call.
             * @param guid guid for the request. Can be fetched from the callback of speechSynthesisStart
             * @param callback The callback will get the state of the speech synthesis
             * @preserve (Part of the public API)
             */speechSynthesisStop(guid,callback){if(TCHMI_DESIGNER){const errorDetail={code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TcSpeechManager",reason:"Speech connectivity is not supported in Designer view."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(!guid){const errorDetail={code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TcSpeechManager",reason:"Guid to stop synthesis has to be provided."};return void TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}if(null!==TcHmi.Server.writeSymbolEx(this.__currentConfig.domain+".Event.Raise",{SpeechApiVersion:1,SocketId:this.__peerData.localSocketId,RemoteSocketId:this.__peerData.remoteSocketId,Command:{Type:"SpeechSynthesisStop",Guid:guid}},null,TcHmi.Server.__handleServerResponse({completed:data=>{TcHmi.Callback.callSafe(callback,null,{error:data.error,details:data.details,guid:guid})}})));else{const errorDetail={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Request could not be sent.",domain:"TcHmi.System.TcSpeechManager"};TcHmi.Callback.callSafe(callback,null,{error:errorDetail.code,details:errorDetail})}}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.ThemeManager=class{constructor(){this.__activeThemes="Base",this.__registered_themedValueFiles_fromControl=new Map,this.__registered_styleCheets_fromControl=new Map,this.__control_themeFiles=new Map,this.__project_themeFiles=new Map,this.__resolveControlInheritance=()=>{if(!TcHmi.System.Services.controlManager)return;const resolve=(hierarchyEntry,parent)=>{if(!hierarchyEntry)return;const normalizeFile=descr=>{descr.controlTypeValues||(descr.controlTypeValues={});let attrValue=descr.controlTypeValues[hierarchyEntry.controlType];attrValue||(attrValue=descr.controlTypeValues[hierarchyEntry.controlType]={}),attrValue.attributes||(attrValue.attributes={}),attrValue.themedResources||(attrValue.themedResources={})};this.__project_themeFiles.forEach(descr=>{if(descr&&(normalizeFile(descr),parent)){const parentAttrValue=descr.controlTypeValues[parent.controlType],controlAttrValue=descr.controlTypeValues[hierarchyEntry.controlType];for(const parentAttrName of Object.keys(parentAttrValue.attributes))void 0===controlAttrValue.attributes[parentAttrName]&&(controlAttrValue.attributes[parentAttrName]=parentAttrValue.attributes[parentAttrName]);for(const parentResourceName of Object.keys(parentAttrValue.themedResources))void 0===controlAttrValue.themedResources[parentResourceName]&&(controlAttrValue.themedResources[parentResourceName]=parentAttrValue.themedResources[parentResourceName])}}),this.__control_themeFiles.forEach(controlTypeMap=>{controlTypeMap.forEach((descr,controlName)=>{descr&&normalizeFile(descr)});let descr=controlTypeMap.get(hierarchyEntry.controlType);if(descr&&parent&&controlTypeMap.has(parent.controlType)){const parentAttrValue=controlTypeMap.get(parent.controlType).controlTypeValues[parent.controlType],controlAttrValue=descr.controlTypeValues[hierarchyEntry.controlType];for(const parentAttrName of Object.keys(parentAttrValue.attributes))void 0===controlAttrValue.attributes[parentAttrName]&&(controlAttrValue.attributes[parentAttrName]=parentAttrValue.attributes[parentAttrName]);for(const parentResourceName of Object.keys(parentAttrValue.themedResources))void 0===controlAttrValue.themedResources[parentResourceName]&&(controlAttrValue.themedResources[parentResourceName]=parentAttrValue.themedResources[parentResourceName])}});for(let child of hierarchyEntry.children)resolve(child,hierarchyEntry)};resolve(TcHmi.System.Services.controlManager.getInheritanceTree(),void 0)},this.__asyncLoadCount=0,this.retriggerUserControls=()=>{let controlsToTrigger=[];TcHmi.System.Services.controlManager.getControlsCache().forEach((control,controlName)=>{"TcHmi.Controls.System.TcHmiUserControlHost"===control.getType()&&controlsToTrigger.push(control)}),this.__triggerControlsWithImplicitValues(controlsToTrigger)},this.__watchAttributeDefaults=new Map,this.__destroyOnPropertyChanged=new Map,this.__settingThemeValueInProgress=null,this.__onControlDestroyed=(e,control)=>{this.__watchAttributeDefaults.delete(control);const destroy=this.__destroyOnPropertyChanged.get(control);destroy&&(destroy(),this.__destroyOnPropertyChanged.delete(control))},this.__onControlClassNamesChanged=(e,data)=>{let currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeThemes);if(currentProjectThemeFiles){if(data.oldClassNames)for(let oldClassName of data.oldClassNames)if(currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[oldClassName])return void this.__triggerControlsWithImplicitValues([data.control]);for(let newClassName of data.newClassName)if(currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[newClassName])return void this.__triggerControlsWithImplicitValues([data.control])}},TcHmi.EventProvider.register("System.onControlDestroyed",this.__onControlDestroyed),TcHmi.EventProvider.register("System.onControlClassNamesChanged",this.__onControlClassNamesChanged),TcHmi.EventProvider.register("System.onUserControlConfigCreated",this.retriggerUserControls),TcHmi.EventProvider.register("System.onUserControlConfigChanged",this.retriggerUserControls),TcHmi.EventProvider.register("System.onUserControlConfigRemoved",this.retriggerUserControls),TcHmi.System.config.activeTheme&&this.setTheme(TcHmi.System.config.activeTheme,!1);const fontFaceSet=document.fonts;fontFaceSet&&fontFaceSet.addEventListener&&fontFaceSet.addEventListener("loadingdone",evt=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded another font file. Triggering a onThemeDataChanged."),TcHmi.EventProvider.raise("onThemeDataChanged")})}__clearProjectThemeUrl(cleanPath){if(cleanPath.endsWith(".theme"))this.__control_themeFiles.clear(),this.__project_themeFiles.clear();else if(cleanPath.endsWith(".css")){let currentLinkElem=document.head.querySelector('link[href="'+cleanPath+'"]');currentLinkElem&&(currentLinkElem.href="")}}getTheme(){return this.__activeThemes}setTheme(valueNew,processTheme){return"string"!=typeof valueNew||""===valueNew?TcHmi.Errors.E_PARAMETER_INVALID:(tchmi_equal(this.__activeThemes,valueNew)||(this.__activeThemes=valueNew,processTheme&&this.processActiveTheme()),TcHmi.Errors.NONE)}registerControlThemeFiles(controlDescr){let ctrlType=TcHmi.System.resolveQualifiedName(controlDescr.name,controlDescr.namespace),themeFiles=controlDescr.themes;if(themeFiles)for(let themeName in themeFiles)for(let arrayIterator=0;arrayIterator<themeFiles[themeName].resources.length;arrayIterator++){const themeFile=themeFiles[themeName].resources[arrayIterator];if(themeFile.name){if("ThemedValues"===themeFile.type){let currentThemeEntry=this.__registered_themedValueFiles_fromControl.get(themeName);currentThemeEntry||(currentThemeEntry=new Map,this.__registered_themedValueFiles_fromControl.set(themeName,currentThemeEntry));let currentCtrlTypeEntry=currentThemeEntry.get(ctrlType);currentCtrlTypeEntry||(currentCtrlTypeEntry=[],currentThemeEntry.set(ctrlType,currentCtrlTypeEntry)),currentCtrlTypeEntry.push(themeFile)}else if("Stylesheet"===themeFile.type){let currentThemeEntry=this.__registered_styleCheets_fromControl.get(themeName);currentThemeEntry||(currentThemeEntry=new Map,this.__registered_styleCheets_fromControl.set(themeName,currentThemeEntry));let currentCtrlTypeEntry=currentThemeEntry.get(ctrlType);currentCtrlTypeEntry||(currentCtrlTypeEntry=[],currentThemeEntry.set(ctrlType,currentCtrlTypeEntry)),currentCtrlTypeEntry.push(themeFile)}}else TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.System.ThemeManager] No file path found for theme entry  ("+themeName+") and control ("+ctrlType+") in Description.json:",themeFile)}}processActiveTheme(callback,options){let jsonValueChanged=!1,asyncLoadingHandler=evt=>{var _a;this.__asyncLoadCount--,this.__asyncLoadCount<=0&&(this.__resolveControlInheritance(),this.__triggerControlsWithImplicitValues(null),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded and parsed all async files. Triggering a control resize check and event onThemeDataChanged."),null===(_a=TcHmi.System.Services.controlManager)||void 0===_a||_a.checkControlGeometry(),TcHmi.EventProvider.raise("onThemeDataChanged"),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE}))};if(TcHmi.Engineering.ErrorPane.remove("ThemeManager_multipleThemes"),TcHmi.System.config)for(let projectThemedValueThemeName in TcHmi.System.config.themes){if(this.__activeThemes!==projectThemedValueThemeName)continue;let foundProjectThemedValue="";for(let projectIterator=0;projectIterator<TcHmi.System.config.themes[projectThemedValueThemeName].resources.length;projectIterator++){let projectFile=TcHmi.System.config.themes[projectThemedValueThemeName].resources[projectIterator];if("Stylesheet"===projectFile.type)continue;if("ThemedValues"!==projectFile.type){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Type value of entry invalid in tchmiconfig.json (has to be ThemedValues or Stylesheet).",projectFile);continue}if(!projectFile.name){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Entry missing name property in tchmiconfig.json.",projectFile);continue}if(foundProjectThemedValue){TcHmi.Engineering.ErrorPane.add("ThemeManager_multipleThemes","Only one ThemedValues entry per theme ("+projectThemedValueThemeName+") allowed in tchmiconfig.json. Only "+foundProjectThemedValue+" will be used.",TcHmi.Engineering.ErrorPane.MessageType.Error);break}foundProjectThemedValue=projectFile.name;let currentProjTheme=this.__project_themeFiles.get(projectThemedValueThemeName);null!==currentProjTheme&&(void 0===currentProjTheme?(this.__project_themeFiles.set(projectThemedValueThemeName,null),((themeName,fileName)=>{let xhr=new XMLHttpRequest;xhr.addEventListener("load",evt=>{if(200!==xhr.status)this.__project_themeFiles.delete(themeName),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Loading "+fileName+" failed: "+xhr.statusText);else{const descr=TcHmi.ValueConverter.toObject(xhr.responseText,null);if(null!==descr){if(descr.controlTypeValues){let temp={};for(let key in descr.controlTypeValues){let newControlType=TcHmi.System.mapControlNamesFromPackageManifestApi0ToApi1.get(key);newControlType&&(temp[newControlType]=descr.controlTypeValues[key])}for(let key in temp)descr.controlTypeValues[key]=temp[key]}this.__project_themeFiles.set(themeName,descr),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetched and parsed "+fileName)}else this.__project_themeFiles.delete(themeName),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to parse "+fileName+". Details: "+xhr.responseText)}asyncLoadingHandler()});const errorHandler=evt=>{this.__project_themeFiles.delete(themeName),0===xhr.status||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to load "+fileName),asyncLoadingHandler()};xhr.addEventListener("error",errorHandler),xhr.addEventListener("abort",errorHandler),xhr.addEventListener("timeout",errorHandler),xhr.open("GET",tchmi_path(fileName)),xhr.send(),this.__asyncLoadCount++,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetching "+fileName+" async.")})(projectThemedValueThemeName,projectFile.name)):jsonValueChanged=!0)}}let themeAndBase=[this.__activeThemes];"Base"!==this.__activeThemes&&themeAndBase.push("Base"),this.__registered_themedValueFiles_fromControl.forEach((controlTypeMap,controlThemedValueThemeName)=>{-1!==themeAndBase.indexOf(controlThemedValueThemeName)&&controlTypeMap.forEach((registeredList,ctrlType)=>{let module=TcHmi.System.Data.Modules.controls.map.get(ctrlType);if(!module)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Missing package control module for type: '"+ctrlType+"'."));if(module&&module.error!==TcHmi.Errors.NONE)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Can't load package control module for type: '"+ctrlType+"'. Error: "+TcHmi.Log.buildMessage(module.errorDetails)));let foundControlThemedValue=!1;for(let controlIterator=0;controlIterator<registeredList.length;controlIterator++){let registered=registeredList[controlIterator],currentControlThemeFiles=this.__control_themeFiles.get(controlThemedValueThemeName);if(currentControlThemeFiles||(currentControlThemeFiles=new Map,this.__control_themeFiles.set(controlThemedValueThemeName,currentControlThemeFiles)),foundControlThemedValue){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Only one ThemedValues entry per theme ("+controlThemedValueThemeName+") and control ("+ctrlType+") allowed in Description.json.",this.__registered_themedValueFiles_fromControl.get(controlThemedValueThemeName).get(ctrlType));break}foundControlThemedValue=!0;let currentControlThemeFile=currentControlThemeFiles.get(ctrlType);null!==currentControlThemeFile&&(void 0===currentControlThemeFile?(currentControlThemeFiles.set(ctrlType,null),((themeName,ctrlType,fileName)=>{let xhr=new XMLHttpRequest;xhr.addEventListener("load",evt=>{if(200!==xhr.status)this.__control_themeFiles.get(themeName).delete(ctrlType),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Loading "+fileName+" failed: "+xhr.statusText);else{const descr=TcHmi.ValueConverter.toObject(xhr.responseText);if(null!==descr){if(descr.controlTypeValues){let temp={};for(let key in descr.controlTypeValues){let newControlType=TcHmi.System.mapControlNamesFromPackageManifestApi0ToApi1.get(key);newControlType&&(temp[newControlType]=descr.controlTypeValues[key])}for(let key in temp)descr.controlTypeValues[key]=temp[key]}this.__control_themeFiles.get(themeName).set(ctrlType,descr),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetched and parsed "+fileName)}else this.__control_themeFiles.get(themeName).delete(ctrlType),TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to parse "+fileName+". Details: "+xhr.responseText)}asyncLoadingHandler()});const errorHandler=evt=>{this.__control_themeFiles.get(themeName).delete(ctrlType),0===xhr.status||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi.System.ThemeManager] Failed to load "+fileName),asyncLoadingHandler()};xhr.addEventListener("error",errorHandler),xhr.addEventListener("abort",errorHandler),xhr.addEventListener("timeout",errorHandler);let module=TcHmi.System.Data.Modules.controls.map.get(ctrlType);module?module&&module.error!==TcHmi.Errors.NONE?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Can't load package control module for type: '"+ctrlType+"'. Error: "+TcHmi.Log.buildMessage(module.errorDetails)):module.package&&void 0!==module.package.basePath&&module.manifestData&&void 0!==module.manifestData.basePath&&fileName&&(xhr.open("GET",tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+fileName)),xhr.send(),this.__asyncLoadCount++,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Fetching "+fileName+" async.")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Missing package control module for type: '"+ctrlType+"'.")})(controlThemedValueThemeName,ctrlType,registered.name)):jsonValueChanged=!0)}})});let allCssStyles={frameworkGlobal:[],packages:[],projectGlobal:[],projectTheme:[]};if(TcHmi.System.description&&TcHmi.System.description.dependencyFiles)for(let frameworkGlobal of TcHmi.System.description.dependencyFiles)"Stylesheet"===frameworkGlobal.type&&allCssStyles.frameworkGlobal.push({url:TcHmi.System.config.basePath+"/"+frameworkGlobal.name,theme:null});if(TcHmi.System.config.packages.length>0){let processedPackageNames=new Set,sortedQueue=new Set,packagesQueue=new Set,sortDependency=packageInfo=>{let packageObj=TcHmi.System.Data.packages.get(packageInfo.name);if(packageObj){let preconditionFullfilled=!0;for(let i=0;i<packageObj.manifest.modules.length;i++){let moduleData=packageObj.manifest.modules[i];if("Package"===moduleData.type)if(TcHmi.System.Data.packages.has(moduleData.nugetId)){if(!processedPackageNames.has(moduleData.nugetId)){preconditionFullfilled=!1;break}}else;}return preconditionFullfilled?(sortedQueue.has(packageObj)||(sortedQueue.add(packageObj),processedPackageNames.add(packageInfo.name)),void packagesQueue.delete(packageObj)):void packagesQueue.add(packageObj)}};TcHmi.System.config.packages.forEach(sortDependency);let maxSortCount=TcHmi.System.config.packages.length**2;for(;packagesQueue.size;){if(maxSortCount<0){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Recursion or unsatisfied dependency found in referenced Packages from Properties/tchmiconfig.json");break}packagesQueue.forEach(sortDependency),maxSortCount--}let packageParser=packageInfo=>{let packageObj=TcHmi.System.Data.packages.get(packageInfo.name);packageObj&&packageObj.manifest.modules.forEach(moduleData=>{var _a,_b;switch(moduleData.type){case"Package":break;case"Resource":(null===(_a=moduleData.path)||void 0===_a?void 0:_a.endsWith(".css"))&&(moduleData.theme?this.__activeThemes===moduleData.theme&&allCssStyles.packages.push({theme:moduleData.theme,url:tchmi_path(packageInfo.basePath+"/"+moduleData.path)}):allCssStyles.packages.push({theme:null,url:tchmi_path(packageInfo.basePath+"/"+moduleData.path)}));break;case"Control":const cleanPath=tchmi_path(packageInfo.basePath+"/"+moduleData.basePath+"/"+moduleData.descriptionFile);let module=TcHmi.System.Data.Modules.controls.urlMap.get(cleanPath);if(!module||!module.descriptionExpanded){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] Internal Error: Did not found entry "+cleanPath+" in url cache.");break}if(module.descriptionExpanded.dependencyFiles&&module.package&&(null===(_b=null==module?void 0:module.manifestData)||void 0===_b?void 0:_b.basePath))for(let dependencyFile of module.descriptionExpanded.dependencyFiles)"Stylesheet"===dependencyFile.type&&allCssStyles.packages.push({theme:null,url:tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+dependencyFile.name)});let controlType=TcHmi.System.resolveQualifiedName(module.descriptionExpanded.name,module.descriptionExpanded.namespace);if(TcHmi.System.config.themes[this.__activeThemes]&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls){if(TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(controlType))break;const legacyControlType=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(controlType);if(legacyControlType&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(legacyControlType))break}let controlCssList=[],controlCssThemeName=this.__activeThemes,currentThemeEntry=this.__registered_styleCheets_fromControl.get(this.__activeThemes),currentCtrlTypeEntry=currentThemeEntry?currentThemeEntry.get(controlType):void 0;if(currentCtrlTypeEntry)controlCssList=currentCtrlTypeEntry;else{if(!this.__registered_styleCheets_fromControl.has("Base")||!this.__registered_styleCheets_fromControl.get("Base").has(controlType))return;controlCssList=this.__registered_styleCheets_fromControl.get("Base").get(controlType),controlCssThemeName="Base"}if(module.package&&module.manifestData)for(let controlThemeEntry of controlCssList)allCssStyles.packages.push({theme:controlCssThemeName,url:tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+controlThemeEntry.name)})}})};sortedQueue.forEach(packageParser)}if(TcHmi.System.config.dependencyFiles)for(let unthemeProjectIterator=0;unthemeProjectIterator<TcHmi.System.config.dependencyFiles.length;unthemeProjectIterator++){let unthemeProjectFile=TcHmi.System.config.dependencyFiles[unthemeProjectIterator];"Stylesheet"===unthemeProjectFile.type&&allCssStyles.projectGlobal.push({theme:null,url:unthemeProjectFile.name})}for(let projectCssThemeName in TcHmi.System.config.themes)if(this.__activeThemes===projectCssThemeName)for(let projectIterator=0;projectIterator<TcHmi.System.config.themes[projectCssThemeName].resources.length;projectIterator++){let projectFile=TcHmi.System.config.themes[projectCssThemeName].resources[projectIterator];"Stylesheet"===projectFile.type&&(projectFile.name?allCssStyles.projectTheme.push({theme:projectCssThemeName,url:projectFile.name}):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ThemeManager] Entry missing name property in tchmiconfig.json.",projectFile))}let linkInserter=(cssStyles,origin)=>{var _a;cssStyles.length||cssStyles.push({url:"",theme:null});for(let currentIndex=0;currentIndex<cssStyles.length;currentIndex++){let currentStyle=cssStyles[currentIndex],cleanPath=tchmi_path(currentStyle.url),currentOriginStyles=document.head.querySelectorAll("link[data-tchmi-file-origin="+origin+"]");const currentLinkElem=currentOriginStyles[currentIndex],makeNewElem=()=>{const newLinkElem=document.createElement("link");return newLinkElem.rel="stylesheet",newLinkElem.type="text/css",newLinkElem.href=cleanPath,cleanPath?(newLinkElem.addEventListener("load",asyncLoadingHandler),newLinkElem.addEventListener("error",asyncLoadingHandler),this.__asyncLoadCount++):newLinkElem.dataset.tchmiReason="internal marker",newLinkElem.dataset.tchmiFileOrigin=origin,currentStyle.theme&&(newLinkElem.dataset.tchmiFromTheme=currentStyle.theme),newLinkElem};if(currentLinkElem){if(currentLinkElem.getAttribute("href")!==cleanPath||(null!==(_a=currentLinkElem.dataset.tchmiFromTheme)&&void 0!==_a?_a:null)!==currentStyle.theme){const newLinkElem=makeNewElem();currentLinkElem.replaceWith(newLinkElem),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Replaced CSS style node for "+currentStyle.url+".")}}else{const newLinkElem=makeNewElem();let lastElementSameOrigin=currentOriginStyles.length?currentOriginStyles[currentOriginStyles.length-1]:void 0;lastElementSameOrigin?(lastElementSameOrigin.after(newLinkElem),newLinkElem.after(document.createTextNode("\n"))):(document.head.appendChild(newLinkElem),document.head.appendChild(document.createTextNode("\n"))),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] Added CSS style node for "+currentStyle.url+".")}}let currentOriginStyles=document.head.querySelectorAll("link[data-tchmi-file-origin="+origin+"]");for(let removeCounter=cssStyles.length;removeCounter<currentOriginStyles.length;removeCounter++)currentOriginStyles[removeCounter].remove()};linkInserter(allCssStyles.frameworkGlobal,"frameworkGlobal"),linkInserter(allCssStyles.packages,"package"),linkInserter(allCssStyles.projectGlobal,"projectGlobal"),linkInserter(allCssStyles.projectTheme,"projectTheme"),this.__asyncLoadCount<=0&&(jsonValueChanged&&this.__triggerControlsWithImplicitValues(null),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ThemeManager] System has loaded and parsed all sync files. Triggering a onThemeDataChanged."),TcHmi.EventProvider.raise("onThemeDataChanged"),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE}))}__triggerControlsWithImplicitValues(controlsToTrigger){let ThemeManager_triggerSingleControl=(attributeList,control)=>{attributeList.forEach(propertyName=>{this.__settingThemeValueInProgress=propertyName;let error=TcHmi.System.Services.controlManager.setControlProperty(control,propertyName,null);this.__settingThemeValueInProgress=null,error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ThemeManager] "+TcHmi.Log.buildMessage(error))})};if(null===controlsToTrigger)this.__watchAttributeDefaults.forEach((attributeList,control)=>{ThemeManager_triggerSingleControl(attributeList,control)});else for(let controlToTrigger of controlsToTrigger){const attributeList=this.__watchAttributeDefaults.get(controlToTrigger);attributeList&&ThemeManager_triggerSingleControl(attributeList,controlToTrigger)}}getDefaultPropertyValue(control,propertyName){var _a,_b,_c;let res=null,currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeThemes);const controlClasses=control.getClassNames();if(controlClasses&&controlClasses.length>0){for(let controlClass of controlClasses)currentProjectThemeFiles&&currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[controlClass]&&currentProjectThemeFiles.controlClassValues[controlClass].attributes&&void 0!==currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]&&null!==currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]&&(res=currentProjectThemeFiles.controlClassValues[controlClass].attributes[propertyName]);if(null!==res)return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)}}const controlType=control.getType(),projectBasedThemeValue=null===(_c=null===(_b=null===(_a=null==currentProjectThemeFiles?void 0:currentProjectThemeFiles.controlTypeValues)||void 0===_a?void 0:_a[controlType])||void 0===_b?void 0:_b.attributes)||void 0===_c?void 0:_c[propertyName];if(null!=projectBasedThemeValue)return res=projectBasedThemeValue,{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)};const legacyControlType=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(controlType);if(TcHmi.System.config.themes[this.__activeThemes]&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(controlType));else if(legacyControlType&&TcHmi.System.config.themes[this.__activeThemes]&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(legacyControlType));else{let themeAndBase=[this.__activeThemes];"Base"!==this.__activeThemes&&themeAndBase.push("Base");for(let themeName of themeAndBase){let currentControlThemeFiles=this.__control_themeFiles.get(themeName),currentControlThemeFile=currentControlThemeFiles?currentControlThemeFiles.get(controlType):void 0;if(currentControlThemeFile&&currentControlThemeFile.controlTypeValues&&currentControlThemeFile.controlTypeValues[controlType]&&currentControlThemeFile.controlTypeValues[controlType].attributes&&void 0!==currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName]&&null!==currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName])return res=currentControlThemeFile.controlTypeValues[controlType].attributes[propertyName],{error:TcHmi.Errors.NONE,origin:"control",originThemeName:themeName,value:tchmi_clone_object(res)}}}let ctrlDescrAttr=TcHmi.System.Services.controlManager.getDescriptionAttributeByPropertyName(controlType,propertyName);if(ctrlDescrAttr){if(void 0!==ctrlDescrAttr.defaultValueInternal)return res=ctrlDescrAttr.defaultValueInternal,{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)};{let schema=TcHmi.Type.getSchema(ctrlDescrAttr.type);if(schema)return res=TcHmi.Type.Schema.resolveDefault(schema),{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)}}}if("TcHmi.Controls.System.TcHmiUserControlHost"===controlType){let targetUserControl=control.getTargetUserControl();if(targetUserControl){let ucConfigUrl=tchmi_path(targetUserControl.replace(".usercontrol",".usercontrol.json")),UCdescrAttr=System.Services.controlManager.getUserControlConfigAttributeByPropertyName(ucConfigUrl,propertyName);if(UCdescrAttr&&void 0!==UCdescrAttr.defaultValueInternal)return res=UCdescrAttr.defaultValueInternal,{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)};if(UCdescrAttr){let type=UCdescrAttr.type;if(type){let schema=TcHmi.Type.getSchema(type);if(schema)return res=TcHmi.Type.Schema.resolveDefault(schema),{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)}}}}}return{error:TcHmi.Errors.NONE,origin:"control",originThemeName:this.__activeThemes,value:null}}getThemeResource(control,resourceName){let res=null,currentProjectThemeFiles=this.__project_themeFiles.get(this.__activeThemes);const controlClasses=control.getClassNames();if(controlClasses&&controlClasses.length>0){for(let controlClass of controlClasses)currentProjectThemeFiles&&currentProjectThemeFiles.controlClassValues&&currentProjectThemeFiles.controlClassValues[controlClass]&&void 0!==currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]&&null!==currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]&&(res=currentProjectThemeFiles.controlClassValues[controlClass].themedResources[resourceName]);if(null!==res)return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)}}const controlType=control.getType();if(currentProjectThemeFiles&&currentProjectThemeFiles.controlTypeValues&&currentProjectThemeFiles.controlTypeValues[controlType]&&currentProjectThemeFiles.controlTypeValues[controlType].themedResources&&void 0!==currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName]&&null!==currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName])return res=currentProjectThemeFiles.controlTypeValues[controlType].themedResources[resourceName],{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:tchmi_clone_object(res)};if(TcHmi.System.config.themes[this.__activeThemes]&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls){if(TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(controlType))return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:null};const legacyControlType=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(controlType);if(legacyControlType&&TcHmi.System.config.themes[this.__activeThemes].replacesThemeForControls.includes(legacyControlType))return{error:TcHmi.Errors.NONE,origin:"project",originThemeName:this.__activeThemes,value:null}}let themeAndBase=[this.__activeThemes];"Base"!==this.__activeThemes&&themeAndBase.push("Base");for(let themeName of themeAndBase){let currentControlThemeFiles=this.__control_themeFiles.get(themeName),currentControlThemeFile=currentControlThemeFiles?currentControlThemeFiles.get(controlType):void 0;if(currentControlThemeFile&&currentControlThemeFile.controlTypeValues&&currentControlThemeFile.controlTypeValues[controlType]&&currentControlThemeFile.controlTypeValues[controlType].themedResources&&void 0!==currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName]&&null!==currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName])return res=currentControlThemeFile.controlTypeValues[controlType].themedResources[resourceName],{error:TcHmi.Errors.NONE,origin:"control",originThemeName:themeName,value:tchmi_clone_object(res)}}return{error:TcHmi.Errors.ERROR,origin:"control",originThemeName:this.__activeThemes,value:null}}watchAttributeDefaults(control,propertyName){let attributeList=this.__watchAttributeDefaults.get(control);attributeList||(attributeList=new Set,this.__watchAttributeDefaults.set(control,attributeList)),attributeList.add(propertyName)}startAttributeSetterWatcher(control){this.__watchAttributeDefaults.has(control)&&(this.__destroyOnPropertyChanged.has(control)||this.__destroyOnPropertyChanged.set(control,TcHmi.EventProvider.register(control.getId()+".onPropertyChanged",this.__handleOnPropertyChanged(control))))}unwatchAttributeDefaults(control,propertyName){const attributeList=this.__watchAttributeDefaults.get(control);if(attributeList&&attributeList.delete(propertyName)&&0===attributeList.size){this.__watchAttributeDefaults.delete(control);const destroy=this.__destroyOnPropertyChanged.get(control);destroy&&(destroy(),this.__destroyOnPropertyChanged.delete(control))}}__handleOnPropertyChanged(control){return(e,data)=>{this.__settingThemeValueInProgress!==data.propertyName&&this.unwatchAttributeDefaults(control,data.propertyName)}}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.TopMostLayer=class{constructor(){this.__optionsList=new Map,this.__detachEventDestroy=null,this.__abortClick=evt=>{if(evt.target===this.__masterDiv.lastElementChild&&this.__masterDiv.lastElementChild){let nativeElem=this.__masterDiv.lastElementChild.lastElementChild,internalOption=this.__optionsList.get(nativeElem);internalOption&&!1!==internalOption.closeOnBackground&&this.remove(internalOption.origin,$(nativeElem),!0)}},this.__checkDetachedControls=(evt,control)=>{for(const[nativeElem,internalOptions]of this.__optionsList)internalOptions.origin===control&&this.remove(control,$(nativeElem),!0)},this.__updateAllChildPosition=(evtOrMutations,observer)=>{if(evtOrMutations&&Array.isArray(evtOrMutations)){let updateNeeded=!1,styleOfChangedNodes=new Map;for(let i=0,ii=evtOrMutations.length;i<ii;i++){let mutation=evtOrMutations[i],node=mutation.target;if(node instanceof HTMLElement)if("attributes"===mutation.type){if("style"!==mutation.attributeName){updateNeeded=!0,styleOfChangedNodes.clear();break}styleOfChangedNodes.has(node)||styleOfChangedNodes.set(node,mutation.oldValue)}else if("childList"===mutation.type){updateNeeded=!0,styleOfChangedNodes.clear();break}}if(!1===updateNeeded&&styleOfChangedNodes.forEach((function(initialStyle,changedNode,map){initialStyle!==changedNode.getAttribute("style")&&(updateNeeded=!0),map.clear()})),!1===updateNeeded)return}let resizeCallbackList=[];const childNodes=this.__masterDiv.children;for(let i=0;i<childNodes.length;i++){if(!(childNodes[i]instanceof HTMLElement))continue;let containerElem=childNodes[i],nativeElem=containerElem.firstElementChild,internalOption=this.__optionsList.get(nativeElem);if(internalOption){let centeringRequested=!0===internalOption.centerVertical||!0===internalOption.centerHorizontal;if(centeringRequested||internalOption.resizeCb){let resizedByTML=!1;if(centeringRequested&&containerElem.firstElementChild){const boundingRect=containerElem.firstElementChild.getBoundingClientRect();if(!0===internalOption.centerVertical){const newTop=(document.documentElement.clientHeight-boundingRect.height)/2;nativeElem.style.top!==newTop+"px"&&(nativeElem.style.top=newTop+"px",resizedByTML=!0)}if(!0===internalOption.centerHorizontal){const newLeft=(document.documentElement.clientWidth-boundingRect.width)/2;nativeElem.style.left!==newLeft+"px"&&(nativeElem.style.left=newLeft+"px",resizedByTML=!0)}}!1!==centeringRequested&&!0!==resizedByTML||!internalOption.resizeCb||resizeCallbackList.push({callback:internalOption.resizeCb,thisArg:internalOption.origin,args:{error:TcHmi.Errors.NONE,element:$(nativeElem),parentPixelSize:{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}})}}}for(let i=0;i<resizeCallbackList.length;i++)TcHmi.Callback.callSafeEx(resizeCallbackList[i].callback,resizeCallbackList[i].thisArg,resizeCallbackList[i].args)},this.__dimLastContainer=()=>{const childNodes=this.__masterDiv.children;let lastDimChild;for(let i=0;i<childNodes.length;i++){if(!(childNodes[i].firstElementChild instanceof HTMLElement))continue;let containerElem=childNodes[i];containerElem.classList.remove("tchmi-topmostlayer-non-modal");let internalOption=this.__optionsList.get(containerElem.firstElementChild);internalOption&&(!1!==internalOption.dimBackground&&(lastDimChild=containerElem),containerElem.classList.remove("tchmi-topmostlayer-background-dim"),!1===internalOption.modal&&containerElem.classList.add("tchmi-topmostlayer-non-modal"))}lastDimChild&&lastDimChild.classList.add("tchmi-topmostlayer-background-dim")},this.__masterDiv=document.createElement("div"),this.__masterDiv.id="tchmi-system-top-layer-master",this.__masterDiv.style.zIndex="5000",this.__masterDiv.style.position="absolute",this.__masterDiv.addEventListener("click",this.__abortClick,!1),this.__mutationObserver=new MutationObserver(this.__updateAllChildPosition)}add(origin,element,options){if(!element)return!1;if(1!==element.length)return!1;let nativeElem=element[0];if(!(nativeElem instanceof HTMLElement))return!1;if(this.__optionsList.has(nativeElem))return!1;nativeElem.classList.add("tchmi-in-topmostlayer");let internalOption,containerElem=document.createElement("div");if(containerElem.classList.add("tchmi-system-topmostlayer-container"),containerElem.style.position="fixed",containerElem.style.width="100%",containerElem.style.height="100%",containerElem.style.overscrollBehavior="contain",containerElem.appendChild(nativeElem),this.__masterDiv.appendChild(containerElem),options?(internalOption=Object.assign(Object.assign({},options),{origin:origin,styleBackup:{left:nativeElem.style.left,top:nativeElem.style.top,position:nativeElem.style.position}}),!0!==internalOption.centerVertical&&!0!==internalOption.centerHorizontal||(nativeElem.style.position="absolute",this.__mutationObserver.observe(nativeElem,{attributes:!0,attributeFilter:["style","class","id"],attributeOldValue:!0,childList:!0,subtree:!0}))):internalOption={origin:origin},this.__optionsList.set(nativeElem,internalOption),this.__dimLastContainer(),!this.__masterDiv.parentElement){const passiveEventOptions={passive:!0,capture:!1};window.addEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),this.__detachEventDestroy=TcHmi.EventProvider.register("System.onControlDetached",this.__checkDetachedControls),document.body.appendChild(this.__masterDiv)}this.__updateAllChildPosition();let subcontrolElements=this.__masterDiv.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements){element.classList.add("tchmi-in-topmostlayer");let control=TcHmi.Controls.get(element.id);control&&!control.getParent()&&(control.__processIsEnabled(),control.__processAccessConfig())}return!0}remove(origin,element,cancel){if(!element)return element;if(1!==element.length)return element;let nativeElem=element[0];if(!nativeElem.parentElement)return element;let internalOption=this.__optionsList.get(nativeElem);if(!internalOption)return element;nativeElem.classList.remove("tchmi-in-topmostlayer");let subcontrolElements=nativeElem.querySelectorAll("div[data-tchmi-type]");for(const element of subcontrolElements)element.classList.remove("tchmi-in-topmostlayer");const containerElem=nativeElem.parentElement;if(this.__masterDiv.removeChild(containerElem),containerElem.removeChild(nativeElem),!this.__masterDiv.firstElementChild){document.body.removeChild(this.__masterDiv);const passiveEventOptions={passive:!0,capture:!1};window.removeEventListener("resize",this.__updateAllChildPosition,passiveEventOptions),this.__detachEventDestroy&&(this.__detachEventDestroy(),this.__detachEventDestroy=null),this.__mutationObserver.disconnect()}const cbParam={error:TcHmi.Errors.NONE,element:element,canceled:cancel};return!0!==internalOption.centerVertical&&!0!==internalOption.centerHorizontal||!internalOption.styleBackup||(nativeElem.style.position=internalOption.styleBackup.position,!0===internalOption.centerHorizontal&&(nativeElem.style.left=internalOption.styleBackup.left),!0===internalOption.centerVertical&&(nativeElem.style.top=internalOption.styleBackup.top)),this.__optionsList.delete(nativeElem),internalOption.removeCb&&TcHmi.Callback.callSafeEx(internalOption.removeCb,internalOption.origin,cbParam),this.__dimLastContainer(),element}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.SyncCmdToFramework=class{constructor(cmd){this.__cmd=cmd,this.__result=TcHmi.Errors.NONE,this.sendSynchronousConfirmation=!0}confirmRequest(confirmId){new TcHmi.System.Engineering.SyncCmdToCreatorConfirmation({name:"Confirmation",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",confirmId:confirmId,errorCode:this.__result,replyTo:null}).send()}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkRemoveControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;let controls=this.__cmd.controls;for(let i=0,ii=controls.length;i<ii;i++){const tco=TcHmi.Controls.get(controls[i]);if(!tco){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkRemoveControls] Failed to remove control "${controls[i]}": Not found in control cache.\n`);break}const parentTco=tco.getParent();null!==parentTco&&parentTco.getPcElement().children("#"+tchmi_css_escape_selector(tco.getId())).remove(),TcHmi.Engineering.ErrorPane.remove(tco.getId()+"requiredAttributeTouched"),tco.__getKeepAlive()&&tco.__setKeepAlive(!1),tco.destroy()}new Engineering.SyncCmdToCreatorSyncControls({name:"SyncControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null}).send()}}Engineering.SyncCmdToFrameworkRemoveControls=SyncCmdToFrameworkRemoveControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkConfirmation extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.sendSynchronousConfirmation=!1}run(){}}Engineering.SyncCmdToFrameworkConfirmation=SyncCmdToFrameworkConfirmation}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkControlLocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.Engineering.designerModeManager.setControlLocked(this.__cmd.targetControl,this.__cmd.locked)}}Engineering.SyncCmdToFrameworkControlLocked=SyncCmdToFrameworkControlLocked}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkCreateControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.__controlsToSelect=[],this.__createsPending=0}createCallback(){return data=>{if(this.__createsPending--,this.__createsPending<=0&&!0===TCHMI_DESIGNER&&this.__controlsToSelect.length>0){TcHmi.System.Services.Engineering.designerModeManager.unselectEach(!0);for(let i=0,ii=this.__controlsToSelect.length;i<ii;i++){let controlToSelect=this.__controlsToSelect[i];TcHmi.System.Services.Engineering.designerModeManager.select(controlToSelect,!0)}!0===TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.resyncSelectedControls()}}}run(){if(!1===TCHMI_DESIGNER)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;let controls=this.__cmd.controls;if(null!=controls)for(let i=0,ii=controls.length;i<ii;i++){let control=this.__cmd.controls[i];control.controlHtml?(this.__createsPending++,!0===TCHMI_DESIGNER&&!0===control.select&&this.__controlsToSelect.push(control.controlId),TcHmi.System.Services.Engineering.designerModeManager.createControl(this.__cmd.targetPartial,control.targetParentControl,control.domPosition,control.controlHtml,this.createCallback())):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCreateControls] Failed to decode base64 encoded html content of "+control.controlId),this.__result=TcHmi.Errors.E_PARAMETER_INVALID),control=null}else this.__result=TcHmi.Errors.E_PARAMETER_INVALID}}Engineering.SyncCmdToFrameworkCreateControls=SyncCmdToFrameworkCreateControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkCurrentPartialContent extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a;if(void 0===this.__cmd.targetPartial||null===this.__cmd.targetPartial)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial. Command property targetPartial="+this.__cmd.targetPartial+"."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);let targetPartial=tchmi_path(this.__cmd.targetPartial);const piggyBackObj=TcHmi.ValueConverter.toObject(this.__cmd.piggyBack);if(null!=piggyBackObj&&void 0!==piggyBackObj.requestId&&null!==piggyBackObj.requestId){let request=TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.getRequest(piggyBackObj.requestId);if(request){let callback=request.callback;request.destroy&&request.destroy(),this.__cmd.content?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,targetPartial:targetPartial,content:this.__cmd.content}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,targetPartial:targetPartial,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Got no content for targetpartial "+this.__cmd.targetPartial,domain:"TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent"}})}}else{if(!this.__cmd.content)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". Command property content="+this.__cmd.content+"."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);let tempDiv=document.createElement("div");tempDiv.innerHTML=this.__cmd.content;let rawPartialContent=tempDiv.firstElementChild;if(!rawPartialContent||void 0===rawPartialContent.id)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". Failed to read attribute=id."),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);if(TcHmi.Controls.get(rawPartialContent.id))try{TcHmi.System.Services.Engineering.designerModeManager.syncControl(targetPartial,rawPartialContent.id,rawPartialContent.outerHTML)}catch(e){return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". An uncaught exception occurred:\n",e),void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID)}let type=TcHmi.PartialType.Invalid;try{let partials=[];targetPartial.indexOf(".view")>-1?(partials=System.config.views,type=TcHmi.PartialType.View):targetPartial.indexOf(".content")>-1?(partials=System.config.content,type=TcHmi.PartialType.Content):targetPartial.indexOf(".usercontrol")>-1&&(partials=System.config.userControls,type=TcHmi.PartialType.UserControl);for(let i=0,ii=partials.length;i<ii;i++)if(partials[i].url===targetPartial){type!==TcHmi.PartialType.UserControl&&(type!==TcHmi.PartialType.View&&type!==TcHmi.PartialType.Content||!0!==partials[i].preload)||TcHmi.System.Data.Caches.partialMarkupCache.set(targetPartial,{markup:this.__cmd.content,partialId:rawPartialContent.id});break}}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkCurrentPartialContent] Failed to synchronize partial="+targetPartial+". An uncaught exception occurred:\n",e)}switch(type){case TcHmi.PartialType.View:TcHmi.EventProvider.raise("System.onViewChanged",{url:targetPartial,content:this.__cmd.content});break;case TcHmi.PartialType.Content:TcHmi.EventProvider.raise("System.onContentChanged",{url:targetPartial,content:this.__cmd.content});break;case TcHmi.PartialType.UserControl:TcHmi.EventProvider.raise("System.onUserControlChanged",{url:targetPartial,content:this.__cmd.content});break;case TcHmi.PartialType.Invalid:}!0===TCHMI_ENGINEERING&&!0===TCHMI_DESIGNER&&(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.highlightManager)||void 0===_a||_a.processDomVisibility())}}}Engineering.SyncCmdToFrameworkCurrentPartialContent=SyncCmdToFrameworkCurrentPartialContent}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkCurrentPartialEditorLockState extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!0===TCHMI_DESIGNER||!0!==TCHMI_LIVEVIEW)return;tchmi_path(this.__cmd.targetPartial)===TCHMI_TARGET_PARTIAL&&!0===this.__cmd.locked&&System.Services.Engineering.designerModeManager.lock()}}Engineering.SyncCmdToFrameworkCurrentPartialEditorLockState=SyncCmdToFrameworkCurrentPartialEditorLockState}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkCurrentPartialHighlightContainerState extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a;if(!0!==TCHMI_DESIGNER)return;tchmi_path(this.__cmd.targetPartial)===TCHMI_TARGET_PARTIAL&&(null===(_a=System.Services.Engineering.designerModeManager.highlightManager)||void 0===_a||_a.setHighlightContainerVisibility(this.__cmd.state))}}Engineering.SyncCmdToFrameworkCurrentPartialHighlightContainerState=SyncCmdToFrameworkCurrentPartialHighlightContainerState}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkDesignerSettings extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){!1!==TCHMI_DESIGNER&&TcHmi.System.Services.Engineering.designerModeManager.updateSettings(this.__cmd.settings)}}Engineering.SyncCmdToFrameworkDesignerSettings=SyncCmdToFrameworkDesignerSettings}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkDomVisibility extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.highlightManager)||void 0===_a||_a.setCreatorVisibilityAttribute(this.__cmd.targetControl,this.__cmd.visibility))}}Engineering.SyncCmdToFrameworkDomVisibility=SyncCmdToFrameworkDomVisibility}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkInjectResources extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){TcHmi.System.Services.Engineering.designerModeManager.resourceInjectionManager.injectPackageResources(this.__cmd.injectInfo,data=>{new Engineering.SyncCmdToCreatorInjectedResources({name:"InjectedResources",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_DESIGNER?TCHMI_TARGET_PARTIAL:void 0,piggyBack:this.__cmd.piggyBack,replyTo:null}).send()})}}Engineering.SyncCmdToFrameworkInjectResources=SyncCmdToFrameworkInjectResources}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkKeyStates extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.sendSynchronousConfirmation=!1}run(){if(!1===TCHMI_DESIGNER||!TcHmi.System.Services.Engineering.designerModeManager.interactionManager)return;if(tchmi_path(this.__cmd.targetPartial)!==TCHMI_TARGET_PARTIAL)return;let s=this.__cmd.states;null!=s?(void 0!==s.leftCtrl&&null!==s.leftCtrl&&void 0!==s.leftCtrl.down&&!0===s.leftCtrl.down||void 0!==s.rightCtrl&&null!==s.rightCtrl&&void 0!==s.rightCtrl.down&&!0===s.rightCtrl.down?TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setCtrlModifierKeyState(!0):TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setCtrlModifierKeyState(!1),void 0!==s.leftShift&&null!==s.leftShift&&void 0!==s.leftShift.down&&!0===s.leftShift.down||void 0!==s.rightShift&&null!==s.rightShift&&void 0!==s.rightShift.down&&!0===s.rightShift.down?TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setShiftModifierKeyState(!0):TcHmi.System.Services.Engineering.designerModeManager.interactionManager.setShiftModifierKeyState(!1)):this.__result=TcHmi.Errors.E_PARAMETER_INVALID}}Engineering.SyncCmdToFrameworkKeyStates=SyncCmdToFrameworkKeyStates}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkLogoutClient extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){4!==TcHmi.System.Services.accessManager.getCurrentUserConfig().state||this.__cmd.targetInstance&&this.__cmd.targetInstance!==TCHMI_DYNAMIC_INSTANCE_ID||TcHmi.Server.logout()}}Engineering.SyncCmdToFrameworkLogoutClient=SyncCmdToFrameworkLogoutClient}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkPartialEditorLocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){tchmi_path(this.__cmd.targetPartial)===tchmi_path(TCHMI_TARGET_PARTIAL)&&TcHmi.System.Services.Engineering.designerModeManager.lock()}}Engineering.SyncCmdToFrameworkPartialEditorLocked=SyncCmdToFrameworkPartialEditorLocked}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkPartialEditorUnlocked extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(TCHMI_DESIGNER){if(tchmi_path(this.__cmd.targetPartial)!==tchmi_path(TCHMI_TARGET_PARTIAL))return;void 0!==window.location&&null!==window.location&&window.location.reload()}}}Engineering.SyncCmdToFrameworkPartialEditorUnlocked=SyncCmdToFrameworkPartialEditorUnlocked}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkRequestDropControlPosition extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){if(!1===TCHMI_DESIGNER||!TcHmi.System.Services.Engineering.designerModeManager.hierarchyManager)return;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(preparedTargetPartial!==TCHMI_TARGET_PARTIAL)return;if(void 0===this.__cmd.type||null===this.__cmd.type)return void(this.__result=TcHmi.Errors.E_PARAMETER_INVALID);const dropConfig=TcHmi.System.Services.Engineering.designerModeManager.hierarchyManager.getContainerFromPoint({left:this.__cmd.position.left+window.scrollX,top:this.__cmd.position.top+window.scrollY});if(!dropConfig)return void(this.__result=TcHmi.Errors.ERROR);let command={name:"DropControlPosition",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:preparedTargetPartial,controls:[{piggyBack:this.__cmd.piggyBack,targetParentControl:dropConfig.tco.getId(),type:this.__cmd.type,position:{centerX:dropConfig.mousePosXinTarget,centerY:dropConfig.mousePosYinTarget}}],replyTo:null};null===dropConfig.rowIndex||null===dropConfig.columnIndex||0===dropConfig.rowIndex&&0===dropConfig.columnIndex||(command.controls[0].attributes=[{name:"data-tchmi-grid-row-index",value:dropConfig.rowIndex},{name:"data-tchmi-grid-column-index",value:dropConfig.columnIndex}]),new Engineering.SyncCmdToCreatorDropControlPosition(command).send()}}Engineering.SyncCmdToFrameworkRequestDropControlPosition=SyncCmdToFrameworkRequestDropControlPosition}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkScrollPositionChanged extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a,_b;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&(null===(_b=null===(_a=TcHmi.System.Services.Engineering.designerModeManager)||void 0===_a?void 0:_a.rootControlManager)||void 0===_b||_b.scroll(this.__cmd.position))}}Engineering.SyncCmdToFrameworkScrollPositionChanged=SyncCmdToFrameworkScrollPositionChanged}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkSelectedControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL){TcHmi.System.Services.Engineering.designerModeManager.unselectEach(!0);let controls=this.__cmd.controls;for(let i=0,ii=controls.length;i<ii;i++){let control=controls[i];TcHmi.System.Services.Engineering.designerModeManager.select(control,!0)}TcHmi.System.Services.Engineering.designerModeManager.resyncSelectedControls()}}}Engineering.SyncCmdToFrameworkSelectedControls=SyncCmdToFrameworkSelectedControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkServerAddress extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&TcHmi.System.Services.serverManager.setServerAddress(this.__cmd.host,this.__cmd.port,this.__cmd.protocol)}}Engineering.SyncCmdToFrameworkServerAddress=SyncCmdToFrameworkServerAddress}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkSyncControls extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a;if(!1===TCHMI_DESIGNER)return;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);if(preparedTargetPartial!==TCHMI_TARGET_PARTIAL)return;let bCausedChanges=!1;const controls=this.__cmd.controls;for(let i=0,ii=controls.length;i<ii;i++){const control=controls[i];try{!0===TcHmi.System.Services.Engineering.designerModeManager.syncControl(preparedTargetPartial,control.targetControl,control.controlHtml)&&(bCausedChanges=!0)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(e),this.__result=TcHmi.Errors.ERROR}}!0===bCausedChanges&&(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.highlightManager)||void 0===_a||_a.processDomVisibility())}}Engineering.SyncCmdToFrameworkSyncControls=SyncCmdToFrameworkSyncControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkTcHmiConfigChanged extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}__refreshBaseConfig(config,configOld){var _a,_b,_c;config.scaleMode!==configOld.scaleMode&&TcHmi.System.Services.viewManager.setScaleMode(config.scaleMode),!1===TCHMI_DESIGNER?config.startupView!==configOld.startupView&&TcHmi.System.Services.viewManager.loadView(config.startupView):config.creatorSettings&&config.creatorSettings.viewport&&(config.creatorSettings.viewport.defaultHeight!==configOld.creatorSettings.viewport.defaultHeight||config.creatorSettings.viewport.defaultWidth!==configOld.creatorSettings.viewport.defaultWidth)&&(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.rootControlManager)||void 0===_a||_a.setCreatorViewPortPosition(TcHmi.System.Services.viewManager.getView())),config.activeTheme!==configOld.activeTheme?TcHmi.System.Services.themeManager.setTheme(config.activeTheme,!0):tchmi_equal(config.themes,configOld.themes)&&tchmi_equal(null===(_b=config.dependencyFiles)||void 0===_b?void 0:_b.filter(value=>"Stylesheet"===value.type),null===(_c=configOld.dependencyFiles)||void 0===_c?void 0:_c.filter(value=>"Stylesheet"===value.type))||TcHmi.System.Services.themeManager.processActiveTheme(),tchmi_equal(config.trigger,configOld.trigger)||(TcHmi.System.Services.triggerManager.unregister(configOld.trigger),TcHmi.System.Services.triggerManager.register(config.trigger)),TCHMI_ENGINEERING&&TCHMI_LIVEVIEW&&!tchmi_equal(config.tcHmiServer,configOld.tcHmiServer)&&TcHmi.System.Services.serverManager.refreshSubscriptions()}__loadViewPartial(v,callback){let vm=null;if(!0===v.preload&&!0!==TCHMI_DESIGNER){let xhr=new XMLHttpRequest;xhr.open("GET",v.url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){200===xhr.status?vm=xhr.responseText:TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+v.url+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,v,vm)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+v.url+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,v,vm)})),xhr.send()}}__loadViewPartialCallback(v,vm){if(null==vm)return;let cacheEntry,cleanUrl=tchmi_path(v.url);if(void 0!==v.url&&null!==v.url&&!0===v.preload&&(cacheEntry={markup:vm},TcHmi.System.Data.Caches.partialMarkupCache.set(cleanUrl,cacheEntry)),!0===v.preload&&void 0!==v.url&&null!==v.url&&!0!==TCHMI_DESIGNER){let tempDiv=document.createElement("div");if(tempDiv.innerHTML=vm,tempDiv.firstElementChild){const tco=TcHmi.System.Services.controlManager.compile(tempDiv.firstElementChild);void 0!==tco&&(cacheEntry&&(cacheEntry.partialId=tco.getId()),tco.__setKeepAlive(!0),tco.getElement().attr("data-tchmi-partial-url",v.url))}}TcHmi.EventProvider.raise("System.onViewCreated",{url:cleanUrl})}__refreshViewPartials(views,viewsOld){if(null==views||null==viewsOld)return;let viewsRemoved=[];for(let i=0,ii=viewsOld.length;i<ii;i++){let po=viewsOld[i],bExists=!1;for(let j=0,jj=views.length;j<jj;j++){if(views[j].url===po.url){bExists=!0;break}}!1===bExists&&viewsRemoved.push(po)}let viewsCreated=[];for(let i=0,ii=views.length;i<ii;i++){let p=views[i],bExists=!1;for(let j=0,jj=viewsOld.length;j<jj;j++){let po=viewsOld[j];if(p.url===po.url){bExists=!0;break}}!1===bExists&&viewsCreated.push(p)}for(let i=0,ii=viewsRemoved.length;i<ii;i++){let v=viewsRemoved[i];if(void 0===v.url||null===v.url)continue;let cleanUrl=tchmi_path(v.url);TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUrl),TcHmi.EventProvider.raise("System.onViewRemoved",{url:cleanUrl})}for(let i=0,ii=viewsCreated.length;i<ii;i++){let v=viewsCreated[i];this.__loadViewPartial(v,this.__loadViewPartialCallback)}}__refreshContentPartials(content,contentOld){if(null==content||null==contentOld)return;let contentRemoved=[];for(let i=0,ii=contentOld.length;i<ii;i++){let po=contentOld[i],bExists=!1;for(let j=0,jj=content.length;j<jj;j++){if(content[j].url===po.url){bExists=!0;break}}!1===bExists&&contentRemoved.push(po)}let contentCreated=[];for(const p of content){TcHmi.System.Data.isLoadSyncContent.set(p.url,!!p.loadSync);let bExists=!1;for(let j=0,jj=contentOld.length;j<jj;j++){let po=contentOld[j];if(p.url===po.url){bExists=!0;break}}!1===bExists&&contentCreated.push(p)}for(let i=0,ii=contentRemoved.length;i<ii;i++){let c=contentRemoved[i];if(void 0===c.url||null===c.url)continue;let cleanUrl=tchmi_path(c.url);TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUrl),TcHmi.EventProvider.raise("System.onContentRemoved",{url:cleanUrl})}for(let i=0,ii=contentCreated.length;i<ii;i++){let v=contentCreated[i];this.__loadViewPartial(v,this.__loadViewPartialCallback)}}__loadUserControlPartial(uc,callback){let ucm=null,ucc=null,uccUrl=uc.url.replace(".usercontrol",".usercontrol.json"),xhrDescr=new XMLHttpRequest;xhrDescr.open("GET",uc.url+"?preventcache="+Math.random()),xhrDescr.addEventListener("load",(function(evt){if(200===xhrDescr.status){ucm=xhrDescr.responseText;let xhr=new XMLHttpRequest;xhr.open("GET",uccUrl+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){200===xhr.status?ucc=TcHmi.ValueConverter.toObject(xhr.responseText):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uccUrl+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uccUrl+". Details:"+xhr.statusText),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhr.send()}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uc.url+", status="+xhrDescr.status),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhrDescr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+uc.url+", status="+xhrDescr.status),TcHmi.Callback.callSafeEx(callback,null,uc,ucm,ucc)})),xhrDescr.send()}__loadUserControlPartialCallback(uc,ucm,ucc){if(null==ucm)return;let cacheEntry,cleanUcUrl=tchmi_path(uc.url),cleanUcConfigUrl=tchmi_path(uc.url.replace(".usercontrol",".usercontrol.json"));void 0!==uc.url&&null!==uc.url&&(cacheEntry={markup:ucm},TcHmi.System.Data.Caches.partialMarkupCache.set(cleanUcUrl,cacheEntry)),null!=ucc&&void 0!==uc.url&&null!==uc.url&&TcHmi.System.Data.Caches.partialCompositeConfigCache.set(cleanUcConfigUrl,ucc),TcHmi.EventProvider.raise("System.onUserControlCreated",{url:cleanUcUrl}),TcHmi.EventProvider.raise("System.onUserControlConfigCreated",{url:cleanUcConfigUrl})}__refreshUserControlPartials(userControls,userControlsOld){if(null==userControls||null==userControlsOld)return;let userControlsRemoved=[];for(let i=0,ii=userControlsOld.length;i<ii;i++){let po=userControlsOld[i],bExists=!1;for(let j=0,jj=userControls.length;j<jj;j++){userControls[j].url===po.url&&(bExists=!0)}!1===bExists&&userControlsRemoved.push(po)}let userControlsCreated=[];for(let i=0,ii=userControls.length;i<ii;i++){let p=userControls[i],bExists=!1;for(let j=0,jj=userControlsOld.length;j<jj;j++){let po=userControlsOld[j];p.url===po.url&&(bExists=!0)}!1===bExists&&userControlsCreated.push(p)}for(let i=0,ii=userControlsRemoved.length;i<ii;i++){let uc=userControlsRemoved[i];if(void 0===uc.url||null===uc.url)continue;let cleanUcUrl=tchmi_path(uc.url),cleanUcConfigUrl=tchmi_path(uc.url.replace(".usercontrol",".usercontrol.json"));TcHmi.System.Data.Caches.partialMarkupCache.delete(cleanUcUrl),TcHmi.System.Data.Caches.partialCompositeConfigCache.delete(cleanUcConfigUrl),TcHmi.EventProvider.raise("System.onUserControlRemoved",{url:cleanUcUrl}),TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:cleanUcConfigUrl})}for(let i=0,ii=userControlsCreated.length;i<ii;i++){let uc=userControlsCreated[i];this.__loadUserControlPartial(uc,this.__loadUserControlPartialCallback)}}__refreshSymbols(symbols,symbolsOld){let i=0,ii=0,iSymbols=symbols.internal,iSymbolsOld=symbolsOld.internal,key=null,keyOld=null,bRemove=!1,remove=[],bCreate=!1,create=[],update=[];if(null!=iSymbolsOld&&null!=iSymbols)for(keyOld in iSymbolsOld)if(iSymbolsOld.hasOwnProperty(keyOld)){for(key in bRemove=!0,iSymbols)if(iSymbols.hasOwnProperty(key)){if(keyOld===key){bRemove=!1;break}key=null}!0===bRemove&&remove.push(keyOld),bRemove=!1,keyOld=null}for(i=0,ii=remove.length;i<ii;i++)TcHmi.System.Services.internalSymbolManager.remove(remove[i]);if(null!=iSymbolsOld&&null!=iSymbols)for(key in iSymbols)if(iSymbols.hasOwnProperty(key)){for(keyOld in bCreate=!0,iSymbolsOld)if(iSymbolsOld.hasOwnProperty(keyOld)&&key===keyOld){bCreate=!1,tchmi_equal(iSymbols[key].value,iSymbolsOld[keyOld].value)&&iSymbols[key].persist===iSymbolsOld[keyOld].persist&&iSymbols[key].type===iSymbolsOld[keyOld].type&&iSymbols[key].readonly===iSymbolsOld[keyOld].readonly||update.push({key:key,item:iSymbols[key]});break}!0===bCreate&&create.push({key:key,item:iSymbols[key]})}for(i=0,ii=create.length;i<ii;i++)TcHmi.System.Services.internalSymbolManager.add(create[i].key,create[i].item);for(i=0,ii=update.length;i<ii;i++)TcHmi.System.Services.internalSymbolManager.update(update[i].key,update[i].item)}__refreshPackages(packages,packagesOld){let i=0,ii=0,j=0,jj=0,bCreate=!1,newPackages=[];if(null!=packages&&null!=packagesOld){for(i=0,ii=packages.length;i<ii;i++){for(bCreate=!0,j=0,jj=packagesOld.length;j<jj;j++)if(packages[i].name===packagesOld[j].name){bCreate=!1;break}!0===bCreate&&newPackages.push(packages[i])}TcHmi.System.Services.Engineering.designerModeManager.resourceInjectionManager.injectPackageResources(newPackages)}}__refreshUserFunctions(userFunctions,userFunctionsOld){let userFunctionsCreated=[];for(let i=0,ii=userFunctions.length;i<ii;i++){let userFunction=userFunctions[i],bExists=!1;if(userFunctionsOld)for(let j=0,jj=userFunctionsOld.length;j<jj;j++){let userFunctionOld=userFunctionsOld[j];if(tchmi_path(userFunction.url)===tchmi_path(userFunctionOld.url)){bExists=!0;break}}else bExists=!1;!1===bExists&&userFunctionsCreated.push(userFunction)}for(let i=0,ii=userFunctionsCreated.length;i<ii;i++){!function(userFunction){let url=tchmi_path(userFunction.url.replace(".js",".function.json")),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let descr=TcHmi.ValueConverter.toObject(xhr.responseText);if(!descr)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing object loaded from "+url));let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name),add=function(){if(!registration||!registration.name)return;let name=registration.name,qname=TcHmi.System.resolveQualifiedName(registration.name,registration.namespace),module={error:TcHmi.Errors.NONE,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,module),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))};registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname),registration?add():TcHmi.EventProvider.register("System.onFunctionRegistered",(function(e,data){e.destroy(),registration=data,add()})))}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.send()}(userFunctionsCreated[i])}}__refreshDependencyFiles(dependencyFiles,dependencyFilesOld){if(!dependencyFiles||!dependencyFilesOld)return;let dependencyFilesCreated=[];for(let i=0,ii=dependencyFiles.length;i<ii;i++){let dependencyFile=dependencyFiles[i],bExists=!1;if(dependencyFilesOld)for(let j=0,jj=dependencyFilesOld.length;j<jj;j++){let dependencyFileOld=dependencyFilesOld[j];if(tchmi_path(dependencyFile.name)===tchmi_path(dependencyFileOld.name)){bExists=!0;break}}else bExists=!1;!1===bExists&&dependencyFilesCreated.push(dependencyFile)}if(dependencyFilesCreated.length>0){let fragment=document.createDocumentFragment();for(let i=0,ii=dependencyFilesCreated.length;i<ii;i++){let dependencyFile=dependencyFilesCreated[i];"JavaScript"===dependencyFile.type&&function(dependencyFileJs){let script=document.createElement("script");script.src=tchmi_path(dependencyFileJs.name),script.async=!1,script.onload=function(ev){},script.onerror=function(ev){},fragment.appendChild(script)}(dependencyFile)}document.head.appendChild(fragment)}}__refreshLanguageFallback(languageFallback,languageFallbackOld){languageFallback!==languageFallbackOld&&(TcHmi.System.Services.localizationManager.setFallbackLocale(languageFallback),TcHmi.System.Services.localizationManager.resetFallbackLocale())}__doReloadTcHmiConfig(url){let config=null,configOld=TcHmi.System.config,__this=this,xhr=new XMLHttpRequest;xhr.open("GET","Properties/tchmiconfig.json?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){if(config=TcHmi.ValueConverter.toObject(xhr.responseText),null===config)return;__this.__doRefreshTcHmiConfig(config,configOld)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Command will be ignored. Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Command will be ignored. Details: "+xhr.statusText)})),xhr.send()}__doRefreshTcHmiConfig(config,configOld){TcHmi.System.config=config,TcHmi.System.config.basePath=configOld.basePath,TcHmi.System.config.tcHmiServer?TcHmi.System.config.tcHmiServer.websocketIntervalTime||(TcHmi.System.config.tcHmiServer.websocketIntervalTime=configOld.tcHmiServer.websocketIntervalTime):TcHmi.System.config.tcHmiServer=configOld.tcHmiServer,this.__refreshBaseConfig(config,configOld),this.__refreshViewPartials(config.views,configOld.views),this.__refreshContentPartials(config.content,configOld.content),this.__refreshUserControlPartials(config.userControls,configOld.userControls),this.__refreshSymbols(config.symbols,configOld.symbols),this.__refreshPackages(config.packages,configOld.packages),this.__refreshUserFunctions(config.userFunctions,configOld.userFunctions),this.__refreshDependencyFiles(config.dependencyFiles,configOld.dependencyFiles),this.__refreshLanguageFallback(config.languageFallback,configOld.languageFallback),tchmi_equal(config,configOld)||TcHmi.EventProvider.raise("onConfigChanged",{configNew:config,configOld:configOld})}__doReloadUserControlConfig(url){let __this=this,xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let data=TcHmi.ValueConverter.toObject(xhr.responseText);data?__this.__doRefreshUserControlConfig(url,data):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing file loaded from "+url)}else TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:url})})),xhr.addEventListener("error",(function(evt){TcHmi.EventProvider.raise("System.onUserControlConfigRemoved",{url:url})})),xhr.send()}__doRefreshUserControlConfig(url,data){TcHmi.System.Data.Caches.partialCompositeConfigCache.set(url,data),TcHmi.EventProvider.raise("System.onUserControlConfigChanged",{url:url})}__doReloadLocalizationFile(url){let __this=this,xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(200===xhr.status){let data=TcHmi.ValueConverter.toObject(xhr.responseText);data?__this.__doRefreshLocalizationFile(url,data):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while parsing file loaded from "+url)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.addEventListener("error",(function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.SyncCmdToFrameworkTcHmiConfigChanged] Error while loading "+url+". Details: "+xhr.statusText)})),xhr.send()}__doRefreshLocalizationFile(url,data){let locale=data.locale;if(null==locale)return;let currentLocaleData=TcHmi.System.Services.localizationManager.getLocaleData("TcHmi.System.Localization.Application"),currentLocaleFallbackData=TcHmi.System.Services.localizationManager.getLocaleFallbackData("TcHmi.System.Localization.Application");currentLocaleData&&currentLocaleData.locale===locale&&(TcHmi.System.Services.localizationManager.setLocaleData("TcHmi.System.Localization.Application",data,url),currentLocaleData=TcHmi.System.Services.localizationManager.getLocaleData("TcHmi.System.Localization.Application"),TcHmi.System.Services.localizationManager.processLocalizationData("TcHmi.System.Localization.Application",currentLocaleData,currentLocaleFallbackData)),currentLocaleFallbackData&&currentLocaleFallbackData.locale===locale&&(TcHmi.System.Services.localizationManager.setLocaleFallbackData("TcHmi.System.Localization.Application",data,url),currentLocaleFallbackData=TcHmi.System.Services.localizationManager.getLocaleFallbackData("TcHmi.System.Localization.Application"),TcHmi.System.Services.localizationManager.processLocalizationData("TcHmi.System.Localization.Application",currentLocaleData,currentLocaleFallbackData))}__doRefreshThemeFile(url){TcHmi.System.Services.themeManager.__clearProjectThemeUrl(url),TcHmi.System.Services.themeManager.processActiveTheme()}run(){let cmd=this.__cmd,preparedConfigPath=tchmi_path(cmd.configPath);switch(cmd.type){case"TcHmiConfig":this.__doReloadTcHmiConfig(preparedConfigPath);break;case"UserControlConfig":this.__doReloadUserControlConfig(preparedConfigPath);break;case"Localization":this.__doReloadLocalizationFile(preparedConfigPath);break;case"ThemeConfig":this.__doRefreshThemeFile(preparedConfigPath)}}}Engineering.SyncCmdToFrameworkTcHmiConfigChanged=SyncCmdToFrameworkTcHmiConfigChanged}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkTransactionBegin extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.sendSynchronousConfirmation=!1}run(){var _a;null===(_a=TcHmi.System.Services.Engineering.designerModeManager.syncManager)||void 0===_a||_a.beginTransaction(this.__cmd.transactionName)}}Engineering.SyncCmdToFrameworkTransactionBegin=SyncCmdToFrameworkTransactionBegin}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkTransactionCommit extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd),this.sendSynchronousConfirmation=!1}run(){var _a;null===(_a=TcHmi.System.Services.Engineering.designerModeManager.syncManager)||void 0===_a||_a.commitTransaction(this.__cmd.transactionName)}}Engineering.SyncCmdToFrameworkTransactionCommit=SyncCmdToFrameworkTransactionCommit}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToFrameworkZoom extends Engineering.SyncCmdToFramework{constructor(cmd){super(cmd)}run(){var _a;const preparedTargetPartial=tchmi_path(this.__cmd.targetPartial);!0===TCHMI_DESIGNER&&preparedTargetPartial===TCHMI_TARGET_PARTIAL&&(null===(_a=TcHmi.System.Services.Engineering.designerModeManager.rootControlManager)||void 0===_a||_a.setCreatorZoom(this.__cmd.factor))}}Engineering.SyncCmdToFrameworkZoom=SyncCmdToFrameworkZoom}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.SyncCmdToCreator=class{constructor(cmd){this.__cmd=cmd}send(){TcHmi.System.Services.Engineering.designerModeComManager.sendCommand(this.__cmd)}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorConfirmation extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorConfirmation=SyncCmdToCreatorConfirmation}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorControlDoubleClick extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorControlDoubleClick=SyncCmdToCreatorControlDoubleClick}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorCopyMoveControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorCopyMoveControls=SyncCmdToCreatorCopyMoveControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorHierarchyMoveControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorHierarchyMoveControls=SyncCmdToCreatorHierarchyMoveControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorMessages extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorMessages=SyncCmdToCreatorMessages}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorDropControlPosition extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorDropControlPosition=SyncCmdToCreatorDropControlPosition}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorRegisterSyncView extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRegisterSyncView=SyncCmdToCreatorRegisterSyncView}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorRequestCurrentPartialContent extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRequestCurrentPartialContent=SyncCmdToCreatorRequestCurrentPartialContent}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorRequestRequiredViewPortSize extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorRequestRequiredViewPortSize=SyncCmdToCreatorRequestRequiredViewPortSize}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorSyncControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorSyncControls=SyncCmdToCreatorSyncControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorSelectedControls extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorSelectedControls=SyncCmdToCreatorSelectedControls}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class SyncCmdToCreatorInjectedResources extends Engineering.SyncCmdToCreator{constructor(cmd){super(cmd)}}Engineering.SyncCmdToCreatorInjectedResources=SyncCmdToCreatorInjectedResources}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.ErrorPane=class{constructor(){this.__messages={}}add(name,content,type){if(!1===TCHMI_ENGINEERING||!1===TCHMI_DESIGNER)return;this.remove(name);let guid=tchmi_create_guid(),message={identifier:guid,type:type,content:content},m={append:!0,identifier:guid,targetPartial:TCHMI_TARGET_PARTIAL,targetInstance:TCHMI_DYNAMIC_INSTANCE_ID,type:type,content:content,line:null,position:null,unixTimestamp:Math.round(Date.now()/1e3)};this.__messages[name]=message,new Engineering.SyncCmdToCreatorMessages({name:"Messages",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",messages:[m],replyTo:null}).send()}remove(name){if(!1===TCHMI_ENGINEERING||!1===TCHMI_DESIGNER)return;let message=this.__messages[name];if(!message)return;let m={remove:!0,identifier:message.identifier};new Engineering.SyncCmdToCreatorMessages({name:"Messages",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",messages:[m],replyTo:null}).send(),delete this.__messages[name]}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){class DesignerModeComManager{constructor(){this.__websocket=void 0,this.__websocketWasClosedUnexpected=!1,this.__connectionWatcherInterval=0,this.__unloaded=!1,this.__disableCommunication=evt=>{this.__unloaded=!0,this.__websocket&&(this.__websocket.close(),this.__websocket=void 0)},this.__connectionWatcherTick=()=>()=>{void 0===this.__websocket&&this.open()},TcHmi.EventProvider.register("System.disableCommunication",this.__disableCommunication)}__handleSyncCommandMessageResponse(messageObj){if(!messageObj.command)return;let commandHandler,checkDesignerLock=!0;switch(messageObj.command.name){case"Messages":break;case"InjectResources":commandHandler=new Engineering.SyncCmdToFrameworkInjectResources(messageObj.command);break;case"Confirmation":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkConfirmation(messageObj.command);break;case"TransactionBegin":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkTransactionBegin(messageObj.command);break;case"TransactionCommit":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkTransactionCommit(messageObj.command);break;case"ScrollPositionChanged":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkScrollPositionChanged(messageObj.command);break;case"RequestDropControlPosition":commandHandler=new Engineering.SyncCmdToFrameworkRequestDropControlPosition(messageObj.command);break;case"CreateControls":commandHandler=new Engineering.SyncCmdToFrameworkCreateControls(messageObj.command);break;case"SyncControls":commandHandler=new Engineering.SyncCmdToFrameworkSyncControls(messageObj.command);break;case"RemoveControls":commandHandler=new Engineering.SyncCmdToFrameworkRemoveControls(messageObj.command);break;case"SelectedControls":commandHandler=new Engineering.SyncCmdToFrameworkSelectedControls(messageObj.command);break;case"ServerAddress":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkServerAddress(messageObj.command);break;case"DesignerSettings":commandHandler=new Engineering.SyncCmdToFrameworkDesignerSettings(messageObj.command);break;case"DomVisibility":commandHandler=new Engineering.SyncCmdToFrameworkDomVisibility(messageObj.command);break;case"ControlLocked":commandHandler=new Engineering.SyncCmdToFrameworkControlLocked(messageObj.command);break;case"KeyStates":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkKeyStates(messageObj.command);break;case"CurrentPartialContent":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialContent(messageObj.command);break;case"TcHmiConfigChanged":commandHandler=new Engineering.SyncCmdToFrameworkTcHmiConfigChanged(messageObj.command);break;case"Zoom":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkZoom(messageObj.command);break;case"PartialEditorLocked":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkPartialEditorLocked(messageObj.command);break;case"PartialEditorUnlocked":checkDesignerLock=!1,commandHandler=new Engineering.SyncCmdToFrameworkPartialEditorUnlocked(messageObj.command);break;case"CurrentPartialEditorLockState":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialEditorLockState(messageObj.command);break;case"CurrentPartialHighlightContainerState":commandHandler=new Engineering.SyncCmdToFrameworkCurrentPartialHighlightContainerState(messageObj.command);break;case"LogoutClient":commandHandler=new Engineering.SyncCmdToFrameworkLogoutClient(messageObj.command)}if(!checkDesignerLock||!0!==System.Services.Engineering.designerModeManager.isLocked())if(void 0!==commandHandler){try{commandHandler.run()}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] An uncaught exception occurred while performing "'+messageObj.command.name+'" command:\n',e)}commandHandler.sendSynchronousConfirmation&&commandHandler.confirmRequest(messageObj.id)}else TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Command "'+messageObj.command.name+'" not implemented.')}__websocketOnOpen(callback){return openEvent=>{var _a;TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" opened."),this.__websocket?this.__websocketWasClosedUnexpected?TCHMI_ENGINEERING&&!TCHMI_DESIGNER?(TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.Engineering.DesignerModeComManager"}}),TcHmi.System.Services.dialogManager.showDialog("__DesignerModeComManager",!1,TcHmi.DialogManager.DialogType.Overlay,{force:!0}),TcHmi.System.Services.dialogManager.updateText("__DesignerModeComManager",TcHmi.System.Services.localization.getText("Engineering_Websocket_Restored",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Reload_In_N_Seconds",{level:TcHmi.Locale.Level.Engineering}),5),TcHmi.DialogManager.DialogSeverity.Info),TcHmi.System.Services.dialogManager.showDialog("__DesignerModeComManager",!0,TcHmi.DialogManager.DialogType.Overlay),setTimeout(()=>{window.location.reload()},5e3)):window.location.reload():(new Engineering.SyncCmdToCreatorRegisterSyncView({name:"RegisterSyncView",targetPartial:TCHMI_TARGET_PARTIAL,targetInstance:TCHMI_DYNAMIC_INSTANCE_ID,syncViewLevel:TCHMI_DESIGNER?"Master":"Slave",sessionId:null!==(_a=TcHmi.System.Services.accessManager.getCurrentUserConfig().session)&&void 0!==_a?_a:"",replyTo:null}).send(),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.Engineering.DesignerModeComManager"}})}}__websocketOnClose(){return closeEvent=>{!0!==this.__unloaded&&this.__websocket&&(this.__websocketWasClosedUnexpected=!0,closeEvent.code&&!closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed with code="+closeEvent.code+"."):closeEvent.code&&closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed with code="+closeEvent.code+" and reason="+closeEvent.reason+"."):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] WebSocket with url="+this.__websocket.url+" was closed."),this.__websocket=void 0,this.__connectionWatcherInterval&&window.clearInterval(this.__connectionWatcherInterval),this.__unloaded||(this.__connectionWatcherInterval=window.setInterval(this.__connectionWatcherTick(),DesignerModeComManager.RECONNECT_INTERVAL)))}}__websocketOnMessage(){return messageEvent=>{if(!0===this.__unloaded)return;if(void 0===messageEvent)return;if(void 0===messageEvent.data)return;const messageObj=TcHmi.ValueConverter.toObject(messageEvent.data);if(null!==messageObj&&messageObj.command){try{!0===TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES&&"KeyStates"!==messageObj.command.name&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Response from TwinCAT HMI Creator.",{messageObj:messageObj})}catch(e){}this.__handleSyncCommandMessageResponse(messageObj)}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Failed to parse JSON message from TcHmiCreator!",{messageObj:messageObj})}}open(callback){if(!0!==this.__unloaded){if(void 0===this.__websocket){if(void 0===TCHMI_ENGINEERING_WEBSOCKET)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Missing flag=TCHMI_ENGINEERING_WEBSOCKET."));try{this.__websocket=new WebSocket(TCHMI_ENGINEERING_WEBSOCKET+"/DesignerWebsocketname="+TCHMI_ENGINEERING_WEBSOCKET)}catch(ex){let reason="Opening connection to Engineering failed";throw ex instanceof DOMException&&(reason=reason+": "+ex.message),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] "+reason),new Error(reason)}this.__websocket.onopen=this.__websocketOnOpen(callback),this.__websocket.onclose=this.__websocketOnClose(),this.__websocket.onmessage=this.__websocketOnMessage()}}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.Engineering.DesignerModeComManager",reason:"Website already unloaded."}})}sendCommand(cmd){let messageObj={id:tchmi_create_guid(),timestamp:Date.now(),command:cmd};const message=JSON.stringify(messageObj);void 0!==this.__websocket&&this.__websocket.readyState===WebSocket.OPEN&&(!0===TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Request to TwinCAT HMI Creator.",{messageObj:messageObj}),this.__websocket.send(message))}}DesignerModeComManager.RECONNECT_INTERVAL=5e3,Engineering.DesignerModeComManager=DesignerModeComManager}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeManager=class{constructor(){this.__locked=!1,this.__partialRequested={},this.__settings={theme:{ChessboardLight:null,ChessboardDark:null},enableSnapping:!0,snapToControls:!0,snapToInnerContainerSides:!0,snapDistanceToControls:10,untransformedColor:null,selectionHighlightColor:null,unSelectedHighlightColor:null,selectedSecondaryColor:null,snapHighlightColor:null},this.metaDataManager=new Engineering.DesignerModeControlMetaDataManager(this),this.partialContentManager=new Engineering.DesignerModePartialContentManager(this),this.resourceInjectionManager=new Engineering.DesignerModeResourceInjectionManager(this),!0===TCHMI_DESIGNER&&(this.hierarchyManager=new Engineering.DesignerModeMasterHierarchyManager(this),this.rootControlManager=new Engineering.DesignerModeMasterRootControlManager(this),this.highlightManager=new Engineering.DesignerModeMasterControlHighlightManager(this),this.syncManager=new Engineering.DesignerModeMasterSyncManager(this),this.interactionManager=new Engineering.DesignerModeMasterInteractionManager(this),this.controlMoveManager=new Engineering.DesignerModeMasterControlMoveManager(this),this.rectSelectManager=new Engineering.DesignerModeMasterRectSelectManager(this),this.controlResizeManager=new Engineering.DesignerModeMasterControlResizeManager(this),this.userControlParameterManager=new Engineering.DesignerModeUserControlParameterManager(this),TcHmi.EventProvider.register("onThemeDataChanged",this.__onThemeDataChanged())),TcHmi.EventProvider.register("onControlAttached",this.__onControlAttached())}__onControlAttached(){let __this=this;return function(e,tco){var _a,_b,_c,_d,_e,_f,_g,_h,_j;let purl=null;if(null!=tco&&(purl=tco.getElement()[0].getAttribute("data-tchmi-partial-url"),!0===TCHMI_DESIGNER&&__this.hierarchyManager&&__this.highlightManager&&__this.rootControlManager&&__this.controlMoveManager&&__this.controlResizeManager)){if(!0===__this.hierarchyManager.isDesignerModeControl(tco.getId())){let creatorAttr,isPartialRoot=!1;tchmi_path(purl)===TCHMI_TARGET_PARTIAL&&(isPartialRoot=!0);let bCreatorVisibility=!0;creatorAttr=tco.getElement()[0].getAttribute("data-tchmi-creator-visibility"),creatorAttr&&(creatorAttr=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:framework#/definitions/Visibility")),"Collapsed"===creatorAttr&&(bCreatorVisibility=!1);let bCreatorLocked=!1;creatorAttr=tco.getElement()[0].getAttribute("data-tchmi-creator-locked"),creatorAttr&&(bCreatorLocked=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:general#/definitions/Boolean"));let controlCollapsed=!1;"Collapsed"===tco.getVisibility()&&(controlCollapsed=!0);let ctrlMeta=__this.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta){let controlzindex=0;const aZindex=TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),"z-index");void 0!==aZindex["z-index"]&&(controlzindex=parseInt(aZindex["z-index"],10),isNaN(controlzindex)&&(controlzindex=0)),ctrlMeta={id:tco.getId(),parent:null,jControlPosition:__this.highlightManager.createControlPosition(tco,2e3+controlzindex),jHierarchyControlposition:__this.highlightManager.createHierarchyControlPosition(tco,2e3+controlzindex),jOriginalPosition:__this.highlightManager.createOriginalPosition(tco,1e3+controlzindex),jAnchorContainer:__this.highlightManager.createAnchorContainer(tco,3e3+controlzindex,bCreatorLocked),jHierarchyAnchorContainer:__this.highlightManager.createHierarchyAnchorContainer(tco,3e3+controlzindex,bCreatorLocked),isSelected:!1,isSelectedPrev:!1,isPartialRoot:isPartialRoot,controlCollapsed:controlCollapsed,isContainerControl:tco.getIsContainerControl()&&!(null===(_c=null===(_b=null===(_a=tco.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))||void 0===_c||_c),isGridControl:"TcHmi.Controls.System.TcHmiGrid"===tco.getType(),domVisibility:bCreatorVisibility,locked:bCreatorLocked,controlAttributeDimension:{},controlCssPixelDimension:{},relativeControlRotation:0,absoluteParentRotation:0},!0===isPartialRoot&&(ctrlMeta.jControlPosition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jHierarchyControlposition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jOriginalPosition[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jAnchorContainer[0].classList.add("tchmi-creator-root-partial"),ctrlMeta.jHierarchyAnchorContainer[0].classList.add("tchmi-creator-root-partial")),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorLocked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorLocked),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-height-inactive","Content"===tco.getHeightMode()),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-width-inactive","Content"===tco.getWidthMode()),__this.highlightManager.processHighlightType(ctrlMeta),__this.highlightManager.processDomVisibility(ctrlMeta),!0===ctrlMeta.isGridControl&&__this.highlightManager.createGridHighlighter(tco,ctrlMeta),__this.metaDataManager.register(ctrlMeta)}else ctrlMeta.isPartialRoot=isPartialRoot,ctrlMeta.controlCollapsed=controlCollapsed,ctrlMeta.domVisibility=bCreatorVisibility;__this.metaDataManager.refreshControlMetaData(ctrlMeta),__this.controlMoveManager.registerControl(ctrlMeta),__this.hierarchyManager.registerContainerControl(ctrlMeta),__this.controlResizeManager.registerControl(ctrlMeta);let ctco=tco;for(;null!=ctco;){if(ctco.getIsContainerControl()&&null!==(_f=null===(_e=null===(_d=ctco.getElement())||void 0===_d?void 0:_d[0])||void 0===_e?void 0:_e.hasAttribute("data-tchmi-designer-ignore"))&&void 0!==_f&&!_f){let tcoPar=tco.getParent();if(tcoPar&&tcoPar.getId()===ctco.getId()){let ctrlParentMeta=__this.metaDataManager.getControlMetaData(ctco.getId());if(null===ctrlParentMeta){let creatorParentAttr,controlParentZindex=0;controlParentZindex=parseInt(ctco.getElement().css("zIndex"),10),isNaN(controlParentZindex)&&(controlParentZindex=0);let bCreatorParentVisibility=!0;creatorParentAttr=ctco.getElement()[0].getAttribute("data-tchmi-creator-visibility"),creatorParentAttr&&(creatorParentAttr=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:framework#/definitions/Visibility")),"Collapsed"===creatorParentAttr&&(bCreatorParentVisibility=!1);let bCreatorParentLocked=!1;creatorParentAttr=ctco.getElement()[0].getAttribute("data-tchmi-creator-locked"),creatorParentAttr&&(bCreatorParentLocked=TcHmi.ValueConverter.toType(creatorAttr,"tchmi:general#/definitions/Boolean"));let controlParentCollapsed=!1;"Collapsed"===ctco.getVisibility()&&(controlParentCollapsed=!0),ctrlParentMeta={id:ctco.getId(),parent:null,jControlPosition:__this.highlightManager.createControlPosition(ctco,2e3+controlParentZindex),jHierarchyControlposition:__this.highlightManager.createHierarchyControlPosition(ctco,2e3+controlParentZindex),jOriginalPosition:__this.highlightManager.createOriginalPosition(ctco,1e3+controlParentZindex),jAnchorContainer:__this.highlightManager.createAnchorContainer(ctco,3e3+controlParentZindex,bCreatorParentLocked),jHierarchyAnchorContainer:__this.highlightManager.createHierarchyAnchorContainer(ctco,3e3+controlParentZindex,bCreatorParentLocked),isSelected:!1,isSelectedPrev:!1,isPartialRoot:!1,controlCollapsed:controlParentCollapsed,isContainerControl:ctco.getIsContainerControl()&&!(null===(_j=null===(_h=null===(_g=ctco.getElement())||void 0===_g?void 0:_g[0])||void 0===_h?void 0:_h.hasAttribute("data-tchmi-designer-ignore"))||void 0===_j||_j),isGridControl:"TcHmi.Controls.System.TcHmiGrid"===ctco.getType(),domVisibility:bCreatorParentVisibility,locked:bCreatorParentLocked,controlAttributeDimension:{},controlCssPixelDimension:{},relativeControlRotation:0,absoluteParentRotation:0},ctrlParentMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorParentLocked),ctrlParentMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bCreatorParentLocked),__this.metaDataManager.refreshControlMetaData(ctrlParentMeta),!0===ctrlParentMeta.isGridControl&&__this.highlightManager.createGridHighlighter(ctco,ctrlParentMeta),__this.metaDataManager.register(ctrlParentMeta)}ctrlMeta.parent=ctrlParentMeta}}ctco=ctco.getParent()}let tcoPar=tco.getParent();if(null!==ctrlMeta.parent&&null!==tcoPar){const nextCtrl=tco.getElement().next();let nextCtrlMeta=null;if(0!==nextCtrl.length&&(nextCtrlMeta=__this.metaDataManager.getControlMetaData(nextCtrl[0].id)),nextCtrlMeta)nextCtrlMeta.jOriginalPosition.before(ctrlMeta.jOriginalPosition),nextCtrlMeta.jControlPosition.before(ctrlMeta.jControlPosition),nextCtrlMeta.jControlPosition.before(ctrlMeta.jHierarchyControlposition),nextCtrlMeta.jAnchorContainer.before(ctrlMeta.jAnchorContainer),nextCtrlMeta.jAnchorContainer.before(ctrlMeta.jHierarchyAnchorContainer);else if(!1===ctrlMeta.parent.isGridControl)ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jOriginalPosition),ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jControlPosition),ctrlMeta.parent.jHierarchyControlposition.append(ctrlMeta.jHierarchyControlposition),ctrlMeta.parent.jHierarchyAnchorContainer.append(ctrlMeta.jAnchorContainer),ctrlMeta.parent.jHierarchyAnchorContainer.append(ctrlMeta.jHierarchyAnchorContainer);else{let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tcoPar.__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tcoPar.__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Fatal internal error: Could not find target grid cell for "+tco.getParent().getId()+" to attach highlight container."),targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer)}}else{const HighlightingContainer=__this.rootControlManager.getViewPortHighlightingSimulator();HighlightingContainer.append(ctrlMeta.jOriginalPosition),HighlightingContainer.append(ctrlMeta.jControlPosition),HighlightingContainer.append(ctrlMeta.jHierarchyControlposition),HighlightingContainer.append(ctrlMeta.jAnchorContainer),HighlightingContainer.append(ctrlMeta.jHierarchyAnchorContainer),TcHmi.System.SharedResources.jqBody.append(HighlightingContainer)}let ctrlAsyncData=__this.highlightManager.requestAsyncHighlighterUpdateForControl(tco);ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,ctrlMeta.isPartialRoot&&__this.rootControlManager.setRootControl(tco,ctrlMeta)}}}}__onThemeDataChanged(){let __this=this;return function(e){__this.metaDataManager.refreshControlMetaData()}}resyncSelectedControls(){if(this.metaDataManager.getSelectedControlsMetaDataHasChanged()){let metaData=this.metaDataManager.getSelectedControlsMetaData();const cmd={name:"SelectedControls",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null};for(let id in metaData)cmd.controls.push(id);new Engineering.SyncCmdToCreatorSelectedControls(cmd).send(),this.metaDataManager.resetSelectedControlsMetaDataHasChanged()}}resyncControls(){if(this.metaDataManager.getChangedControlsMetaDataHasChanged()){let metaData=this.metaDataManager.getChangedControlsMetaData();const cmd={name:"SyncControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,controls:[],replyTo:null};for(let id in metaData){const md=metaData[id],tco=TcHmi.Controls.get(id);if(!tco)continue;let markup=tco.getPcElement()[0].outerHTML;cmd.controls.push({targetControl:md.id,descriptionPath:TcHmi.System.Services.controlManager.getDescriptionPath(tco.getType()),controlHtml:markup})}new Engineering.SyncCmdToCreatorSyncControls(cmd).send(),this.metaDataManager.resetChangedControlsMetaData()}}syncControl(targetPartial,targetControl,controlHtml){var _a,_b,_c;let __this=this;if(!targetControl)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Invalid target control."),!1;if(!controlHtml)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Invalid or missing html."),!1;const tco=TcHmi.Controls.get(targetControl);if(!tco)return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Control="+targetControl+" not found in control cache."),!1;let tempDiv=document.createElement("div");tempDiv.innerHTML=controlHtml;let jControlHtmlNew=$(tempDiv.firstElementChild);if(0===jControlHtmlNew.length)return!1;if(1!==jControlHtmlNew.length&&(jControlHtmlNew=jControlHtmlNew.filter("div[data-tchmi-type]"),1!==jControlHtmlNew.length))return TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Only one control is allowed but got "+jControlHtmlNew.length),!1;if(!jControlHtmlNew[0].getAttribute("data-tchmi-type"))return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed for control="+targetControl+". Missing attribute=data-tchmi-type."),!1;if(!jControlHtmlNew[0].id)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed for control="+targetControl+". Missing attribute=id."),!1;let jControlHtmlCurrent=tco.getPcElement().clone();if(0===jControlHtmlCurrent.length)return!1;if(jControlHtmlNew[0].outerHTML===jControlHtmlCurrent[0].outerHTML)return!1;let attrsCurrent=tco.getAttrs(),attrsNewRes=System.resolveAttributesFromControlElement(jControlHtmlNew[0]);const ctrlMeta=this.metaDataManager.getControlMetaData(targetControl);let newId=attrsNewRes.value.id.value,tcoPar=tco.getParent();if(targetControl!==newId&&tcoPar){let jParentPcElementClone=tcoPar.getPcElement().clone(),tempDiv=document.createElement("div");return tempDiv.innerHTML=controlHtml,jParentPcElementClone.find("#"+tchmi_css_escape_selector(targetControl)).replaceWith($(tempDiv.firstElementChild)),this.syncControl(targetPartial,jParentPcElementClone[0].id,jParentPcElementClone[0].outerHTML),ctrlMeta&&ctrlMeta.isSelected&&TcHmi.EventProvider.register(newId+".onAttached",(function(e,data){__this.select(newId,!0),e.destroy()})),!0}TcHmi.Engineering.ErrorPane.remove(tco.getId()+"requiredAttributeTouched");const creatorAttributesNotSynced={"data-tchmi-creator-visibility":!0,"data-tchmi-creator-locked":!0,"data-tchmi-creator-viewport-width":!0,"data-tchmi-creator-viewport-height":!0,"data-tchmi-zindex":!0};let attrsToProcess=[],attrsToRemove=[];for(let keyNew in attrsNewRes.value){const attrNew=attrsNewRes.value[keyNew],attrCurrent=attrsCurrent[keyNew];if(void 0===attrCurrent||!tchmi_equal(attrNew.value,attrCurrent.value)){if(attrNew.descr&&!0===attrNew.descr.requiredOnCompile){TcHmi.Engineering.ErrorPane.add(tco.getId()+"requiredAttributeTouched","Synchronization problem while changing attribute "+attrNew.descr.name+" of control="+tco.getId()+". It is not possible to change this attribute in runtime. Please save and reload this window.",TcHmi.Engineering.ErrorPane.MessageType.Error);continue}attrsToProcess.push(attrNew)}creatorAttributesNotSynced[attrNew.name]&&delete creatorAttributesNotSynced[attrNew.name]}for(let keyCurrent in attrsCurrent){let attrCurrent=attrsCurrent[keyCurrent];if(void 0===attrsNewRes.value[attrCurrent.name]){if(attrCurrent.descr&&!0===attrCurrent.descr.requiredOnCompile){TcHmi.Engineering.ErrorPane.add(tco.getId()+"requiredAttributeTouched","Synchronization problem while removing attribute "+attrCurrent.descr.name+" of control="+tco.getId()+". This attribute is not allowed to be deleted.",TcHmi.Engineering.ErrorPane.MessageType.Error);continue}attrsToRemove.push(attrCurrent)}}for(let missingCreatorAttribute in creatorAttributesNotSynced){switch(missingCreatorAttribute){case"data-tchmi-creator-visibility":null!==ctrlMeta&&(ctrlMeta.domVisibility=!0);break;case"data-tchmi-creator-locked":null!==ctrlMeta&&(ctrlMeta.locked=!1);break;case"data-tchmi-zindex":if(null!==ctrlMeta){const controlzindex=0;ctrlMeta.jOriginalPosition.css("z-index",1e3+controlzindex),ctrlMeta.jControlPosition.css("z-index",2e3+controlzindex),ctrlMeta.jHierarchyControlposition.css("z-index",2e3+controlzindex),ctrlMeta.jAnchorContainer.css("z-index",3e3+controlzindex),ctrlMeta.jHierarchyAnchorContainer.css("z-index",3e3+controlzindex)}}tco.getElement()[0].removeAttribute(missingCreatorAttribute),tco.getPcElement()[0].removeAttribute(missingCreatorAttribute),delete tco.getAttrs()[missingCreatorAttribute]}if(null!=attrsToProcess)for(let i=0,ii=attrsToProcess.length;i<ii;i++){const attr=attrsToProcess[i];switch(attr.name.toLowerCase()){case"data-tchmi-creator-visibility":if(!0===TCHMI_DESIGNER&&null!==ctrlMeta)switch(TcHmi.ValueConverter.toType(attr.value,"tchmi:framework#/definitions/Visibility")){case"Collapsed":ctrlMeta.domVisibility=!1;break;default:ctrlMeta.domVisibility=!0}tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-creator-locked":!0===TCHMI_DESIGNER&&null!==ctrlMeta&&(ctrlMeta.locked=TcHmi.ValueConverter.toType(attr.value,"tchmi:general#/definitions/Boolean")),tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-creator-viewport-width":case"data-tchmi-creator-viewport-height":tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr;break;case"data-tchmi-zindex":if(!0===TCHMI_DESIGNER&&null!==ctrlMeta){let controlzindex=parseInt(attr.value,10);isNaN(controlzindex)&&(controlzindex=0),controlzindex>=0&&(ctrlMeta.jOriginalPosition.css("z-index",1e3+controlzindex),ctrlMeta.jControlPosition.css("z-index",2e3+controlzindex),ctrlMeta.jHierarchyControlposition.css("z-index",2e3+controlzindex),ctrlMeta.jAnchorContainer.css("z-index",3e3+controlzindex),ctrlMeta.jHierarchyAnchorContainer.css("z-index",3e3+controlzindex))}}}if("TcHmi.Controls.System.TcHmiHtmlHost"===tco.getType()){let contentNew=jControlHtmlNew[0].innerHTML;contentNew&&tco.setContent(contentNew),contentNew=""}for(let i=0,ii=attrsToRemove.length;i<ii;i++){let attr=attrsToRemove[i];if(void 0===attr.descr||null===attr.descr)continue;if(attr.valueType===System.ControlAttributeValueType.Simple&&tco.getElement()[0].removeAttribute(attr.name),delete tco.getAttrs()[attr.name],!0===attr.descr.readOnly)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(attr.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(attr.value);if(isSymbolExpression&&!isSymbolExpressionEscaped)try{TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!0)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while removing binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}else{let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(tco,attr.descr,null);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error))}}for(let i=0,ii=attrsToProcess.length;i<ii;i++){let attr=attrsToProcess[i];if(void 0===attr.descr||null===attr.descr)continue;if(attr.valueType===System.ControlAttributeValueType.Simple&&tco.getElement()[0].setAttribute(attr.name,attr.value),tco.getAttrs()[attr.name]=attr,!0===attr.descr.readOnly)continue;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(attr.value),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(attr.value);if(isSymbolExpression&&!isSymbolExpressionEscaped){let designerPartialParamExpression=null;if(TCHMI_DESIGNER){let attrValueExpression=new TcHmi.SymbolExpression(attr.value);attrValueExpression&&attrValueExpression.getType()===TcHmi.SymbolType.PartialParam&&(designerPartialParamExpression=new TcHmi.SymbolExpression("%pp%TCHMI_TARGET_DESIGNER_PARTIALPARAM::"+attrValueExpression.getContent()+"%/pp%"))}let bResetBinding=!0,existingBinding=TcHmi.System.Services.bindingManager.getBinding(attr.descr.propertyName,tco);if(null!=existingBinding){let existingBindingSymbol=existingBinding.getSymbol();if(null!=existingBindingSymbol){let existingBindingSymbolExpression=existingBindingSymbol.getExpression();if(null!=existingBindingSymbolExpression)if(designerPartialParamExpression){if(designerPartialParamExpression.toString()===existingBindingSymbolExpression.toString()){bResetBinding=!1;break}}else if(attr.value===existingBindingSymbolExpression.toString()){bResetBinding=!1;break}}}if(!0===bResetBinding)try{if(TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!1),designerPartialParamExpression){const dPPExpression=designerPartialParamExpression.toString();dPPExpression?TcHmi.System.Services.bindingManager.createBinding(dPPExpression,attr.descr.propertyName,tco):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. designer partial param expression invalid while creating binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+".")}else TcHmi.System.Services.bindingManager.createBinding(attr.value,attr.descr.propertyName,tco)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while creating binding for attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}}else{let prepValue=attr.value;isSymbolExpressionEscaped&&(prepValue=TcHmi.Symbol.escapeSymbolExpression(prepValue));try{TcHmi.System.Services.bindingManager.removeBinding(attr.descr.propertyName,tco,!1)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while removing binding from attribute="+attr.descr.propertyName+" of control="+tco.getId()+":\n",e)}let error=TcHmi.System.Services.controlManager.setControlPropertyByAttribute(tco,attr.descr,prepValue);error&&error.code!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&(error.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error),"\nException:",error.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] "+TcHmi.Log.buildMessage(error)))}}if(tco.getIsContainerControl()&&null!==(_c=null===(_b=null===(_a=tco.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))&&void 0!==_c&&!_c){let jContentChildren=jControlHtmlNew.children(),jCurrentChildren=jControlHtmlCurrent.children("div[data-tchmi-type]"),removed=[];for(let i=0,ii=jCurrentChildren.length;i<ii;i++){let jCurrentChild=jCurrentChildren.eq(i),bDelete=!0;for(let j=0,jj=jContentChildren.length;j<jj;j++)if("DIV"===jContentChildren[j].nodeName&&!1!==jContentChildren[j].hasAttribute("data-tchmi-type")&&jCurrentChild[0].id===jContentChildren[j].id){bDelete=!1;break}if(!0===bDelete){removed.push(jCurrentChild[0].id);let removedControl=TcHmi.Controls.get(jCurrentChild[0].id);if(removedControl){removedControl.__getKeepAlive()&&removedControl.__setKeepAlive(!1),removedControl.destroy()}}}for(let i=0,ii=jContentChildren.length;i<ii;i++){if("DIV"!==jContentChildren[i].nodeName||!1===jContentChildren[i].hasAttribute("data-tchmi-type"))continue;let bRemoved=!1;for(let j=0,jj=removed.length;j<jj;j++)if(jContentChildren[i].id===removed[j]){bRemoved=!0;break}if(!0!==bRemoved)try{this.syncControl(targetPartial,jContentChildren[i].id,jContentChildren[i].outerHTML)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. An uncaught exception occurred while syncing control="+jContentChildren[i].id+":\n",e)}}let created=[],controlIndex=-1;for(let i=0,ii=jContentChildren.length;i<ii;i++){if("DIV"!==jContentChildren[i].nodeName||!1===jContentChildren[i].hasAttribute("data-tchmi-type"))continue;controlIndex++;let bCreate=!0;for(let j=0,jj=jCurrentChildren.length;j<jj;j++)if(jCurrentChildren[j].id===jContentChildren[i].id){bCreate=!1;break}if(!0===bCreate){created.push(jContentChildren[i].id);try{this.createControl(targetPartial,targetControl,controlIndex,jContentChildren[i].outerHTML,null)}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Synchronization failed. Unexpected An uncaught exception occurred while creating control="+jContentChildren[i].id+":\n",e)}}}}const pcElementOld=tco.getPcElement();if(tco.__setPcElement(jControlHtmlNew.clone()),void 0!==tco.getParent()&&null!==tco.getParent()){let temp=tco.getParent();for(;null!==temp;)temp.getPcElement().find("#"+tchmi_css_escape_selector(pcElementOld[0].id)).replaceWith(tco.getPcElement().clone()),temp=temp.getParent()}if(!0===TCHMI_DESIGNER&&this.hierarchyManager&&this.hierarchyManager.isDesignerModeControl(targetControl)&&this.rootControlManager&&this.highlightManager){const tCtrlMeta=this.metaDataManager.refreshControlMetaData(targetControl);if(null!=tCtrlMeta){let ctrlAsyncData=this.highlightManager.requestAsyncHighlighterUpdateForControl(tco);if(ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,!0===tCtrlMeta.isPartialRoot);else if(tco.getParent()){let recursiveControl=tco.getParent();do{if(!recursiveControl||"Content"!==recursiveControl.getHeightMode()&&"Content"!==recursiveControl.getWidthMode())recursiveControl=null;else{const parentCtrlMeta=this.metaDataManager.getControlMetaData(recursiveControl.getId());if(!parentCtrlMeta){recursiveControl=null;break}if(parentCtrlMeta.isPartialRoot){this.rootControlManager.setCreatorViewPortPosition(recursiveControl);break}recursiveControl=recursiveControl.getParent()}}while(null!==recursiveControl)}}}return null!==ctrlMeta&&(ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",ctrlMeta.locked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",ctrlMeta.locked),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-height-inactive","Content"===tco.getHeightMode()),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-width-inactive","Content"===tco.getWidthMode())),!0}createControl(targetPartial,targetParentControl,domPos,controlHtml,callback=null){var _a,_b,_c;let __this=this,tempDiv=document.createElement("div");tempDiv.innerHTML=controlHtml;let jControlHTML=$(tempDiv.firstElementChild);if(0===jControlHTML.length)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html."));let controlType=jControlHTML[0].getAttribute("data-tchmi-type");if(!controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html. Missing attribute=data-tchmi-type."));let controlId=jControlHTML[0].id;if(!controlId)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Invalid control html. Missing attribute=id."));if(TcHmi.Controls.get(controlId))return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error('[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create instance of control. Id: "'+controlId+'" does already exist.'));let tpco=null;if(null!=targetParentControl&&""!==targetParentControl){if(tpco=TcHmi.Controls.get(targetParentControl),!tpco)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Target parent control="+targetParentControl+" not found in control cache."))}else{if("TcHmi.Controls.System.TcHmiView"!==controlType&&"TcHmi.Controls.System.TcHmiContent"!==controlType&&"TcHmi.Controls.System.TcHmiUserControl"!==controlType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Only controls of type 'TcHmi.Controls.System.TcHmiView', 'TcHmi.Controls.System.TcHmiContent' or 'TcHmi.Controls.System.TcHmiUserControl' are valid as a root element."));jControlHTML.attr("data-tchmi-partial-url",tchmi_path(TCHMI_TARGET_PARTIAL)).attr("data-tchmi-creator-partial-key",TCHMI_TARGET_PARTIAL)}let tco=TcHmi.System.Services.controlManager.compile(jControlHTML[0],tpco,{pos:domPos});if(void 0===tco)return;if(null!==tpco){if(!tpco.getIsContainerControl()||null===(_c=null===(_b=null===(_a=tco.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))||void 0===_c||_c||"function"!=typeof tpco.addChild)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Can't add child to a not 'TcHmiContainerControl' based control! Requested parent target control="+tpco.getId()+" has type="+tpco.getType()+"."));if(0===domPos)tpco.getPcElement().prepend(tco.getPcElement().clone());else{const jContentChildren=tpco.getPcElement().children();let intDomPos=-1;for(let controlCounter=0,i=0,ii=jContentChildren.length;i<ii;i++)if("DIV"===jContentChildren[i].nodeName&&!1!==jContentChildren[i].hasAttribute("data-tchmi-type")){if(controlCounter++,domPos===controlCounter){intDomPos=i;break}if(domPos<controlCounter)break}-1===intDomPos?tpco.getPcElement().append(tco.getPcElement().clone()):jContentChildren.eq(intDomPos).after(tco.getPcElement().clone())}}else{const tcoType=tco.getType();if("TcHmi.Controls.System.TcHmiView"!==tcoType&&"TcHmi.Controls.System.TcHmiUserControl"!==tcoType&&"TcHmi.Controls.System.TcHmiContent"!==tcoType)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to create control. Can't load root element because it is of type="+tcoType+" but only controls of type TcHmi.Controls.System.TcHmiView, TcHmi.Controls.System.TcHmiContent and TcHmi.Controls.System.TcHmiUserControl are allowed as root element."));TcHmi.System.Services.viewManager.loadViewObject(tco)}let tcoId=tco.getId();TcHmi.Engineering.ErrorPane.remove(tcoId+"requiredAttributeTouched"),TcHmi.EventProvider.register(tcoId+".onAttached",(function(e,data){e.destroy(),"function"==typeof callback&&callback.call(__this,{error:TcHmi.Errors.NONE})}))}select(controlId,bIgnoreSync=!1){var _a;if(!0!==TCHMI_DESIGNER)return;const ctrlMeta=this.metaDataManager.getControlMetaData(controlId);if(null===ctrlMeta)return void(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeManager] Failed to select control="+controlId+"."));let tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;ctrlMeta.isSelectedPrev=ctrlMeta.isSelected,ctrlMeta.isSelected=!0,this.metaDataManager.selectControl(ctrlMeta),null===(_a=this.highlightManager)||void 0===_a||_a.processHighlightType(ctrlMeta);let tcoPar=tco.getParent();if(tcoPar&&"function"==typeof tcoPar.getChildren&&ctrlMeta.parent){let childSelected=!1;for(let childCtrl of tcoPar.getChildren()){const ctrlChildMeta=this.metaDataManager.getControlMetaData(childCtrl.getId());if(ctrlChildMeta&&ctrlChildMeta.isSelected){childSelected=!0;break}}ctrlMeta.parent.jControlPosition[0].classList.toggle("tchmi-creator-childcontrol-selected",childSelected)}!0!==bIgnoreSync&&this.resyncSelectedControls()}unselect(controlId,bIgnoreSync=!1){var _a;if(!0!==TCHMI_DESIGNER)return;const ctrlMeta=this.metaDataManager.getControlMetaData(controlId);if(null===ctrlMeta)return;let tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;ctrlMeta.isSelected=!1,this.metaDataManager.unselectControl(ctrlMeta),ctrlMeta.isSelectedPrev=!1,null===(_a=this.highlightManager)||void 0===_a||_a.processHighlightType(ctrlMeta);let tcoPar=tco.getParent();if(tcoPar&&"function"==typeof tcoPar.getChildren&&ctrlMeta.parent){let childSelected=!1;for(let childCtrl of tcoPar.getChildren()){const ctrlChildMeta=this.metaDataManager.getControlMetaData(childCtrl.getId());if(ctrlChildMeta&&ctrlChildMeta.isSelected){childSelected=!0;break}}ctrlMeta.parent.jControlPosition[0].classList.toggle("tchmi-creator-childcontrol-selected",childSelected)}!0!==bIgnoreSync&&this.resyncSelectedControls()}selectEach(bIgnoreSync){let selectionHasChanged=this.unselectEach(!0);const controlsMetaData=this.metaDataManager.getControlMetaData();for(let id in controlsMetaData)!1===controlsMetaData[id].isPartialRoot&&(this.select(id,!0),selectionHasChanged=!0);return!0!==bIgnoreSync&&selectionHasChanged&&this.resyncSelectedControls(),selectionHasChanged}unselectEach(bIgnoreSync){let selectionHasChanged=!1;const controlsMetaData=this.metaDataManager.getControlMetaData();for(let id in controlsMetaData)!0===controlsMetaData[id].isSelected&&(this.unselect(id,!0),selectionHasChanged=!0);return!0!==bIgnoreSync&&selectionHasChanged&&this.resyncSelectedControls(),selectionHasChanged}setControlLocked(targetControl,bLocked){let ctrlMeta=this.metaDataManager.getControlMetaData(targetControl);null!==ctrlMeta&&(ctrlMeta.locked=bLocked,ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bLocked),ctrlMeta.jHierarchyAnchorContainer[0].classList.toggle("tchmi-creator-control-locked",bLocked));let tco=TcHmi.Controls.get(targetControl);tco&&(bLocked?(tco.getElement()[0].setAttribute("data-tchmi-creator-locked","True"),tco.getPcElement()[0].setAttribute("data-tchmi-creator-locked","True")):(tco.getElement()[0].removeAttribute("data-tchmi-creator-locked"),tco.getPcElement()[0].removeAttribute("data-tchmi-creator-locked")))}lock(){if(this.__locked=!0,!0===TCHMI_LIVEVIEW)TcHmi.System.Services.dialogManager.updateText("__TcHmiDesignerLock",TcHmi.System.Services.localization.getText("Changes_To_Project_Require_Reload",{level:TcHmi.Locale.Level.Engineering})+' <a onclick="window.location.reload()">'+TcHmi.System.Services.localization.getText("Click_Here_For_Reload",{level:TcHmi.Locale.Level.Engineering})+"</a>"),TcHmi.System.Services.dialogManager.showDialog("__TcHmiDesignerLock",!0,TcHmi.DialogManager.DialogType.Overlay);else if(!0===TCHMI_DESIGNER){TcHmi.System.Services.dialogManager.updateText("__TcHmiDesignerLock",""),TcHmi.System.Services.dialogManager.showDialog("__TcHmiDesignerLock",!0,TcHmi.DialogManager.DialogType.Overlay),this.unselectEach(!0);const v=System.Services.viewManager.getView();null!=v&&TcHmi.StyleProvider.setSimpleElementStyle(v.getElement(),"filter","blur(2px)")}TcHmi.System.SharedResources.jqBody.css({overflow:"hidden"})}unlock(){throw new Error("Not implemented!")}isLocked(){return this.__locked}getSettings(){return this.__settings}updateSettings(valueNew){var _a,_b,_c;tchmi_equal(this.__settings,valueNew)||(this.__settings=valueNew,null===(_a=this.highlightManager)||void 0===_a||_a.updateEngineeringStyles().call(null),null===(_b=this.interactionManager)||void 0===_b||_b.clearControlSnapPositionCache(),null===(_c=this.interactionManager)||void 0===_c||_c.refreshControlSnapPositionCache())}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeControlMetaDataManager=class{constructor(designerModeManager){this.__controlsMetaData={},this.__selectedControlsMetaData={},this.__selectedControlsMetaDataHasChanged=!1,this.__changedControlsMetaData={},this.__changedControlsMetaDataHasChanged=!1,this.__selectedControlIdsWithChildren=[],this.__designerModeManager=designerModeManager,TcHmi.EventProvider.register("onControlDetached",this.__onControlDetached())}register(ctrlMeta){this.__controlsMetaData[ctrlMeta.id]=ctrlMeta}unregister(tcoId){void 0!==this.__controlsMetaData[tcoId]&&(!0===TCHMI_DESIGNER&&this.__designerModeManager.highlightManager&&this.__designerModeManager.rootControlManager&&(this.__designerModeManager.highlightManager.handleControlRemoved(this.__controlsMetaData[tcoId]),this.__designerModeManager.rootControlManager.setCreatorViewPortPosition(TcHmi.System.Services.viewManager.getView()),this.__designerModeManager.highlightManager.requestAsyncHighlighterUpdate()),delete this.__controlsMetaData[tcoId]),void 0!==this.__selectedControlsMetaData[tcoId]&&(delete this.__selectedControlsMetaData[tcoId],this.__rebuildSelectIdCache())}__onControlDetached(){let __this=this;return function(e,tco){null!=tco&&__this.unregister(tco.getId())}}getControlMetaData(id){return null==id?this.__controlsMetaData:void 0!==this.__controlsMetaData[id]?this.__controlsMetaData[id]:null}refreshControlMetaData(idOrControl){let ctrlMeta,id;if("string"==typeof idOrControl)ctrlMeta=this.getControlMetaData(idOrControl),id=idOrControl;else{if(!idOrControl){for(let id in this.__controlsMetaData)this.refreshControlMetaData(this.__controlsMetaData[id]);return null}ctrlMeta=idOrControl,id=ctrlMeta.id}if(null==ctrlMeta||!this.__designerModeManager.highlightManager)return null;const tco=TcHmi.Controls.get(id);if(!tco)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeComManager] Failed to refresh Control Meta Data of control "${id}": Not found in control cache.\n`),null;const element=tco.getElement();ctrlMeta.controlAttributeDimension=this.__getControlAttributeDimension(tco),ctrlMeta.relativeControlRotation=this.__getRelativeRotation(element[0]),ctrlMeta.absoluteParentRotation=this.__getAbsoluteRotation(element.offsetParent()[0]),ctrlMeta.controlCssPixelDimension=this.__getControlCssPixelDimension(tco);let ctrlAsyncData=this.__designerModeManager.highlightManager.requestAsyncHighlighterUpdateForControl(tco);return ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0,ctrlMeta}getChangedControlsMetaData(){return this.__changedControlsMetaData}resetChangedControlsMetaData(){this.__changedControlsMetaDataHasChanged=!1,this.__changedControlsMetaData={}}getChangedControlsMetaDataHasChanged(){return this.__changedControlsMetaDataHasChanged}addChangedControlsMetaData(ctrlMeta){this.__changedControlsMetaData[ctrlMeta.id]||(this.__changedControlsMetaDataHasChanged=!0),this.__changedControlsMetaData[ctrlMeta.id]=ctrlMeta}getSelectedControlsMetaData(){return this.__selectedControlsMetaData}resetSelectedControlsMetaDataHasChanged(){this.__selectedControlsMetaDataHasChanged=!1}getSelectedControlsMetaDataHasChanged(){return this.__selectedControlsMetaDataHasChanged}selectControl(ctrlMeta){this.__selectedControlsMetaData[ctrlMeta.id]||(this.__selectedControlsMetaDataHasChanged=!0),this.__selectedControlsMetaData[ctrlMeta.id]=ctrlMeta;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;const hierarchy=TcHmi.System.resolveControlHierarchy(tco,null),getAllChildren=h=>{var _a,_b,_c;const ctrl=h.ctrl;if(-1===this.__selectedControlIdsWithChildren.indexOf(ctrl.getId())&&this.__selectedControlIdsWithChildren.push(ctrl.getId()),ctrl.getIsContainerControl()&&null!==(_c=null===(_b=null===(_a=ctrl.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))&&void 0!==_c&&!_c)for(let i=0,ii=h.children_hierarchy.length;i<ii;i++)getAllChildren(h.children_hierarchy[i])};getAllChildren(hierarchy),this.__rebuildSelectIdCache(ctrlMeta)}unselectControl(ctrlMeta){this.__selectedControlsMetaData[ctrlMeta.id]&&(this.__selectedControlsMetaDataHasChanged=!0),delete this.__selectedControlsMetaData[ctrlMeta.id],this.__rebuildSelectIdCache()}getSelectedControlIdsWithChildren(){return this.__selectedControlIdsWithChildren}__rebuildSelectIdCache(ctrlMeta){if(void 0===ctrlMeta){this.__selectedControlIdsWithChildren=[];for(let id in this.__selectedControlsMetaData){const childCtrl=this.__selectedControlsMetaData[id];!1===childCtrl.isPartialRoot&&this.__rebuildSelectIdCache(childCtrl)}return}if(!0===ctrlMeta.isPartialRoot)return;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;const hierarchy=TcHmi.System.resolveControlHierarchy(tco,null),getAllChildren=h=>{var _a,_b,_c;const ctrl=h.ctrl;if(-1===this.__selectedControlIdsWithChildren.indexOf(ctrl.getId())&&this.__selectedControlIdsWithChildren.push(ctrl.getId()),ctrl.getIsContainerControl()&&null!==(_c=null===(_b=null===(_a=ctrl.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))&&void 0!==_c&&!_c)for(let i=0,ii=h.children_hierarchy.length;i<ii;i++)getAllChildren(h.children_hierarchy[i])};getAllChildren(hierarchy)}__getControlAttributeDimension(tco){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x;return{topValue:null!==(_a=tco.getTop())&&void 0!==_a?_a:null,topUnit:null!==(_b=tco.getTopUnit())&&void 0!==_b?_b:"px",leftValue:null!==(_c=tco.getLeft())&&void 0!==_c?_c:null,leftUnit:null!==(_d=tco.getLeftUnit())&&void 0!==_d?_d:"px",widthValue:null!==(_e=tco.getWidth())&&void 0!==_e?_e:null,widthUnit:null!==(_f=tco.getWidthUnit())&&void 0!==_f?_f:"px",minWidthValue:null!==(_g=tco.getMinWidth())&&void 0!==_g?_g:null,minWidthUnit:null!==(_h=tco.getMinWidthUnit())&&void 0!==_h?_h:"px",maxWidthValue:null!==(_j=tco.getMaxWidth())&&void 0!==_j?_j:null,maxWidthUnit:null!==(_k=tco.getMaxWidthUnit())&&void 0!==_k?_k:"px",widthMode:null!==(_l=tco.getWidthMode())&&void 0!==_l?_l:"Value",rightValue:null!==(_m=tco.getRight())&&void 0!==_m?_m:null,rightUnit:null!==(_o=tco.getRightUnit())&&void 0!==_o?_o:"px",heightValue:null!==(_p=tco.getHeight())&&void 0!==_p?_p:null,heightUnit:null!==(_q=tco.getHeightUnit())&&void 0!==_q?_q:"px",heightMode:null!==(_r=tco.getHeightMode())&&void 0!==_r?_r:"Value",minHeightValue:null!==(_s=tco.getMinHeight())&&void 0!==_s?_s:null,minHeightUnit:null!==(_t=tco.getMinHeightUnit())&&void 0!==_t?_t:"px",maxHeightValue:null!==(_u=tco.getMaxHeight())&&void 0!==_u?_u:null,maxHeightUnit:null!==(_v=tco.getMaxHeightUnit())&&void 0!==_v?_v:"px",bottomValue:null!==(_w=tco.getBottom())&&void 0!==_w?_w:null,bottomUnit:null!==(_x=tco.getBottomUnit())&&void 0!==_x?_x:"px"}}__getControlCssPixelDimension(tco){let res={width:null,height:null,left:null,top:null,right:null,bottom:null},element=tco.getElement();if(element){let width=element.css("width");width&&(res.width=parseFloat(width));let height=element.css("height");height&&(res.height=parseFloat(height));let left=element.css("left");left&&(res.left=parseFloat(left));let top=element.css("top");top&&(res.top=parseFloat(top));let right=element.css("right");right&&(res.right=parseFloat(right));let bottom=element.css("bottom");bottom&&(res.bottom=parseFloat(bottom))}return res}__getAbsoluteRotation(jElem){if(!jElem)return 0;let angleParent=0;const offsetParent=jElem.parentElement;!offsetParent||offsetParent.nodeName&&"HTML"===offsetParent.tagName||(angleParent=this.__getAbsoluteRotation(offsetParent));return angleParent+this.__getRelativeRotation(jElem)}__getRelativeRotation(Elem){if(!Elem)return 0;const tr=TcHmi.StyleProvider.getComputedElementStyle(Elem,"transform").transform;let angle=0;if(tr&&"none"!==tr){const arrMatrixContent=tr.substring(tr.indexOf("(")+1,tr.lastIndexOf(")")).split(",");if(6===arrMatrixContent.length){const a=parseFloat(arrMatrixContent[0]),b=parseFloat(arrMatrixContent[1]);angle=Math.round(Math.atan2(b,a)*(180/Math.PI))}}return angle}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterSyncManager=class{constructor(designerModeManager){this.__transactionLock=[],this.__designerModeManager=designerModeManager}beginTransaction(name){-1===this.__transactionLock.indexOf(name)&&this.__transactionLock.push(name)}commitTransaction(name){const arrayIndex=this.__transactionLock.indexOf(name);-1!==arrayIndex&&this.__transactionLock.splice(arrayIndex,1),0===this.__transactionLock.length&&this.__sendPendingCommands()}__sendPendingCommands(){}transactionActive(){return 0===this.__transactionLock.length}updatePcElementAndSync(eventName){var _a,_b;const tcoList=[],stylenames=["top","left","width","right","height","bottom"],selectedControlsMeta=this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(null==ctrlMeta)continue;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)continue;tcoList.push(tco);let horizontalCount=0,verticalCount=0;const pcElementClone=tco.getPcElement().clone(),tValue=TcHmi.StyleProvider.getSimpleElementStyle(tco.getElement(),stylenames);for(let stylename of stylenames)if(void 0!==tValue[stylename]){let styleHtmlName="data-tchmi-"+stylename,oldValue=pcElementClone.attr(styleHtmlName);if(oldValue){["top","height","bottom"].includes(stylename)?verticalCount++:["right","width","left"].includes(stylename)&&horizontalCount++;let isSymbolExpression=TcHmi.Symbol.isSymbolExpression(oldValue),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(oldValue);if(isSymbolExpression&&!isSymbolExpressionEscaped){let sym=new TcHmi.System.Symbol(oldValue);if(sym){if(sym.getExpression().getType()===TcHmi.SymbolType.Server){sym.destroy();continue}sym.read((function(data){data.error===TcHmi.Errors.NONE&&(oldValue=data.value),sym.destroy()}))}}}"string"==typeof oldValue&&(oldValue=parseFloat(oldValue));let styleUnitHtmlName="data-tchmi-"+stylename+"-unit",oldUnit=pcElementClone.attr(styleUnitHtmlName),tUnitValue=tValue[stylename].replace(/[-.0-9]/g,"");"px"!==tUnitValue&&"%"!==tUnitValue&&(tUnitValue="px"),void 0===oldUnit?"px"!==tUnitValue&&pcElementClone.attr(styleUnitHtmlName,tUnitValue):oldUnit!==tUnitValue&&pcElementClone.attr(styleUnitHtmlName,tUnitValue);let newValue=parseFloat(tValue[stylename]);void 0===oldValue||"number"!=typeof oldValue||Math.round(oldValue)===Math.round(newValue)||["height","width"].includes(stylename)&&["Content","Parent"].includes(null!==(_a=pcElementClone.attr("data-tchmi-"+stylename+"-mode"))&&void 0!==_a?_a:"")||("px"===tUnitValue?pcElementClone.attr(styleHtmlName,newValue.toFixed(0)):"%"===tUnitValue&&pcElementClone.attr(styleHtmlName,newValue.toFixed(1)))}horizontalCount<2&&tValue.left&&"0px"!==tValue.left&&!pcElementClone[0].hasAttribute("data-tchmi-left")&&pcElementClone[0].setAttribute("data-tchmi-left",tValue.left.replace("px","")),verticalCount<2&&tValue.top&&"0px"!==tValue.top&&!pcElementClone[0].hasAttribute("data-tchmi-top")&&pcElementClone[0].setAttribute("data-tchmi-top",tValue.top.replace("px","")),!0===ctrlMeta.domVisibility?pcElementClone.removeAttr("data-tchmi-creator-visibility"):pcElementClone.attr("data-tchmi-creator-visibility","False"),!1===ctrlMeta.locked?pcElementClone.removeAttr("data-tchmi-creator-locked"):pcElementClone.attr("data-tchmi-creator-locked","True"),0===this.__transactionLock.length&&this.__designerModeManager.syncControl(TCHMI_TARGET_PARTIAL,ctrlMeta.id,pcElementClone[0].outerHTML)}TcHmi.EventProvider.raise(eventName,tcoList),null===(_b=this.__designerModeManager.highlightManager)||void 0===_b||_b.requestAsyncHighlighterUpdate()}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterHierarchyManager=class{constructor(designerModeManager){this.__dragtargetContainerHighlighting={},this.__designerModeManager=designerModeManager,TcHmi.System.SharedResources.jqBody.on("dragover.DesignerModeMasterHierarchyManager.body",event=>{event.preventDefault()}).on("dragenter.DesignerModeMasterHierarchyManager.body",this.__onDragEnter()).on("dragleave.DesignerModeMasterHierarchyManager.body",this.__onDragLeave())}isDesignerModeControl(id){let res=!1,hierarchyRecursion=function(h){if(h.ctrl.getId()!==id)for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){let childHierarchy=h.children_hierarchy[i];if(hierarchyRecursion(childHierarchy),!0===res)return}else res=!0},tpco=void 0,partial=document.querySelector(`div[data-tchmi-creator-partial-key="${TCHMI_TARGET_PARTIAL}"]`);if(partial&&(tpco=TcHmi.Controls.get(partial.id)),tpco){let designerIgnore=!1,tco=TcHmi.Controls.get(id);if(tco){let element=tco.getElement();element&&element.length>0&&(designerIgnore=element[0].hasAttribute("data-tchmi-designer-ignore"))}if(designerIgnore)res=!1;else{let hierarchy=TcHmi.System.resolveControlHierarchy(tpco,null);hierarchyRecursion(hierarchy)}}return res}registerContainerControl(ctrlMeta){ctrlMeta.jControlPosition.on("dragover.DesignerModeMasterHierarchyManager."+ctrlMeta.id,event=>{event.preventDefault()}),ctrlMeta.jControlPosition.on("dragenter.DesignerModeMasterHierarchyManager."+ctrlMeta.id,this.__onDragEnter()),ctrlMeta.jControlPosition.on("dragleave.DesignerModeMasterHierarchyManager."+ctrlMeta.id,this.__onDragLeave())}registerContainerElement(jElem){jElem.on("dragenter.DesignerModeMasterHierarchyManager",this.__onDragEnter()).on("dragleave.DesignerModeMasterHierarchyManager",this.__onDragLeave())}__onDragEnter(){return event=>{event.preventDefault(),void 0!==event.pageX&&void 0!==event.pageY&&this.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target)}}__onDragLeave(){return event=>{const targetKey=(event.target.hasAttribute("data-tchmi-creator-target-control")?event.target.getAttribute("data-tchmi-creator-target-control"):"body")+"_r"+(event.target.hasAttribute("data-tchmi-creator-grid-rowindex")?event.target.getAttribute("data-tchmi-creator-grid-rowindex"):null)+"_c"+(event.target.hasAttribute("data-tchmi-creator-grid-cellindex")?event.target.getAttribute("data-tchmi-creator-grid-cellindex"):null);this.__dragtargetContainerHighlighting[targetKey]&&(this.__dragtargetContainerHighlighting[targetKey].classList.remove("tchmi-creator-possibledroptarget"),delete this.__dragtargetContainerHighlighting[targetKey])}}addHighlightDropTarget(position,targetElem){const dropConfig=this.getContainerFromPoint(position);if(this.removeHighlightDropTarget(),!dropConfig||!dropConfig.jHighlighter)return;const targetKey=(targetElem.hasAttribute("data-tchmi-creator-target-control")?targetElem.getAttribute("data-tchmi-creator-target-control"):"body")+"_r"+dropConfig.rowIndex+"_c"+dropConfig.columnIndex;dropConfig.jHighlighter[0].classList.add("tchmi-creator-possibledroptarget"),this.__dragtargetContainerHighlighting[targetKey]=dropConfig.jHighlighter[0]}removeHighlightDropTarget(){for(let key in this.__dragtargetContainerHighlighting)this.__dragtargetContainerHighlighting[key].classList.remove("tchmi-creator-possibledroptarget"),delete this.__dragtargetContainerHighlighting[key]}getContainerFromPoint(position){var _a,_b,_c,_d;const currentView=TcHmi.System.Services.viewManager.getView();if(null===currentView)return null;const jClickTarget=$(document.elementFromPoint(position.left-window.scrollX,position.top-window.scrollY));let jHighlighter,tco=void 0;if(0===jClickTarget.length||jClickTarget[0]===document.body){tco=currentView;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());ctrlMeta&&(jHighlighter=ctrlMeta.jControlPosition)}else{const resolvePossibleDropTargets=function(h){var _a,_b,_c;const ctrl=h.ctrl,ctrlType=ctrl.getType();if(("TcHmi.Controls.System.TcHmiView"===ctrlType||"TcHmi.Controls.System.TcHmiContent"===ctrlType||"TcHmi.Controls.System.TcHmiUserControl"===ctrlType)&&ctrl.getId()!==currentView.getId())return[];let res=[];if(ctrl.getIsContainerControl()&&null!==(_c=null===(_b=null===(_a=ctrl.getElement())||void 0===_a?void 0:_a[0])||void 0===_b?void 0:_b.hasAttribute("data-tchmi-designer-ignore"))&&void 0!==_c&&!_c){res.push(ctrl);for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){const pdts=resolvePossibleDropTargets(h.children_hierarchy[i]);res=res.concat(pdts)}}return res},hierarchy=TcHmi.System.resolveControlHierarchy(currentView,null),pdts=resolvePossibleDropTargets(hierarchy);let tmpInteractioncont=jClickTarget;do{const targetId=tmpInteractioncont.attr("data-tchmi-creator-target-control");if(void 0!==targetId){let bDropTargetFound=!1;for(let i=0,ii=pdts.length;i<ii;i++){const pdt=pdts[i];if(pdt.getId()===targetId){tco=pdt,jHighlighter=tmpInteractioncont,bDropTargetFound=!0;break}}if(!0===bDropTargetFound)break}tmpInteractioncont=tmpInteractioncont.parent()}while(tmpInteractioncont.length>0);tmpInteractioncont=null,null==tco&&(tco=currentView)}let x=position.left,y=position.top,rowIndex=null,cellIndex=null;if(jHighlighter&&"TcHmi.Controls.System.TcHmiGrid"===tco.getType()){if(jClickTarget[0].classList.contains("tchmi-creator-gridcell"))jHighlighter=jClickTarget;else{const jClickTargetParent=jClickTarget.parent();jClickTargetParent.length&&jClickTargetParent[0].classList.contains("tchmi-creator-hierarchy-gridcellposition")&&(jHighlighter=jClickTargetParent)}let parsedRowIndex=parseInt(null!==(_a=jHighlighter.attr("data-tchmi-creator-grid-rowindex"))&&void 0!==_a?_a:"0",10),parsedCellIndex=parseInt(null!==(_b=jHighlighter.attr("data-tchmi-creator-grid-cellindex"))&&void 0!==_b?_b:"0",10);if(!isNaN(parsedCellIndex)&&!isNaN(parsedRowIndex)){rowIndex=parsedRowIndex,cellIndex=parsedCellIndex;const cellPos=jHighlighter.position();x-=cellPos.left,y-=cellPos.top}}let tmpElem2=tco.getElement();if(tmpElem2.length>0)do{const pos=tmpElem2.position();x-=pos.left,y-=pos.top,tmpElem2=tmpElem2.offsetParent(),x-=parseFloat(tmpElem2.css("border-left-width")),y-=parseFloat(tmpElem2.css("border-top-width"))}while(tmpElem2.length>0&&!0!==tmpElem2.is(TcHmi.System.SharedResources.jqBody)&&tmpElem2[0]!==document.documentElement);const zf=null!==(_d=null===(_c=this.__designerModeManager.rootControlManager)||void 0===_c?void 0:_c.getCreatorZoomFactor())&&void 0!==_d?_d:1;return{tco:tco,jHighlighter:jHighlighter,mousePosXinTarget:Math.round(x/zf),mousePosYinTarget:Math.round(y/zf),rowIndex:rowIndex,columnIndex:cellIndex}}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterRootControlManager=class{constructor(designerModeManager){this.__rootControlMetaElements=[],this.__scrollPosition={left:0,top:0},this.__creatorZoomFactor=1,this.__viewportCurrentWidth=0,this.__vpCurrentHeight=0,this.__scrollAnimationFrameId=0,this.__zoomAnimationFrameId=0,this.__designerModeManager=designerModeManager,document.body.classList.add("tchmi-creator-chessboard"),TcHmi.System.SharedResources.jqBody.css({overflow:"hidden"});let tempDiv=document.createElement("div");tempDiv.innerHTML='<div class="tchmi-creator-view-port-simulator"></div>',this.__viewPortSimulator=$(tempDiv.firstElementChild),tempDiv.innerHTML='<div class="tchmi-creator-view-port-highlighting"></div>',this.__viewPortHighlightingSimulator=$(tempDiv.firstElementChild),window.setInterval(this.__onRequiredViewPortSizeWatchTick(),50)}getCreatorZoomFactor(){return this.__creatorZoomFactor}getViewPortSimulator(){return this.__viewPortSimulator}getViewPortHighlightingSimulator(){return this.__viewPortHighlightingSimulator}scroll(p){p.left===this.__scrollPosition.left&&p.top===this.__scrollPosition.top||(this.__scrollPosition.left=p.left,this.__scrollPosition.top=p.top,0!==this.__scrollAnimationFrameId&&window.cancelAnimationFrame(this.__scrollAnimationFrameId),this.__scrollAnimationFrameId=window.requestAnimationFrame(()=>{document.scrollingElement.scrollLeft=this.__scrollPosition.left,document.scrollingElement.scrollTop=this.__scrollPosition.top,this.__scrollAnimationFrameId=0}))}setCreatorZoom(newZoom){void 0!==newZoom&&this.__creatorZoomFactor!==newZoom&&(this.__creatorZoomFactor=newZoom,0!==this.__zoomAnimationFrameId&&window.cancelAnimationFrame(this.__zoomAnimationFrameId),this.__zoomAnimationFrameId=window.requestAnimationFrame(()=>{1!==this.__creatorZoomFactor?this.__viewPortSimulator.css("transform","scale("+this.__creatorZoomFactor+")"):this.__viewPortSimulator.css("transform",""),this.__designerModeManager.metaDataManager.refreshControlMetaData(),this.__zoomAnimationFrameId=0}))}setRootControl(tco,newControlMeta){this.setCreatorViewPortPosition(tco),this.__rootControlMeta=newControlMeta,this.__rootControlMetaElements[0]=this.__rootControlMeta.jControlPosition,this.__rootControlMetaElements[1]=this.__rootControlMeta.jAnchorContainer,this.__viewPortSimulator[0].setAttribute("data-tchmi-creator-target-control-type",tco.getType())}__onRequiredViewPortSizeWatchTick(){return()=>{if(!this.__rootControlMeta)return;let vpWidth=50,vpHeight=50;for(let j=0,jj=this.__rootControlMetaElements.length;j<jj;j++){let elem=this.__rootControlMetaElements[j];if(null!=elem){let brect=elem[0].getBoundingClientRect(),brWidth=brect.width,brHeight=brect.height,oWidth=elem[0].offsetWidth,oHeight=elem[0].offsetHeight,wOverflow=elem[0].scrollWidth-oWidth,hOverflow=elem[0].scrollHeight-oHeight,calcWidth=brWidth+(brect.left+window.pageXOffset-document.documentElement.clientLeft)+wOverflow,calcHeight=brHeight+(brect.top+window.pageYOffset-document.documentElement.clientTop)+hOverflow;calcWidth>vpWidth&&(vpWidth=calcWidth),calcHeight>vpHeight&&(vpHeight=calcHeight)}}vpWidth=Math.floor(vpWidth)+35,vpHeight=Math.floor(vpHeight)+35,vpWidth===this.__viewportCurrentWidth&&vpHeight===this.__vpCurrentHeight||(new Engineering.SyncCmdToCreatorRequestRequiredViewPortSize({name:"RequestRequiredViewPortSize",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,width:vpWidth,height:vpHeight,replyTo:null}).send(),this.__viewportCurrentWidth=vpWidth,this.__vpCurrentHeight=vpHeight,document.body.style.width=vpWidth+"px",document.body.style.height=vpHeight+"px")}}setCreatorViewPortPosition(tco){if(!tco)return;let viewportWidth,attributeViewportWidth=0,attrStr=tco.getElement()[0].getAttribute("data-tchmi-creator-viewport-width");attrStr&&(attributeViewportWidth=TcHmi.ValueConverter.toType(attrStr,"tchmi:framework#/definitions/PositiveNumber")),viewportWidth="number"==typeof attributeViewportWidth&&attributeViewportWidth>0?attributeViewportWidth:TcHmi.System.config.creatorSettings.viewport.defaultWidth;let viewportWidthActive=!1,widthValue=tco.getWidth();const widthUnit=tco.getWidthUnit(),widthMode=tco.getWidthMode();if("Parent"===widthMode?widthValue=null:"Content"===widthMode&&(widthValue=tco.__getContentWidth()),("%"===widthUnit||null==widthValue)&&(viewportWidthActive=!0),!1===viewportWidthActive&&widthValue){let widthMinValue=tco.getMinWidth(),widthMinUnit=tco.getMinWidthUnit(),widthMinPix=widthMinValue;null!=widthMinValue&&"%"===widthMinUnit&&(widthMinPix=widthMinValue*viewportWidth/100),null!=widthMinPix&&widthValue<widthMinPix&&(viewportWidthActive=!0)}if(!1===viewportWidthActive&&widthValue){let widthMaxValue=tco.getMaxWidth(),widthMaxUnit=tco.getMaxWidthUnit(),widthMaxPix=widthMaxValue;null!=widthMaxValue&&"%"===widthMaxUnit&&(widthMaxPix=widthMaxValue*viewportWidth/100),null!=widthMaxPix&&widthValue>widthMaxPix&&(viewportWidthActive=!0)}let viewportHeight;!1===viewportWidthActive&&widthValue&&(viewportWidth=parseInt(tco.getElement().css("left"),10)+widthValue);let attributeViewportHeight=0;attrStr=tco.getElement()[0].getAttribute("data-tchmi-creator-viewport-height"),attrStr&&(attributeViewportHeight=TcHmi.ValueConverter.toType(attrStr,"tchmi:framework#/definitions/PositiveNumber")),viewportHeight="number"==typeof attributeViewportHeight&&attributeViewportHeight>0?attributeViewportHeight:TcHmi.System.config.creatorSettings.viewport.defaultHeight;let viewportHeightActive=!1,heightValue=tco.getHeight();const heightUnit=tco.getHeightUnit(),heightMode=tco.getHeightMode();if("Parent"===heightMode?heightValue=null:"Content"===heightMode&&(heightValue=tco.__getContentHeight()),("%"===heightUnit||null===heightValue)&&(viewportHeightActive=!0),!1===viewportHeightActive&&heightValue){let heightMinValue=tco.getMinHeight(),heightMinUnit=tco.getMinHeightUnit(),heightMinPix=heightMinValue;null!=heightMinValue&&"%"===heightMinUnit&&(heightMinPix=heightMinValue*viewportHeight/100),null!=heightMinPix&&heightValue<heightMinPix&&(viewportHeightActive=!0)}if(!1===viewportHeightActive&&heightValue){let heightMaxValue=tco.getMaxHeight(),heightMaxUnit=tco.getMaxHeightUnit(),heightMaxPix=heightMaxValue;null!=heightMaxValue&&"%"===heightMaxUnit&&(heightMaxPix=heightMaxValue*viewportHeight/100),null!=heightMaxPix&&heightValue>heightMaxPix&&(viewportHeightActive=!0)}!1===viewportHeightActive&&heightValue&&(viewportHeight=parseInt(tco.getElement().css("top"),10)+heightValue),TcHmi.StyleProvider.setSimpleElementStyle(this.__viewPortSimulator,{width:viewportWidth+"px",height:viewportHeight+"px"}),TcHmi.StyleProvider.setSimpleElementStyle(this.__viewPortHighlightingSimulator,{width:viewportWidth*this.__creatorZoomFactor+"px",height:viewportHeight*this.__creatorZoomFactor+"px"})}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterControlHighlightManager=class{constructor(designerModeManager){this.__highlightContainerVisibility=!0,this.__asyncWorkData={animationFrameId:0,ctrlList:new Map},this.__selectorGripsId=["TopLeft","TopCenter","TopRight","CenterRight","BottomRight","BottomCenter","BottomLeft","CenterLeft"],this.__selectorGrips=["nwse","ns","nesw","ew","nwse","ns","nesw","ew"],this.__designerModeManager=designerModeManager,TcHmi.EventProvider.register("System.onControlsResized",this.__onControlsResized()),TcHmi.EventProvider.register("System.onControlsMoved",this.__onControlsMoved()),TcHmi.EventProvider.register("System.onControlVisibilityChanged",this.__onControlVisibilityChanged()),TcHmi.EventProvider.register("System.onControlGetRowCountChanged",this.__onGridRowOrColumnChanged()),TcHmi.EventProvider.register("System.onControlGetColumnCountChanged",this.__onGridRowOrColumnChanged()),TcHmi.EventProvider.register("System.onGridCellResized",this.__onGridCellResized()),TcHmi.EventProvider.register("System.onControlGridRowIndexChanged",this.__onGridRowOrColumnIndexChanged()),TcHmi.EventProvider.register("System.onControlGridColumnIndexChanged",this.__onGridRowOrColumnIndexChanged()),TcHmi.EventProvider.register("onThemeDataChanged",this.updateEngineeringStyles());let tempDiv=document.createElement("div");tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-controlposition tchmi-box"\n                                style="z-index:0;">\n                                <div data-tchmi-creator-target-control=""\n                                    class="tchmi-creator-controlname tchmi-box"\n                                    title=""><bdi></bdi></div>\n                        </div>';let controlPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-hierarchy-controlposition tchmi-box"\n                                style="z-index:0;">\n                        </div>';let hierarchyControlPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-originalposition tchmi-box"\n                                style="z-index:0;">\n\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-top"></div>\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-left"></div>\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-width"></div>\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-right"></div>\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-height"></div>\n                                <div class="tchmi-creator-distance-line tchmi-box tchmi-creator-distance-bottom"></div>\n\n                                <div class="tchmi-creator-snapline tchmi-box tchmi-creator-snapline-top"></div>\n                                <div class="tchmi-creator-snapline tchmi-box tchmi-creator-snapline-left"></div>\n                                <div class="tchmi-creator-snapline tchmi-box tchmi-creator-snapline-right"></div>\n                                <div class="tchmi-creator-snapline tchmi-box tchmi-creator-snapline-bottom"></div>\n\n                        </div>';let originalPosition=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-anchorcontainer tchmi-box"\n                                style="border-width: 1px;z-index:0;">\n\n                                <div data-tchmi-creator-anchor-name="TopLeft"      class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-top-left"></div>\n                                <div data-tchmi-creator-anchor-name="TopCenter"    class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-top-center"></div>\n                                <div data-tchmi-creator-anchor-name="TopRight"     class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-top-right"></div>\n                                <div data-tchmi-creator-anchor-name="CenterLeft"   class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-center-left"></div>\n                                <div data-tchmi-creator-anchor-name="CenterRight"  class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-center-right"></div>\n                                <div data-tchmi-creator-anchor-name="BottomLeft"   class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-bottom-left"></div>\n                                <div data-tchmi-creator-anchor-name="BottomCenter" class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-bottom-center"></div>\n                                <div data-tchmi-creator-anchor-name="BottomRight"  class="tchmi-creator-anchor-rect tchmi-box tchmi-creator-anchor-bottom-right"></div>\n                        </div>';let anchorContainer=tempDiv.firstElementChild;tempDiv.innerHTML='<div data-tchmi-creator-target-control=""\n                                class="tchmi-creator-hierarchy-anchorcontainer"\n                                style="z-index:0;">\n                        </div>';let hierarchyAnchorContainer=tempDiv.firstElementChild;this.__cloneSource={controlPosition:controlPosition,hierarchyControlPosition:hierarchyControlPosition,originalPosition:originalPosition,anchorContainer:anchorContainer,hierarchyAnchorContainer:hierarchyAnchorContainer}}handleControlRemoved(ctrlMeta){ctrlMeta.jOriginalPosition.remove(),ctrlMeta.jControlPosition.remove(),ctrlMeta.jHierarchyControlposition.remove(),ctrlMeta.jAnchorContainer.remove(),ctrlMeta.jHierarchyAnchorContainer.remove()}requestAsyncHighlighterUpdate(){0===this.__asyncWorkData.animationFrameId&&(this.__asyncWorkData.animationFrameId=window.requestAnimationFrame(()=>{var _a,_b;const ctrlList=new Set;this.__asyncWorkData.ctrlList.forEach((value,tco)=>{var _a;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta)return;ctrlList.add(tco);const ctrlParent=tco.getParent();ctrlParent&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl&&(ctrlList.has(ctrlParent)||ctrlList.add(ctrlParent)),value.rowColumnChanged&&this.createGridHighlighter(tco,ctrlMeta),value.resized&&ctrlMeta.isPartialRoot&&(null===(_a=this.__designerModeManager.rootControlManager)||void 0===_a||_a.setCreatorViewPortPosition(tco)),this.updateGripCursors(ctrlMeta)}),this.setContainerPositions(ctrlList),null===(_a=this.__designerModeManager.interactionManager)||void 0===_a||_a.clearControlSnapPositionCache(),null===(_b=this.__designerModeManager.interactionManager)||void 0===_b||_b.refreshControlSnapPositionCache(),this.__asyncWorkData.ctrlList.clear(),this.__asyncWorkData.animationFrameId=0}))}__onControlsResized(){return(e,ctrls)=>{if(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&!0!==this.__designerModeManager.controlResizeManager.getControlResizing())for(let ctrl of ctrls){this.requestAsyncHighlighterUpdateForControl(ctrl).resized=!0}}}__onControlsMoved(){return(e,ctrls)=>{if(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&!0!==this.__designerModeManager.controlMoveManager.getControlMoveActive())for(let ctrl of ctrls){this.requestAsyncHighlighterUpdateForControl(ctrl).moved=!0}}}requestAsyncHighlighterUpdateForControl(ctrl){this.requestAsyncHighlighterUpdate();let resizeMoveInfo=this.__asyncWorkData.ctrlList.get(ctrl);return resizeMoveInfo||(resizeMoveInfo={resized:!1,moved:!1,rowColumnChanged:!1},this.__asyncWorkData.ctrlList.set(ctrl,resizeMoveInfo)),resizeMoveInfo}__onControlVisibilityChanged(){return(e,tco)=>{const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta)return;"Collapsed"===tco.getVisibility()?ctrlMeta.controlCollapsed=!0:ctrlMeta.controlCollapsed=!1;let ctrlAsyncData=this.requestAsyncHighlighterUpdateForControl(tco);ctrlAsyncData.moved=!0,ctrlAsyncData.resized=!0}}__onGridRowOrColumnIndexChanged(){return(e,tco)=>{let tcoPar=tco.getParent();if(!tcoPar||"TcHmi.Controls.System.TcHmiGrid"!==tcoPar.getType())return;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null===ctrlMeta||null===ctrlMeta.parent)return;let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tco.getParent().__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tco.getParent().__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Fatal internal error: Could not find target grid cell for "+tcoPar.getId()+" to attach highlight container."),targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer)}}__onGridRowOrColumnChanged(){return(e,tco)=>{if(this.requestAsyncHighlighterUpdateForControl(tco).rowColumnChanged=!0,"function"==typeof tco.getChildren){const gridChildren=tco.getChildren();for(const gridChild of gridChildren){this.requestAsyncHighlighterUpdateForControl(gridChild).resized=!0}}}}__onGridCellResized(){return(e,tco)=>{if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return;if(!0===this.__designerModeManager.controlResizeManager.getControlResizing())return;this.requestAsyncHighlighterUpdateForControl(tco).resized=!0}}setHighlightContainerVisibility(valueNew){this.__highlightContainerVisibility=valueNew;const controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id];this.processHighlightType(ctrlMeta)}this.processDomVisibility()}setCreatorVisibilityAttribute(targetControl,bVisibility){let ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(targetControl);null!==ctrlMeta&&(ctrlMeta.domVisibility=bVisibility,this.processDomVisibility(ctrlMeta))}processDomVisibility(processCtrlMeta){if(!0!==TCHMI_DESIGNER)return;let controlsMetaData;controlsMetaData=processCtrlMeta?{singleCtrl:processCtrlMeta}:this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id],tco=TcHmi.Controls.get(ctrlMeta.id);tco?(tco.getElement()[0].classList.toggle("tchmi-creator-controlhidden",!1===ctrlMeta.domVisibility),!ctrlMeta.domVisibility||ctrlMeta.controlCollapsed?(ctrlMeta.jOriginalPosition[0].style.display="none",ctrlMeta.jControlPosition[0].style.display="none",ctrlMeta.jHierarchyControlposition[0].style.display="none",ctrlMeta.jAnchorContainer[0].style.display="none",ctrlMeta.jHierarchyAnchorContainer[0].style.display="none"):(ctrlMeta.jOriginalPosition[0].style.display="",ctrlMeta.jControlPosition[0].style.display="",ctrlMeta.jHierarchyControlposition[0].style.display="",ctrlMeta.jAnchorContainer[0].style.display="",ctrlMeta.jHierarchyAnchorContainer[0].style.display="")):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Failed to handle control "${ctrlMeta.id}": Not found in control cache.\n`)}}__handleOuterDimension(dimension,renderedDimension,dimensionName,controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return defineCount;const element=tco.getElement(),jDistanceline=ctrlMeta.jOriginalPosition.children(".tchmi-creator-distance-"+dimensionName),controlPixelSize=renderedDimension[dimensionName],normalizedControlPixelSize=controlPixelSize*creatorZoomFactor;"top"!==dimensionName&&normalizedControlPixelSize>=30||"top"===dimensionName&&normalizedControlPixelSize>=50?TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{width:normalizedControlPixelSize+"px",display:"","background-color":"","border-color":"",opacity:"","font-size":""}):TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{width:normalizedControlPixelSize+"px",display:"","background-color":"","border-color":"",opacity:"","font-size":"0px"}),normalizedControlPixelSize>=10?jDistanceline.removeClass("no-triangle"):jDistanceline.addClass("no-triangle");let dimensionActive=!0;if(null!=controlSizeValue){if("px"===controlSizeUnit)dimension[dimensionName]=normalizedControlPixelSize+controlSizeUnit,!0!==this.__designerModeManager.controlResizeManager.getControlResizing()&&!0!==this.__designerModeManager.controlMoveManager.getControlMoveActive()&&controlSizeValue?jDistanceline[0].textContent=controlSizeValue.toFixed(0)+controlSizeUnit:jDistanceline[0].textContent=controlPixelSize.toFixed(0)+controlSizeUnit;else if("%"===controlSizeUnit){let controlParentPixelSize;"top"===dimensionName||"bottom"===dimensionName?controlParentPixelSize=parseFloat(element.parent().css("height")):"left"!==dimensionName&&"right"!==dimensionName||(controlParentPixelSize=parseFloat(element.parent().css("width")));let realValue=controlPixelSize/controlParentPixelSize*100;dimension[dimensionName]=realValue+controlSizeUnit,!0!==this.__designerModeManager.controlResizeManager.getControlResizing()&&!0!==this.__designerModeManager.controlMoveManager.getControlMoveActive()&&controlSizeValue?jDistanceline[0].textContent=controlSizeValue.toFixed(1)+controlSizeUnit:jDistanceline[0].textContent=realValue.toFixed(1)+controlSizeUnit}3!==++defineCount||"right"!==dimensionName&&"bottom"!==dimensionName||(dimensionActive=!1,TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{width:"45px",display:"",opacity:"0.5"}),"%"!==controlSizeUnit&&normalizedControlPixelSize<=7&&(jDistanceline[0].textContent=controlSizeValue.toFixed(0)+controlSizeUnit))}else dimensionActive=!1,TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,"display","none");return ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-definedfrom"+dimensionName,dimensionActive),defineCount}__handleInnerDimension(dimension,renderedDimension,dimensionName,controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor){if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return defineCount;const element=tco.getElement(),jDistanceline=ctrlMeta.jOriginalPosition.children(".tchmi-creator-distance-"+dimensionName),controlPixelSize=renderedDimension[dimensionName];if(ctrlMeta.controlCollapsed)dimension[dimensionName]="0",TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{display:"none"}),defineCount++;else{if(TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{width:controlPixelSize*creatorZoomFactor+"px",display:"",opacity:""}),"px"===controlSizeUnit){let realValue=controlPixelSize*creatorZoomFactor;dimension[dimensionName]=realValue+controlSizeUnit,!0!==this.__designerModeManager.controlResizeManager.getControlResizing()&&!0!==this.__designerModeManager.controlMoveManager.getControlMoveActive()&&controlSizeValue?jDistanceline[0].textContent=controlSizeValue.toFixed(0)+controlSizeUnit:jDistanceline[0].textContent=controlPixelSize.toFixed(0)+controlSizeUnit,"Parent"!==elementSizeMode&&null!=controlSizeValue&&defineCount++}else if("%"===controlSizeUnit){let realValue=controlPixelSize/parseFloat(element.parent().css(dimensionName))*100;if(dimension[dimensionName]=realValue+controlSizeUnit,!0!==this.__designerModeManager.controlResizeManager.getControlResizing()&&!0!==this.__designerModeManager.controlMoveManager.getControlMoveActive()&&controlSizeValue)jDistanceline[0].textContent=controlSizeValue.toFixed(1)+controlSizeUnit;else{const activeAnchor=this.__designerModeManager.interactionManager.getAnchorName();ctrlMeta.isPartialRoot&&activeAnchor&&("height"===dimensionName&&(activeAnchor.includes("Top")||activeAnchor.includes("Bottom"))||"width"===dimensionName&&(activeAnchor.includes("Left")||activeAnchor.includes("Right")))?jDistanceline[0].textContent=(controlPixelSize*creatorZoomFactor).toFixed(0)+"px":jDistanceline[0].textContent=realValue.toFixed(1)+controlSizeUnit}"Parent"!==elementSizeMode&&null!=controlSizeValue&&defineCount++}"Parent"===elementSizeMode||"Content"===elementSizeMode?null!=controlSizeValue?TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{opacity:"0.5"}):TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{display:"none"}):"Value"===elementSizeMode&&(null!=controlSizeValue?TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{opacity:"1.0"}):TcHmi.StyleProvider.setSimpleElementStyle(jDistanceline,{display:"none"}))}return defineCount}setContainerPositions(ctrlList){if(!ctrlList||0===ctrlList.size)return;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return;const creatorZoomFactor=this.__designerModeManager.rootControlManager.getCreatorZoomFactor(),dimensionCacheControl=new Map,dimensionCacheGridCells=new Map;ctrlList.forEach(tco=>{var _a,_b;if(!tco.getIsAttached()||tco.getIsDestroyed())return;const element=tco.getElement();if(!element||0===element.length)return;const ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());if(null==ctrlMeta)return;if(!1===ctrlMeta.domVisibility)return;let renderedDimension={top:0,height:0,bottom:0,left:0,width:0,right:0,transform:"","transform-origin":"","border-width":"","border-style":""};if(!ctrlMeta.controlCollapsed){let currentStyle=TcHmi.StyleProvider.getComputedElementStyle(element,Object.keys(renderedDimension));renderedDimension.top=parseFloat(currentStyle.top),renderedDimension.height=parseFloat(currentStyle.height),renderedDimension.bottom=parseFloat(currentStyle.bottom),renderedDimension.left=parseFloat(currentStyle.left),renderedDimension.width=parseFloat(currentStyle.width),renderedDimension.right=parseFloat(currentStyle.right),renderedDimension.transform=currentStyle.transform,renderedDimension["transform-origin"]=currentStyle["transform-origin"],renderedDimension["border-width"]=currentStyle["border-width"],renderedDimension["border-style"]=currentStyle["border-style"]}if(ctrlMeta.controlCollapsed||!ctrlMeta.domVisibility?(ctrlMeta.jAnchorContainer[0].style.display="none",ctrlMeta.jControlPosition[0].style.display="none",ctrlMeta.jHierarchyAnchorContainer[0].style.display="none",ctrlMeta.jHierarchyControlposition[0].style.display="none",ctrlMeta.jOriginalPosition[0].style.display="none"):(ctrlMeta.jAnchorContainer[0].style.display="",ctrlMeta.jControlPosition[0].style.display="",ctrlMeta.jHierarchyAnchorContainer[0].style.display="",ctrlMeta.jHierarchyControlposition[0].style.display="",ctrlMeta.jOriginalPosition[0].style.display=""),dimensionCacheControl.set(tco,renderedDimension),!0===ctrlMeta.isGridControl&&"function"==typeof tco.getChildren){tco.getChildren().forEach(ctrl=>{ctrlList.has(ctrl)||ctrlList.add(ctrl)});const gridBCR=element[0].getBoundingClientRect();let allGridCells=ctrlMeta.jHierarchyControlposition.children(".tchmi-creator-hierarchy-gridcellposition");allGridCells=allGridCells.add(ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell"));for(let i=0;i<allGridCells.length;i++){const creatorCell=allGridCells[i],rowIndex=parseInt(null!==(_a=creatorCell.getAttribute("data-tchmi-creator-grid-rowindex"))&&void 0!==_a?_a:"0",10),rowElement=element.children().children(".TcHmi_Controls_System_TcHmiGrid-grid").children().eq(rowIndex),cellIndex=parseInt(null!==(_b=creatorCell.getAttribute("data-tchmi-creator-grid-cellindex"))&&void 0!==_b?_b:"0",10),cellElement=rowElement.children()[cellIndex];if(0===rowElement.length||!cellElement)return;const elmStyles=TcHmi.StyleProvider.getComputedElementStyle(element,["border-top-width","border-left-width"]),cellStyles=TcHmi.StyleProvider.getComputedElementStyle(cellElement,["border-top-width","border-left-width","padding-top","padding-left"]),gridTopBorderWidth=parseFloat(elmStyles["border-top-width"])*creatorZoomFactor,gridLeftBorderWidth=parseFloat(elmStyles["border-left-width"])*creatorZoomFactor,cellTopOffset=parseFloat(cellStyles["border-top-width"])*creatorZoomFactor+parseFloat(cellStyles["padding-top"])*creatorZoomFactor,cellLeftOffset=parseFloat(cellStyles["border-left-width"])*creatorZoomFactor+parseFloat(cellStyles["padding-left"])*creatorZoomFactor;let offsetHeight,offsetWidth,offsetTop,offsetLeft,creatorCellStyle;if(0===ctrlMeta.absoluteParentRotation&&0===ctrlMeta.relativeControlRotation){const cellBCR=cellElement.getBoundingClientRect();offsetHeight=cellBCR.height,offsetWidth=cellBCR.width,offsetTop=cellBCR.top-gridBCR.top-gridTopBorderWidth,offsetLeft=cellBCR.left-gridBCR.left-gridLeftBorderWidth}else offsetHeight=cellElement.offsetHeight*creatorZoomFactor,offsetWidth=cellElement.offsetWidth*creatorZoomFactor,offsetTop=cellElement.offsetTop*creatorZoomFactor,offsetLeft=cellElement.offsetLeft*creatorZoomFactor;creatorCellStyle=creatorCell.classList.contains("tchmi-creator-gridcell")?{height:offsetHeight+"px",width:offsetWidth+"px",top:gridTopBorderWidth+offsetTop+"px",left:gridLeftBorderWidth+offsetLeft+"px"}:{height:offsetHeight-2*cellTopOffset+"px",width:offsetWidth-2*cellLeftOffset+"px",top:cellTopOffset+offsetTop+"px",left:cellLeftOffset+offsetLeft+"px"},dimensionCacheGridCells.set(creatorCell,creatorCellStyle)}}}),dimensionCacheControl.forEach((renderedDimension,tco)=>{var _a;const dimension={top:"",height:"",bottom:"",left:"",width:"",right:""},ctrlMeta=this.__designerModeManager.metaDataManager.getControlMetaData(tco.getId());let defineCount=0,controlSizeValue=tco.getTop(),controlSizeUnit=tco.getTopUnit();defineCount=this.__handleOuterDimension(dimension,renderedDimension,"top",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getHeight(),controlSizeUnit=tco.getHeightUnit();let elementSizeMode=tco.getHeightMode();defineCount=this.__handleInnerDimension(dimension,renderedDimension,"height",controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getBottom(),controlSizeUnit=tco.getBottomUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"bottom",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount<2&&this.__handleOuterDimension(dimension,renderedDimension,"top",0,"px",defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount=0,controlSizeValue=tco.getLeft(),controlSizeUnit=tco.getLeftUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"left",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getWidth(),controlSizeUnit=tco.getWidthUnit(),elementSizeMode=tco.getWidthMode(),defineCount=this.__handleInnerDimension(dimension,renderedDimension,"width",controlSizeValue,controlSizeUnit,elementSizeMode,defineCount,tco,ctrlMeta,creatorZoomFactor),controlSizeValue=tco.getRight(),controlSizeUnit=tco.getRightUnit(),defineCount=this.__handleOuterDimension(dimension,renderedDimension,"right",controlSizeValue,controlSizeUnit,defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount<2&&this.__handleOuterDimension(dimension,renderedDimension,"left",0,"px",defineCount,tco,ctrlMeta,creatorZoomFactor),defineCount=0,TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jOriginalPosition,dimension);const orgTransform=renderedDimension.transform;if(1!==creatorZoomFactor&&orgTransform.startsWith("matrix")){let transformtype="",twoDimMatrixEnties=[],orgTransformArray=orgTransform.substring(orgTransform.lastIndexOf("(")+1,orgTransform.lastIndexOf(")")).split(",");6===orgTransformArray.length?(transformtype="matrix",twoDimMatrixEnties=[4,5]):16===orgTransformArray.length&&(transformtype="matrix3d",twoDimMatrixEnties=[12,13,14]);for(let it of twoDimMatrixEnties)orgTransformArray[it]=(parseInt(orgTransformArray[it],10)*creatorZoomFactor).toString();dimension.transform=transformtype+"("+orgTransformArray.join(",")+")"}else dimension.transform="none"!==orgTransform?orgTransform:"";if(""!==dimension.transform){const orgTransformOrigin=renderedDimension["transform-origin"];if(orgTransformOrigin){let orgTransformOriginArray=orgTransformOrigin.split(" ");for(let it=0,itl=orgTransformOriginArray.length;it<itl;it++)-1!==orgTransformOriginArray[it].indexOf("px")&&(orgTransformOriginArray[it]=parseInt(orgTransformOriginArray[it],10)*creatorZoomFactor+"px");dimension["transform-origin"]=orgTransformOriginArray.join(" ")}else dimension["transform-origin"]=""}else dimension["transform-origin"]="";TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyControlposition,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jAnchorContainer,dimension),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyAnchorContainer,dimension);let borderWidth=renderedDimension["border-width"];borderWidth||(borderWidth="0px");let borderStyle=renderedDimension["border-style"];borderStyle||(borderStyle="none");let borderWidthArray=borderWidth.split("px"),normalizedBorderWidth="";borderWidthArray.forEach((function(strvalue,index){let valueNumber=parseFloat(strvalue);isNaN(valueNumber)||(normalizedBorderWidth+=valueNumber*creatorZoomFactor+"px ")}));let borderClone={"border-width":normalizedBorderWidth,"border-style":borderStyle,"border-color":"transparent"};if(TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyControlposition,borderClone),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jHierarchyAnchorContainer,borderClone),tco.getParent()&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl&&0===ctrlMeta.jHierarchyControlposition.parent().length){let targetRowIndex=tco.getGridRowIndex();(!targetRowIndex||targetRowIndex>=tco.getParent().__rowOptions.length)&&(targetRowIndex=0);let targetColumnIndex=tco.getGridColumnIndex();(!targetColumnIndex||targetColumnIndex>=tco.getParent().__columnOptions.length)&&(targetColumnIndex=0);const targetCell=ctrlMeta.parent.jHierarchyControlposition.children("[data-tchmi-creator-grid-rowindex="+targetRowIndex+"][data-tchmi-creator-grid-cellindex="+targetColumnIndex+"]");0===targetCell.length&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Fatal internal error: Could not find target grid cell for "+(null===(_a=tco.getParent())||void 0===_a?void 0:_a.getId())+" to attach highlight container."),ctrlMeta.jHierarchyControlposition.parent().is(targetCell)||(targetCell.append(ctrlMeta.jOriginalPosition),targetCell.append(ctrlMeta.jControlPosition),targetCell.append(ctrlMeta.jHierarchyControlposition),targetCell.append(ctrlMeta.jAnchorContainer),targetCell.append(ctrlMeta.jHierarchyAnchorContainer))}}),dimensionCacheGridCells.forEach((creatorCellStyle,creatorCell)=>{TcHmi.StyleProvider.setSimpleElementStyle(creatorCell,creatorCellStyle)})}updateGripCursors(ctrlMeta){var _a,_b;let i,steps=Math.round(((null!==(_a=ctrlMeta.relativeControlRotation)&&void 0!==_a?_a:0)+(null!==(_b=ctrlMeta.absoluteParentRotation)&&void 0!==_b?_b:0))*(8/360));for(steps<0&&(steps+=8),i=0;i<8;i++){const index=(i+steps)%8;TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jAnchorContainer[0].querySelectorAll(`[data-tchmi-creator-anchor-name="${this.__selectorGripsId[i]}"]`),"cursor",this.__selectorGrips[index]+"-resize")}}processHighlightType(ctrlMeta){!0===ctrlMeta.isSelected?ctrlMeta.jControlPosition[0].classList.remove("tchmi-creator-active-highlight"):ctrlMeta.jControlPosition[0].classList.toggle("tchmi-creator-active-highlight",this.__highlightContainerVisibility),ctrlMeta.jControlPosition[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jAnchorContainer[0].classList.toggle("tchmi-creator-control-selected",ctrlMeta.isSelected),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-active-highlight",this.__highlightContainerVisibility)}updateEngineeringStyles(){return e=>{let linkElem=document.querySelector('link[href*="StyleEngineering.css"]');const systemColorToRgba=function(color){return"rgba("+color.r+","+color.g+","+color.b+","+color.a/255+")"};if(linkElem&&linkElem.sheet){const settings=this.__designerModeManager.getSettings();let cssRules=linkElem.sheet.cssRules[0];if(":root"!==cssRules.selectorText)throw new SyntaxError("StyleEngineering.css has invalid format: First selector has to be :root");let cssStyle=cssRules.style;if(!(cssStyle.getPropertyValue("--tchmi-designer-control-untransformed-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-unselected-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-selected-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-selected-secondary-color")&&cssStyle.getPropertyValue("--tchmi-designer-control-snap-color")))throw new SyntaxError("StyleEngineering.css has invalid format: CSS custom properties missing");settings.untransformedColor&&cssStyle.setProperty("--tchmi-designer-control-untransformed-color",systemColorToRgba(settings.untransformedColor)),settings.unSelectedHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-unselected-color",systemColorToRgba(settings.unSelectedHighlightColor)),settings.selectionHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-selected-color",systemColorToRgba(settings.selectionHighlightColor)),settings.selectedSecondaryColor&&cssStyle.setProperty("--tchmi-designer-control-selected-secondary-color",systemColorToRgba(settings.selectedSecondaryColor)),settings.snapHighlightColor&&cssStyle.setProperty("--tchmi-designer-control-snap-color",systemColorToRgba(settings.snapHighlightColor)),void 0!==settings.snapDistanceToControls&&cssStyle.setProperty("--tchmi-designer-control-remote-snap-distance",settings.snapDistanceToControls+"px"),settings.theme&&settings.theme.ChessboardLight&&cssStyle.setProperty("--tchmi-designer-vs-theme-chessboard-light",systemColorToRgba(settings.theme.ChessboardLight)),settings.theme&&settings.theme.ChessboardDark&&cssStyle.setProperty("--tchmi-designer-vs-theme-chessboard-dark",systemColorToRgba(settings.theme.ChessboardDark))}}}createControlPosition(relatedControl,zindex){let controlId=relatedControl.getId(),typeDisplayName=relatedControl.getType(),module=TcHmi.System.Data.Modules.controls.map.get(typeDisplayName);module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&(typeDisplayName=module.descriptionExpanded.displayName||"");let highlighterElement=this.__cloneSource.controlPosition.cloneNode(!0);highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString();let child=highlighterElement.firstElementChild;return child.title=controlId+": "+typeDisplayName,child.firstElementChild.textContent=controlId,child.setAttribute("data-tchmi-creator-target-control",controlId),$(highlighterElement)}createHierarchyControlPosition(relatedControl,zindex){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.hierarchyControlPosition.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),$(highlighterElement)}createOriginalPosition(relatedControl,zindex){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.originalPosition.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),$(highlighterElement)}createAnchorContainer(relatedControl,zindex,locked){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.anchorContainer.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),locked&&highlighterElement.classList.add("tchmi-creator-control-locked"),$(highlighterElement)}createHierarchyAnchorContainer(relatedControl,zindex,locked){let controlId=relatedControl.getId(),highlighterElement=this.__cloneSource.hierarchyAnchorContainer.cloneNode(!0);return highlighterElement.setAttribute("data-tchmi-creator-target-control",controlId),highlighterElement.style.zIndex=zindex.toString(),locked&&highlighterElement.classList.add("tchmi-creator-control-locked"),$(highlighterElement)}createGridHighlighter(gridControl,ctrlMeta){if(!ctrlMeta)return;if(!gridControl.__rowOptions)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Grid control "+gridControl.getId()+" has invalid Row Options."));if(!gridControl.__columnOptions)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeMasterHighlightManager] Grid control "+gridControl.getId()+" has invalid Column Options."));const oldGridcells=ctrlMeta.jHierarchyControlposition.children(".tchmi-creator-hierarchy-gridcellposition");oldGridcells.children().detach(),oldGridcells.remove(),ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell").remove();let zIndexControlposition=TcHmi.StyleProvider.getSimpleElementStyle(ctrlMeta.jControlPosition,"z-index"),hierarchyGridcellpositionCollection=$(),gridcellCollection=$(),tempDiv=document.createElement("div");for(let i=0;i<gridControl.__rowOptions.length;i++)for(let j=0;j<gridControl.__columnOptions.length;j++){tempDiv.innerHTML=`<div data-tchmi-creator-target-control="${gridControl.getId()}"\n                                                class="tchmi-creator-hierarchy-gridcellposition tchmi-box"\n                                                style="z-index:${zIndexControlposition["z-index"]}"\n                                                data-tchmi-creator-grid-rowindex="${i}" data-tchmi-creator-grid-cellindex="${j}">\n                                                </div>`;const hierarchyGridcell=$(tempDiv.firstElementChild);hierarchyGridcellpositionCollection=hierarchyGridcellpositionCollection.add(hierarchyGridcell),tempDiv.innerHTML=`<div data-tchmi-creator-target-control="${gridControl.getId()}"\n                                                class="tchmi-creator-gridcell tchmi-box"\n                                                style="z-index:${zIndexControlposition["z-index"]}"\n                                                data-tchmi-creator-grid-rowindex="${i}" data-tchmi-creator-grid-cellindex="${j}">\n                                                </div>`;const highlightGridcell=$(tempDiv.firstElementChild);this.__designerModeManager.hierarchyManager.registerContainerElement(highlightGridcell),gridcellCollection=gridcellCollection.add(highlightGridcell)}ctrlMeta.jHierarchyControlposition.append(hierarchyGridcellpositionCollection),ctrlMeta.jControlPosition.append(gridcellCollection)}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterRectSelectManager=class{constructor(designerModeManager){this.__rectSelecting=!1,this.__lockRectSelect=!1,this.__documentRectSelectMouseMoveNs="mousemove.DesignerModeManager.DocumentRectSelectMouseMove",this.__documentRectSelectMouseUpNs="mouseup.DesignerModeManager.DocumentRectSelectMouseUp",this.__documentRectSelectMouseDownNs="mousedown.DesignerModeManager.DocumentRectSelectMouseDown",this.__designerModeManager=designerModeManager,this.__selectionDragHighlighter=document.createElement("div"),this.__selectionDragHighlighter.classList.add("tchmi-creator-selection-drag-container"),TcHmi.System.SharedResources.jqDocument.on(this.__documentRectSelectMouseDownNs,this.__onDocumentRectSelectMouseDown())}getRectSelecting(){return this.__rectSelecting}lockRectSelect(){this.__lockRectSelect=!0}resetState(){this.__rectSelecting=!1,this.__lockRectSelect=!1,TcHmi.System.SharedResources.jqDocument.off(this.__documentRectSelectMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(this.__documentRectSelectMouseUpNs)}__onDocumentRectSelectMouseDown(){let __this=this;return function(event){var _a;1===event.which&&(null===(_a=__this.__designerModeManager.interactionManager)||void 0===_a||_a.handleInteractionStart(event,null),__this.__lockRectSelect=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__documentRectSelectMouseMoveNs,__this.__onDocumentRectSelectMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__documentRectSelectMouseUpNs,__this.__onDocumentRectSelectMouseUp()))}}__onDocumentRectSelectMouseMove(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(1!==event.which)return;if(!0===__this.__designerModeManager.controlMoveManager.getControlMoveActive())return;if(!0===__this.__designerModeManager.controlResizeManager.getControlResizing())return;if(!0===__this.__lockRectSelect)return;const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos();let deltaStartLeft=event.pageX-startMousePosition.left,deltaStartTop=event.pageY-startMousePosition.top;if(Math.abs(deltaStartLeft)<=5&&Math.abs(deltaStartTop)<=5)return;let w=0,l=0,h=0,t=0;__this.__designerModeManager.controlMoveManager.setMouseMoving(!0),deltaStartLeft>=0?(w=deltaStartLeft,l=startMousePosition.left):(w=-deltaStartLeft,l=startMousePosition.left+deltaStartLeft),deltaStartTop>=0?(h=deltaStartTop,t=startMousePosition.top):(h=-deltaStartTop,t=startMousePosition.top+deltaStartTop),TcHmi.StyleProvider.setSimpleElementStyle(__this.__selectionDragHighlighter,{width:w+"px",left:l+"px",height:h+"px",top:t+"px","pointer-events":"none"}),__this.__selectionDragHighlighter.parentElement||document.body.appendChild(__this.__selectionDragHighlighter),__this.__rectSelecting=!0,__this.__designerModeManager.controlMoveManager.lockControlMove(),__this.__designerModeManager.controlResizeManager.lockControlResize()}}__onDocumentRectSelectMouseUp(){let __this=this;return function(event){var _a,_b;if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;let resetExistingSelections=!1;1!==event.which?(3===event.which&&__this.__selectionDragHighlighter.remove(),__this.__designerModeManager.controlMoveManager.setMouseMoving(!1)):!0===__this.__lockRectSelect&&!1===__this.__rectSelecting||(resetExistingSelections=!__this.__processRectSelect(__this.__selectionDragHighlighter.getBoundingClientRect(),null!==(_a=event.ctrlKey)&&void 0!==_a&&_a,null!==(_b=event.altKey)&&void 0!==_b&&_b),__this.__selectionDragHighlighter.remove(),__this.__designerModeManager.controlMoveManager.setMouseMoving(!1)),resetExistingSelections&&__this.__designerModeManager.unselectEach(!1),__this.resetState()}}__processRectSelect(rectDragSelection,ctrlKeyPressed,altKeyPressed){let res=!1;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager))return res;let selectionHasChanged=!1,isFirstSelect=!0;const controlsToSelect=[],controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData){const ctrlMeta=controlsMetaData[id];if(!1===ctrlMeta.domVisibility||!0===ctrlMeta.controlCollapsed)continue;let bParentalOverride=!1,ctrlParentMeta=ctrlMeta.parent;for(;null!==ctrlParentMeta;){if(!1===ctrlParentMeta.domVisibility||!0===ctrlParentMeta.controlCollapsed){bParentalOverride=!0;break}ctrlParentMeta=ctrlParentMeta.parent}if(!0===bParentalOverride)continue;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)continue;if(!tco.getElement())continue;const controlRect=ctrlMeta.jControlPosition[0].getBoundingClientRect();if(!0===this.__hasClientRectIntersection(controlRect,rectDragSelection,altKeyPressed)){if(!0===ctrlMeta.isPartialRoot)continue;if(res=!0,!0===isFirstSelect&&!1===ctrlKeyPressed){isFirstSelect=!1,this.__designerModeManager.unselectEach(!0)&&(selectionHasChanged=!0)}let activeControl=this.__designerModeManager.controlMoveManager.getActiveControl();if(activeControl&&activeControl.id===ctrlMeta.id&&activeControl.isContainerControl&&ctrlKeyPressed)continue;let skip=!1,temp=activeControl;for(;temp;){if(temp.id===ctrlMeta.id){skip=!0;break}temp=temp.parent}if(skip)continue;controlsToSelect.push(ctrlMeta.id),selectionHasChanged=!0}}return controlsToSelect.forEach(ctrlName=>{this.__designerModeManager.select(ctrlName,!0)}),selectionHasChanged&&this.__designerModeManager.resyncSelectedControls(),res}__hasClientRectIntersection(rc1,rc2,rc1enclosedMode){let rc1l=rc1.left,rc1r=rc1.right,rc1t=rc1.top,rc1b=rc1.bottom,rc2l=rc2.left,rc2r=rc2.right,rc2t=rc2.top,rc2b=rc2.bottom;return!1===rc1enclosedMode?!(rc1l>rc2r||rc1r<rc2l||rc1t>rc2b||rc1b<rc2t):rc1l>rc2l&&rc1r<rc2r&&rc1t>rc2t&&rc1b<rc2b}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterControlMoveManager=class{constructor(designerModeManager){this.__copyMoveRectHighlightOffset={left:0,top:0},this.__highlightMouseDownNs="mousedown.DesignerModeManager.HighlightMouseDown",this.__highlightMouseUpNs="mouseup.DesignerModeManager.HighlightMouseUp",this.__highlightMouseMoveNs="mousemove.DesignerModeManager.HighlightMouseMove",this.__activeControl=null,this.__activeControlPrev=null,this.__mouseMoving=!1,this.__lockControlMove=!1,this.__controlMoveActive=!1,this.__designerModeManager=designerModeManager,this.__copyMoveRectHighlighter=document.createElement("canvas"),this.__copyMoveRectHighlighter.classList.add("tchmi-creator-copymove-container"),this.__onHighlightMouseUpLastProc=Date.now()}registerControl(ctrlMeta){ctrlMeta.jControlPosition.on(this.__highlightMouseDownNs,this.__onHighlightMouseDown())}getActiveControl(){return this.__activeControl}getActiveControlPrev(){return this.__activeControlPrev}getControlMoveActive(){return this.__controlMoveActive}lockControlMove(){this.__lockControlMove=!0}setMouseMoving(valueNew){this.__mouseMoving=valueNew}resetState(){this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&(this.__lockControlMove=!1,this.__controlMoveActive=!1,TcHmi.System.SharedResources.jqDocument.off(this.__highlightMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(this.__highlightMouseUpNs),TcHmi.StyleProvider.setSimpleElementStyle(TcHmi.System.SharedResources.jqBody,"cursor",""),this.__designerModeManager.hierarchyManager.removeHighlightDropTarget(),this.__copyMoveRectHighlighter.remove(),null!==this.__activeControl&&(this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote")))}__onHighlightMouseDown(){let __this=this;return function(event){if(1!==event.which)return;let targetControl=$(event.target).attr("data-tchmi-creator-target-control");if(!targetControl)return;const acNew=__this.__designerModeManager.metaDataManager.getControlMetaData(targetControl);null!==acNew&&(__this.__activeControlPrev=__this.__activeControl,__this.__activeControl=acNew,__this.__designerModeManager.interactionManager&&(__this.__designerModeManager.interactionManager.handleInteractionStart(event,acNew),__this.__designerModeManager.interactionManager.handleInteractionStartCopyMoveOffsetPosition(event),__this.__designerModeManager.interactionManager.setAnchorName(void 0)),__this.__lockControlMove=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__highlightMouseMoveNs,__this.__onHighlightMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__highlightMouseUpNs,__this.__onHighlightMouseUp()))}}__selectedControlsSameParent(preventPointerEvents){if(!this.__activeControl)return null;let selectedControls=[];null===this.__activeControl.parent&&(selectedControls=null);const selectedControlsMeta=this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];let newCssPointerEvent=!0===preventPointerEvents?"none":"";null!==preventPointerEvents&&(TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,"pointer-events",newCssPointerEvent),ctrlMeta.isGridControl&&TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition[0].children,"pointer-events",newCssPointerEvent)),null!==ctrlMeta.parent?ctrlMeta.parent.id===this.__activeControl.parent.id?selectedControls&&selectedControls.push(ctrlMeta.id):selectedControls=null:selectedControls=null}return selectedControls}__onHighlightMouseMove(){let __this=this;return function(event){var _a;if(null===__this.__activeControl)return;if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(!0===__this.__designerModeManager.controlResizeManager.getControlResizing())return;if(!0===__this.__activeControl.isPartialRoot)return;if(!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return;if(!0===__this.__lockControlMove)return;if(void 0===event.pageX||void 0===event.pageY)return;if(!0===event.ctrlKey&&!0===__this.__activeControl.isContainerControl){let temp=__this.__activeControl;for(;temp;)__this.__designerModeManager.unselect(temp.id,!0),temp=temp.parent;return}let selectedControlsMeta;if(1!==event.which)return void __this.resetState();let iterateMeta=__this.__activeControl;do{if(!0===iterateMeta.locked)return;iterateMeta=iterateMeta.parent}while(iterateMeta);if(!1===__this.__mouseMoving){if(!1===event.ctrlKey&&!1===__this.__activeControl.isSelected){selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){let ctrlMeta=selectedControlsMeta[id];null!==ctrlMeta&&null!==__this.__activeControl&&ctrlMeta.id!==__this.__activeControl.id&&__this.__designerModeManager.unselect(ctrlMeta.id,!0)}}__this.__designerModeManager.select(__this.__activeControl.id,!0)}const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),startMousePositionCopyMoveOffsetPosition=__this.__designerModeManager.interactionManager.getStartMousePosCopyMoveOffsetPosition();let deltaLeft=event.pageX-startMousePosition.left,deltaTop=event.pageY-startMousePosition.top,directionLock="none";if(0!==deltaLeft||0!==deltaTop){if(__this.__mouseMoving=!0,!0===event.shiftKey&&(Math.abs(deltaLeft)>Math.abs(deltaTop)?(deltaTop=0,directionLock="topBottom"):(deltaLeft=0,directionLock="leftRight")),__this.__controlMoveActive=!0,__this.__designerModeManager.rectSelectManager.lockRectSelect(),!1===event.ctrlKey){const creatorZoomFactor=__this.__designerModeManager.rootControlManager.getCreatorZoomFactor();let snappedDelta=__this.__designerModeManager.interactionManager.handleSnapping(__this.__activeControl,{left:deltaLeft/creatorZoomFactor,top:deltaTop/creatorZoomFactor},{left:event.pageX,top:event.pageY},!event.altKey,directionLock);__this.__copyMoveRectHighlighter.parentElement&&(TcHmi.StyleProvider.setSimpleElementStyle(TcHmi.System.SharedResources.jqBody,"cursor",""),__this.__copyMoveRectHighlighter.remove());const ctrlList=[];selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(!0===ctrlMeta.isPartialRoot)continue;__this.__processMove(ctrlMeta,snappedDelta);const tco=TcHmi.Controls.get(ctrlMeta.id);tco&&ctrlList.push(tco)}__this.__designerModeManager.hierarchyManager.removeHighlightDropTarget();if(null!==__this.__selectedControlsSameParent(!0)){const currentDropTarget=__this.__designerModeManager.hierarchyManager.getContainerFromPoint({left:event.pageX,top:event.pageY});if(currentDropTarget){let tco=TcHmi.Controls.get(__this.__activeControl.id);const parentId=__this.__activeControl.parent?__this.__activeControl.parent.id:"";tco&&(!0!==event.altKey&&parentId!==currentDropTarget.tco.getId()?(__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),__this.__activeControl.jControlPosition[0].classList.add("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.add("tchmi-creator-will-get-new-parent")):!0===event.altKey||!(null===(_a=__this.__activeControl.parent)||void 0===_a?void 0:_a.isGridControl)||currentDropTarget.columnIndex===tco.getGridColumnIndex()&&currentDropTarget.rowIndex===tco.getGridRowIndex()?(__this.__activeControl.jControlPosition[0].classList.remove("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-will-get-new-parent")):(__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),__this.__activeControl.jControlPosition[0].classList.add("tchmi-creator-will-get-new-parent"),__this.__activeControl.jOriginalPosition[0].classList.add("tchmi-creator-will-get-new-parent")))}}__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__selectedControlsSameParent(!1)}else if(Math.abs(deltaLeft)>=5&&Math.abs(deltaTop)>=5)if(__this.__copyMoveRectHighlighter.parentElement){let startMouseOffsetTop=startMousePosition.top-startMousePositionCopyMoveOffsetPosition.top,startMouseOffsetLeft=startMousePosition.left-startMousePositionCopyMoveOffsetPosition.left;__this.__copyMoveRectHighlighter.style.top=__this.__copyMoveRectHighlightOffset.top+deltaTop+window.scrollY+startMouseOffsetTop+"px",__this.__copyMoveRectHighlighter.style.left=__this.__copyMoveRectHighlightOffset.left+deltaLeft+window.scrollX+startMouseOffsetLeft+"px",__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target)}else{__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote");let combinedBounding={top:Number.POSITIVE_INFINITY,left:Number.POSITIVE_INFINITY,rightside:Number.NEGATIVE_INFINITY,bottomside:Number.NEGATIVE_INFINITY},validSelection=!0;null===__this.__activeControl.parent&&(validSelection=!1);let controlOutlineList=[];selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();const ctrlList=[];for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];if(__this.__processMove(ctrlMeta,{left:0,top:0}),TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,"pointer-events","none"),!1===validSelection)continue;if(null===ctrlMeta.parent){validSelection=!1;continue}if(ctrlMeta.parent.id!==__this.__activeControl.parent.id){validSelection=!1;continue}let ctrlBB=ctrlMeta.jControlPosition[0].getBoundingClientRect();combinedBounding.top>ctrlBB.top&&(combinedBounding.top=ctrlBB.top),combinedBounding.left>ctrlBB.left&&(combinedBounding.left=ctrlBB.left),combinedBounding.bottomside<ctrlBB.top+ctrlBB.height&&(combinedBounding.bottomside=ctrlBB.top+ctrlBB.height),combinedBounding.rightside<ctrlBB.left+ctrlBB.width&&(combinedBounding.rightside=ctrlBB.left+ctrlBB.width),controlOutlineList.push({top:ctrlBB.top,left:ctrlBB.left,height:ctrlBB.height,width:ctrlBB.width});const tco=TcHmi.Controls.get(ctrlMeta.id);tco&&ctrlList.push(tco)}if(__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__designerModeManager.interactionManager.handleInteractionStartCopyMoveOffsetPosition(event),__this.__designerModeManager.hierarchyManager.addHighlightDropTarget({left:event.pageX,top:event.pageY},event.target),!1===validSelection)TcHmi.StyleProvider.setSimpleElementStyle(TcHmi.System.SharedResources.jqBody,"cursor","no-drop");else{TcHmi.StyleProvider.setSimpleElementStyle(TcHmi.System.SharedResources.jqBody,"cursor","copy"),__this.__copyMoveRectHighlightOffset.top=combinedBounding.top,__this.__copyMoveRectHighlightOffset.left=combinedBounding.left;let pageBoundingTop=combinedBounding.top+deltaTop+window.scrollY,pageBoundingLeft=combinedBounding.left+deltaLeft+window.scrollX,boundingHeight=combinedBounding.bottomside-combinedBounding.top,boundingWidth=combinedBounding.rightside-combinedBounding.left;__this.__copyMoveRectHighlighter.width=boundingWidth,__this.__copyMoveRectHighlighter.height=boundingHeight,__this.__copyMoveRectHighlighter.style.cssText="top:"+pageBoundingTop+"px;left:"+pageBoundingLeft+"px;height:"+boundingHeight+"px;width:"+boundingWidth+"px;";const ctx=__this.__copyMoveRectHighlighter.getContext("2d");if(ctx){ctx.strokeStyle="gray";for(let ctrlOutline of controlOutlineList)void 0!==ctrlOutline.left&&void 0!==ctrlOutline.top&&void 0!==ctrlOutline.width&&void 0!==ctrlOutline.height&&ctx.strokeRect(ctrlOutline.left+window.scrollX+deltaLeft-pageBoundingLeft,ctrlOutline.top+window.scrollY+deltaTop-pageBoundingTop,ctrlOutline.width,ctrlOutline.height);document.body.appendChild(__this.__copyMoveRectHighlighter)}}for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];TcHmi.StyleProvider.setSimpleElementStyle(ctrlMeta.jControlPosition,"pointer-events","")}}}else __this.__designerModeManager.rectSelectManager.lockRectSelect()}}__processMove(ctrlMeta,delta){var _a,_b,_c,_d;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return;let deltaLeft=delta.left,deltaTop=delta.top,iterateMeta=ctrlMeta,breakLoop=!1;do{if(!0===iterateMeta.locked){breakLoop=!0;break}iterateMeta=iterateMeta.parent}while(iterateMeta);if(!0===breakLoop)return;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(`Failed to move control "${ctrlMeta.id}": Not found in control cache.\n`));let parental_lock=!1,jParentControls=tco.getElement().parents("[data-tchmi-type]");const selectedControlIdsWithChildren=this.__designerModeManager.metaDataManager.getSelectedControlIdsWithChildren();for(let k=0,kk=jParentControls.length;k<kk;k++)if(-1!==selectedControlIdsWithChildren.indexOf(jParentControls[k].id)){parental_lock=!0;break}if(!0===parental_lock)return;let potentialNewSize,parentDimension=null,newStyle={};null!==ctrlMeta.controlAttributeDimension.topValue&&("%"!==ctrlMeta.controlAttributeDimension.topUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.topValue+Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.top=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=null!==(_a=tco.getElement().parent().outerHeight())&&void 0!==_a?_a:1),potentialNewSize=ctrlMeta.controlAttributeDimension.topValue+100*(+Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.top=potentialNewSize+"%")),null!==ctrlMeta.controlAttributeDimension.bottomValue&&("%"!==ctrlMeta.controlAttributeDimension.bottomUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.bottomValue-Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.bottom=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=null!==(_b=tco.getElement().parent().outerHeight())&&void 0!==_b?_b:1),potentialNewSize=ctrlMeta.controlAttributeDimension.bottomValue+100*(-Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.bottom=potentialNewSize+"%")),null===ctrlMeta.controlAttributeDimension.topValue&&null===ctrlMeta.controlAttributeDimension.bottomValue&&(newStyle.top=Math.round(Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)+"px"),parentDimension=null,null!==ctrlMeta.controlAttributeDimension.leftValue&&("%"!==ctrlMeta.controlAttributeDimension.leftUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.leftValue+Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.left=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=null!==(_c=tco.getElement().parent().outerWidth())&&void 0!==_c?_c:1),potentialNewSize=ctrlMeta.controlAttributeDimension.leftValue+100*(+Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.left=potentialNewSize+"%")),null!==ctrlMeta.controlAttributeDimension.rightValue&&("%"!==ctrlMeta.controlAttributeDimension.rightUnit?(potentialNewSize=ctrlMeta.controlAttributeDimension.rightValue-Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop,newStyle.right=Math.round(potentialNewSize)+"px"):(null===parentDimension&&(parentDimension=null!==(_d=tco.getElement().parent().outerWidth())&&void 0!==_d?_d:1),potentialNewSize=ctrlMeta.controlAttributeDimension.rightValue+100*(-Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft-Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)/parentDimension,newStyle.right=potentialNewSize+"%")),null===ctrlMeta.controlAttributeDimension.leftValue&&null===ctrlMeta.controlAttributeDimension.rightValue&&(newStyle.left=Math.round(Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaLeft+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*deltaTop)+"px"),TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),newStyle),this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta);const tcoParent=tco.getParent();if(tcoParent&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl){const setWithParent=new Set;setWithParent.add(tcoParent),this.__designerModeManager.highlightManager.setContainerPositions(setWithParent)}}__onHighlightMouseUp(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;const ac=__this.__activeControl,acPrev=__this.__activeControlPrev;if(!ac||!ac.controlAttributeDimension||void 0===ac.absoluteParentRotation||void 0===ac.relativeControlRotation)return;let selectedControlsMeta={};if(1!==event.which){if(3===event.which&&!0===__this.__controlMoveActive){selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData();for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];!0!==ctrlMeta.isPartialRoot&&__this.__processMove(ctrlMeta,{left:0,top:0})}}return void __this.resetState()}if(!0===__this.__lockControlMove&&!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return void __this.resetState();if(null===__this.__activeControl)return __this.__mouseMoving=!1,void __this.resetState();!1===__this.__mouseMoving&&(!1===event.ctrlKey&&!1===ac.isSelected&&__this.__designerModeManager.unselectEach(!0),__this.__designerModeManager.select(ac.id,!0),__this.__designerModeManager.rectSelectManager.lockRectSelect());const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),deltaLeft=event.pageX-startMousePosition.left,deltaTop=event.pageY-startMousePosition.top;let interactionState=0;null!=acPrev&&ac.id===acPrev.id&&Math.abs(deltaLeft)<5&&Math.abs(deltaTop)<5&&Date.now()-__this.__onHighlightMouseUpLastProc<=500&&(interactionState=3),__this.__onHighlightMouseUpLastProc=Date.now();let activeTco=TcHmi.Controls.get(__this.__activeControl.id);if(3===interactionState&&event.ctrlKey&&activeTco){let module=TcHmi.System.Data.Modules.controls.map.get(activeTco.getType());module&&module.error===TcHmi.Errors.NONE&&module.descriptionExpanded&&!module.descriptionExpanded.defaultDesignerEvent&&(interactionState=0)}if(3===interactionState)activeTco&&new Engineering.SyncCmdToCreatorControlDoubleClick({name:"ControlDoubleClick",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,targetControl:{id:ac.id,type:activeTco.getType()},replyTo:null}).send();else{let command;!0===event.ctrlKey&&!1===__this.__mouseMoving&&!0===ac.isSelectedPrev&&ac.isSelected&&__this.__designerModeManager.unselect(ac.id,!0),!0===event.ctrlKey&&(Math.abs(deltaLeft)>5||Math.abs(deltaTop)>5)?interactionState=2:!0!==event.altKey&&(Math.abs(deltaLeft)>5||Math.abs(deltaTop)>5)&&(interactionState=1),null===ac.parent&&(interactionState=0);let dropConfig,controls=null;if(0!==interactionState&&(controls=__this.__selectedControlsSameParent(!0),dropConfig=__this.__designerModeManager.hierarchyManager.getContainerFromPoint({left:event.pageX,top:event.pageY}),__this.__selectedControlsSameParent(!1),null===controls&&(interactionState=0)),controls&&dropConfig){if(2===interactionState?command={name:"CopyMoveControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,deltaPosition:{left:null,top:null},controls:controls,targetParentControl:dropConfig.tco.getId(),replyTo:null}:1===interactionState&&(command={name:"HierarchyMoveControls",frameworkType:TCHMI_DESIGNER?"Designer":"LiveView",targetPartial:TCHMI_TARGET_PARTIAL,deltaPosition:{left:null,top:null},controls:controls,targetParentControl:dropConfig.tco.getId(),replyTo:null}),0!==interactionState&&activeTco){null===dropConfig.rowIndex&&(dropConfig.rowIndex=0),null===dropConfig.columnIndex&&(dropConfig.columnIndex=0);let oldRowIndex=activeTco.getGridRowIndex(),oldColumnIndex=activeTco.getGridColumnIndex();1===interactionState&&dropConfig.rowIndex===oldRowIndex&&dropConfig.columnIndex===oldColumnIndex&&dropConfig.tco===activeTco.getParent()?interactionState=0:command&&(command.attributes=[{name:"data-tchmi-grid-row-index",value:dropConfig.rowIndex},{name:"data-tchmi-grid-column-index",value:dropConfig.columnIndex}])}if(0!==interactionState&&null!==ac.parent&&null!==ac.controlAttributeDimension.topValue&&"px"===ac.controlAttributeDimension.topUnit&&null!==ac.controlAttributeDimension.heightValue&&"px"===ac.controlAttributeDimension.heightUnit&&"Value"===ac.controlAttributeDimension.heightMode&&0===ac.absoluteParentRotation&&dropConfig.jHighlighter&&command){let acBCR=ac.jOriginalPosition.parent()[0].getBoundingClientRect(),targetBCR=dropConfig.jHighlighter[0].getBoundingClientRect();command.deltaPosition.top=Math.round(deltaTop+(acBCR.top-targetBCR.top))}if(0!==interactionState&&null!==ac.parent&&null!==ac.controlAttributeDimension.leftValue&&"px"===ac.controlAttributeDimension.leftUnit&&null!==ac.controlAttributeDimension.widthValue&&"px"===ac.controlAttributeDimension.widthUnit&&"Value"===ac.controlAttributeDimension.widthMode&&dropConfig.jHighlighter&&command&&0===ac.absoluteParentRotation){let acBCR=ac.jOriginalPosition.parent()[0].getBoundingClientRect(),targetBCR=dropConfig.jHighlighter[0].getBoundingClientRect();command.deltaPosition.left=Math.round(deltaLeft+(acBCR.left-targetBCR.left))}}if(2===interactionState&&command&&"CopyMoveControls"===command.name)new Engineering.SyncCmdToCreatorCopyMoveControls(command).send(),__this.__designerModeManager.metaDataManager.resetChangedControlsMetaData();else if(1===interactionState&&command&&"HierarchyMoveControls"===command.name)new Engineering.SyncCmdToCreatorHierarchyMoveControls(command).send(),__this.__designerModeManager.metaDataManager.resetChangedControlsMetaData();else if(0===interactionState&&activeTco){const ctrlList=[],hierarchy=TcHmi.System.resolveControlHierarchy(activeTco,null),hierarchyRecursion=function(h){for(let i=0,ii=h.children_hierarchy.length;i<ii;i++){let childHierarchy=h.children_hierarchy[i];ctrlList.push(childHierarchy.ctrl),hierarchyRecursion(childHierarchy)}};hierarchyRecursion(hierarchy),__this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList)),__this.__controlMoveActive=!1,__this.__designerModeManager.syncManager.updatePcElementAndSync("System.onControlPositionParameterChanged"),__this.__designerModeManager.resyncSelectedControls(),__this.__designerModeManager.resyncControls()}}__this.__mouseMoving=!1,__this.resetState()}}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterControlResizeManager=class{constructor(designerModeManager){this.__anchorMouseMoveNs="mousemove.DesignerModeManager.AnchorMouseMove",this.__anchorMouseUpNs="mouseup.DesignerModeManager.AnchorMouseUp",this.__anchorMouseDownNs="mousedown.DesignerModeManager.AnchorMouseDown",this.__lockControlResize=!1,this.__controlResizing=!1,this.__activeControl=null,this.__designerModeManager=designerModeManager}registerControl(ctrlMeta){ctrlMeta.jAnchorContainer.children(".tchmi-creator-anchor-rect").on(this.__anchorMouseDownNs,this.__onAnchorMouseDown())}getControlResizing(){return this.__controlResizing}lockControlResize(){this.__lockControlResize=!0}__onAnchorMouseDown(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(1!==event.which)return;let targetControl=$(event.target).parent().attr("data-tchmi-creator-target-control");if(!targetControl)return;if(__this.__activeControl=__this.__designerModeManager.metaDataManager.getControlMetaData(targetControl),null===__this.__activeControl)return;const anchor=$(event.target).attr("data-tchmi-creator-anchor-name");__this.__designerModeManager.interactionManager.setAnchorName(anchor),anchor&&(__this.__designerModeManager.interactionManager.handleInteractionStart(event,__this.__activeControl),__this.__lockControlResize=!1,TcHmi.System.SharedResources.jqDocument.on(__this.__anchorMouseMoveNs,__this.__onAnchorMouseMove()),TcHmi.System.SharedResources.jqDocument.on(__this.__anchorMouseUpNs,__this.__onAnchorMouseUp()))}}__onAnchorMouseMove(){let __this=this;return function(event){if(!(__this.__designerModeManager.rectSelectManager&&__this.__designerModeManager.interactionManager&&__this.__designerModeManager.rootControlManager&&__this.__designerModeManager.hierarchyManager&&__this.__designerModeManager.highlightManager&&__this.__designerModeManager.syncManager&&__this.__designerModeManager.controlMoveManager&&__this.__designerModeManager.controlResizeManager))return;if(void 0===event.pageX||void 0===event.pageY)return;if(null===__this.__activeControl)return;if(!0===__this.__designerModeManager.rectSelectManager.getRectSelecting())return;if(!0===__this.__lockControlResize)return;const activeAnchor=__this.__designerModeManager.interactionManager.getAnchorName();if(!activeAnchor)return;if(1!==event.which)return TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseUpNs),__this.__controlResizing=!1,void __this.__designerModeManager.rectSelectManager.resetState();let iterateMeta=__this.__activeControl;do{if(!0===iterateMeta.locked)return;iterateMeta=iterateMeta.parent}while(iterateMeta);__this.__controlResizing=!0,__this.__designerModeManager.rectSelectManager.lockRectSelect();const startMousePosition=__this.__designerModeManager.interactionManager.getStartMousePos(),positionInsideControl=__this.__designerModeManager.interactionManager.getPositionInsideControl(),deltaLeft=event.pageX-startMousePosition.left;let deltaTop=event.pageY-startMousePosition.top,snapControls=!event.altKey;!0===event.shiftKey&&0!==positionInsideControl.width&&("TopLeft"===activeAnchor||"BottomRight"===activeAnchor?(deltaTop=deltaLeft*(positionInsideControl.height/positionInsideControl.width),snapControls=!1):"TopRight"!==activeAnchor&&"BottomLeft"!==activeAnchor||(deltaTop=-deltaLeft*(positionInsideControl.height/positionInsideControl.width),snapControls=!1));const creatorZoomFactor=__this.__designerModeManager.rootControlManager.getCreatorZoomFactor(),selectedControlsMeta=__this.__designerModeManager.metaDataManager.getSelectedControlsMetaData(),snappedDelta=__this.__designerModeManager.interactionManager.handleSnapping(__this.__activeControl,{left:deltaLeft/creatorZoomFactor,top:deltaTop/creatorZoomFactor},{left:event.pageX,top:event.pageY},snapControls,"none");for(let id in selectedControlsMeta){const ctrlMeta=selectedControlsMeta[id];__this.__processResize(ctrlMeta,snappedDelta,activeAnchor),ctrlMeta.isPartialRoot&&__this.__designerModeManager.rootControlManager.setCreatorViewPortPosition(TcHmi.Controls.get(ctrlMeta.id))}}}__processResize(ctrlMeta,delta,anchor){var _a;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return;let iterateMeta=ctrlMeta,breakLoop=!1;do{if(!0===iterateMeta.locked){breakLoop=!0;break}iterateMeta=iterateMeta.parent}while(iterateMeta);if(!0===breakLoop)return;const tco=TcHmi.Controls.get(ctrlMeta.id);if(!tco)return;let transDeltaTop=Math.sin(-ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.left+Math.cos(-ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.top,transDeltaLeft=Math.cos(ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.left+Math.sin(ctrlMeta.absoluteParentRotation*Math.PI/180)*delta.top;const ctrlRect=this.__getResizedRect(ctrlMeta,anchor,transDeltaLeft,transDeltaTop);let newStyle={};null!==ctrlRect.heightValue&&"Parent"!==ctrlRect.heightMode&&(newStyle.height=ctrlRect.heightValue+ctrlRect.heightUnit),null!==ctrlRect.widthValue&&"Parent"!==ctrlRect.widthMode&&(newStyle.width=ctrlRect.widthValue+ctrlRect.widthUnit),null!==ctrlRect.leftValue&&(newStyle.left=ctrlRect.leftValue+ctrlRect.leftUnit),null!==ctrlRect.topValue&&(newStyle.top=ctrlRect.topValue+ctrlRect.topUnit),null!==ctrlRect.rightValue&&(newStyle.right=ctrlRect.rightValue+ctrlRect.rightUnit),null!==ctrlRect.bottomValue&&(newStyle.bottom=ctrlRect.bottomValue+ctrlRect.bottomUnit),null===ctrlRect.leftValue&&null===ctrlRect.rightValue&&(newStyle.left="0"),null===ctrlRect.topValue&&null===ctrlRect.bottomValue&&(newStyle.top="0"),TcHmi.StyleProvider.setSimpleElementStyle(tco.getElement(),newStyle),this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta);const tcoParent=tco.getParent();if(tcoParent&&ctrlMeta.parent&&!0===ctrlMeta.parent.isGridControl){const setWithParent=new Set;setWithParent.add(tcoParent),this.__designerModeManager.highlightManager.setContainerPositions(setWithParent)}const ctrlList=[];ctrlList.push(tco);const activeControl=TcHmi.Controls.get(null===(_a=this.__activeControl)||void 0===_a?void 0:_a.id);if(null!==this.__activeControl&&void 0!==activeControl){const hierarchyRecursion=function(h){for(let j=0,jj=h.children_hierarchy.length;j<jj;j++){const childHierarchy=h.children_hierarchy[j];ctrlList.push(childHierarchy.ctrl),hierarchyRecursion(childHierarchy)}};if(activeControl){const hierarchy=TcHmi.System.resolveControlHierarchy(activeControl,null);hierarchyRecursion(hierarchy),this.__designerModeManager.highlightManager.setContainerPositions(new Set(ctrlList))}}this.__designerModeManager.metaDataManager.addChangedControlsMetaData(ctrlMeta)}__getResizedRectRotationOffset(startWidth,startHeight,deltaWidth,deltaHeight,radians,sin,cos){if(0===radians)return{left:0,top:0};null==sin&&(sin=Math.sin(radians)),null==cos&&(cos=Math.cos(radians));const startWidthNum=null!=startWidth?startWidth:0,startHeightNum=null!=startHeight?startHeight:0;let xOrig=-startWidthNum/2,yOrig=startHeightNum/2,xRot=-(startWidthNum+deltaWidth)/2,yRot=(startHeightNum+deltaHeight)/2;return{left:yRot*sin+xRot*cos-xRot-(yOrig*sin+xOrig*cos-xOrig),top:yRot*cos-xRot*sin-yRot-(yOrig*cos-xOrig*sin-yOrig)}}__getResizedRect(ctrlMeta,anchorType,deltaLeft,deltaTop){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x,_y,_z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31;if(!(this.__designerModeManager.rectSelectManager&&this.__designerModeManager.interactionManager&&this.__designerModeManager.rootControlManager&&this.__designerModeManager.hierarchyManager&&this.__designerModeManager.highlightManager&&this.__designerModeManager.syncManager&&this.__designerModeManager.controlMoveManager&&this.__designerModeManager.controlResizeManager&&ctrlMeta.controlAttributeDimension&&ctrlMeta.controlCssPixelDimension&&void 0!==ctrlMeta.absoluteParentRotation&&void 0!==ctrlMeta.relativeControlRotation))return ctrlMeta.controlAttributeDimension;const angle=ctrlMeta.relativeControlRotation;let parentPixelHeight,parentPixelWidth,positionInsideControl;if(ctrlMeta.isPartialRoot){const viewPortContainer=this.__designerModeManager.rootControlManager.getViewPortSimulator();parentPixelHeight=null!==(_a=viewPortContainer.outerHeight())&&void 0!==_a?_a:1,parentPixelWidth=null!==(_b=viewPortContainer.outerWidth())&&void 0!==_b?_b:1,positionInsideControl=this.__designerModeManager.interactionManager.getPositionInsideControl()}else parentPixelHeight=null!==(_c=ctrlMeta.jControlPosition.parent().outerHeight())&&void 0!==_c?_c:1,parentPixelWidth=null!==(_d=ctrlMeta.jControlPosition.parent().outerWidth())&&void 0!==_d?_d:1,positionInsideControl={top:0,left:0,width:0,right:0,height:0,bottom:0};let resizedRect=tchmi_clone_object(ctrlMeta.controlAttributeDimension);const radians=angle*Math.PI/180,sinAlpha=Math.sin(radians),cosAlpha=Math.cos(radians);let offset,deltaHeight=-sinAlpha*deltaLeft+cosAlpha*deltaTop,deltaWidth=cosAlpha*deltaLeft+sinAlpha*deltaTop;switch(anchorType){case"TopLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-(offset.left-deltaWidth):(dummyLeft+=100*-(offset.left-deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=null!==(_e=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_e?_e:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-(-offset.top-deltaHeight):(dummyTop+=100*-(-offset.top-deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=null!==(_f=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_f?_f:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_g=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_g?_g:0)-deltaWidth:resizedRect.widthValue=(null!==(_h=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_h?_h:0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_j=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_j?_j:0)-deltaHeight:resizedRect.heightValue=(null!==(_k=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_k?_k:0)/parentPixelHeight*100-100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-(offset.left-deltaWidth):resizedRect.leftValue+=100*-(offset.left-deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-(-offset.top-deltaHeight):resizedRect.topValue+=100*-(-offset.top-deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"TopCenter":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-offset.top+cosAlpha*deltaHeight:(dummyTop+=100*(-offset.top+cosAlpha*deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=null!==(_l=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_l?_l:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_m=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_m?_m:0)-deltaHeight:resizedRect.heightValue=(null!==(_o=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_o?_o:0)/parentPixelHeight*100-100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-(-offset.left+sinAlpha*deltaHeight):resizedRect.leftValue+=100*-(-offset.left+sinAlpha*deltaHeight)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-offset.top+cosAlpha*deltaHeight:resizedRect.topValue+=100*(-offset.top+cosAlpha*deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"TopRight":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(null!==(_p=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_p?_p:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight>=translatedMaxHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMaxHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.maxHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.heightValue-resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue-deltaHeight<=translatedMinHeightValue&&(deltaHeight=resizedRect.heightValue-translatedMinHeightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue-deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=translatedHeightValue-resizedRect.minHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue-deltaHeight<=0&&(deltaHeight=resizedRect.heightValue):100*-deltaHeight/parentPixelHeight<=0&&(deltaHeight=resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=-(-offset.top-deltaHeight):(dummyTop+=100*-(-offset.top-deltaHeight)/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-offset.top:(dummyBottom+=100*-offset.top/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=null!==(_q=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_q?_q:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_r=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_r?_r:0)+deltaWidth:resizedRect.widthValue=(null!==(_s=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_s?_s:0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=-deltaHeight:resizedRect.heightValue+=100*-deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_t=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_t?_t:0)+deltaHeight:resizedRect.heightValue=(null!==(_u=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_u?_u:0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=-(-offset.top-deltaHeight):resizedRect.topValue+=100*-(-offset.top-deltaHeight)/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"CenterLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=offset.left+cosAlpha*deltaWidth:(dummyLeft+=100*(offset.left+cosAlpha*deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=null!==(_v=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_v?_v:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_w=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_w?_w:0)-deltaWidth:resizedRect.widthValue=(null!==(_x=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_x?_x:0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=offset.left+cosAlpha*deltaWidth:resizedRect.leftValue+=100*(offset.left+cosAlpha*deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"CenterRight":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.widthValue&&"%"===resizedRect.widthUnit&&(resizedRect.widthUnit="px",resizedRect.widthValue=resizedRect.widthValue/100*positionInsideControl.width),null!==resizedRect.rightValue&&"%"===resizedRect.rightUnit&&(resizedRect.rightUnit="px",resizedRect.rightValue=resizedRect.rightValue/100*parentPixelWidth)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha),null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(null!==(_y=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_y?_y:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,0,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_z=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_z?_z:0)+deltaWidth:resizedRect.widthValue=(null!==(_0=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_0?_0:0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-offset.top:resizedRect.bottomValue+=100*-offset.top/parentPixelHeight);break;case"BottomLeft":if(offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(offset.top+deltaHeight):(dummyBottom+=100*-(offset.top+deltaHeight)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(null!==(_1=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_1?_1:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth>=translatedMaxWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMaxWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.maxWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.widthValue-resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue-deltaWidth<=translatedMinWidthValue&&(deltaWidth=resizedRect.widthValue-translatedMinWidthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue-deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=translatedWidthValue-resizedRect.minWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue-deltaWidth<=0&&(deltaWidth=resizedRect.widthValue):resizedRect.widthValue-100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left+deltaWidth:(dummyLeft+=100*(-offset.left+deltaWidth)/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=offset.left:(dummyRight+=100*offset.left/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=null!==(_2=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_2?_2:0,offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=-deltaWidth:resizedRect.widthValue+=100*-deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_3=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_3?_3:0)-deltaWidth:resizedRect.widthValue=(null!==(_4=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_4?_4:0)/parentPixelWidth*100-100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_5=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_5?_5:0)+deltaHeight:resizedRect.heightValue=(null!==(_6=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_6?_6:0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left+deltaWidth:resizedRect.leftValue+=100*(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(offset.top+deltaHeight):resizedRect.bottomValue+=100*-(offset.top+deltaHeight)/parentPixelHeight);break;case"BottomCenter":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.heightValue&&"%"===resizedRect.heightUnit&&(resizedRect.heightUnit="px",resizedRect.heightValue=resizedRect.heightValue/100*positionInsideControl.height),null!==resizedRect.bottomValue&&"px"===resizedRect.bottomUnit&&(resizedRect.bottomUnit="px",resizedRect.bottomValue=resizedRect.bottomValue/100*parentPixelHeight)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)(null!==(_7=resizedRect.heightValue)&&void 0!==_7?_7:0)>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;(null!==(_8=resizedRect.heightValue)&&void 0!==_8?_8:0)>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{(null!==(_9=resizedRect.heightValue)&&void 0!==_9?_9:0)/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)(null!==(_10=resizedRect.heightValue)&&void 0!==_10?_10:0)<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;(null!==(_11=resizedRect.heightValue)&&void 0!==_11?_11:0)<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{(null!==(_12=resizedRect.heightValue)&&void 0!==_12?_12:0)/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)(null!==(_13=resizedRect.heightValue)&&void 0!==_13?_13:0)+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-(null!==(_14=resizedRect.heightValue)&&void 0!==_14?_14:0));else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;(null!==(_15=resizedRect.heightValue)&&void 0!==_15?_15:0)+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-(null!==(_16=resizedRect.heightValue)&&void 0!==_16?_16:0))}else{let translatedHeightValue=(null!==(_17=resizedRect.heightValue)&&void 0!==_17?_17:0)/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)(null!==(_18=resizedRect.heightValue)&&void 0!==_18?_18:0)+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-(null!==(_19=resizedRect.heightValue)&&void 0!==_19?_19:0));else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;(null!==(_20=resizedRect.heightValue)&&void 0!==_20?_20:0)+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-(null!==(_21=resizedRect.heightValue)&&void 0!==_21?_21:0))}else{let translatedHeightValue=(null!==(_22=resizedRect.heightValue)&&void 0!==_22?_22:0)/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}if(null!==resizedRect.heightValue)"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha);else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(deltaHeight+offset.top):(dummyBottom+=100*-(deltaHeight+offset.top)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(null!==(_23=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_23?_23:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,0,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_24=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_24?_24:0)+deltaHeight:resizedRect.heightValue=(null!==(_25=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_25?_25:0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=offset.left:resizedRect.rightValue+=100*offset.left/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(deltaHeight+offset.top):resizedRect.bottomValue+=100*-(deltaHeight+offset.top)/parentPixelHeight);break;case"BottomRight":if(!0===ctrlMeta.isPartialRoot&&(null!==resizedRect.heightValue&&"%"===resizedRect.heightUnit&&(resizedRect.heightUnit="px",resizedRect.heightValue=resizedRect.heightValue/100*positionInsideControl.height),null!==resizedRect.widthValue&&"%"===resizedRect.widthUnit&&(resizedRect.widthUnit="px",resizedRect.widthValue=resizedRect.widthValue/100*positionInsideControl.width),null!==resizedRect.bottomValue&&"%"===resizedRect.bottomUnit&&(resizedRect.bottomUnit="px",resizedRect.bottomValue=resizedRect.bottomValue/100*parentPixelHeight),null!==resizedRect.rightValue&&"%"===resizedRect.rightUnit&&(resizedRect.rightUnit="px",resizedRect.rightValue=resizedRect.rightValue/100*parentPixelWidth)),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha),null!==resizedRect.heightValue){if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue>translatedMaxHeightValue&&(resizedRect.heightValue=translatedMaxHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight>resizedRect.maxHeightValue&&(resizedRect.heightValue=resizedRect.maxHeightValue/parentPixelHeight*100)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue<translatedMinHeightValue&&(resizedRect.heightValue=translatedMinHeightValue)}else{resizedRect.heightValue/100*parentPixelHeight<resizedRect.minHeightValue&&(resizedRect.heightValue=resizedRect.minHeightValue/parentPixelHeight*100)}if(null!==resizedRect.maxHeightValue)if(resizedRect.heightUnit===resizedRect.maxHeightUnit)resizedRect.heightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMaxHeightValue=resizedRect.maxHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight>=translatedMaxHeightValue&&(deltaHeight=translatedMaxHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight>=resizedRect.maxHeightValue&&(deltaHeight=resizedRect.maxHeightValue-translatedHeightValue)}if(null!==resizedRect.minHeightValue)if(resizedRect.heightUnit===resizedRect.minHeightUnit)resizedRect.heightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-resizedRect.heightValue);else if("%"!==resizedRect.heightUnit){let translatedMinHeightValue=resizedRect.minHeightValue/100*parentPixelHeight;resizedRect.heightValue+deltaHeight<=translatedMinHeightValue&&(deltaHeight=translatedMinHeightValue-resizedRect.heightValue)}else{let translatedHeightValue=resizedRect.heightValue/100*parentPixelHeight;translatedHeightValue+deltaHeight<=resizedRect.minHeightValue&&(deltaHeight=resizedRect.minHeightValue-translatedHeightValue)}"%"!==resizedRect.heightUnit?resizedRect.heightValue+deltaHeight<=0&&(deltaHeight=-resizedRect.heightValue):resizedRect.heightValue+100*deltaHeight/parentPixelHeight<=0&&(deltaHeight=-resizedRect.heightValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.heightValue&&null!==resizedRect.topValue&&null!==resizedRect.bottomValue){let dummyTop=resizedRect.topValue;"%"!==resizedRect.topUnit?dummyTop+=offset.top:(dummyTop+=100*offset.top/parentPixelHeight,dummyTop=parentPixelHeight*(dummyTop/100));let dummyBottom=resizedRect.bottomValue;"%"!==resizedRect.bottomUnit?dummyBottom+=-(offset.top+deltaHeight):(dummyBottom+=100*-(offset.top+deltaHeight)/parentPixelHeight,dummyBottom=parentPixelHeight*(dummyBottom/100)),dummyTop+dummyBottom>=parentPixelHeight&&(deltaHeight=-(null!==(_26=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_26?_26:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}if(null!==resizedRect.widthValue){if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue>translatedMaxWidthValue&&(resizedRect.widthValue=translatedMaxWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth>resizedRect.maxWidthValue&&(resizedRect.widthValue=resizedRect.maxWidthValue/parentPixelWidth*100)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue<translatedMinWidthValue&&(resizedRect.widthValue=translatedMinWidthValue)}else{resizedRect.widthValue/100*parentPixelWidth<resizedRect.minWidthValue&&(resizedRect.widthValue=resizedRect.minWidthValue/parentPixelWidth*100)}if(null!==resizedRect.maxWidthValue)if(resizedRect.widthUnit===resizedRect.maxWidthUnit)resizedRect.widthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMaxWidthValue=resizedRect.maxWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth>=translatedMaxWidthValue&&(deltaWidth=translatedMaxWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth>=resizedRect.maxWidthValue&&(deltaWidth=resizedRect.maxWidthValue-translatedWidthValue)}if(null!==resizedRect.minWidthValue)if(resizedRect.widthUnit===resizedRect.minWidthUnit)resizedRect.widthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-resizedRect.widthValue);else if("%"!==resizedRect.widthUnit){let translatedMinWidthValue=resizedRect.minWidthValue/100*parentPixelWidth;resizedRect.widthValue+deltaWidth<=translatedMinWidthValue&&(deltaWidth=translatedMinWidthValue-resizedRect.widthValue)}else{let translatedWidthValue=resizedRect.widthValue/100*parentPixelWidth;translatedWidthValue+deltaWidth<=resizedRect.minWidthValue&&(deltaWidth=resizedRect.minWidthValue-translatedWidthValue)}"%"!==resizedRect.widthUnit?resizedRect.widthValue+deltaWidth<=0&&(deltaWidth=-resizedRect.widthValue):resizedRect.widthValue+100*deltaWidth/parentPixelWidth<=0&&(deltaWidth=-resizedRect.widthValue),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha)}else if(null===resizedRect.widthValue&&null!==resizedRect.leftValue&&null!==resizedRect.rightValue){let dummyLeft=resizedRect.leftValue;"%"!==resizedRect.leftUnit?dummyLeft+=-offset.left:(dummyLeft+=100*-offset.left/parentPixelWidth,dummyLeft=parentPixelWidth*(dummyLeft/100));let dummyRight=resizedRect.rightValue;"%"!==resizedRect.rightUnit?dummyRight+=-(-offset.left+deltaWidth):(dummyRight+=100*-(-offset.left+deltaWidth)/parentPixelWidth,dummyRight=parentPixelWidth*(dummyRight/100)),dummyLeft+dummyRight>=parentPixelWidth&&(deltaWidth=-(null!==(_27=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_27?_27:0),offset=this.__getResizedRectRotationOffset(resizedRect.widthValue,resizedRect.heightValue,deltaWidth,deltaHeight,radians,sinAlpha,cosAlpha))}null!==resizedRect.widthValue?"%"!==resizedRect.widthUnit?resizedRect.widthValue+=deltaWidth:resizedRect.widthValue+=100*deltaWidth/parentPixelWidth:(null===resizedRect.leftValue&&null!==resizedRect.rightValue||null!==resizedRect.leftValue&&null===resizedRect.rightValue)&&("%"!==resizedRect.widthUnit?resizedRect.widthValue=(null!==(_28=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_28?_28:0)+deltaWidth:resizedRect.widthValue=(null!==(_29=ctrlMeta.controlCssPixelDimension.width)&&void 0!==_29?_29:0)/parentPixelWidth*100+100*deltaWidth/parentPixelWidth),null!==resizedRect.heightValue?"%"!==resizedRect.heightUnit?resizedRect.heightValue+=deltaHeight:resizedRect.heightValue+=100*deltaHeight/parentPixelHeight:(null===resizedRect.topValue&&null!==resizedRect.bottomValue||null!==resizedRect.topValue&&null===resizedRect.bottomValue)&&("%"!==resizedRect.heightUnit?resizedRect.heightValue=(null!==(_30=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_30?_30:0)+deltaHeight:resizedRect.heightValue=(null!==(_31=ctrlMeta.controlCssPixelDimension.height)&&void 0!==_31?_31:0)/parentPixelHeight*100+100*deltaHeight/parentPixelHeight),null!==resizedRect.leftValue&&("%"!==resizedRect.leftUnit?resizedRect.leftValue+=-offset.left:resizedRect.leftValue+=100*-offset.left/parentPixelWidth),null!==resizedRect.topValue&&("%"!==resizedRect.topUnit?resizedRect.topValue+=offset.top:resizedRect.topValue+=100*offset.top/parentPixelHeight),null!==resizedRect.rightValue&&("%"!==resizedRect.rightUnit?resizedRect.rightValue+=-(-offset.left+deltaWidth):resizedRect.rightValue+=100*-(-offset.left+deltaWidth)/parentPixelWidth),null!==resizedRect.bottomValue&&("%"!==resizedRect.bottomUnit?resizedRect.bottomValue+=-(offset.top+deltaHeight):resizedRect.bottomValue+=100*-(offset.top+deltaHeight)/parentPixelHeight)}return resizedRect}__onAnchorMouseUp(){let __this=this;return function(event){var _a,_b;1===event.which&&(TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseMoveNs),TcHmi.System.SharedResources.jqDocument.off(__this.__anchorMouseUpNs),null!==__this.__activeControl&&(__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snaptop-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapleft-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapbottom-remote"),__this.__activeControl.jOriginalPosition[0].classList.remove("tchmi-creator-control-snapright-remote"),!0!==__this.__lockControlResize&&(__this.__controlResizing=!1,null===(_a=__this.__designerModeManager.rectSelectManager)||void 0===_a||_a.lockRectSelect(),null===(_b=__this.__designerModeManager.syncManager)||void 0===_b||_b.updatePcElementAndSync("System.onControlSizeParameterChanged"),__this.__designerModeManager.resyncControls())))}}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeMasterInteractionManager=class{constructor(designerModeManager){this.__verPositionCache={},this.__horPositionCache={},this.__anchorName=void 0,this.__designerModeManager=designerModeManager,this.__modifierKeyPressed={ctrl:!1,shift:!1},this.__startMousePosition={left:0,top:0},this.__startMousePositionCopyMoveOffsetPosition={left:0,top:0},this.__positionInsideControl={top:0,left:0,right:0,bottom:0,height:0,width:0}}getAnchorName(){return this.__anchorName}setAnchorName(newAnchorName){this.__anchorName=newAnchorName}getStartMousePos(){return this.__startMousePosition}getStartMousePosCopyMoveOffsetPosition(){return this.__startMousePositionCopyMoveOffsetPosition}getPositionInsideControl(){return this.__positionInsideControl}setCtrlModifierKeyState(bState){this.__modifierKeyPressed.ctrl=bState}setShiftModifierKeyState(bState){this.__modifierKeyPressed.shift=bState}clearControlSnapPositionCache(){this.__horPositionCache={},this.__verPositionCache={}}handleInteractionStart(event,activeControl){if(void 0!==event.pageX&&void 0!==event.pageY&&(this.__startMousePosition.left=event.pageX,this.__startMousePosition.top=event.pageY,this.__startMousePositionCopyMoveOffsetPosition.left=0,this.__startMousePositionCopyMoveOffsetPosition.top=0,activeControl&&activeControl.jOriginalPosition)){const untransformedBBox=activeControl.jOriginalPosition[0].getBoundingClientRect();this.__positionInsideControl.top=event.pageY-untransformedBBox.top-window.scrollY,this.__positionInsideControl.left=event.pageX-untransformedBBox.left-window.scrollX,this.__positionInsideControl.right=untransformedBBox.right+window.scrollX-event.pageX,this.__positionInsideControl.bottom=untransformedBBox.bottom+window.scrollY-event.pageY,this.__positionInsideControl.height=untransformedBBox.height,this.__positionInsideControl.width=untransformedBBox.width}}handleInteractionStartCopyMoveOffsetPosition(event){void 0!==event.pageX&&void 0!==event.pageY&&(this.__startMousePositionCopyMoveOffsetPosition.left=event.pageX,this.__startMousePositionCopyMoveOffsetPosition.top=event.pageY)}refreshControlSnapPositionCache(ctrlMeta){if(this.__designerModeManager.getSettings().enableSnapping)if(ctrlMeta){if(0===ctrlMeta.absoluteParentRotation&&(this.__addPositionCacheEntry(ctrlMeta.jOriginalPosition[0],ctrlMeta.id,ctrlMeta.isContainerControl),!0===ctrlMeta.isGridControl)){let allGridCells=ctrlMeta.jControlPosition.children(".tchmi-creator-gridcell");for(let i=0,ii=allGridCells.length;i<ii;i++)this.__addPositionCacheEntry(allGridCells[i],ctrlMeta.id,!0)}}else{const controlsMetaData=this.__designerModeManager.metaDataManager.getControlMetaData();for(let id in controlsMetaData)this.refreshControlSnapPositionCache(controlsMetaData[id])}}__addSnapPosition(cache,newEntry,key){cache[key]?cache[key].push(newEntry):cache[key]=[newEntry]}__addPositionCacheEntry(htmlElem,name,isContainer){let designerSettings=this.__designerModeManager.getSettings(),controlDistance=designerSettings.snapDistanceToControls,containerInnerDistance=designerSettings.snapDistanceToControls;const untransformedBBox=htmlElem.getBoundingClientRect(),left=Math.round(untransformedBBox.left+window.scrollX),top=Math.round(untransformedBBox.top+window.scrollY),right=Math.round(untransformedBBox.right+window.scrollX),bottom=Math.round(untransformedBBox.bottom+window.scrollY);designerSettings.snapToControls&&(this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!1},top),this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},top-controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},top+containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!1},bottom),this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},bottom+controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__verPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},bottom-containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!1},left),this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},left-controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},left+containerInnerDistance),designerSettings.snapToControls&&(this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!1},right),this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!1,remoteMatch:!0},right+controlDistance)),isContainer&&designerSettings.snapToInnerContainerSides&&this.__addSnapPosition(this.__horPositionCache,{name:name,controlTopOrLeft:!0,remoteMatch:!0},right-containerInnerDistance)}handleSnapping(ctrlMeta,mouseDelta,mousePos,snapControls,directionLock){var _a,_b;let deltaCorrectionLeft=0,deltaCorrectionTop=0;const creatorZoomFactor=null!==(_b=null===(_a=this.__designerModeManager.rootControlManager)||void 0===_a?void 0:_a.getCreatorZoomFactor())&&void 0!==_b?_b:1;let controlSnappedTop="topBottom"===directionLock,controlSnappedBottom="topBottom"===directionLock,controlSnappedLeft="leftRight"===directionLock,controlSnappedRight="leftRight"===directionLock,controlSnappedTopRemoteMatch=!1,controlSnappedBottomRemoteMatch=!1,controlSnappedLeftRemoteMatch=!1,controlSnappedRightRemoteMatch=!1;if(snapControls&&0===ctrlMeta.absoluteParentRotation){const selectedControlIds=this.__designerModeManager.metaDataManager.getSelectedControlIdsWithChildren();let controlSnappointInViewportPixelStr,controlSnappointInViewportPixel,snapAtTop="topBottom"!==directionLock,snapAtBottom="topBottom"!==directionLock,snapAtLeft="leftRight"!==directionLock,snapAtRight="leftRight"!==directionLock;switch(this.__anchorName){case"TopLeft":snapAtBottom=!1,snapAtRight=!1;break;case"TopCenter":snapAtBottom=!1,snapAtLeft=!1,snapAtRight=!1;break;case"TopRight":snapAtBottom=!1,snapAtLeft=!1;break;case"CenterRight":snapAtTop=!1,snapAtBottom=!1,snapAtLeft=!1;break;case"CenterLeft":snapAtTop=!1,snapAtBottom=!1,snapAtRight=!1;break;case"BottomLeft":snapAtTop=!1,snapAtRight=!1;break;case"BottomCenter":snapAtTop=!1,snapAtLeft=!1,snapAtRight=!1;break;case"BottomRight":snapAtTop=!1,snapAtLeft=!1}if(!0===snapAtTop||!0===snapAtBottom)for(controlSnappointInViewportPixelStr in this.__verPositionCache){let snappedControlInfoArray=this.__verPositionCache[controlSnappointInViewportPixelStr];if(controlSnappointInViewportPixel=parseInt(controlSnappointInViewportPixelStr,10),!isNaN(controlSnappointInViewportPixel))if(!0===snapAtTop&&controlSnappointInViewportPixel-5<mousePos.top-this.__positionInsideControl.top&&mousePos.top-this.__positionInsideControl.top<controlSnappointInViewportPixel+5){for(let snappedControlInfo of snappedControlInfoArray)if(-1===selectedControlIds.indexOf(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!0!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedTop&&!1===controlSnappedBottom?(deltaCorrectionTop=controlSnappointInViewportPixel-(mousePos.top-this.__positionInsideControl.top),controlSnappedTop=!0,controlSnappedTopRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionTop==mousePos.top-this.__positionInsideControl.top&&(controlSnappedTop=!0,controlSnappedTopRemoteMatch=snappedControlInfo.remoteMatch);break}}else if(!0===snapAtBottom&&controlSnappointInViewportPixel-5<mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height&&mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height<controlSnappointInViewportPixel+5)for(let snappedControlInfo of snappedControlInfoArray)if(-1===selectedControlIds.indexOf(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!1!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedTop&&!1===controlSnappedBottom?(deltaCorrectionTop=controlSnappointInViewportPixel-(mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height),controlSnappedBottom=!0,controlSnappedBottomRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionTop===mousePos.top-this.__positionInsideControl.top+this.__positionInsideControl.height&&(controlSnappedBottom=!0,controlSnappedBottomRemoteMatch=snappedControlInfo.remoteMatch);break}if(!0===controlSnappedTop&&!0===controlSnappedBottom)break}if(!0===snapAtLeft||!0===snapAtRight)for(controlSnappointInViewportPixelStr in this.__horPositionCache){let snappedControlInfoArray=this.__horPositionCache[controlSnappointInViewportPixelStr];if(controlSnappointInViewportPixel=parseInt(controlSnappointInViewportPixelStr,10),!isNaN(controlSnappointInViewportPixel))if(!0===snapAtLeft&&controlSnappointInViewportPixel-5<mousePos.left-this.__positionInsideControl.left&&mousePos.left-this.__positionInsideControl.left<controlSnappointInViewportPixel+5){for(let snappedControlInfo of snappedControlInfoArray)if(-1===selectedControlIds.indexOf(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!0!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedLeft&&!1===controlSnappedRight?(deltaCorrectionLeft=controlSnappointInViewportPixel-(mousePos.left-this.__positionInsideControl.left),controlSnappedLeft=!0,controlSnappedLeftRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionLeft==mousePos.left-this.__positionInsideControl.left&&(controlSnappedLeft=!0,controlSnappedLeftRemoteMatch=snappedControlInfo.remoteMatch);break}}else if(!0===snapAtRight&&controlSnappointInViewportPixel-5<mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width&&mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width<controlSnappointInViewportPixel+5)for(let snappedControlInfo of snappedControlInfoArray)if(-1===selectedControlIds.indexOf(snappedControlInfo.name)&&(!0!==snappedControlInfo.remoteMatch||!1!==snappedControlInfo.controlTopOrLeft)){!1===controlSnappedLeft&&!1===controlSnappedRight?(deltaCorrectionLeft=controlSnappointInViewportPixel-(mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width),controlSnappedRight=!0,controlSnappedRightRemoteMatch=snappedControlInfo.remoteMatch):controlSnappointInViewportPixel-deltaCorrectionLeft===mousePos.left-this.__positionInsideControl.left+this.__positionInsideControl.width&&(controlSnappedRight=!0,controlSnappedRightRemoteMatch=snappedControlInfo.remoteMatch);break}if(!0===controlSnappedLeft&&controlSnappedRight)break}}return ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snaptop",controlSnappedTop),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapbottom",controlSnappedBottom),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapleft",controlSnappedLeft),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapright",controlSnappedRight),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snaptop-remote",controlSnappedTopRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapbottom-remote",controlSnappedBottomRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapleft-remote",controlSnappedLeftRemoteMatch),ctrlMeta.jOriginalPosition[0].classList.toggle("tchmi-creator-control-snapright-remote",controlSnappedRightRemoteMatch),{left:mouseDelta.left+deltaCorrectionLeft/creatorZoomFactor,top:mouseDelta.top+deltaCorrectionTop/creatorZoomFactor}}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeResourceInjectionManager=class{constructor(designerModeManager){this.__designerModeManager=designerModeManager}injectPackageResources(packages,callback){let destroyOnControlsRegistered,destroyOnFunctionRegistered,__this=this,pending=0,mPackages=new Map,modControls={map:new Map,urlByName:new Map,array:[]},modFunctions={map:new Map,array:[]},mapControlDescriptionByPath=new Map,mapFunctionDescriptionByPath=new Map,asyncFinalizeStage4=function(){pending>0||(pending=0,destroyOnControlsRegistered&&(destroyOnControlsRegistered(),destroyOnControlsRegistered=null),destroyOnFunctionRegistered&&(destroyOnFunctionRegistered(),destroyOnFunctionRegistered=null),TcHmi.System.Services.typeManager.doForceSchemaDefinitions(data=>{TcHmi.System.Services.controlManager.resolveDescriptionInheritation(),TcHmi.System.Services.themeManager.processActiveTheme(),TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.NONE})}))},asyncFinalizeStage3=function(){pending>0||(pending=0,modControls.array.forEach((function(module,index){!function(module){var _a;if(!(null===(_a=module.description)||void 0===_a?void 0:_a.template)||!module.package||!module.manifestData)return;let url=tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+module.description.template),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){pending--,200===xhr.status?(TcHmi.System.Data.Caches.templateMarkupCache.set(url,this.responseText),asyncFinalizeStage4()):asyncFinalizeStage4()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage4()})),pending++,xhr.send()}(module)})),asyncFinalizeStage4())},asyncFinalizeStage2=function(){var _a;if(pending>0)return;pending=0;let jsincludes=[],packagesSorted=[];mPackages.forEach((pkg,name)=>{packagesSorted.push(pkg)}),packagesSorted.sort((a,b)=>{if(a&&a.manifest&&a.manifest.modules)for(let i=0,ii=a.manifest.modules.length;i<ii;i++){let module=a.manifest.modules[i];if((!module||"Package"===module.type)&&module.nugetId===b.name)return-1}if(b&&b.manifest&&b.manifest.modules)for(let i=0,ii=b.manifest.modules.length;i<ii;i++){let module=b.manifest.modules[i];if((!module||"Package"===module.type)&&module.nugetId===a.name)return 1}return 0});for(let i=0,ii=packagesSorted.length;i<ii;i++){let pkg=packagesSorted[i];if(!pkg)continue;let manifest=pkg.manifest;if(!manifest)continue;let manifestModules=manifest.modules;if(manifestModules)for(let j=0,jj=manifestModules.length;j<jj;j++){let manifestModule=manifestModules[j];if("Control"===manifestModule.type){let descrUrl=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+manifestModule.descriptionFile),descr=mapControlDescriptionByPath.get(descrUrl);if(!descr)continue;let module={error:TcHmi.Errors.NONE,manifestData:manifestModule,package:pkg,description:descr,descriptionExpanded:Object.assign(Object.assign({},tchmi_clone_object(descr)),{inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}})},name=descr.name;if(modControls.array.push(module),1===(null===(_a=module.package)||void 0===_a?void 0:_a.manifest.apiVersion)){let qname=TcHmi.System.resolveQualifiedName(descr.name,descr.namespace);modControls.map.has(name)?(modControls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(name)):(modControls.map.set(name,module),modControls.urlByName.set(name,descrUrl)),modControls.map.has(qname)?(modControls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(qname)):(modControls.map.set(qname,module),modControls.urlByName.set(qname,descrUrl))}else modControls.map.has(name)?(modControls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}),modControls.urlByName.delete(name)):(modControls.map.set(name,module),modControls.urlByName.set(name,descrUrl));TcHmi.System.Services.themeManager.registerControlThemeFiles(descr);for(let k=0,kk=descr.dependencyFiles.length;k<kk;k++){let dependencyFile=descr.dependencyFiles[k];if(dependencyFile&&(dependencyFile.type&&"JAVASCRIPT"===dependencyFile.type.toUpperCase())){let jsinclude=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+dependencyFile.name);if(jsincludes.indexOf(jsinclude)>-1)continue;jsincludes.push(jsinclude)}}}else if("Function"===manifestModule.type){let descrUrl=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+manifestModule.descriptionFile),descr=mapFunctionDescriptionByPath.get(descrUrl);if(!descr)continue;let module={error:TcHmi.Errors.NONE,manifestData:manifestModule,package:pkg,description:descr};modFunctions.array.push(module),modFunctions.map.set(descr.function.name,module);let name=descr.function.name;if(1===pkg.manifest.apiVersion){let qname=TcHmi.System.resolveQualifiedName(descr.function.name,"Namespace");modFunctions.map.has(name)?modFunctions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(name,module),modFunctions.map.has(qname)?modFunctions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(qname,module)}else modFunctions.map.has(name)?modFunctions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):modFunctions.map.set(name,module);for(let k=0,kk=descr.dependencyFiles.length;k<kk;k++){let dependencyFile=descr.dependencyFiles[k];if(dependencyFile&&(dependencyFile.type&&"JAVASCRIPT"===dependencyFile.type.toUpperCase())){let include=tchmi_path(pkg.basePath+"/"+manifestModule.basePath+"/"+dependencyFile.name);if(jsincludes.indexOf(include)>-1)continue;jsincludes.push(include)}}}else if("Resource"===manifestModule.type&&".js"===manifestModule.path.substr(manifestModule.path.length-3,3).toLowerCase()){let jsinclude=tchmi_path(pkg.basePath+"/"+manifestModule.path);if(jsincludes.indexOf(jsinclude)>-1)continue;jsincludes.push(jsinclude)}}}let fragment=document.createDocumentFragment();destroyOnControlsRegistered=TcHmi.EventProvider.register("System.onControlRegistered",(function(e,data){var _a;if(data.error!==TcHmi.Errors.NONE||!data.name)return;let name=data.name,qname=TcHmi.System.resolveQualifiedName(data.name,data.namespace),modControlName=modControls.map.get(name);if(1===(null===(_a=null==modControlName?void 0:modControlName.package)||void 0===_a?void 0:_a.manifest.apiVersion)){let modControlQualifiedName=modControls.map.get(qname);if(TcHmi.System.Data.Modules.controls.array.push(modControlName),modControlName&&modControlName.error===TcHmi.Errors.NONE)if(modControlName.reg=data,TcHmi.System.Data.Modules.controls.map.has(name)){TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}});let url=modControls.urlByName.get(name);url&&TcHmi.System.Data.Modules.controls.urlMap.delete(url)}else{TcHmi.System.Data.Modules.controls.map.set(name,modControlName);let url=modControls.urlByName.get(name);url&&TcHmi.System.Data.Modules.controls.urlMap.set(url,modControlName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlName.error});if(modControlQualifiedName)if(modControlQualifiedName.error===TcHmi.Errors.NONE)if(modControlQualifiedName.reg=data,TcHmi.System.Data.Modules.controls.map.has(qname)){TcHmi.System.Data.Modules.controls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}});let url=modControls.urlByName.get(qname);url&&TcHmi.System.Data.Modules.controls.urlMap.delete(url)}else{TcHmi.System.Data.Modules.controls.map.set(qname,modControlQualifiedName);let url=modControls.urlByName.get(qname);url&&TcHmi.System.Data.Modules.controls.urlMap.set(url,modControlQualifiedName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlQualifiedName.error});else;}else if(modControlName)if(modControlName.error===TcHmi.Errors.NONE){if(modControlName.reg=data,modControlName.reg.directory&&modControlName.reg.template){let cleanTemplatePath=tchmi_path(modControlName.reg.template),cleanTemplateDirectory=tchmi_path(modControlName.reg.directory);if(cleanTemplatePath.indexOf(cleanTemplateDirectory)>=-1&&modControlName.description&&modControlName.descriptionExpanded){let cleanRelativeTemplatePath=tchmi_path(cleanTemplatePath.replace(cleanTemplateDirectory,""));modControlName.description.template=cleanRelativeTemplatePath,modControlName.descriptionExpanded.template=cleanRelativeTemplatePath}}TcHmi.System.Data.Modules.controls.map.has(name)?TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.controls.map.set(name,modControlName)}else TcHmi.System.Data.Modules.controls.map.set(name,{error:modControlName.error})})),destroyOnFunctionRegistered=TcHmi.EventProvider.register("System.onFunctionRegistered",(function(e,data){let name=data.name,qname=TcHmi.System.resolveQualifiedName(data.name,data.namespace),modFunctionName=modFunctions.map.get(name);if(modFunctionName&&modFunctionName.package)if(TcHmi.System.Data.Modules.functions.array.push(modFunctionName),1===modFunctionName.package.manifest.apiVersion){let modFunctionQualifiedName=modFunctions.map.get(qname);modFunctionName&&modFunctionName.error===TcHmi.Errors.NONE?(modFunctionName.reg=data,TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,modFunctionName)):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionName.error}),modFunctionQualifiedName&&(modFunctionQualifiedName.error===TcHmi.Errors.NONE?TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(qname,modFunctionQualifiedName):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionQualifiedName.error}))}else modFunctionName&&modFunctionName.error===TcHmi.Errors.NONE?(modFunctionName.reg=data,TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE]}}):TcHmi.System.Data.Modules.functions.map.set(name,modFunctionName)):TcHmi.System.Data.Modules.functions.map.set(name,{error:modFunctionName.error});else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModeResourceInjectionManager] Internal error. Did not found function module information.")}));for(let i=0,ii=jsincludes.length;i<ii;i++){!function(include){pending++;let script=document.createElement("script");script.src=include,script.async=!1,script.onload=function(ev){pending--,asyncFinalizeStage3()},script.onerror=function(ev){pending--,asyncFinalizeStage3()},fragment.appendChild(script)}(jsincludes[i])}document.head.appendChild(fragment),asyncFinalizeStage3()},asyncFinalizeStage1=function(){pending>0||(pending=0,mPackages.forEach((pkg,name)=>{let manifest=pkg.manifest;if(manifest){let manifestModules=manifest.modules;if(manifestModules)for(let i=0,ii=manifestModules.length;i<ii;i++){let manifestModule=manifestModules[i];manifestModule&&("Control"===manifestModule.type?function(pkg,module){let url=tchmi_path(pkg.basePath+"/"+module.basePath+"/"+module.descriptionFile),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200===xhr.status){try{mapControlDescriptionByPath.set(url,JSON.parse(this.responseText))}catch(e){}asyncFinalizeStage2()}else asyncFinalizeStage2()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage2()})),pending++,xhr.send()}(pkg,manifestModule):"Function"===manifestModule.type&&function(pkg,module){let url=tchmi_path(pkg.basePath+"/"+module.basePath+"/"+module.descriptionFile),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200===xhr.status){try{mapFunctionDescriptionByPath.set(url,JSON.parse(this.responseText))}catch(e){}asyncFinalizeStage2()}else asyncFinalizeStage2()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage2()})),pending++,xhr.send()}(pkg,manifestModule))}}}),asyncFinalizeStage2())};for(let i=0,ii=packages.length;i<ii;i++){let pi=packages[i];TcHmi.System.Data.packages.has(pi.name)||function(pi){let url=tchmi_path(pi.basePath+"/Manifest.json"),xhr=new XMLHttpRequest;xhr.open("GET",url+"?preventcache="+Math.random()),xhr.addEventListener("load",(function(evt){if(pending--,200!==xhr.status)return void asyncFinalizeStage1();let manifest;try{manifest=JSON.parse(this.responseText)}catch(e){}if(!manifest)return void asyncFinalizeStage1();let pkg={name:pi.name,basePath:pi.basePath,manifest:manifest};mPackages.set(pkg.name,pkg),TcHmi.System.Data.packages.set(pkg.name,pkg),asyncFinalizeStage1()})),xhr.addEventListener("error",(function(evt){pending--,asyncFinalizeStage1()})),pending++,xhr.send()}(pi),asyncFinalizeStage1()}}injectProjectResources(){}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModePartialContentManager=class{constructor(designerModeManager){this.__requests=new Map,this.__requestIdCount=0,this.__designerModeManager=designerModeManager}requestCurrentPartialContent(partialUrl,callback){let requestId=0,loopcount=0;do{if(requestId=0,loopcount++,loopcount>=1e6){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModePartialContentManager] Reached maxium of parallel requests."),requestId=null;break}this.__requestIdCount++,this.__requestIdCount>=1e6&&(this.__requestIdCount=1),requestId=this.__requestIdCount}while(this.__requests.has(requestId));if(null===requestId)return()=>{};let piggyBack=null;try{piggyBack=JSON.stringify({requestId:requestId,requestInstance:TCHMI_DYNAMIC_INSTANCE_ID})}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.Engineering.DesignerModePartialContentManager] An uncaught exception occurred:\n",e)}let requestObject={callback:callback,timeoutTimer:setTimeout(()=>{null!==requestId&&this.__requests.delete(requestId),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_TIMEOUT,details:{code:TcHmi.Errors.E_TIMEOUT,message:TcHmi.Errors[TcHmi.Errors.E_TIMEOUT],domain:"TcHmi.System.Engineering.DesignerModePartialContentManager"}})},6e4)},destroy=()=>{null!==requestId&&this.__requests.delete(requestId),requestObject&&(clearTimeout(requestObject.timeoutTimer),requestObject.timeoutTimer=0,requestObject.callback=null,requestObject=null)};return requestObject.destroy=destroy,this.__requests.set(requestId,requestObject),new Engineering.SyncCmdToCreatorRequestCurrentPartialContent({name:"RequestCurrentPartialContent",targetPartial:partialUrl,piggyBack:piggyBack,replyTo:TCHMI_DYNAMIC_INSTANCE_ID}).send(),destroy}getRequest(requestId){let request=this.__requests.get(requestId);return request&&this.__requests.delete(requestId),request}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Engineering;!function(Engineering){Engineering.DesignerModeUserControlParameterManager=class{constructor(designerModeManager){this.__params=new Map,this.__designerModeManager=designerModeManager,this.__params=new Map}add(name,param){this.__params.set(name,param)}remove(name){this.__params.delete(name)}get(name){if(name)return this.__params.get(name)}}}(Engineering=System.Engineering||(System.Engineering={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){let Locale;!function(Locale){class Framework extends TcHmi.Locale.Localization{constructor(){super(),this.__namespace="TcHmi.System.Localization.Framework"}}Locale.Framework=Framework}(Locale=System.Locale||(System.Locale={}))}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.LocalizationManager=class{constructor(){this.__files=new Map,this.__localizations=new Map,this.__localizationCallbacks=new Map,this.__localizationEngineeringCallbacks=new Map,this.__locale=void 0,this.__localeFallback=void 0,this.__localeEngineering=void 0,this.__localeEngineeringFallback=void 0,this.__localizationData=new Map,this.__localizationFallbackData=new Map,this.__localizationEngineeringData=new Map,this.__localizationEngineeringFallbackData=new Map,this.__localizationDataByNsAndUrl=new Map,this.__localizationFilesRequested=[],this.__localizationFallbackFilesRequested=[],this.__localizationEngineeringFilesRequested=[],this.__localizationEngineeringFallbackFilesRequested=[],this.__callbackMap=new Map}getLocale(options){var _a,_b;return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?null!==(_a=this.__localeEngineering)&&void 0!==_a?_a:void 0:null!==(_b=this.__locale)&&void 0!==_b?_b:void 0}getLocaleFallback(options){var _a;return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localeEngineeringFallback:null!==(_a=this.__localeFallback)&&void 0!==_a?_a:void 0}getLocaleData(namespace,options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localizationEngineeringData.get(namespace):this.__localizationData.get(namespace)}setLocaleData(namespace,data,fileurl,options){if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationEngineeringData.delete(namespace),namespaceData.forEach(localeData=>{const currentData=this.__localizationEngineeringData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationEngineeringData.set(namespace,localeData)})}else{let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationData.delete(namespace),namespaceData.forEach(localeData=>{const currentData=this.__localizationData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationData.set(namespace,localeData)})}}getLocaleFallbackData(namespace,options){return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?this.__localizationEngineeringFallbackData.get(namespace):this.__localizationFallbackData.get(namespace)}setLocaleFallbackData(namespace,data,fileurl,options){if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationEngineeringFallbackData.delete(namespace),namespaceData.forEach(localeData=>{const currentData=this.__localizationEngineeringFallbackData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationEngineeringFallbackData.set(namespace,localeData)})}else{let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileurl,data),this.__localizationFallbackData.delete(namespace),namespaceData.forEach(localeData=>{const currentData=this.__localizationFallbackData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationFallbackData.set(namespace,localeData)})}}loadLocale(locale,callback){locale||TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Missing locale.",domain:"TcHmi.System.LocalizationManager"}}),TcHmi.System.Services.serverManager.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"SetLocale",writeValue:locale}]},TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{if(callback){if(locale===this.__locale)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE});let callbackList=this.__callbackMap.get(locale);callbackList||(callbackList=[],this.__callbackMap.set(locale,callbackList)),callbackList.push(callback)}}}))}processLocalizationData(namespace,data,fallback,options){var _a;if(!namespace)return TcHmi.Errors.E_PARAMETER_INVALID;const fileLocalizedText=data&&void 0!==data.locale&&null!==data.locale&&data.localizedText?data.localizedText:null,fallbackLocalizedText=fallback?fallback.localizedText:null;let entriesToProcess=new Set,localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let keysToRemove=new Set,level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let localizationCallbacks,keyTextBefore=new Map;if(level.forEach((entry,key)=>{!keyTextBefore.has(key)&&entry&&void 0!==entry.text&&null!==entry.text&&keyTextBefore.set(key,entry.text),keysToRemove.add(key)}),fallbackLocalizedText)for(let key in fallbackLocalizedText){const text=fallbackLocalizedText[key];if(null==text)continue;keysToRemove.delete(key);let entry=level.get(key);entry?tchmi_equal(entry.text,text)||(entry.text=text,entry.fallback=!0,entry.dummy=!1,entriesToProcess.has(entry)||entriesToProcess.add(entry)):(entry={key:key,text:text,fallback:!0,dummy:!1,callbacks:[]},level.set(key,entry))}if(fileLocalizedText)for(let key in fileLocalizedText){const text=fileLocalizedText[key];if(null==text)continue;keysToRemove.delete(key);let entry=level.get(key);if(entry){if(keyTextBefore.has(key)){tchmi_equal(keyTextBefore.get(key),text)||entriesToProcess.has(entry)||entriesToProcess.add(entry)}else entriesToProcess.has(entry)||entriesToProcess.add(entry);entry.text=text,entry.fallback=!1,entry.dummy=!1}else entry={key:key,text:text,fallback:!1,dummy:!1,callbacks:[]},level.set(key,entry)}for(let keyToRemove of keysToRemove.values()){let entry=level.get(keyToRemove);if(entry&&(entry.dummy=!0,entry.fallback=!1,delete entry.text,entry.callbacks)){let callbackList=[];for(let j=0,jj=entry.callbacks.length;j<jj;j++)callbackList[j]=entry.callbacks[j];for(let innerCallback of callbackList)-1!==entry.callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,text:keyToRemove,destroy:innerCallback.destroy})}}for(let entry of entriesToProcess.values()){let callbackList=[];for(let j=0,jj=entry.callbacks.length;j<jj;j++)callbackList[j]=entry.callbacks[j];for(let innerCallback of callbackList)-1!==entry.callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,this,{error:TcHmi.Errors.NONE,text:null!==(_a=entry.text)&&void 0!==_a?_a:entry.key,destroy:innerCallback.destroy})}if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?localizationCallbacks=this.__localizationEngineeringCallbacks.get(namespace):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&(localizationCallbacks=this.__localizationCallbacks.get(namespace)),localizationCallbacks){let localizationReader=this.get(namespace);for(let i=0,ii=localizationCallbacks.length;i<ii;i++){let localizationCallback=localizationCallbacks[i];localizationCallback&&TcHmi.Callback.callSafeEx(localizationCallback.callback,this,{error:TcHmi.Errors.NONE,reader:localizationReader,destroy:localizationCallback.destroy})}}return TcHmi.Errors.NONE}__processLocaleForNamespace(newLocale,namespace,options,callback){var _a;let files=this.__files.get(namespace);if(!files||0===files.size)return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});const locale2fileurl=function(newLocale){if(!newLocale||!files)return;let file=files.get(newLocale);if(!file){const arrNewLanguageAndRegion=newLocale.toLowerCase().split("-");for(let language of Array.from(files.keys()))if(language.toLowerCase().split("-")[0]===arrNewLanguageAndRegion[0])return files.get(language)}return file};let fileFallback,file=locale2fileurl(newLocale);if(!file){let langList=null!==(_a=navigator.languages)&&void 0!==_a?_a:[];for(let i=0;i<langList.length&&(file=locale2fileurl(langList[i]),!file);i++);}TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?fileFallback=locale2fileurl(this.__localeEngineeringFallback):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&(fileFallback=locale2fileurl(this.__localeFallback)),!fileFallback&&(namespace.startsWith("TcHmi.System.Localization.Framework")||namespace.startsWith("TcHmi.System.Localization.Control")||namespace.startsWith("TcHmi.System.Localization.Function"))&&(fileFallback=locale2fileurl("en"));let localeRequestErrorMessage,localeFallbackRequestErrorMessage,localeFileRequested,localeFallbackFileRequested,finishedLocaleRequest=!1,finishedLocaleFallbackRequest=!1,localeRequestHasFailed=!1,localeFallbackRequestHasFailed=!1;const finalize=()=>{if(!finishedLocaleRequest||!finishedLocaleFallbackRequest)return;if(localeRequestHasFailed)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Failed to load localization file: '"+localeFileRequested+"' for namespace: '"+namespace+"'. Details: '"+localeRequestErrorMessage+"'."),void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});let localeData,localeFallbackData;localeFallbackRequestHasFailed&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Failed to load fallback localization file: '"+localeFallbackFileRequested+"' for namespace: '"+namespace+"'. Details: '"+localeFallbackRequestErrorMessage+"'. Proceeding without fallback language support."),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?(localeData=this.__localizationEngineeringData.get(namespace),localeFallbackData=this.__localizationEngineeringFallbackData.get(namespace)):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&(localeData=this.__localizationData.get(namespace),localeFallbackData=this.__localizationFallbackData.get(namespace));this.processLocalizationData(namespace,localeData,localeFallbackData,options)!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=TcHmi, Module=TcHmi.System.LocalizationManager] Parsing localization file '"+localeFileRequested+"' for locale: '"+newLocale+"' of namespace: '"+namespace+"' failed."),TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})};(()=>{if(!fileFallback)return finishedLocaleFallbackRequest=!0,void finalize();if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let allRequested=!0;if("string"==typeof fileFallback)this.__localizationEngineeringFallbackFilesRequested.includes(fileFallback)||(allRequested=!1,this.__localizationEngineeringFallbackFilesRequested.push(fileFallback));else for(let entry of fileFallback)this.__localizationEngineeringFallbackFilesRequested.includes(entry)||(allRequested=!1,this.__localizationEngineeringFallbackFilesRequested.push(entry));if(allRequested)return finishedLocaleFallbackRequest=!0,void finalize()}else if(!options||options&&options.level===TcHmi.Locale.Level.Application){let allRequested=!0;if("string"==typeof fileFallback)this.__localizationFallbackFilesRequested.includes(fileFallback)||(allRequested=!1,this.__localizationFallbackFilesRequested.push(fileFallback));else for(let entry of fileFallback)this.__localizationFallbackFilesRequested.includes(entry)||(allRequested=!1,this.__localizationFallbackFilesRequested.push(entry));if(allRequested)return finishedLocaleFallbackRequest=!0,void finalize()}localeFallbackFileRequested=fileFallback;const engineeringLocData=[],locData=[];if(fileFallback){const fetcher=(fileFallback,index)=>fetch(fileFallback+(TCHMI_ENGINEERING?"?preventcache="+Math.random():"")).then(response=>200===response.status&&response.ok?response.json().catch(reason=>(localeFallbackRequestErrorMessage="Could not parse fallback localisation JSON file from "+fileFallback,Promise.reject())):(localeFallbackRequestErrorMessage=response.statusText,Promise.reject())).then(fallbackData=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){engineeringLocData[index]=fallbackData;let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileFallback,fallbackData)}else if((!options||options&&options.level===TcHmi.Locale.Level.Application)&&(locData[index]=fallbackData,TCHMI_ENGINEERING)){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(fileFallback,fallbackData)}}).catch(()=>{localeFallbackRequestHasFailed=!0});let fetchPromise;if("string"==typeof fileFallback)engineeringLocData.length=1,locData.length=1,fetchPromise=fetcher(fileFallback,1);else if(Array.isArray(fileFallback)){engineeringLocData.length=fileFallback.length,locData.length=fileFallback.length;let promiseArray=[];for(const[index,fileFallbackItem]of fileFallback.entries())promiseArray.push(fetcher(fileFallbackItem,index));fetchPromise=Promise.all(promiseArray)}else fetchPromise=Promise.reject();fetchPromise.catch(()=>{}).then(()=>{this.__localizationEngineeringFallbackData.delete(namespace),this.__localizationFallbackData.delete(namespace);for(const fallbackData of engineeringLocData){if(!fallbackData)continue;const currentData=this.__localizationEngineeringFallbackData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),fallbackData.localizedText):this.__localizationEngineeringFallbackData.set(namespace,fallbackData)}for(const fallbackData of locData){if(!fallbackData)continue;const currentData=this.__localizationFallbackData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),fallbackData.localizedText):this.__localizationFallbackData.set(namespace,fallbackData)}finishedLocaleFallbackRequest=!0,finalize()})}else finishedLocaleFallbackRequest=!0,finalize()})(),(()=>{if(!file)return finishedLocaleRequest=!0,void finalize();if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){let allRequested=!0;if("string"==typeof file)this.__localizationEngineeringFilesRequested.includes(file)||(allRequested=!1,this.__localizationEngineeringFilesRequested.push(file));else for(let entry of file)this.__localizationEngineeringFilesRequested.includes(entry)||(allRequested=!1,this.__localizationEngineeringFilesRequested.push(entry));if(allRequested)return finishedLocaleRequest=!0,void finalize()}else if(!options||options&&options.level===TcHmi.Locale.Level.Application){let allRequested=!0;if("string"==typeof file)this.__localizationFilesRequested.includes(file)||(allRequested=!1,this.__localizationFilesRequested.push(file));else for(let entry of file)this.__localizationFilesRequested.includes(entry)||(allRequested=!1,this.__localizationFilesRequested.push(entry));if(allRequested)return finishedLocaleRequest=!0,void finalize()}if(file){localeFileRequested=file;const engineeringLocData=[],locData=[],fetcher=(file,index)=>fetch(file+(TCHMI_ENGINEERING?"?preventcache="+Math.random():"")).then(response=>200===response.status&&response.ok?response.json().catch(reason=>(localeRequestErrorMessage="Could not parse localisation JSON file from"+file,Promise.reject())):(localeRequestErrorMessage=response.statusText,Promise.reject())).then(localeData=>{if(TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering){engineeringLocData[index]=localeData;let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(file,localeData)}else if((!options||options&&options.level===TcHmi.Locale.Level.Application)&&(locData[index]=localeData,TCHMI_ENGINEERING)){let namespaceData=this.__localizationDataByNsAndUrl.get(namespace);namespaceData||(namespaceData=new Map,this.__localizationDataByNsAndUrl.set(namespace,namespaceData)),namespaceData.set(file,localeData)}}).catch(()=>{localeRequestHasFailed=!0});let fetchPromise;if("string"==typeof file)engineeringLocData.length=1,locData.length=1,fetchPromise=fetcher(file,0);else if(Array.isArray(file)){engineeringLocData.length=file.length,locData.length=file.length;let promiseArray=[];for(const[index,fileItem]of file.entries())promiseArray.push(fetcher(fileItem,index));fetchPromise=Promise.all(promiseArray)}else fetchPromise=Promise.reject();fetchPromise.catch(()=>{}).then(()=>{this.__localizationEngineeringData.delete(namespace),this.__localizationData.delete(namespace);for(const localeData of engineeringLocData){if(!localeData)continue;const currentData=this.__localizationEngineeringData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationEngineeringData.set(namespace,localeData)}for(const localeData of locData){if(!localeData)continue;const currentData=this.__localizationData.get(namespace);currentData?currentData.localizedText=Object.assign(Object.assign({},currentData.localizedText),localeData.localizedText):this.__localizationData.set(namespace,localeData)}finishedLocaleRequest=!0,finalize()})}else finishedLocaleRequest=!0,finalize()})()}processLocale(newLocale,options,callback){var _a;let savedCallbackList=null!==(_a=this.__callbackMap.get(newLocale))&&void 0!==_a?_a:[];callback&&savedCallbackList.push(callback),savedCallbackList.push(()=>{this.__callbackMap.delete(newLocale)}),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?newLocale!==this.__localeEngineering&&(this.__localizationEngineeringFilesRequested=[],this.__localizationEngineeringData.clear()):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&newLocale!==this.__locale&&(this.__localizationFilesRequested=[],this.__localizationData.clear());const finalize=()=>{if(pending>0)return;let localeOld;this.__resolveControlLocalizationFileInheritation(),TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?(localeOld=this.__localeEngineering,this.__localeEngineering=newLocale):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&(localeOld=this.__locale,this.__locale=newLocale),TcHmi.System.Callback.callSafeCallbacks1Param(savedCallbackList,null,{error:TcHmi.Errors.NONE}),document.documentElement.lang=null!=newLocale?newLocale:"",TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering?localeOld!==newLocale&&TcHmi.EventProvider.raise("onEngineeringLocaleChanged",newLocale):(!options||options&&options.level===TcHmi.Locale.Level.Application)&&localeOld!==newLocale&&TcHmi.EventProvider.raise("onLocaleChanged",newLocale)};let pending=this.__files.size;this.__files.forEach((files,namespace)=>{this.__processLocaleForNamespace(newLocale,namespace,options,data=>{pending--,finalize()})}),0===this.__files.size&&finalize()}registerLocalizationFile(namespace,locale,pathOrPathArray){let files=this.__files.get(namespace);files||(files=new Map,this.__files.set(namespace,files)),files.set(locale,pathOrPathArray)}unregisterLocalizationFile(namespace,locale,path){let files=this.__files.get(namespace);files&&(files.has(locale)&&tchmi_path(files.get(locale))===tchmi_path(path)&&files.delete(locale),0===files.size&&this.__files.delete(namespace))}__resolveControlLocalizationFileInheritation(){if(!TcHmi.System.Services.controlManager)return;let root=TcHmi.System.Services.controlManager.getInheritanceTree();if(!root)return;const merge=(entry,parents)=>{let inheritationHierarchyPath=[entry];parents&&(inheritationHierarchyPath=parents.concat([entry]));let currentInheritationApplicationLocalizations=[],currentInheritationEngineeringLocalizations=[];for(let i=0,ii=inheritationHierarchyPath.length;i<ii;i++){let current=inheritationHierarchyPath[i];if(!current)continue;let isNew=!1,currentLocalization=this.__localizations.get("TcHmi.System.Localization.Control<"+current.controlType+">");currentLocalization||(isNew=!0,currentLocalization={application:new Map,engineering:new Map});for(let j=0,jj=currentInheritationApplicationLocalizations.length;j<jj;j++){let currentInheritationApplicationLocalization=currentInheritationApplicationLocalizations[j];currentInheritationApplicationLocalization&&currentInheritationApplicationLocalization.forEach((localizedText,key)=>{if(currentLocalization.application.has(key)){let entryToUpdate=currentLocalization.application.get(key);entryToUpdate&&(entryToUpdate.text=localizedText.text,entryToUpdate.dummy=localizedText.dummy,entryToUpdate.fallback=localizedText.fallback)}else currentLocalization.application.set(key,{key:key,text:localizedText.text,dummy:localizedText.dummy,fallback:localizedText.fallback,callbacks:[]})})}for(let j=0,jj=currentInheritationEngineeringLocalizations.length;j<jj;j++){let currentInheritationEngineeringLocalization=currentInheritationEngineeringLocalizations[j];currentInheritationEngineeringLocalization&&currentInheritationEngineeringLocalization.forEach((localizedText,key)=>{if(currentLocalization.engineering.has(key)){let entryToUpdate=currentLocalization.engineering.get(key);entryToUpdate&&(entryToUpdate.text=localizedText.text,entryToUpdate.dummy=localizedText.dummy,entryToUpdate.fallback=localizedText.fallback)}else currentLocalization.engineering.set(key,{key:key,text:localizedText.text,dummy:localizedText.dummy,fallback:localizedText.fallback,callbacks:[]})})}currentInheritationApplicationLocalizations.push(currentLocalization.application),currentInheritationEngineeringLocalizations.push(currentLocalization.engineering),isNew&&this.__localizations.set("TcHmi.System.Localization.Control<"+current.controlType+">",currentLocalization)}},recurse=(entry,parents)=>{if(entry)for(let i=0,ii=entry.children.length;i<ii;i++){let child=entry.children[i],parentsNew=[];if(parents&&0!==parents.length){parentsNew=[];for(let i=0,ii=parents.length;i<ii;i++)parentsNew.push(parents[i]);parentsNew.push(entry)}else parentsNew.push(entry);child.children&&child.children.length>0?recurse(child,parentsNew):merge(child,parentsNew)}};recurse(root,null)}setFallbackLocale(fallback){this.__localeFallback=null!=fallback?fallback:void 0}resetFallbackLocale(callback=null){this.__localizationFallbackData.clear(),this.__localizationFallbackFilesRequested=[],this.processLocale(this.__locale)}getFiles(){return this.__files}get(namespace,options){let res={},localization=this.__localizations.get(namespace);if(!localization)return new TcHmi.Locale.LocalizationReader(res);let level=localization.application;return TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering),level.forEach((entry,key)=>{entry.dummy||(res[key]=entry.text)}),new TcHmi.Locale.LocalizationReader(res)}watch(namespace,options={},callback){let localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let callbackCacheEntry={callback:callback,destroy:()=>{}},callbackCache=this.__localizationCallbacks.get(namespace);callbackCache?callbackCache.push(callbackCacheEntry):(callbackCache=[callbackCacheEntry],this.__localizationCallbacks.set(namespace,callbackCache));let destroy=()=>{if(!callbackCache)return;let pos=callbackCache.indexOf(callbackCacheEntry);pos>-1&&callbackCache.splice(pos,1),0===callbackCache.length&&this.__localizationCallbacks.delete(namespace)};callbackCacheEntry.destroy=destroy;let reader=this.get(namespace,options);return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,reader:reader,destroy:destroy}),destroy}getText(namespace,key,options){var _a;let localization=this.__localizations.get(namespace);if(localization){let level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let entry=level.get(key);return!entry||entry.dummy?key:null!==(_a=entry.text)&&void 0!==_a?_a:key}return key}watchText(namespace,key,options={},callback){var _a;let localization=this.__localizations.get(namespace);localization||(localization={application:new Map,engineering:new Map},this.__localizations.set(namespace,localization));let level=localization.application;TCHMI_DESIGNER&&options&&options.level===TcHmi.Locale.Level.Engineering&&(level=localization.engineering);let entry=level.get(key);entry||(entry={key:key,fallback:!1,dummy:!0,callbacks:[]},level.set(key,entry));let destroy=function(){if(!entry)return;let index=entry.callbacks.indexOf(co);-1!==index&&(entry.callbacks.splice(index,1),co.callback=void 0)},co={callback:callback,destroy:destroy};return entry.callbacks.push(co),entry.dummy?TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,text:key,destroy:destroy}):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE,text:null!==(_a=entry.text)&&void 0!==_a?_a:key,destroy:destroy}),destroy}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){class ServerManager{constructor(){this.__serverHost="",this.__serverPort="",this.__serverProtocol="http:",this.__websocketProtocol="ws:",this.__isInitialized=!1,this.__disabledCommunication=!1,this.__lastConnectState=0,this.__cyclicReconnect=!1,this.__watchSymbolCache=new Map,this.__requestCache=new Map,this.__requestQueue=[],this.__requestPending=null,this.__requestIdCount=0,this.__conWatcherIntervalId=0,this.__firstAccessReject=0,this.__firstAccessRejectTimeoutId=0,this.__symbolWatcherIntervalId=0,this.__symbolWatcherStartTime=Date.now(),this.__checkLicenseSubscriptionId=null,this.__serverStateWatcherIntervalId=0,this.__serverStatePublishInProgress=!1,this.__serverStatePublishInProgressOld=!1,this.__serverStateLastErrorStatus=null,this.__serverStateLastErrorStatusOld=null,this.resolveHandleServerState=callback=>{if(TCHMI_ENGINEERING)return this.__serverStateLastErrorStatusOld=this.__serverStateLastErrorStatus,this.__serverStateLastErrorStatus=null,void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE});let url=this.__serverProtocol+"//"+this.__serverHost+":"+this.__serverPort+"/Config/ServerState",xhr=new XMLHttpRequest;xhr.open("GET",url),xhr.addEventListener("load",evt=>{if(200!==xhr.status)return this.__serverStateLastErrorStatusOld=this.__serverStateLastErrorStatus,this.__serverStateLastErrorStatus=xhr.status,void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}});let response;this.__serverStateLastErrorStatusOld=this.__serverStateLastErrorStatus,this.__serverStateLastErrorStatus=null;try{response=JSON.parse(xhr.responseText)}catch(e){return void TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})}response?(this.__serverStatePublishInProgress=response.publishInProgress,!0===this.__serverStatePublishInProgress&&!1===this.__serverStatePublishInProgressOld?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Publish_In_Progress",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Application_Reload_When_Publish_Done",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Info)):!1===this.__serverStatePublishInProgress&&!0===this.__serverStatePublishInProgressOld&&window.location.reload(),this.__serverStatePublishInProgressOld=this.__serverStatePublishInProgress,TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})}),xhr.addEventListener("error",evt=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR]}})}),xhr.send()},this.__disableCommunication=evt=>{"__TcHmiServerManager"===TcHmi.System.Services.dialogManager.getDialogOwner()&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1),this.__disabledCommunication=!0,this.__cyclicReconnect=!1,this.__lastConnectState=4,this.close()},TcHmi.EventProvider.register("System.disableCommunication",this.__disableCommunication);let port=window.location.port;port||(port="https:"===window.location.protocol?"443":"80"),this.setServerAddress(window.location.hostname,port,window.location.protocol)}watchServerState(){this.__serverStateWatcherIntervalId||(this.__serverStateWatcherIntervalId=setInterval(()=>{this.resolveHandleServerState(data=>{null!==this.__serverStateLastErrorStatus||460!==this.__serverStateLastErrorStatusOld&&465!==this.__serverStateLastErrorStatusOld||window.location.reload(),null!==this.__serverStateLastErrorStatusOld||460!==this.__serverStateLastErrorStatus&&465!==this.__serverStateLastErrorStatus||this.logout(!1,null,data=>{this.close()})})},TCHMI_SERVER_STATE_WATCH_INTERVAL))}unwatchServerState(){this.__serverStateWatcherIntervalId&&(clearInterval(this.__serverStateWatcherIntervalId),this.__serverStateWatcherIntervalId=0)}onWsOpen(callback){let __this=this;return function(openEvent){if(!__this.__websocket)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.ServerManager"}});TCHMI_ENGINEERING&&TcHmi.Engineering.ErrorPane.remove("E_SERVER_CONNECTION_LOST"),!1===TCHMI_UNITTEST_MODE&&__this.watchServerState(),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+__this.__websocket.url+" opened.");let callbackPending=!0;__this.__checkLicenseSubscriptionId=TcHmi.Server.subscribeEx([{commandOptions:["SendErrorMessage"],symbol:"Diagnostics::LICENSE"}],1e3,{timeout:TcHmi.System.config.tcHmiServer.websocketSystemTimeout},data=>{let connectState=1,errDetail={code:TcHmi.Errors.NONE};if(data&&data.response&&(data.error===TcHmi.Errors.NONE||data.error===TcHmi.Errors.E_SERVER_RESPONSE_ERROR)){let error=data.response.error;if(void 0!==error)error.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE||error.code===TcHmi.Server.Error.HMI_E_LICENSE_VERIFY||error.code===TcHmi.Server.Error.HMI_E_LICENSE_TARGET?(connectState=6,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+'<br />\n<br />\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">"',TcHmi.DialogManager.DialogSeverity.Error)):(connectState=1,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(error),TcHmi.DialogManager.DialogSeverity.Error));else{let commands=data.response.commands;if(null==commands||void 0===commands[0]||null===commands[0])connectState=1,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Server_Response_Invalid",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Missing_Commands_Or_Command",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error);else if(void 0!==commands[0].error){let cmdErr=commands[0].error;if(cmdErr.code===TcHmi.Server.Error.HMI_E_MISSING_LICENSE_HANDSHAKE||cmdErr.code===TcHmi.Server.Error.HMI_E_LICENSE_VERIFY||cmdErr.code===TcHmi.Server.Error.HMI_E_LICENSE_TARGET)connectState=6,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING,errDetail.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TCHMI_DESIGNER?TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error):TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+'<br />\n<br />\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">"',TcHmi.DialogManager.DialogSeverity.Error);else if(cmdErr.code===TcHmi.Server.Error.HMI_E_INSUFFICIENT_ACCESS)if(TCHMI_DESIGNER)connectState=5,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS,errDetail.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Insufficient_Access",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error);else{let bRecon=!1;if(0===__this.__lastConnectState&&window.localStorage)try{let lsReconCount=window.localStorage.getItem("TCHMI_SERVER_RECONNECT_COUNT"),nReconCount=0;lsReconCount&&(nReconCount=parseInt(lsReconCount,10)),nReconCount++,window.localStorage.setItem("TCHMI_SERVER_RECONNECT_COUNT",nReconCount.toString()),nReconCount<2&&(bRecon=!0)}catch(ex){}if(bRecon)window.location.reload();else{if(window.localStorage)try{window.localStorage.setItem("TCHMI_SERVER_RECONNECT_COUNT","0")}catch(ex){}connectState=5,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS,errDetail.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Insufficient_Access",{level:TcHmi.Locale.Level.Engineering})+'<br/>\n<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">"',TcHmi.DialogManager.DialogSeverity.Error)}}else connectState=2,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,errDetail.errors=[cmdErr],TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(cmdErr),TcHmi.DialogManager.DialogSeverity.Error)}else{let rv=commands[0].readValue;if(null==rv)connectState=1,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Response_Invalid",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Missing_ReadValue",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error);else switch(rv.STATE){case"Engineering":case"Demo":case"OK":connectState=3,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1,TcHmi.DialogManager.DialogType.Overlay);break;case"Unregistered":case"Pending":case"Error":connectState=6,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("License_State_Placeholder",{level:TcHmi.Locale.Level.Engineering}),rv.STATE),TcHmi.DialogManager.DialogSeverity.Error);break;default:connectState=6,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("License_State_Unknown_Placeholder",{level:TcHmi.Locale.Level.Engineering}),rv.STATE),TcHmi.DialogManager.DialogSeverity.Error)}}}}else if(connectState=1,errDetail.code=TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED,TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),data.error!==TcHmi.Errors.NONE){let details=data.details;details||(details={code:data.error,message:TcHmi.Errors[data.error]}),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.DialogManager.buildMessage(details),TcHmi.DialogManager.DialogSeverity.Error)}else TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_License_Check_Failed",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error);let result={error:errDetail.code,url:__this.__websocket?__this.__websocket.url:void 0,details:errDetail};if(errDetail.message=TcHmi.Errors[errDetail.code],errDetail.domain="TcHmi.System.ServerManager",callbackPending&&"function"==typeof callback&&"__TcHmiServerManager"===TcHmi.System.Services.dialogManager.getDialogOwner()&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!1),3===connectState){if(__this.__isInitialized=!0,__this.__cyclicReconnect=!0,window.localStorage)try{window.localStorage.setItem("TCHMI_SERVER_RECONNECT_COUNT","0")}catch(ex){}callbackPending&&(callbackPending=!1,0!==__this.__conWatcherIntervalId&&(window.clearInterval(__this.__conWatcherIntervalId),__this.__conWatcherIntervalId=0),__this.refreshSubscriptions((function(data){TcHmi.EventProvider.raise("onWebSocketOpened"),TcHmi.Callback.callSafeEx(callback,null,result),__this.__lastConnectState=connectState,0===__this.__symbolWatcherIntervalId&&(__this.__symbolWatcherStartTime=Date.now(),__this.__symbolWatcherIntervalId=window.setInterval(__this.symbolWatcherTick(),100))})))}else if(6===connectState){if(TCHMI_ENGINEERING){const now=Date.now();let isFirstReject=!1;0===__this.__firstAccessReject&&(isFirstReject=!0),__this.__lastConnectState!==connectState&&(__this.__firstAccessReject=now),isFirstReject&&0===__this.__firstAccessRejectTimeoutId?(__this.__firstAccessReject=0,__this.__firstAccessRejectTimeoutId=setTimeout(()=>{6===__this.__lastConnectState&&(callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),__this.__firstAccessRejectTimeoutId=0)},5e3)):now-__this.__firstAccessReject>5e3&&(__this.__firstAccessReject=0,0!==__this.__firstAccessRejectTimeoutId&&(clearTimeout(__this.__firstAccessRejectTimeoutId),__this.__firstAccessRejectTimeoutId=0),callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),callbackPending=!1)}else callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1),callbackPending=!1;__this.__lastConnectState=connectState}else __this.__lastConnectState=connectState,callbackPending&&(TcHmi.Callback.callSafeEx(callback,null,result),callbackPending=!1)})}}onWsClose(callback){let __this=this;return function(closeEvent){let bShowError=!1;__this.releaseRequest(__this.__checkLicenseSubscriptionId),__this.unwatchServerState(),!0===__this.__disabledCommunication||(closeEvent.code&&1e3!==closeEvent.code&&!closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+this.url+" was closed with code="+closeEvent.code+"."):closeEvent.code&&1e3!==closeEvent.code&&closeEvent.reason?TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+this.url+" was closed with code="+closeEvent.code+" and reason="+closeEvent.reason+"."):TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] WebSocket with url="+this.url+" was closed.")),3===__this.__lastConnectState&&(__this.__lastConnectState=0,!1===__this.__disabledCommunication&&(bShowError=!0,TCHMI_RUNTIME&&!1===__this.__serverStatePublishInProgress&&(TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Determining_Publish_Or_Failure",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("This_Will_Take_A_Few_Seconds",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Info)))),__this.__watchSymbolCache.forEach((function(ws,key){let callbacks=Array.from(ws.callbacks);for(let i=0,ii=callbacks.length;i<ii;i++){let callback=callbacks[i];TcHmi.Callback.callSafeEx(callback.callback,__this,{error:TcHmi.Errors.E_WEBSOCKET_CLOSED,details:{code:TcHmi.Errors.E_WEBSOCKET_CLOSED,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_CLOSED],reason:"The underlying websocket was closed.",domain:"TcHmi.System.ServerManager"}}),callback.dirty=!0}ws.reqId=null}));let removeableRequestCacheEntries=[];if(__this.__requestCache.forEach((function(req,id){clearTimeout(req.timeoutTimer);let callbacks=Array.from(req.callbacks);for(let i=0,ii=callbacks.length;i<ii;i++){let callback=callbacks[i];TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_WEBSOCKET_CLOSED,details:{code:TcHmi.Errors.E_WEBSOCKET_CLOSED,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_CLOSED],reason:"The underlying websocket was closed.",domain:"TcHmi.System.ServerManager"}})}(200!==req.type||200===req.type&&!0===req.managed)&&removeableRequestCacheEntries.push(req)})),removeableRequestCacheEntries.forEach((function(req,index,array){__this.unregisterRequest(req.id)})),TcHmi.EventProvider.raise("onWebSocketClosed"),__this.__isInitialized=!1,TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,url:this.url}),__this.__websocket=void 0,!__this.__disabledCommunication){const processServerStateResult=data=>{bShowError&&!__this.__serverStatePublishInProgress&&(465===__this.__serverStateLastErrorStatus?(TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Forced_Logout_Client_Limit_exceeded",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Reloading_When_Client_License_Available",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),data.error!==TcHmi.Errors.NONE&&__this.watchServerState()):460===__this.__serverStateLastErrorStatus?(TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("License_Expired",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Possible_Reasons",{level:TcHmi.Locale.Level.Engineering})+":<br />- "+TcHmi.System.Services.localization.getText("Forced_Logout_By_Server",{level:TcHmi.Locale.Level.Engineering})+"<br />"+TcHmi.System.Services.localization.getText("Reloading_When_Client_License_Available",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),data.error!==TcHmi.Errors.NONE&&__this.watchServerState()):(TcHmi.Engineering.ErrorPane.add("E_SERVER_CONNECTION_LOST",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Connection_In_Progresss",{level:TcHmi.Locale.Level.Engineering}),TcHmi.Engineering.ErrorPane.MessageType.Error),TcHmi.System.Services.dialogManager.updateText("__TcHmiServerManager",TcHmi.System.Services.localization.getText("Server_Connection_Lost",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Connection_In_Progresss",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Services.dialogManager.showDialog("__TcHmiServerManager",!0,TcHmi.DialogManager.DialogType.Overlay),!0===__this.__cyclicReconnect&&0===__this.__conWatcherIntervalId&&(__this.__conWatcherIntervalId=window.setInterval(__this.conWatcherTick(),ServerManager.RECONNECT_INTERVAL)))),data.error===TcHmi.Errors.NONE&&__this.watchServerState()};__this.resolveHandleServerState(data=>{processServerStateResult(data)})}}}onWsMessage(){let __this=this;return function(messageEvent){let response=TcHmi.ValueConverter.toObject(messageEvent.data,null);if(!0===TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.ServerManager] Response from TwinCAT HMI Server:",{response:response}),null==response)return;if(void 0===response.id||null===response.id)return;let request=__this.getRequest(response.id);request&&(0!==request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),TcHmi.Callback.callSafeEx(request.responseCallback,__this,{error:TcHmi.Errors.NONE,response:response}))}}conWatcherTick(){return()=>{!0===this.__cyclicReconnect&&void 0===this.__websocket&&this.open()}}open(callback){if(!this.__websocket){const dynUri=this.__websocketProtocol+"//"+this.__serverHost+":"+this.__serverPort;try{this.__websocket=new WebSocket(dynUri)}catch(ex){return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Opening connection to Hmi Webserver failed!"))}this.__websocket.onopen=this.onWsOpen(callback),this.__websocket.onclose=this.onWsClose(callback),this.__websocket.onmessage=this.onWsMessage()}}__close(){this.__websocket&&(this.__websocket.close(1e3),this.__websocket=void 0)}close(){this.__websocket&&(0!==this.__conWatcherIntervalId&&(window.clearInterval(this.__conWatcherIntervalId),this.__conWatcherIntervalId=0),this.__close())}requestQueueHasPendingRequest(){return!!this.__requestPending}requestQueueDone(request){request&&this.__requestPending&&this.__requestPending.id===request.id&&(this.__requestPending.pending=!1,this.__requestPending.queued=!1,this.__requestPending=null,this.requestQueueNext())}requestQueueAdd(request){this.__requestQueue.push(request),request.queued=!0,!1===this.requestQueueHasPendingRequest()&&this.requestQueueNext()}requestQueueRemove(request){let pos=-1;for(let i=0,ii=this.__requestQueue.length;i<ii;i++){if(this.__requestQueue[i].id===request.id){pos=i;break}}pos>=0&&this.__requestQueue.splice(pos,1),this.requestQueueDone(request)}requestQueueNext(){if(!this.__websocket)return;let request=this.__requestQueue.shift();request&&(request.pending=!0,this.__requestPending=request,this.__websocket.send(JSON.stringify(request.message)))}getFreeRequestId(){let res=0,loopcount=0;do{if(res=0,loopcount++,loopcount>=1e6){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Reached maxium of parallel requests."),res=null;break}this.__requestIdCount++,this.__requestIdCount>=1e6&&(this.__requestIdCount=1),res=this.__requestIdCount}while(this.__requestCache.has(res));return res}setServerAddress(host,port,protocol){host&&(this.__serverHost=host),port&&(this.__serverPort=port.toString()),protocol&&("http:"===protocol?(this.__serverProtocol=protocol,this.__websocketProtocol="ws:"):"https:"===protocol&&(this.__serverProtocol=protocol,this.__websocketProtocol="wss:"))}getRequest(id){if(null!==id)return this.__requestCache.get(id)}registerRequest(id,type,message){if(this.__requestCache.has(id))return null;let req={id:id,type:type,message:message,deletionPending:!1,timeoutCallback:null,timeoutTimer:0,timeout:null,interval:null,callbacks:[],responseCallback:null,queued:!1,pending:!1,managed:!1};return this.__requestCache.set(id,req),req}unregisterRequest(id){if(null===id)return;let request=this.__requestCache.get(id);request&&(0!==request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),this.requestQueueRemove(request),this.__requestCache.delete(id))}registerRequestCallback(reqId,callback){let request=this.__requestCache.get(reqId);request&&request.callbacks.push(callback)}unregisterRequestCallback(reqId,callback){let request=this.__requestCache.get(reqId);if(request){let pos=request.callbacks.indexOf(callback);pos>-1&&request.callbacks.splice(pos,1)}}registerEventCallback(reqId,callback){let __this=this,request=this.registerRequest(reqId,300);return request?(request.responseCallback=function(data){request&&TcHmi.System.Callback.callSafeCallbacks1Param(request.callbacks,__this,{error:TcHmi.Errors.NONE,response:data.response})},this.registerRequestCallback(reqId,callback),reqId):null}symbolWatcherTick(){let __this=this;return function(){if(!0===__this.__isInitialized&&void 0!==__this.__websocket&&null!==__this.__websocket&&__this.__websocket.readyState===WebSocket.OPEN&&Date.now()-__this.__symbolWatcherStartTime>250){1===__this.refreshSymbolWatcher()&&0!==__this.__symbolWatcherIntervalId&&(window.clearInterval(__this.__symbolWatcherIntervalId),__this.__symbolWatcherIntervalId=0)}}}refreshSymbolWatcher(){let __this=this,error=!1,toUnsubscribe=[],toSubscribeEntries=new Map,ws=this.__watchSymbolCache;if(ws.forEach((function(s,key){null!==s.reqId&&toUnsubscribe.lastIndexOf(s.reqId)<0&&(toUnsubscribe.push(s.reqId),s.reqId=null),0===s.refs?ws.delete(key):toSubscribeEntries.get(key)||toSubscribeEntries.set(key,s)})),toUnsubscribe.length>0){let requestObj={requestType:"ReadWrite",commands:[]};for(let i=0,ii=toUnsubscribe.length;i<ii;i++){let reqId=toUnsubscribe[i];requestObj.commands.push({commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:reqId}),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] Unsubscribing request with id="+reqId+".")}this.request(requestObj,(function(data){let response=data.response;if(void 0===response)return;response.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error. "+TcHmi.Log.buildMessage(response.error));let commands=response.commands;if(null!=commands)for(let i=0,ii=commands.length;i<ii;i++){let command=commands[i];null!=command&&(void 0!==command.error&&null!==command.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error for unsubscribe id="+command.writeValue+". ",TcHmi.Log.buildMessage(command.error)),void 0!==command.writeValue&&null!==command.writeValue&&__this.releaseRequest(command.writeValue))}}))}let toSubscribeMessages=new Map;if(toSubscribeEntries.forEach((function(entry){var _a;let keyToSubscribeMessage="";null===entry.interval?keyToSubscribeMessage+="GLOBAL":keyToSubscribeMessage+=entry.interval,keyToSubscribeMessage+="_",null===entry.timeout?keyToSubscribeMessage+="GLOBAL":keyToSubscribeMessage+=entry.timeout;let toSubscribeMessage=toSubscribeMessages.get(keyToSubscribeMessage),reqId=__this.getFreeRequestId();if(reqId){toSubscribeMessage?entry.reqId=null!==(_a=toSubscribeMessage.message.id)&&void 0!==_a?_a:null:(entry.reqId=reqId,toSubscribeMessage={interval:entry.interval,timeout:entry.timeout,watchEntries:[],message:{requestType:"Subscription",id:reqId,commands:[]}},null!==entry.interval&&(toSubscribeMessage.message.intervalTime=entry.interval)),toSubscribeMessage.watchEntries.push(entry);let nSubCmds=toSubscribeMessage.message.commands;if(!nSubCmds)return void(error=!0);let bCreate=!0;for(let i=0,ii=nSubCmds.length;i<ii;i++){let nSubCmd=nSubCmds[i];if(nSubCmd.symbol===entry.name&&tchmi_equal(nSubCmd.commandOptions,entry.options)){bCreate=!1;break}}bCreate&&(nSubCmds.push({commandOptions:entry.options,symbol:entry.name}),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.ServerManager] Subscribing symbol "+entry.name+" in request id="+reqId+".")),toSubscribeMessages.set(keyToSubscribeMessage,toSubscribeMessage)}else error=!0})),error)return 0;return toSubscribeMessages.forEach((function(message,key){!function(m){for(let i=0,ii=m.watchEntries.length;i<ii;i++){let watchEntry=m.watchEntries[i];for(let j=0,jj=watchEntry.callbacks.length;j<jj;j++){let watchEntryCallback=watchEntry.callbacks[j];!1===watchEntryCallback.dirty&&(watchEntryCallback.refreshLock=!0)}}let request=__this.getRequest(__this.request(m.message,(function(data){if(data.error===TcHmi.Errors.NONE){let response=data.response;response.error&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.ServerManager] Server responds with error: "+TcHmi.Log.buildMessage(response.error));for(let command of response.commands){if(!command)continue;let watchEntryId=command.symbol;null===m.interval?watchEntryId+="_GLOBAL":watchEntryId+="_"+m.interval,null===m.timeout?watchEntryId+="_GLOBAL":watchEntryId+="_"+m.timeout,command.commandOptions&&command.commandOptions.indexOf("Poll")>-1?watchEntryId+="_POLL":watchEntryId+="_GLOBAL";let watchEntry=__this.__watchSymbolCache.get(watchEntryId);if(!watchEntry)continue;if(void 0!==command.error){let res={error:TcHmi.Errors.E_SERVER_COMMAND_ERROR,details:{code:TcHmi.Errors.E_SERVER_COMMAND_ERROR,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMAND_ERROR],domain:"TcHmi.System.ServerManager",reason:command.symbol,errors:[command.error]}};response&&(res.response=response),command.processedStart&&(res.processedStart=command.processedStart),command.processedEnd&&(res.processedEnd=command.processedEnd),TcHmi.System.ServerManager.__callSymbolWatchEntryCallbacks(watchEntry.callbacks,__this,res);continue}if(void 0===command.readValue)continue;let hasChanged=!tchmi_equal(watchEntry.value,command.readValue);watchEntry.value=command.readValue,command.processedStart&&(watchEntry.processedStart=command.processedStart),command.processedEnd&&(watchEntry.processedEnd=command.processedEnd);let callbackList=[];for(let i=0,ii=watchEntry.callbacks.length;i<ii;i++){let wecb=watchEntry.callbacks[i];callbackList.push(wecb)}for(let innerCallback of callbackList)if(-1!==watchEntry.callbacks.indexOf(innerCallback))if(!1===innerCallback.refreshLock||!0===hasChanged){innerCallback.refreshLock=!1,innerCallback.dirty=!1;let res={error:TcHmi.Errors.NONE,destroy:innerCallback.destroy,value:tchmi_clone_object(watchEntry.value)};response&&(res.response=response),watchEntry.processedStart&&(res.processedStart=watchEntry.processedStart),watchEntry.processedEnd&&(res.processedEnd=watchEntry.processedEnd),TcHmi.Callback.callSafeEx(innerCallback.callback,__this,res)}else innerCallback.refreshLock=!1}}else for(let i=0,ii=m.watchEntries.length;i<ii;i++)TcHmi.System.ServerManager.__callSymbolWatchEntryCallbacks(m.watchEntries[i].callbacks,__this,{error:data.error,details:data.details})})));request&&(request.managed=!0)}(message)})),error?0:1}watch(expression,callback){if(null==expression)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No expression given.",domain:"TcHmi.System.ServerManager"}}),function(){};if(expression.getType()!==TcHmi.SymbolType.Server)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No valid expression given. Needs server symbol expression",domain:"TcHmi.System.ServerManager"}}),function(){};if(null==callback||"function"!=typeof callback)return function(){};let name=expression.getName();if(!name)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No valid expression given. Needs valid server symbol expression",domain:"TcHmi.System.ServerManager"}}),function(){};let options=expression.getOptions(),interval=options.Interval?options.Interval:null,timeout=options.Timeout?options.Timeout:null,__this=this,watchEntryOptions=[];watchEntryOptions.push("SendErrorMessage");let watchEntryId=name;watchEntryId+=null===interval?"_GLOBAL":"_"+interval,watchEntryId+=null===timeout?"_GLOBAL":"_"+timeout,options.SubscriptionMode&&"Poll"===options.SubscriptionMode||"Poll"===TcHmi.System.config.tcHmiServer.websocketSubscriptionMode?(watchEntryId+="_POLL",watchEntryOptions.push("Poll")):watchEntryId+="_GLOBAL";let watchEntry=this.__watchSymbolCache.get(watchEntryId),destroy=function(){let refresh=!1;if(watchEntry){watchEntry.refs--;let index=-1;for(let i=0,ii=watchEntry.callbacks.length;i<ii;i++)if(watchEntry.callbacks[i].callback===callback){index=i;break}index>-1&&watchEntry.callbacks.splice(index,1),0===watchEntry.refs&&(refresh=!0)}refresh&&0===__this.__symbolWatcherIntervalId&&(__this.__symbolWatcherStartTime=Date.now(),__this.__symbolWatcherIntervalId=window.setInterval(__this.symbolWatcherTick(),100))};return watchEntry?(watchEntry.callbacks.push({callback:callback,dirty:!0,refreshLock:!1,destroy:destroy}),watchEntry.refs++):(watchEntry={reqId:null,name:name,interval:interval,timeout:timeout,refs:1,value:null,options:watchEntryOptions,callbacks:[{callback:callback,dirty:!0,refreshLock:!1,destroy:destroy}]},this.__watchSymbolCache.set(watchEntryId,watchEntry)),0===this.__symbolWatcherIntervalId&&(this.__symbolWatcherStartTime=Date.now(),this.__symbolWatcherIntervalId=window.setInterval(this.symbolWatcherTick(),100)),destroy}request(requestObj,callback){return this.requestEx(requestObj,null,callback)}requestEx(requestObj,options,callback){var _a,_b;let __this=this;if(!(requestObj=tchmi_clone_object(requestObj)))return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"No request given",domain:"TcHmi.System.ServerManager"}}),null;if(options&&(System.isParameterTypeInvalid(options.parallel,"options.parallel",{type:"boolean",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)||System.isParameterTypeInvalid(options.refresh,"options.refresh",{type:"boolean",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)||System.isParameterTypeInvalid(options.timeout,"options.timeout",{type:"number",required:"undefinedOk"},"TcHmi.System.ServerManager",callback)))return null;if(void 0===requestObj.id||null===requestObj.id){const newId=this.getFreeRequestId();if(null===newId)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"No request id could be generated",domain:"TcHmi.System.ServerManager"}}),null;requestObj.id=newId}if(this.__websocket&&this.__websocket.readyState!==WebSocket.CLOSING&&this.__websocket.readyState!==WebSocket.CLOSED&&this.__websocket.readyState!==WebSocket.CONNECTING){let request,queue=!1,type=0;switch(requestObj.requestType){case"ReadWrite":type=100,queue=!options||!0!==options.parallel;break;case"Subscription":type=200,queue=!options||!0!==options.parallel;break;case"Event":type=300,queue=!1}if(request=options&&!0===options.refresh?this.getRequest(requestObj.id):this.registerRequest(requestObj.id,type,requestObj),!request)return TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"A request with the same id: '"+requestObj.id+"' is already in progress.",domain:"TcHmi.System.ServerManager"}}),null;"function"==typeof callback&&this.registerRequestCallback(requestObj.id,callback),!0===TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES&&TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.ServerManager] Request to TwinCAT HMI Server:",{requestObj:requestObj}),"Subscription"===requestObj.requestType&&(null!==(_a=requestObj.intervalTime)&&void 0!==_a||(requestObj.intervalTime=TcHmi.System.config.tcHmiServer.websocketIntervalTime),request.interval=requestObj.intervalTime),request.timeout=null!==(_b=null==options?void 0:options.timeout)&&void 0!==_b?_b:TcHmi.System.config.tcHmiServer.websocketTimeout,request.timeoutCallback=function(){request&&(TcHmi.Callback.callSafeEx(callback,__this,{error:TcHmi.Errors.E_TIMEOUT,details:{code:TcHmi.Errors.E_TIMEOUT,message:TcHmi.Errors[TcHmi.Errors.E_TIMEOUT],domain:"TcHmi.System.ServerManager",reason:'Request with id: "'+request.id+'" does not respond within expected time.'}}),request.queued&&__this.requestQueueDone(request),__this.releaseRequest(request.id))},request.responseCallback=function(data){request&&(TcHmi.System.Callback.callSafeCallbacks1Param(request.callbacks,__this,{error:TcHmi.Errors.NONE,response:data.response}),request.queued&&__this.requestQueueDone(request),200!==request.type&&__this.releaseRequest(request.id))},request.timeoutTimer=setTimeout((function(){request&&TcHmi.Callback.callSafeEx(request.timeoutCallback,__this)}),request.timeout),queue?this.requestQueueAdd(request):this.__websocket.send(JSON.stringify(request.message))}else TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.E_WEBSOCKET_NOT_READY,details:{code:TcHmi.Errors.E_WEBSOCKET_NOT_READY,message:TcHmi.Errors[TcHmi.Errors.E_WEBSOCKET_NOT_READY],domain:"TcHmi.System.ServerManager"}});return requestObj.id}releaseRequest(id){this.unregisterRequest(id)}getWebsocketReadyState(){var _a,_b;return null!==(_b=null===(_a=this.__websocket)||void 0===_a?void 0:_a.readyState)&&void 0!==_b?_b:null}login(username,password,persistent=!0,reload=!0,options,callback){const message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Login",writeValue:{userName:username,password:password,persistent:persistent}}]};return TcHmi.System.Services.accessManager.unsubscribe(data=>{TcHmi.System.Services.accessManager.enableReload(reload),System.Services.serverManager.requestEx(message,options,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.System.Services.accessManager.subscribe(()=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})})},success:data=>{TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("Login successful with username: "+data.response.commands[0].writeValue.userName);let cookieName="sessionId";data.response.serverId&&(cookieName+="-"+data.response.serverId,document.cookie="sessionId=; expires=Thu, 01 Jan 1970 00:00:00 GMT"),document.cookie=cookieName+"="+data.response.sessionId+"; path=/",reload&&window.location.reload(),TcHmi.System.Services.accessManager.subscribe(()=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})})}}))}),!0}logout(reload=!0,options,callback){return TcHmi.System.Services.accessManager.unsubscribe(data=>{TcHmi.System.Services.accessManager.enableReload(reload);System.Services.serverManager.requestEx({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Logout"}]},options,TcHmi.Server.__handleServerResponse({error:data=>{TcHmi.System.Services.accessManager.subscribe(()=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})})},success:data=>{reload?window.location.reload():TcHmi.System.Services.accessManager.subscribe(data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})})}}))}),!0}forceLogout(username,options,callback){const message={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ForceLogout",writeValue:username}]};return System.Services.serverManager.requestEx(message,options,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}})),!0}refreshSubscription(request,callback){this.request({requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"Unsubscribe",writeValue:request.id}]},data=>{request.message?(null===request.interval&&delete request.message.intervalTime,null===request.timeout&&request.timeoutTimer&&(clearTimeout(request.timeoutTimer),request.timeoutTimer=0),this.requestEx(request.message,{refresh:!0},data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})})):TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"No message found for refreshSubscription",domain:"TcHmi.System.ServerManager"}})})}refreshSubscriptions(callback){let pending=0,finalize=()=>{0===pending&&TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})};this.__requestCache.forEach((request,id)=>{200===request.type&&(pending++,this.refreshSubscription(request,data=>{pending--,finalize()}))}),finalize()}static __callSymbolWatchEntryCallbacks(callbacks,thisArg,data){let callbackList=[];for(let i=0,ii=callbacks.length;i<ii;i++)callbackList.push(callbacks[i]);for(let innerCallback of callbackList)-1!==callbacks.indexOf(innerCallback)&&TcHmi.Callback.callSafeEx(innerCallback.callback,thisArg,data)}}ServerManager.RECONNECT_INTERVAL=5e3,System.ServerManager=ServerManager}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.ServerEventManager=class{constructor(){this.__subscriptions=new TcHmi.List}confirmAlarm(alarm,callback){let reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ConfirmAlarm",writeValue:alarm}]};TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,this,{error:TcHmi.Errors.NONE})}}))}listEvents(filter,callback){const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"ListEvents"}]};filter&&(reqObj.commands[0].filter=filter),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,this,{error:data.error,details:data.details})},success:data=>{setTimeout(()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,events:data.results[0].value})})}}))}subscribe(filter,eventCallback,doneCallback){const responseId=TcHmi.System.Services.serverManager.getFreeRequestId();if(!responseId)return TcHmi.Callback.callSafeEx(eventCallback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.ServerEventManager",reason:"Reached maxium of parallel requests."}}),responseId;const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"SubscribeEvents",writeValue:responseId}]};filter&&(reqObj.commands[0].filter=filter);let subscription={responseId:responseId,callback:eventCallback};return this.__subscriptions.push(subscription),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{let res;res=data.error===TcHmi.Errors.NONE&&data.results?{error:data.results[0].error,details:data.results[0].details}:{error:data.error,details:data.details},TcHmi.Callback.callSafeEx(eventCallback,null,res),TcHmi.Callback.callSafeEx(doneCallback,null,res)},success:data=>{let callbackId=TcHmi.System.Services.serverManager.registerEventCallback(responseId,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(eventCallback,this,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(eventCallback,this,{error:data.error,details:data.details})},success:data=>{setTimeout(()=>{TcHmi.Callback.callSafeEx(eventCallback,null,{error:TcHmi.Errors.NONE,event:data.results[0].value})})}})),result={error:TcHmi.Errors.NONE};null===callbackId&&(result={error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.ServerEventManager",reason:"Internal Error: Multiple callbacks registered to request id "+responseId}},TcHmi.Callback.callSafeEx(eventCallback,null,result)),TcHmi.Callback.callSafeEx(doneCallback,null,result)}})),responseId}unsubscribe(id,callback){const subscription=this.__subscriptions.firstOrDefault(item=>item.responseId===id);if(null!==subscription){const reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"UnsubscribeEvents",writeValue:subscription.responseId}]};TcHmi.System.Services.serverManager.releaseRequest(subscription.responseId),this.__subscriptions.remove(subscription),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Failed unsubscribe because no event subscription with the given id ${id} exists`,domain:"TcHmi.System.ServerEventManager"}})}updateSubscription(id,filter,callback){const subscription=this.__subscriptions.firstOrDefault(item=>item.responseId===id);if(null!==subscription){let reqObj={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","SendWriteValue"],symbol:"UpdateEventsSubscription",writeValue:subscription.responseId}]};filter&&(reqObj.commands[0].filter=filter),TcHmi.System.Services.serverManager.request(reqObj,TcHmi.Server.__handleServerResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}else TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:`Failed update the subscription because no event subscription with the given id ${id} exists`,domain:"TcHmi.System.ServerEventManager"}})}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){let System;!function(System){System.TriggerManager=class{constructor(){this.__triggerMap=new Map}__resolveValue(ctx,v){if(v)switch(v.objectType){case"StaticValue":let value=v.value;ctx.success(value);break;case"Symbol":if(!v.symbolExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"An symbolExpression of a WriteToSymbol must not be empty, null or undefined.",domain:"TcHmi.System.TriggerManager"});try{let s=new System.Symbol(v.symbolExpression);s.read((function(data){data.error===TcHmi.Errors.NONE?ctx.success(data.value):ctx.error(data.error,data.details),null==s||s.destroy(),s=null}))}catch(e){ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],exception:e,reason:"An uncaught exception occurred while reading symbolExpression "+v.symbolExpression+" of a WriteToSymbol.",domain:"TcHmi.System.TriggerManager"})}break;case"FunctionExpression":if(TcHmi.IFunction.isFunctionExpression(v)){let func=new System.FunctionExpression(v.functionExpression);try{let bContextLock=!1;func.execute({success:function(result){bContextLock||(bContextLock=!0,ctx.success(result),func.destroy())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details),func.destroy())}})}catch(e){ctx.error(TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_FUNCTION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred while executing FunctionExpression "+v.functionExpression,exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],domain:"TcHmi.System.TriggerManager"});break;default:ctx.error(TcHmi.Errors.E_NOT_SUPPORTED,{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],domain:"TcHmi.System.TriggerManager"})}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"An object of type: 'IFunction.Value' must not be null or undefined.",domain:"TcHmi.System.TriggerManager"})}__resolveValueAsArray(ctx,values){let res=[];if(!values||0===values.length)return void ctx.success(res);let l=values.length,c=0,__this=this,proc=function(){let value=values[c],bContextLock=!1;__this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,res.push(result),c===l-1?ctx.success(res):(c++,proc()))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},value)};proc()}__resolveConditionExpressionsResult(ctx,expressions){let __this=this,hasError=!1,results=[],pendingExpressionCompares=2*expressions.length,resolveExpressionCompareResult=function(resultObject,compareName){let bContextLock=!1;__this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,hasError||(resultObject.result[compareName]=result,pendingExpressionCompares--,0===pendingExpressionCompares&&function(){let sEval="";sEval+="(";for(let i=0,ii=results.length;i<ii;i++)null!==results[i].expression.logic&&"OR"!==results[i].expression.logic||(sEval+="("),"=="===results[i].expression.compareOperator||"==="===results[i].expression.compareOperator?(sEval+="tchmi_equal(",sEval+="results["+i+"].result.compare1",sEval+=",",sEval+="results["+i+"].result.compare2",sEval+=",false)"):"!="===results[i].expression.compareOperator||"!=="===results[i].expression.compareOperator?(sEval+="!tchmi_equal(",sEval+="results["+i+"].result.compare1",sEval+=",",sEval+="results["+i+"].result.compare2",sEval+=",false)"):(sEval+="(",sEval+="results["+i+"].result.compare1",sEval+=results[i].expression.compareOperator,sEval+="results["+i+"].result.compare2",sEval+=")"),void 0!==results[i+1]?"AND"===results[i+1].expression.logic?sEval+=" && ":"OR"===results[i+1].expression.logic&&(sEval+=") || "):sEval+=")";sEval+=")",sEval+="\n//# sourceURL=TcHmi_System_TriggerManager_ConditionExpressionsResult_Eval";let res=!1;try{res=gIsolatedEval_TcHmi_System_TriggerManager_ConditionExpressionsResult(sEval,results)}catch(e){ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the processing of "+sEval.toString(),exception:e,domain:"TcHmi.System.TriggerManager"})}ctx.success(res)}()))},error:function(error,details){bContextLock||(bContextLock=!0,hasError=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},resultObject.expression[compareName])};for(let i=0,ii=expressions.length;i<ii&&!hasError;i++){let resultObject={expression:expressions[i],result:{compare1:void 0,compare2:void 0}};results[i]=resultObject,resolveExpressionCompareResult(resultObject,"compare1"),resolveExpressionCompareResult(resultObject,"compare2")}}__taControlApiFunction(ctx,action,diagGUID){TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taControlApiFunction called with:",{ctx:ctx,action:action});let f=action;const control=f.control,fn=f.fn;if(null==control)throw new Error("Property: 'control' is missing in object of type: 'TcHmi.Trigger.ControlApiFunction'.");if(null==fn)throw new Error("Property: 'fn' is missing in object of type: 'TcHmi.Trigger.ControlApiFunction'.");let tco=null,isSymbolExpression=TcHmi.Symbol.isSymbolExpression(f.control),isSymbolExpressionEscaped=TcHmi.Symbol.isSymbolExpressionEscaped(f.control);if(isSymbolExpression&&!isSymbolExpressionEscaped){let se=new TcHmi.SymbolExpression(f.control);tco=TcHmi.Controls.get(se.getName())}else tco=TcHmi.Controls.get(f.control);if(null==tco)throw new Error("Can't find instance of control width id: '"+control+"'.");let descr=TcHmi.System.Services.controlManager.getDescription(tco.getType());if(!descr)throw new Error("Can't find description for control type: '"+tco.getType()+"'.");let funcObj=tco[fn];if("function"!=typeof funcObj)throw new Error("Can't find function with name: '"+fn+"' in instance of control with id: '"+control+"'.");let fnDescr=null;if(descr.inheritedFunctions)for(let i=0,ii=descr.inheritedFunctions.length;i<ii;i++){let descrFunction=descr.inheritedFunctions[i];if(descrFunction.name===fn){fnDescr=descrFunction;break}}if(!fnDescr)throw new Error("Can't find description of function: '"+fn+"' in description of control type: '"+tco.getType()+"'.");let bContextLock=!1;this.__resolveValueAsArray({success:function(result){if(bContextLock)return;bContextLock=!0;let res,process=!0,wait=!1,params=[];if(fnDescr&&!0===fnDescr.injectContextObject)if("Asynchronous"===fnDescr.waitMode){wait=!0;let bContextLock2=!1;params.push({success:result=>{bContextLock2||(bContextLock2=!0,process&&ctx.success(result))},error:(error,details)=>{bContextLock2||(bContextLock2=!0,process&&ctx.error(error,details))}})}else params.push({});params.push(...result);try{res=funcObj.call(tco,...params)}catch(e){process=!1,ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the control function of "+(null==tco?void 0:tco.getId())+"."+action.fn,exception:e,domain:"TcHmi.System.TriggerManager"})}!1===wait&&process&&ctx.success(res)},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},f.fnParams)}__taWriteToSymbol(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taWriteToSymbol called with:",{ctx:ctx,action:action}),!action.symbolExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"An symbolExpression of a WriteToSymbol must not be empty, null or undefined.",domain:"TcHmi.System.TriggerManager"});let bContextLock=!1;this.__resolveValue({success:function(result){if(bContextLock)return;bContextLock=!0;let s=new TcHmi.System.Symbol(action.symbolExpression);s.write(result,(function(data){data.error===TcHmi.Errors.NONE?ctx.success():ctx.error(data.error,data.details),null==s||s.destroy(),s=null}))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},action.value)}__taFunction(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taFunction called with:",{ctx:ctx,action:action}),null==action)return;let def={objectType:"Function",active:action.active,fn:action.fn,fnParams:action.fnParams},f=new TcHmi.Function(def);f.executeEx(void 0,(function(data){data.error===TcHmi.Errors.NONE?ctx.success(data.result):ctx.error(data.error,data.details),f.destroy()}))}__taActionTemplate(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taActionTemplate called with:",{ctx:ctx,action:action}),null!=action){let tn=action.templateName;if(null==tn||""===tn||"string"!=typeof tn)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Pproperty: 'templateName' in object of type 'TcHmi.Trigger.ActionTemplate' is invalid. Value must be a valid string with a length of at least one character.",domain:"TcHmi.System.TriggerManager"});if(void 0===System.config||null===System.config)return void ctx.error(TcHmi.Errors.E_INVALID,{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:"TcHmi.System.config is not a valid object of type: 'IConfig'.",domain:"TcHmi.System.TriggerManager"});let at=null;for(let i=0,ii=System.config.actionTemplates.length;i<ii&&(at=System.config.actionTemplates[i],at.name!==tn);i++)at=null;if(null===at)return void ctx.error(TcHmi.Errors.E_INVALID,{code:TcHmi.Errors.E_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_INVALID],reason:"Can't find action template with name: '"+tn+"' in configuration. Please check tchmiconfig.json.",domain:"TcHmi.System.TriggerManager"});const iGuid=tchmi_create_guid();let hasError=!1,params=at.parameters;const cleanUpParams=function(){if(params&&params.length)for(let i=0,ii=params.length;i<ii;i++){let p=params[i];if(!p.name)continue;let name=iGuid+"."+p.name;TcHmi.System.Services.templateParamSymbolManager.keepAlive(name)||TcHmi.System.Services.templateParamSymbolManager.remove(name)}};let fnParams=action.fnParams;for(let i=0,ii=params.length;i<ii;i++){let p=params[i];if(!p.name)continue;let name=iGuid+"."+p.name,fnParam=fnParams[i];if(TcHmi.IFunction.isSymbol(fnParam)){let expression;try{expression=new TcHmi.SymbolExpression(fnParam.symbolExpression)}catch(e){ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Property: 'symbolExpression' in object of type 'TcHmi.Trigger.ActionTemplate' with templateName: '"+action.templateName+"' is no valid symbol expression. Processing will be aborted.",exception:e,domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}TcHmi.System.Services.templateParamSymbolManager.add(name,p.type,expression)}else{if(!TcHmi.IFunction.isStaticValue(fnParam)){if(fnParam){ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown objectType: '"+fnParam.objectType+"' in parameter in property: 'fnParam' in object of type 'TcHmi.Trigger.ActionTemplate' with templateName: '"+action.templateName+"'. Supported objectTypes are 'Symbol' and 'StaticValue'. Processing will be aborted.",domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Missing property: 'fnParam' in object of type 'TcHmi.Trigger.ActionTemplate' with templateName: '"+action.templateName+"'. Processing will be aborted.",domain:"TcHmi.System.TriggerManager"}),hasError=!0;break}TcHmi.System.Services.templateParamSymbolManager.add(name,p.type,fnParam.value)}}if(hasError)ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"}),cleanUpParams();else{let aCloneString=JSON.stringify(at.actions);for(let i=0,ii=params.length;i<ii;i++){let p=params[i];p.name&&(aCloneString=aCloneString.replace(new RegExp(tchmi_escape_regex("%tp%"+p.name),"g"),"%tp%"+iGuid+"."+p.name))}let aClone=TcHmi.ValueConverter.toObject(aCloneString);if(null===aClone)ctx.error(TcHmi.Errors.ERROR,{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Failed to reparse json for scoped action in action template.",domain:"TcHmi.System.TriggerManager"});else try{let bContextLock=!1;this.__processActionList({success:function(result){bContextLock||(bContextLock=!0,ctx.success(),cleanUpParams())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details),cleanUpParams())},trigger:ctx.trigger,event:ctx.event},aClone,diagGUID)}catch(e){ctx.error(TcHmi.Errors.E_EXCEPTION,{code:TcHmi.Errors.E_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_EXCEPTION],reason:"An uncaught exception occurred in the processing of the "+action.templateName,exception:e,domain:"TcHmi.System.TriggerManager"})}}}}__taFunctionExpression(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taFunctionExpression called with action:",{ctx:ctx,action:action}),!TcHmi.Trigger.isFunctionExpression(action))return;if(!action.functionExpression)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"functionExpression was empty",domain:"TcHmi.System.TriggerManager"});let func=new System.FunctionExpression(action.functionExpression),bContextLock=!1;func.execute({success:function(result){bContextLock||(bContextLock=!0,ctx.success(result))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))}})}__taJavaScript(ctx,action,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taJavaScript called with:",{ctx:ctx,action:action}),!TcHmi.Trigger.isJavaScript(action))return;let sEval="",sl=action.sourceLines;if(Array.isArray(sl)){for(let i=0,ii=sl.length;i<ii;i++)sEval+=tchmi_decode_control_characters(sl[i])+"\n";sEval+="\n//# sourceURL=TcHmi_System_TriggerManager___taJavaScript_Eval";try{let bContextLock=!1;gIsolatedEval_TcHmi_System_TriggerManager_JavaScriptAction({success:function(){bContextLock||(bContextLock=!0,"Asynchronous"===action.waitMode&&ctx.success())},error:function(error,details){bContextLock||(bContextLock=!0,"Asynchronous"===action.waitMode&&ctx.error(error,details))}},sEval),"Asynchronous"!==action.waitMode&&ctx.success()}catch(e){"Asynchronous"!==action.waitMode&&ctx.error(TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_JAVASCRIPT_EVAL_EXCEPTION],reason:"An uncaught exception occurred in the processing of a JavaScript action",exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Invalid property: 'sourceLines' in obect of type 'TcHmi.Trigger.JavaScript'. Expected an array of strings.",domain:"TcHmi.System.TriggerManager"})}__taCondition(ctx,condition,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taCondition called with:",{ctx:ctx,condition:condition}),!condition)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Object of type 'TcHmi.Trigger.Condition' must not be null or undefined.",domain:"TcHmi.System.TriggerManager"});let parts=condition.parts;if(!parts)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Object of type 'TcHmi.Trigger.Condition' requires at least a property with name \"part\" which is an array with one object which contains a property named 'if' with a value of type 'TcHmi.Trigger.Expression'.",domain:"TcHmi.System.TriggerManager"});if(0===parts.length)return void ctx.success();let __this=this,processedIf=!1,i=0,proc=function(ctx){let expressions,followingActions,part=parts[i];if(part){if(i++,void 0!==part.if)expressions=part.if,followingActions=part.then,processedIf=!0;else if(void 0!==part.elseif){if(expressions=part.elseif,followingActions=part.then,!processedIf)return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Part 'elseif' must not be defined before part 'if'.",domain:"TcHmi.System.TriggerManager"})}else if(void 0!==part.else&&(followingActions=part.else,!processedIf))return void ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Part 'else' must not be defined before part 'if'.",domain:"TcHmi.System.TriggerManager"});try{let bContextLock=!1;expressions&&followingActions?__this.__resolveConditionExpressionsResult({success:function(result){bContextLock||(bContextLock=!0,!0===result?__this.__processActionList({success:function(result){ctx.success()},error:function(error,details){ctx.success()},trigger:ctx.trigger,event:ctx.event},followingActions,diagGUID):proc({success:function(result){ctx.success()},error:function(error,details){ctx.error(error,details)},trigger:ctx.trigger,event:ctx.event}))},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},expressions):!expressions&&followingActions?__this.__processActionList({success:function(result){ctx.success()},error:function(error,details){ctx.success()},trigger:ctx.trigger,event:ctx.event},followingActions,diagGUID):ctx.error(TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,{code:TcHmi.Errors.E_TRIGGER_CONDITION_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_CONDITION_INVALID],reason:"Condition definition is invalid because it contains no expressions and no following actions.",domain:"TcHmi.System.TriggerManager"})}catch(e){ctx.error(TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_RESOLVE_CONDITION_EXPRESSION_EXCEPTION],reason:"An uncaught exception occurred in the processing of a condition",exception:e,domain:"TcHmi.System.TriggerManager"})}}else ctx.success()};proc({success:function(result){ctx.success()},error:function(error,details){ctx.error(error,details)},trigger:ctx.trigger,event:ctx.event})}__taSwitchCase(ctx,switchCase,diagGUID){if(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __taSwitchCase called with:",{ctx:ctx,switchCase:switchCase}),null==switchCase)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Object of type 'TcHmi.Trigger.SwitchCase' must not be null or undefined.",domain:"TcHmi.System.TriggerManager"});let comp=switchCase.compare;if(null==comp)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Object of type 'TcHmi.Trigger.SwitchCase' requires a property: 'compare' which must not be null or undefined.",domain:"TcHmi.System.TriggerManager"});let cases=switchCase.cases;if(null==cases)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Object of type 'TcHmi.Trigger.SwitchCase' requires a property: 'cases' which must not be null or undefined.",domain:"TcHmi.System.TriggerManager"});let dc=null;void 0!==switchCase.caseDefault&&null!==switchCase.caseDefault&&(dc=switchCase.caseDefault);let __this=this,cpv=void 0,bContextLock=!1;this.__resolveValue({success:function(result){bContextLock||(bContextLock=!0,cpv=result,function(){let resultByCase=new WeakMap,pending=cases.length,finalize=function(){if(pending>0)return;let error=null,tc=null;for(let i=0,ii=cases.length;i<ii;i++){let c=cases[i],res=resultByCase.get(c);if(!res){error={code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"};break}if(res.error!==TcHmi.Errors.NONE){error=res.details?res.details:{code:res.error,message:TcHmi.Errors[res.error],domain:"TcHmi.System.TriggerManager"};break}if(!0===tchmi_equal(res.value,cpv,!1)&&(tc=c),null!==tc)break}error?ctx.error(error.code,error):null!==tc?__this.__processActionList({success:function(){ctx.success(TcHmi.Errors.NONE)},error:function(){ctx.success(TcHmi.Errors.NONE)},trigger:ctx.trigger,event:ctx.event},tc.actions,diagGUID):null!==dc&&__this.__processActionList({success:function(){ctx.success(TcHmi.Errors.NONE)},error:function(){ctx.success(TcHmi.Errors.NONE)},trigger:ctx.trigger,event:ctx.event},dc.actions,diagGUID)};for(let i=0,ii=cases.length;i<ii;i++){const c=cases[i];if(null==c){resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Property: 'cases' in object of type: 'TcHmi.Trigger.SwitchCase' must not contain entries which are null or undefined.",domain:"TcHmi.System.TriggerManager"}}),pending--,finalize();continue}const cv=c.caseValue;if(null!=cv)switch(cv.objectType){case"StaticValue":resultByCase.set(c,{error:TcHmi.Errors.NONE,value:cv.value}),pending--,finalize();break;case"Symbol":let symbol;try{symbol=new System.Symbol(cv.symbolExpression)}catch(e){}symbol?symbol.read((function(data){data.error===TcHmi.Errors.NONE?resultByCase.set(c,{error:TcHmi.Errors.NONE,value:data.value}):resultByCase.set(c,{error:data.error,details:data.details}),pending--,finalize()})):(resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'SymbolExpression "'+cv.symbolExpression+'" is not valid.',domain:"TcHmi.System.TriggerManager"}}),pending--,finalize());break;default:resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:'Object type: "'+cv.objectType+"\" is not supported in switch case. Please use objects of type: 'StaticValue' or symbols.",domain:"TcHmi.System.TriggerManager"}}),pending--,finalize()}else resultByCase.set(c,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],domain:"TcHmi.System.TriggerManager"}}),pending--,finalize()}}())},error:function(error,details){bContextLock||(bContextLock=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},comp)}__processAction(ctx,action,diagGUID){let __this=this;if(!1===action.active)return void ctx.success();let bContextLock=!1,ctx2={success:function(result){if(bContextLock)return;bContextLock=!0;let bContextLock2=!1;__this.__processActionList({success:function(result){bContextLock2||(bContextLock2=!0,ctx.success(result))},error:function(error,details){bContextLock2||(bContextLock2=!0,ctx.error(error,details))},trigger:ctx.trigger,event:ctx.event},action.success,diagGUID)},error:function(error,details){if(bContextLock)return;bContextLock=!0,details?TCHMI_CONSOLE_LOG_LEVEL>=1&&(details.exception?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage(details)+"\nException:",details.exception):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage(details))):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi.System.TriggerManager, Event="+ctx.event.name+", ObjectType="+action.objectType+"] "+TcHmi.Log.buildMessage({code:error,message:TcHmi.Errors[error]}));let bContextLock2=!1;__this.__processActionList({success:function(result){bContextLock2||(bContextLock2=!0,ctx.success(result))},error:function(error,details){bContextLock2||(bContextLock2=!0,ctx.error(error))},trigger:ctx.trigger,event:ctx.event},action.error,diagGUID)},trigger:ctx.trigger,event:ctx.event};try{switch(action.objectType){case"Condition":this.__taCondition(ctx2,action,diagGUID);break;case"SwitchCase":this.__taSwitchCase(ctx2,action,diagGUID);break;case"ControlApiFunction":this.__taControlApiFunction(ctx2,action,diagGUID);break;case"WriteToSymbol":this.__taWriteToSymbol(ctx2,action,diagGUID);break;case"Function":this.__taFunction(ctx2,action,diagGUID);break;case"JavaScript":this.__taJavaScript(ctx2,action,diagGUID);break;case"ActionTemplate":this.__taActionTemplate(ctx2,action,diagGUID);break;case"FunctionExpression":this.__taFunctionExpression(ctx2,action,diagGUID);break;case"Comment":ctx.success();break;default:ctx.error(TcHmi.Errors.E_NOT_SUPPORTED,{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:"Object type: '"+action.objectType+"' is not supported.",domain:"TcHmi.System.TriggerManager"})}}catch(e){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.System.TriggerManager, Event=",ctx.event.name,", ObjectType=",action.objectType,"] Throwed",e),ctx.error(TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION,{code:TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION,message:TcHmi.Errors[TcHmi.Errors.E_TRIGGER_ACTION_EXCEPTION],reason:"An uncaught exception occurred in a __processAction call",exception:e,domain:"TcHmi.System.TriggerManager"})}}__processActionList(ctx,actions,diagGUID){if(!actions)return void ctx.success();let l=actions.length;if(0===l)return void ctx.success();let c=0,__this=this,proc=function(){let action=actions[c],next=function(){c===l-1?ctx.success():(c++,proc())},bContextLock=!1;__this.__processAction({success:function(){bContextLock||(bContextLock=!0,void 0!==action.asyncWait&&!0!==action.asyncWait||next())},error:function(error,details){bContextLock||(bContextLock=!0,void 0!==action.asyncWait&&!0!==action.asyncWait||next())},trigger:ctx.trigger,event:ctx.event},action,diagGUID),void 0!==action.asyncWait&&!1===action.asyncWait&&next()};proc()}__onTriggerEvent(trigger){let __this=this;return function(event,data){let diagGUID="";TCHMI_CONSOLE_LOG_LEVEL>=4&&(diagGUID=tchmi_create_guid()),TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __onTriggerEvent called with:",{event:event,data:data}),!0===trigger.preventDefault&&data&&"function"==typeof data.preventDefault&&(TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi.System.TriggerManager, LogicalScopeDiagGUID="+diagGUID+"] __onTriggerEvent calling data.preventDefault() because 'trigger.preventDefault===true'."),data.preventDefault()),__this.__processActionList({success:function(){},error:function(error,details){},trigger:trigger,event:event},trigger.actions,diagGUID)}}register(triggerArr){if((!0!==TCHMI_ENGINEERING||!0!==TCHMI_DESIGNER)&&null!=triggerArr)for(let i=0,ii=triggerArr.length;i<ii;i++){let trigger=triggerArr[i];if(void 0===trigger.event||null===trigger.event||"string"!=typeof trigger.event)continue;if(void 0===trigger.actions||null===trigger.actions||"object"!=typeof trigger.actions||!1===Array.isArray(trigger.actions))continue;let destroyTriggerEvent=TcHmi.EventProvider.register(trigger.event,this.__onTriggerEvent(trigger),trigger.preventDefault?{passive:!1,capture:!1}:void 0),triggerMapObject=this.__triggerMap.get(trigger.event);void 0===triggerMapObject?(triggerMapObject=[{trigger:trigger,destroyTriggerEvent:destroyTriggerEvent}],this.__triggerMap.set(trigger.event,triggerMapObject)):triggerMapObject.push({trigger:trigger,destroyTriggerEvent:destroyTriggerEvent})}}unregister(triggerArr){if((!0!==TCHMI_ENGINEERING||!0!==TCHMI_DESIGNER)&&null!=triggerArr)for(let i=0,ii=triggerArr.length;i<ii;i++){let trigger=triggerArr[i];if(void 0===trigger.event||null===trigger.event||"string"!=typeof trigger.event)continue;if(void 0===trigger.actions||null===trigger.actions||"object"!=typeof trigger.actions||!1===Array.isArray(trigger.actions))continue;let triggerCallbacks=this.__triggerMap.get(trigger.event);if(void 0!==triggerCallbacks){for(let j=0,jj=triggerCallbacks.length;j<jj;j++){let tco=triggerCallbacks[j];if(tchmi_equal(trigger,tco.trigger)){tco.destroyTriggerEvent(),triggerCallbacks.splice(j,1),j--,jj--;break}tco=null}0===triggerCallbacks.length&&this.__triggerMap.delete(trigger.event)}}}}}(System=TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),function(TcHmi){!function(System){TCHMI_DYNAMIC_INSTANCE_ID=tchmi_create_guid();let buildTimeObj=document.head.querySelector('meta[name="tchmi-buildtime"]');buildTimeObj&&(TcHmi.System.buildtime=buildTimeObj.content);class Init{static printDebugOutput(){var _a,_b,_c;TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Loading TwinCAT HMI Application"),void 0===window.ontouchstart||void 0===window.ontouchend?TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Browser support for touch events (touchstart and/or touchend) is missing. Specific touch event handling will not be available. This is fine if no touch device is attached. If there is a touch device attached please check the configuration and drivers."):0===window.navigator.maxTouchPoints&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Browser support for touch events (navigator.maxTouchPoints === 0) is missing. Specific touch event handling will not be available. This is fine if no touch device is attached. If there is a touch device attached please check the configuration and drivers."),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.location.href:",window.location.href),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appName:",window.navigator.appName),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appCodeName:",window.navigator.appCodeName),window.navigator.userAgentData?(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.brands:",JSON.stringify(null===(_a=window.navigator.userAgentData)||void 0===_a?void 0:_a.brands)),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.platform:",null===(_b=window.navigator.userAgentData)||void 0===_b?void 0:_b.platform),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] navigator.userAgentData.mobile:",null===(_c=window.navigator.userAgentData)||void 0===_c?void 0:_c.mobile)):(TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.appVersion:",window.navigator.appVersion),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.platform:",window.navigator.platform),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.userAgent:",window.navigator.userAgent)),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.cookieEnabled:",window.navigator.cookieEnabled),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] window.navigator.maxTouchPoints:",window.navigator.maxTouchPoints),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DYNAMIC_INSTANCE_ID:",TCHMI_DYNAMIC_INSTANCE_ID),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DEBUG_TIME_LOAD_LIBRARY:",TCHMI_DEBUG_TIME_LOAD_LIBRARY),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_ENGINEERING:",TCHMI_ENGINEERING),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_DESIGNER:",TCHMI_DESIGNER),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_LIVEVIEW:",TCHMI_LIVEVIEW),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_RUNTIME:",TCHMI_RUNTIME),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_TARGET_PARTIAL:",TCHMI_TARGET_PARTIAL),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONFIG_OVERRIDE: ",TCHMI_CONFIG_OVERRIDE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_ENGINEERING_WEBSOCKET:",TCHMI_ENGINEERING_WEBSOCKET),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_LEVEL:",TCHMI_CONSOLE_LOG_LEVEL),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_PERSISTENT:",TCHMI_CONSOLE_LOG_PERSISTENT),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES:",TCHMI_CONSOLE_LOG_PERSISTENT_MAX_ENTRIES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES:",TCHMI_CONSOLE_LOG_TCHMISERVER_MESSAGES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES:",TCHMI_CONSOLE_LOG_ENGINEERING_COM_MESSAGES),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_UNITTEST_MODE:",TCHMI_UNITTEST_MODE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_BENCHMARK_MODE:",TCHMI_BENCHMARK_MODE),TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TCHMI_EVENT_OPTION_OBJECT_SUPPORTED:",TCHMI_EVENT_OPTION_OBJECT_SUPPORTED),TcHmi.System.buildtime&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] TcHmi.System.buildtime:",TcHmi.System.buildtime),performance&&"object"==typeof performance&&"function"==typeof performance.now&&TcHmi.Log.debugEx("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms"))}static prepare(){if(TcHmi.System.SharedResources.jqWindow=$(window),TcHmi.System.SharedResources.jqDocument=$(document),window.addEventListener("beforeunload",TcHmi.System.__unload),TcHmi.System.Services.dialogManager)throw TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Duplicate Framework code running! Please fix JS inclusion. Aborting."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Duplicate Framework code running. Aborting...",TcHmi.DialogManager.DialogSeverity.Error),new Error("Duplicate Framework code running");if(TcHmi.System.Services.dialogManager=new TcHmi.System.DialogManager,TcHmi.System.Services.splashScreen=new TcHmi.System.SplashScreen,document.body)TcHmi.System.SharedResources.jqBody=$(document.body),TcHmi.System.SharedResources.jqBody.empty();else{let populateJqBody=function(){document.body?(document.removeEventListener("readystatechange",populateJqBody),TcHmi.System.SharedResources.jqBody=$(document.body),TcHmi.System.SharedResources.jqBody.empty(),1e4===TcHmi.System.Init.__initStep&&TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay)):window.setTimeout(populateJqBody,10)};document.addEventListener("readystatechange",populateJqBody)}}static run(initStep){TcHmi.System.Init.__initStep=initStep;let indexedDbRequest,initStage=0,userFunctions=[],userControlPartials=[],viewPartials=[],contentPartials=[],packageControlsLoaded=new Set,packageControls=[],packageFunctionsLoaded=new Set,packageFunctions=[],cachedFunctionDescrUrls=[],xhrCacheSuffix=TCHMI_ENGINEERING?"?preventcache="+TCHMI_DYNAMIC_INSTANCE_ID:"";const PendingCounter={PackageLoaded:2e9,BaseConfigLoaded:2e9,BaseDescriptionLoaded:2e9,OpenEngineeringConnection:2e9,OpenServerConnection:2e9,ControlsDescriptionLoaded:2e9,ControlsDescriptionResolved:2e9,TypeDefinitionsResolved:2e9,ServerSymbolSchemaCacheResolved:2e9,ControlsTemplatesLoaded:2e9,PackagesFunctionDescriptionLoaded:2e9,UserFunctionDescriptionLoaded:2e9,UserControlsLoaded:2e9,ContentLoaded:2e9,ViewLoaded:2e9,ContentCompiled:2e9,ViewCompiled:2e9};let initStageInfo=new Map([[0,{id:0,text:"System Configuration",toDo:1,done:0}],[1,{id:1,text:"Preparing System",toDo:1,done:0}],[2,{id:2,text:"Loading Packages",toDo:0,done:0}],[3,{id:3,text:"Preparing Controls",toDo:1,done:0}],[4,{id:4,text:"Preparing Functions",toDo:1,done:0}],[5,{id:5,text:"Connectivity",toDo:1,done:0}],[6,{id:6,text:"Validation",toDo:1,done:0}],[7,{id:7,text:"Type Definitions",toDo:1,done:0}],[8,{id:8,text:"Loading UserControls",toDo:0,done:0}],[9,{id:9,text:"Loading Content",toDo:0,done:0}],[10,{id:10,text:"Loading Views",toDo:0,done:0}],[11,{id:11,text:"Compiling Content",toDo:0,done:0}],[12,{id:12,text:"Compiling Views",toDo:0,done:0}],[13,{id:13,text:"Preloading Bindings",toDo:0,done:0}],[14,{id:14,text:"Finalize",toDo:1,done:0}]]),updateSplashScreen=()=>{if(!TCHMI_DESIGNER){let stage=initStageInfo.get(initStage);if(!stage)return;TcHmi.System.Services.splashScreen.updateVersionInfo("Version: "+TcHmi.version.full),TcHmi.System.Services.splashScreen.updateStageInfo("Stage "+(stage.id+1)+" / "+initStageInfo.size+": "+stage.text),0===stage.done&&0===stage.toDo?TcHmi.System.Services.splashScreen.updateStageProgress(100):0===stage.done&&stage.toDo>0?TcHmi.System.Services.splashScreen.updateStageProgress(0):TcHmi.System.Services.splashScreen.updateStageProgress(stage.done/stage.toDo*100)}};!function InitStateMachine(){var _a,_b,_c,_d;switch(TcHmi.System.Init.__initStep){case 1:break;case 2:{let missingBrowserFeatures=[],neededInGlobal=["WebSocket","Map","WeakMap","MutationObserver","indexedDB","Set","Promise"];for(let feature of neededInGlobal)feature in window||missingBrowserFeatures.push(feature);let neededInDiv=["replaceWith","before","after","prepend","append"];for(let feature of neededInDiv)feature in document.head||missingBrowserFeatures.push("Node."+feature);let neededInArray=["find","includes"];for(let feature of neededInArray)feature in Array.prototype||missingBrowserFeatures.push("Array.prototype."+feature);Array.from||missingBrowserFeatures.push("Array.from");let neededInString=["startsWith","endsWith","includes"];for(let feature of neededInString)feature in String.prototype||missingBrowserFeatures.push("String.prototype."+feature);if(document.head.classList){const testDiv=document.createElement("div");testDiv.classList.add("a","b"),"a b"!==testDiv.className&&missingBrowserFeatures.push("Element.classList.add with multiple arguments"),testDiv.className="a",testDiv.classList.toggle("a",!0),"a"!==testDiv.className&&missingBrowserFeatures.push("Element.classList.toggle with force")}else missingBrowserFeatures.push("Element.classList");if(missingBrowserFeatures.length>0)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Browser does not support required features: "+missingBrowserFeatures.join(", ")+"."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Browser does not support required features: <ul><li>"+missingBrowserFeatures.join("</li>\n<li>")+"</li></ul>",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();TcHmi.System.Init.__initStep=3}case 3:{TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_CONFIGURATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_CONFIGURATION")),PendingCounter.BaseConfigLoaded=1;const tchmiConfigPath="Properties/tchmiconfig.json";let xhrTcHmiConfig=new XMLHttpRequest;xhrTcHmiConfig.open("GET",tchmiConfigPath+xhrCacheSuffix);let xhrTcHmiConfigSuccess=function(evt){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r;if(200!==xhrTcHmiConfig.status)return void xhrTcHmiConfigError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let config=TcHmi.System.config=TcHmi.ValueConverter.toObject(xhrTcHmiConfig.responseText);if(!config)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Configuration file: 'Properties/tchmiconfig.json' is not valid."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Configuration file: 'Properties/tchmiconfig.json' is not valid.",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();for(let key in config)if(key.startsWith("__COMMENT"))return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Configuration file: 'Properties/tchmiconfig.json' is not valid. Content was not generated from 'tchmiconfig.tpl.json'."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Configuration file: 'Properties/tchmiconfig.json' is not valid. Content was not generated from 'tchmiconfig.tpl.json'.",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();null!==(_a=config.basePath)&&void 0!==_a||(config.basePath=""),null!==(_b=config.scaleMode)&&void 0!==_b||(config.scaleMode="None"),null!==(_c=config.startupView)&&void 0!==_c||(config.startupView=""),null!==(_d=config.activeTheme)&&void 0!==_d||(config.activeTheme="Base"),null!==(_e=config.themes)&&void 0!==_e||(config.themes={}),null!==(_f=config.tcHmiServer)&&void 0!==_f||(config.tcHmiServer={websocketIntervalTime:500,websocketSystemTimeout:6e4,websocketTimeout:6e4}),null!==(_g=config.symbols)&&void 0!==_g||(config.symbols={internal:{}}),null!==(_h=config.trigger)&&void 0!==_h||(config.trigger=[]),null!==(_j=config.packages)&&void 0!==_j||(config.packages=[]),null!==(_k=config.views)&&void 0!==_k||(config.views=[]),null!==(_l=config.userFunctions)&&void 0!==_l||(config.userFunctions=[]),null!==(_m=config.userControls)&&void 0!==_m||(config.userControls=[]),null!==(_o=config.content)&&void 0!==_o||(config.content=[]),null!==(_p=config.actionTemplates)&&void 0!==_p||(config.actionTemplates=[]),null!==(_q=config.languages)&&void 0!==_q||(config.languages={}),null!==(_r=config.keyboardLayouts)&&void 0!==_r||(config.keyboardLayouts=[]),config.creatorSettings?config.creatorSettings.viewport||(config.creatorSettings.viewport={defaultHeight:768,defaultWidth:1024}):config.creatorSettings={viewport:{defaultHeight:768,defaultWidth:1024}},config.tcHmiServer.websocketIntervalTime||(config.tcHmiServer.websocketIntervalTime=500),config.tcHmiServer.websocketTimeout||(config.tcHmiServer.websocketTimeout=6e4),config.tcHmiServer.websocketSystemTimeout||(config.tcHmiServer.websocketSystemTimeout=6e4),config.binding?config.binding.symbolError||(config.binding.symbolError="Ignore"):config.binding={symbolError:"Ignore"},userFunctions=[];let userFunctionsPrepared=new Set;for(let i=0;i<TcHmi.System.config.userFunctions.length;i++){let entry=TcHmi.System.config.userFunctions[i];entry.url=tchmi_path(entry.url),userFunctionsPrepared.has(entry.url)||(userFunctionsPrepared.add(entry.url),userFunctions.push(entry))}userControlPartials=[];let userControlPartialsPrepared=new Set;for(let i=0;i<TcHmi.System.config.userControls.length;i++){let entry=TcHmi.System.config.userControls[i];entry.url=tchmi_path(entry.url),userControlPartialsPrepared.has(entry.url)||(userControlPartialsPrepared.add(entry.url),userControlPartials.push(entry))}initStageInfo.get(8).toDo+=2*userControlPartials.length,contentPartials=[];let contentPartialsPrepared=new Set;for(let i=0;i<TcHmi.System.config.content.length;i++){let entry=TcHmi.System.config.content[i];entry.url=tchmi_path(entry.url),contentPartialsPrepared.has(entry.url)||(!0===entry.preload&&(initStageInfo.get(9).toDo++,initStageInfo.get(11).toDo++,entry.keepAlive=!0),void 0===entry.keepAlive&&(entry.keepAlive=!1),!0!==entry.keepAlive||TCHMI_DESIGNER?TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!1):TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!0),!0!==entry.preloadBindings||TCHMI_DESIGNER?TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!1):TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!0),TcHmi.System.Data.isLoadSyncContent.set(entry.url,!!entry.loadSync),contentPartialsPrepared.add(entry.url),contentPartials.push(entry))}PendingCounter.ContentCompiled=contentPartials.length,viewPartials=[];let viewPartialsPrepared=new Set;for(let i=0;i<TcHmi.System.config.views.length;i++){let entry=TcHmi.System.config.views[i];entry.url=tchmi_path(entry.url),viewPartialsPrepared.has(entry.url)||(!0===entry.preload&&(initStageInfo.get(10).toDo++,initStageInfo.get(12).toDo++,entry.keepAlive=!0),void 0===entry.keepAlive&&(entry.keepAlive=!1),!0===entry.keepAlive?TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!0):TcHmi.System.Data.isKeepAlivePartial.set(entry.url,!1),!0!==entry.preloadBindings||TCHMI_DESIGNER?TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!1):TcHmi.System.Data.isPreloadBindingPartial.set(entry.url,!0),viewPartialsPrepared.add(entry.url),viewPartials.push(entry))}if(PendingCounter.ViewCompiled=viewPartials.length,PendingCounter.PackageLoaded=TcHmi.System.config.packages.length,initStageInfo.get(2).toDo=TcHmi.System.config.packages.length,TCHMI_DESIGNER){const newLink=document.createElement("link");newLink.rel="stylesheet",newLink.type="text/css",newLink.href=tchmi_path(TcHmi.System.config.basePath+"/StyleEngineering.css"),document.head.appendChild(newLink)}if(TCHMI_ENGINEERING){const TchmiConfigOverride=TCHMI_CONFIG_OVERRIDE;TchmiConfigOverride&&(void 0!==TchmiConfigOverride.basePath&&(TcHmi.System.config.basePath=TchmiConfigOverride.basePath),TchmiConfigOverride.tcHmiServer&&TchmiConfigOverride.tcHmiServer.websocketIntervalTime&&(TcHmi.System.config.tcHmiServer.websocketIntervalTime=TchmiConfigOverride.tcHmiServer.websocketIntervalTime))}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Loading Properties/tchmiconfig.json finished."),PendingCounter.BaseConfigLoaded--,0===PendingCounter.BaseConfigLoaded&&(TcHmi.System.Init.__initStep=4,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))},xhrTcHmiConfigError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading Properties/tchmiconfig.json failed! Detail: "+xhrTcHmiConfig.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Loading configuration file: 'Properties/tchmiconfig.json' failed. Details: "+xhrTcHmiConfig.statusText,TcHmi.DialogManager.DialogSeverity.Error),1e4!==TcHmi.System.Init.__initStep&&(TcHmi.System.Init.__initStep=1e4,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))};xhrTcHmiConfig.addEventListener("load",xhrTcHmiConfigSuccess),xhrTcHmiConfig.addEventListener("error",xhrTcHmiConfigError),xhrTcHmiConfig.send()}break;case 4:{TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_DESCRIPTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.BASE_DESCRIPTION")),PendingCounter.BaseDescriptionLoaded=1;const frameworkDescriptionPath=tchmi_path(TcHmi.System.config.basePath+"/Description.json");let xhrFwDescr=new XMLHttpRequest;xhrFwDescr.open("GET",frameworkDescriptionPath+xhrCacheSuffix);let xhrFwDescrSuccess=function(evt){if(200===xhrFwDescr.status){if(1e4!==TcHmi.System.Init.__initStep){if(TcHmi.System.description=TcHmi.ValueConverter.toObject(xhrFwDescr.responseText),!TcHmi.System.description||!TcHmi.System.description.version)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading Framework description file: '"+frameworkDescriptionPath+"' failed. File is not a valid Framework description file. Details: "+xhrFwDescr.responseText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Loading Framework description file: '"+frameworkDescriptionPath+"' failed. File is not a valid Framework description file.",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();TcHmi.version=TcHmi.System.description.version,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] TcHmi.version.full: "+TcHmi.version.full),PendingCounter.BaseDescriptionLoaded--,0===PendingCounter.BaseDescriptionLoaded&&(TcHmi.System.Init.__initStep=5,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))}}else xhrFwDescrError(evt)},xhrFwDescrError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading Framework description file: '"+frameworkDescriptionPath+"' failed. Details: "+xhrFwDescr.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain","Loading Framework description file: '"+frameworkDescriptionPath+"' failed. Details: "+xhrFwDescr.statusText,TcHmi.DialogManager.DialogSeverity.Error),1e4!==TcHmi.System.Init.__initStep&&(TcHmi.System.Init.__initStep=1e4,InitStateMachine())};xhrFwDescr.addEventListener("load",xhrFwDescrSuccess),xhrFwDescr.addEventListener("error",xhrFwDescrError),xhrFwDescr.send()}break;case 5:{if(TcHmi.System.Services.localizationManager=new System.LocalizationManager,TcHmi.System.description.languages)for(let locale in TcHmi.System.description.languages){const languageEntry=tchmi_clone_object(TcHmi.System.description.languages[locale]);if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(TcHmi.System.config.basePath+"/"+subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,tchmi_path(TcHmi.System.config.basePath+"/"+languageEntry))}if(TcHmi.System.config.languagesForFramework)for(let locale in TcHmi.System.config.languagesForFramework){const languageEntry=TcHmi.System.config.languagesForFramework[locale];if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Framework",locale,tchmi_path(languageEntry))}let pending=0;const finalize=()=>{pending>0||(TcHmi.System.Init.__initStep=6,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))};TCHMI_DESIGNER&&(pending++,TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Engineering},data=>{pending--,finalize()})),pending++,TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Application},data=>{pending--,finalize()})}break;case 6:if(!document.body)return void setTimeout(()=>{TcHmi.System.Init.__initStep=6,InitStateMachine()},25);TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_EARLY"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_EARLY")),TcHmi.System.Init.__initStep=1,TcHmi.System.Services.themeManager=new System.ThemeManager,TcHmi.System.Services.themeManager.processActiveTheme(()=>{if(initStageInfo.get(initStage).done++,TCHMI_DESIGNER)return TcHmi.System.Init.__initStep=7,void InitStateMachine();window.requestAnimationFrame(()=>{TcHmi.System.Services.splashScreen.show(),updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=7,initStage=1,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})})});break;case 7:{let cachedBuildtime=null;TcHmi.System.buildtime&&(cachedBuildtime=window.localStorage.getItem("TcHmi.Init.cachedBuildtime"));const ourObjectStoreNames=["controlTemplate","contentMarkup","userControlMarkup","userControlConfig","userFunctionConfig"];indexedDbRequest=window.indexedDB.open("TcHmi.Init"),indexedDbRequest.onerror=event=>{event.target.error.name},indexedDbRequest.onupgradeneeded=event=>{try{ourObjectStoreNames.forEach(name=>{if(indexedDbRequest.result.objectStoreNames.contains(name))try{indexedDbRequest.result.deleteObjectStore(name)}catch(e){}indexedDbRequest.result.createObjectStore(name)}),cachedBuildtime=TcHmi.System.buildtime,cachedBuildtime&&window.localStorage.setItem("TcHmi.Init.cachedBuildtime",cachedBuildtime)}catch(e){}},indexedDbRequest.onsuccess=event=>{if(!TCHMI_DESIGNER&&TcHmi.System.buildtime){let deleteDatabase=!1;if(indexedDbRequest.result.objectStoreNames.length!==ourObjectStoreNames.length?deleteDatabase=!0:ourObjectStoreNames.forEach(name=>{!deleteDatabase&&indexedDbRequest.result.objectStoreNames.contains(name)||(deleteDatabase=!0)}),cachedBuildtime!==TcHmi.System.buildtime||deleteDatabase||TcHmi.System.config.disableLoadingOptimization)try{deleteDatabase?(window.localStorage.removeItem("TcHmi.Init.cachedBuildtime"),window.indexedDB.deleteDatabase("TcHmi.Init")):(ourObjectStoreNames.forEach(name=>{indexedDbRequest.result.transaction(name,"readwrite").objectStore(name).clear()}),cachedBuildtime=TcHmi.System.buildtime,window.localStorage.setItem("TcHmi.Init.cachedBuildtime",cachedBuildtime))}catch(e){}else{let transaction=indexedDbRequest.result.transaction(ourObjectStoreNames,"readonly");transaction.objectStore("controlTemplate").openCursor().onsuccess=event=>{let result=event.target.result;result&&(TcHmi.System.Data.Caches.templateMarkupCache.set(result.key,result.value),result.continue())},transaction.objectStore("userControlMarkup").openCursor().onsuccess=event=>{let result=event.target.result;result&&(System.Data.Caches.partialMarkupCache.set(result.key,{markup:result.value}),result.continue())},transaction.objectStore("userControlConfig").openCursor().onsuccess=event=>{let result=event.target.result;result&&(TcHmi.System.Data.Caches.partialCompositeConfigCache.set(result.key,result.value),result.continue())},transaction.objectStore("contentMarkup").openCursor().onsuccess=event=>{let result=event.target.result;result&&(System.Data.Caches.partialMarkupCache.set(result.key,{markup:result.value}),result.continue())},transaction.objectStore("userFunctionConfig").openCursor().onsuccess=event=>{let result=event.target.result;if(result){let registration=TcHmi.System.Data.Registrations.functions.map.get(result.value.name);if(!(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(result.value.qname),registration&&registration.error===TcHmi.Errors.NONE)))return void result.continue();let module={error:TcHmi.Errors.NONE,reg:registration,description:result.value.descr};TcHmi.System.Data.Modules.functions.map.set(result.value.name,module),result.value.name!==result.value.qname&&TcHmi.System.Data.Modules.functions.map.set(result.value.qname,module),cachedFunctionDescrUrls.push(result.key),result.continue()}}}}},TcHmi.System.Init.__initStep=8}case 8:if(TcHmi.System.Init.__initStep=1,TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.SYSTEM_PREPARATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.SYSTEM_PREPARATION")),"3.6.0"!==$().jquery)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Mismatching jquery version. Please avoid overriding."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",null!==(_b=null===(_a=TcHmi.System.Services.localization)||void 0===_a?void 0:_a.getText("Jquery_Version_Missmatch",{level:TcHmi.Locale.Level.Engineering}))&&void 0!==_b?_b:"Mismatching jQuery version. Please avoid overriding",TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();if(!document.body)return void setTimeout(()=>{TcHmi.System.Init.__initStep=8,InitStateMachine()},25);try{TcHmi.System.Services.internalSymbolManager=new System.InternalSymbolManager,TcHmi.System.Services.templateParamSymbolManager=new System.TemplateParamSymbolManager,TcHmi.System.Services.bindingManager=new System.BindingManager,TcHmi.System.Services.localization=new System.Locale.Framework,TcHmi.System.Services.serverManager=new System.ServerManager,TcHmi.System.Services.triggerManager=new System.TriggerManager,TcHmi.System.Services.accessManager=new System.AccessManager,TcHmi.System.Services.topMostLayer=new System.TopMostLayer,TcHmi.System.Services.serverEventManager=new System.ServerEventManager,TcHmi.System.Services.controlManager=new System.ControlManager,TcHmi.System.Services.styleManager=new System.StyleManager,TcHmi.System.Services.typeManager=new System.Type.TypeManager,TcHmi.System.Services.animationProvider=new System.AnimationProvider,TcHmi.System.Services.viewManager=new System.ViewManager,TcHmi.System.Services.tcSpeechManager=new System.TcSpeechManager,!0===TCHMI_ENGINEERING&&(TcHmi.System.Services.Engineering.designerModeManager=new System.Engineering.DesignerModeManager,TcHmi.System.Services.Engineering.designerModeComManager=new System.Engineering.DesignerModeComManager,TcHmi.System.Services.Engineering.errorPane=new System.Engineering.ErrorPane)}catch(e){return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",null!==(_d=null===(_c=TcHmi.System.Services.localization)||void 0===_c?void 0:_c.getText("System_Service_Initialization_Failed",{level:TcHmi.Locale.Level.Engineering}))&&void 0!==_d?_d:"System service initialization has failed: "+e.message,TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()}if(!0===TCHMI_DESIGNER){const TchmiConfigOverride=TCHMI_CONFIG_OVERRIDE;null!==TchmiConfigOverride&&void 0!==TchmiConfigOverride.tcHmiServer&&TchmiConfigOverride.tcHmiServer.websocketOverwrite&&TcHmi.System.Services.serverManager.setServerAddress(TchmiConfigOverride.tcHmiServer.websocketOverwrite.host,TchmiConfigOverride.tcHmiServer.websocketOverwrite.port)}for(let key in TcHmi.System.config.symbols.internal)TcHmi.System.Services.internalSymbolManager.add(key,TcHmi.System.config.symbols.internal[key]);TcHmi.EventProvider.raise("System.onInitializedServices"),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=9,initStage=2,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=9,initStage=2,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}));break;case 9:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_MANIFEST_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_MANIFEST_LOAD")),TcHmi.System.Init.__initStep=1,TcHmi.System.config.packages.length>0){const loadPackageManifest=function(packageInfo){const cleanPath=tchmi_path(packageInfo.basePath+"/Manifest.json");let xhrCtrlDescr=new XMLHttpRequest;xhrCtrlDescr.open("GET",cleanPath+xhrCacheSuffix);let xhrCtrlDescrError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load package: '"+packageInfo.name+"' from 'Properties/tchmiconfig.json'. Missing 'Manifest.json'. Expected path: '"+cleanPath+"'. Details: "+xhrCtrlDescr.statusText),PendingCounter.PackageLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.PackageLoaded<=0&&(TcHmi.System.Init.__initStep=10,initStage=3,TCHMI_DESIGNER?InitStateMachine():(updateSplashScreen(),setTimeout(()=>{InitStateMachine()}))))};xhrCtrlDescr.addEventListener("load",(function(evt){if(200!==xhrCtrlDescr.status)return void xhrCtrlDescrError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let manifest=TcHmi.ValueConverter.toObject(xhrCtrlDescr.responseText);if(manifest&&manifest.modules){let packageObj={name:packageInfo.name,basePath:packageInfo.basePath,manifest:manifest};if(TcHmi.System.Data.packages.has(packageObj.name))TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Found duplicate entry in Properties/tchmiconfig.json#package "+packageObj.name+" Skipping entry.");else if(TcHmi.System.Data.packages.set(packageObj.name,packageObj),manifest.modules.length>0)for(let i=0,ii=manifest.modules.length;i<ii;i++){let module=manifest.modules[i];if(module&&"Control"===module.type){let descrUrl=tchmi_path(packageObj.basePath+"/"+module.basePath+"/"+module.descriptionFile);if(packageControlsLoaded.has(descrUrl))continue;packageControlsLoaded.add(descrUrl),packageControls.push({package:packageObj,module:module})}else if(module&&"Function"===module.type){let descrUrl=tchmi_path(packageObj.basePath+"/"+module.basePath+"/"+module.descriptionFile);if(packageFunctionsLoaded.has(descrUrl))continue;packageFunctionsLoaded.add(descrUrl),packageFunctions.push({package:packageObj,module:module})}}TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Loading "+cleanPath+" finished!")}else TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load package: '"+packageInfo.name+"' from 'Properties/tchmiconfig.json'. Response returns no valid 'Manifest.json' content. Details: "+xhrCtrlDescr.responseText);PendingCounter.PackageLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.PackageLoaded<=0&&(TcHmi.System.Data.packages.forEach(packageIterator=>{packageIterator.manifest.modules.forEach(moduleData=>{"Package"===moduleData.type&&(TcHmi.System.Data.packages.has(moduleData.nugetId)||TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Package",packageIterator.name,"references the unknown package",moduleData.nugetId,". Reference will be skipped."))})}),manifest=null,TcHmi.System.Init.__initStep=10,initStage=3,TCHMI_DESIGNER?InitStateMachine():(updateSplashScreen(),setTimeout(()=>{InitStateMachine()})))})),xhrCtrlDescr.addEventListener("error",xhrCtrlDescrError),xhrCtrlDescr.send()};let packagesLoaded=new Set;for(let i=0,ii=TcHmi.System.config.packages.length;i<ii;i++){const packageInfo=TcHmi.System.config.packages[i];packagesLoaded.has(packageInfo.name)?PendingCounter.PackageLoaded--:(packagesLoaded.add(packageInfo.name),loadPackageManifest(packageInfo))}}else TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=10,initStage=3,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=10,initStage=3,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}));break;case 10:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,packageControls&&packageControls.length>0){PendingCounter.ControlsDescriptionLoaded=packageControls.length;const loadControLDescription=function(packageControl){packageControl.module.basePath||(packageControl.module.basePath="");const cleanPath=tchmi_path(packageControl.package.basePath+"/"+packageControl.module.basePath+"/"+packageControl.module.descriptionFile);let xhrCtrlDescr=new XMLHttpRequest;xhrCtrlDescr.open("GET",cleanPath+xhrCacheSuffix);let xhrCtrlDescrError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load control description: '"+cleanPath+"'. Related control type will not be available. Details: Status: "+xhrCtrlDescr.status+", StatusText: "+xhrCtrlDescr.statusText+"."),PendingCounter.ControlsDescriptionLoaded--,PendingCounter.ControlsDescriptionLoaded<=0&&(TcHmi.System.Init.__initStep=11,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()})))};xhrCtrlDescr.addEventListener("load",(function(evt){if(200!==xhrCtrlDescr.status)return void xhrCtrlDescrError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let descr=TcHmi.ValueConverter.toObject(xhrCtrlDescr.responseText);if(descr&&1===packageControl.package.manifest.apiVersion){let name=descr.name;descr.apiVersion||TCHMI_CONSOLE_LOG_LEVEL>=2&&TcHmi.Log.warn("[Source=Framework, Module=TcHmi] Package: '"+packageControl.package.name+"': API Version mismatch. This may lead to consequential errors. Please contact the developer of the package. Control module: '"+name+"' has apiVersion: '0' but package has apiVersion: '1'. Do not mix TwinCAT HMI 1.10 and TwinCAT 1.12 and greater API modules in one package. If the package is designed to provide TwinCAT HMI 1.10 API controls the apiVersion of the Manifest.json has to be set to '0' if it's designed to provide TwinCAT HMI 1.12 api logic remove the TwinCAT HMI 1.10 API control or set the apiVersion in Description.json to '1' if the control is designed based on TwinCAT HMI 1.12 API.");let qname,namespace=descr.namespace;namespace&&(qname=TcHmi.System.resolveQualifiedName(name,namespace));let registration=TcHmi.System.Data.Registrations.controls.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||!qname||(registration=TcHmi.System.Data.Registrations.controls.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,manifestData:packageControl.module,package:packageControl.package,reg:registration,description:descr,descriptionExpanded:Object.assign(Object.assign({},tchmi_clone_object(descr)),{inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}})};if(TcHmi.System.Data.Modules.controls.array.push(module),registration.namespace!==namespace){let qnameErrorhandling;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Package: '"+packageControl.package.name+"': Namespace from Description.json ("+namespace+") and control registration ("+registration.namespace+") for control "+descr.name+" are different. Please contact the developer of the package."),namespace?qnameErrorhandling=TcHmi.System.resolveQualifiedName(name,namespace):registration.namespace&&(qnameErrorhandling=TcHmi.System.resolveQualifiedName(name,registration.namespace));let modulError={error:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,errorDetails:{code:TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION,message:TcHmi.Errors[TcHmi.Errors.E_CONTROL_INVALID_CONFIGURATION],domain:"TcHmi",reason:"Namespace from Description.json("+namespace+") and control registration("+registration.namespace+") for control "+descr.name+" are different."}};TcHmi.System.Data.Modules.controls.map.set(name,modulError),qnameErrorhandling&&TcHmi.System.Data.Modules.controls.map.set(qnameErrorhandling,modulError)}else TcHmi.System.Data.Modules.controls.map.has(name)?(TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(name,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module));if(qname&&(TcHmi.System.Data.Modules.controls.map.has(qname)?(TcHmi.System.Data.Modules.controls.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(qname,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module))),qname){let nameLegacy=TcHmi.System.mapControlNamesFromPackageManifestApi1ToApi0.get(qname);nameLegacy&&(TcHmi.System.Data.Modules.controls.map.has(nameLegacy)?TcHmi.System.Data.Modules.controls.map.set(nameLegacy,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+nameLegacy+" found."}}):TcHmi.System.Data.Modules.controls.map.set(nameLegacy,module))}System.Services.themeManager.registerControlThemeFiles(descr)}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Registration of control type '"+qname+"' is not valid and will therefore not be available. Details: "+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Control type '"+qname+"' is not registered and will therefore not be available.\nPossible reason/s:\n- Related source file contains a call to 'TcHmi.Controls.registerEx' or 'TcHmi.Controls.register' (deprecated) with name and/or namespace not matching the definition in control description file: '"+cleanPath+"'.\n- Related source file contains no call to 'TcHmi.Controls.registerEx' or 'TcHmi.Controls.register' (deprecated).\n- Related source file is not included in html document.\n- Related source file is not included in required order in html document.\n")}else if(descr){let name=descr.name,registration=TcHmi.System.Data.Registrations.controls.map.get(name);if(registration&&registration.error===TcHmi.Errors.NONE){if(registration.directory&&registration.template){let cleanTemplatePath=tchmi_path(registration.template),cleanTemplateDirectory=tchmi_path(registration.directory);cleanTemplatePath.indexOf(cleanTemplateDirectory)>=-1&&(descr.template=cleanTemplatePath.replace(cleanTemplateDirectory,""))}let module={error:TcHmi.Errors.NONE,manifestData:packageControl.module,package:packageControl.package,reg:registration,description:descr,descriptionExpanded:Object.assign(Object.assign({},tchmi_clone_object(descr)),{inheritationResolved:!1,inheritedTypes:[],inheritedAttributes:[],inheritedAttributesNameMap:new Map,inheritedAttributesPropertyNameMap:new Map,inheritedAttributesPropertyGetterNameMap:new Map,inheritedAttributesPropertySetterNameMap:new Map,inheritedAccess:[],inheritedEvents:[],inheritedFunctions:[],inheritedLanguages:{}})};TcHmi.System.Data.Modules.controls.array.push(module),TcHmi.System.Data.Modules.controls.map.has(name)?(TcHmi.System.Data.Modules.controls.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}),TcHmi.System.Data.Modules.controls.urlMap.delete(cleanPath)):(TcHmi.System.Data.Modules.controls.map.set(name,module),TcHmi.System.Data.Modules.controls.urlMap.set(cleanPath,module)),System.Services.themeManager.registerControlThemeFiles(descr)}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Registration of control type '"+name+"' is not valid and will therefore not be available. Details: "+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Control type '"+name+"' is not registered and will therefore not be available.\nPossible reason/s:\n- Related source file contains a call to 'TcHmi.Controls.registerEx' or 'TcHmi.Controls.register' (deprecated) with name and/or namespace not matching the definition in control description file: '"+cleanPath+"'.\n- Related source file contains no call to 'TcHmi.Controls.registerEx' or 'TcHmi.Controls.register' (deprecated).\n- Related source file is not included in html document.\n- Related source file is not included in required order in html document.\n")}else if(!descr)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load description file of control '"+packageControl.package.name+"'. Response contains no valid control description file."),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Control_Description_Response_Invalid",{level:TcHmi.Locale.Level.Engineering}),packageControl.package.name),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}));PendingCounter.ControlsDescriptionLoaded--,PendingCounter.ControlsDescriptionLoaded<=0&&(descr=null,TcHmi.System.Init.__initStep=11,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))})),xhrCtrlDescr.addEventListener("error",xhrCtrlDescrError),xhrCtrlDescr.send()};for(let i=0,ii=packageControls.length;i<ii;i++){loadControLDescription(packageControls[i])}break}TcHmi.System.Init.__initStep=13,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()});break;case 11:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_RESOLVE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_DESCRIPTION_RESOLVE")),TcHmi.System.Init.__initStep=1,PendingCounter.ControlsDescriptionResolved=1;try{TcHmi.System.Services.controlManager.resolveDescriptionInheritation()}catch(e){return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error(e),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Control_Description_Inheritation_Failed",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()}PendingCounter.ControlsDescriptionResolved=0,TcHmi.System.Init.__initStep=12,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()});break;case 12:{if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.LOCALIZATION_FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.LOCALIZATION_FINAL")),TcHmi.System.config.languages)for(let key in TcHmi.System.config.languages){const languageEntry=TcHmi.System.config.languages[key];if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Application",key,tchmi_path(languageEntry))}if(TcHmi.System.config.languageFallback&&TcHmi.System.Services.localizationManager.setFallbackLocale(TcHmi.System.config.languageFallback),TcHmi.System.Data.Modules.controls.array.forEach(module=>{if(module&&module.descriptionExpanded&&module.descriptionExpanded.languages){if(module.error!==TcHmi.Errors.NONE||!module.reg)return;if(0===module.reg.apiVersion)return;let qname=TcHmi.System.resolveQualifiedName(module.reg.name,module.reg.namespace);for(let key in module.descriptionExpanded.languages){const languageEntry=module.descriptionExpanded.languages[key];if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+qname+">",key,tchmi_path(TcHmi.Environment.getControlBasePath(qname)+"/"+module.descriptionExpanded.languages[key]))}}}),TcHmi.System.config.languagesForControls)for(let name in TcHmi.System.config.languagesForControls){let files=TcHmi.System.config.languagesForControls[name];if(files)for(let locale in files){const languageEntry=files[locale];if(Array.isArray(languageEntry)){const sanitizedLanguageArray=[];for(const subEntry of languageEntry)sanitizedLanguageArray.push(tchmi_path(subEntry));TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+name+">",locale,sanitizedLanguageArray)}else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Control<"+name+">",locale,tchmi_path(languageEntry))}}if(TcHmi.System.Data.Modules.functions.array.forEach(module=>{if(module&&module.description&&module.description.languages){if(module.error!==TcHmi.Errors.NONE||!module.reg||!module.package||!module.manifestData)return;let qname=TcHmi.System.resolveQualifiedName(module.reg.name,module.reg.namespace);for(let key in module.description.languages){const languageEntry=module.description.languages[key];if(Array.isArray(languageEntry))for(const subEntry of languageEntry)TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+subEntry));else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+qname+">",key,tchmi_path(module.package.basePath+"/"+module.manifestData.basePath+"/"+languageEntry))}}}),TcHmi.System.config.languagesForFunctions)for(let name in TcHmi.System.config.languagesForFunctions){let files=TcHmi.System.config.languagesForFunctions[name];if(files)for(let locale in files){const languageEntry=files[locale];if(Array.isArray(languageEntry))for(const subEntry of languageEntry)TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+name+">",locale,tchmi_path(subEntry));else TcHmi.System.Services.localizationManager.registerLocalizationFile("TcHmi.System.Localization.Function<"+name+">",locale,tchmi_path(languageEntry))}}const finalize=()=>{TcHmi.System.Init.__initStep=13,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()})};TCHMI_DESIGNER?TcHmi.System.Services.localizationManager.processLocale("en",{level:TcHmi.Locale.Level.Engineering},data=>{finalize()}):finalize()}break;case 13:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.THEME_MANAGER_FINAL")),TcHmi.System.Init.__initStep=1,TcHmi.System.Services.themeManager.processActiveTheme(),TcHmi.System.Init.__initStep=14,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()});break;case 14:{TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_TEMPLATES_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTROLS_TEMPLATES_LOAD")),TcHmi.System.Init.__initStep=1;let templates=[];if(TcHmi.System.Data.Modules.controls.array.forEach((module,index)=>{module.descriptionExpanded&&module.descriptionExpanded.inheritedTemplate&&!templates.includes(module.descriptionExpanded.inheritedTemplate)&&templates.push(module.descriptionExpanded.inheritedTemplate)}),PendingCounter.ControlsTemplatesLoaded=templates.length,templates&&templates.length>0){const loadControlTemplate=function(url){let xhrCtrlTempl=new XMLHttpRequest;xhrCtrlTempl.open("GET",url+xhrCacheSuffix);let xhrCtrlTemplError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed! Detail: "+xhrCtrlTempl.statusText),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed_With_Error",{level:TcHmi.Locale.Level.Engineering}),url,xhrCtrlTempl.statusText),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine())};xhrCtrlTempl.addEventListener("load",(function(evt){200===xhrCtrlTempl.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.templateMarkupCache.set(url,xhrCtrlTempl.responseText),!TCHMI_DESIGNER&&indexedDbRequest&&"done"===indexedDbRequest.readyState&&indexedDbRequest.result&&indexedDbRequest.result.objectStoreNames&&indexedDbRequest.result.objectStoreNames.contains("controlTemplate")&&indexedDbRequest.result.transaction("controlTemplate","readwrite").objectStore("controlTemplate").put(xhrCtrlTempl.responseText,url),PendingCounter.ControlsTemplatesLoaded--,PendingCounter.ControlsTemplatesLoaded<=0&&(initStageInfo.get(initStage).done++,updateSplashScreen(),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=15,initStage=4,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=15,initStage=4,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))):xhrCtrlTemplError(evt)})),xhrCtrlTempl.addEventListener("error",xhrCtrlTemplError),xhrCtrlTempl.send()};for(let i=0,ii=templates.length;i<ii;i++){const template=templates[i];TcHmi.System.Data.Caches.templateMarkupCache.has(template)?PendingCounter.ControlsTemplatesLoaded--:loadControlTemplate(template)}}PendingCounter.ControlsTemplatesLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=15,initStage=4,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=15,initStage=4,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))}break;case 15:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_FUNCTION_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.PACKAGES_FUNCTION_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,packageFunctions&&packageFunctions.length>0){PendingCounter.PackagesFunctionDescriptionLoaded=packageFunctions.length,TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] Loading and processing "+PendingCounter.PackagesFunctionDescriptionLoaded+" package function description files");const loadPackageFunctionDescription=function(packageFunction){if(packageFunction.module.basePath||(packageFunction.module.basePath=""),!packageFunction.module.descriptionFile)return PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=16,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))):void 0;const cleanPath=tchmi_path(packageFunction.package.basePath+"/"+packageFunction.module.basePath+"/"+packageFunction.module.descriptionFile);let xhrPackageFunctionDescr=new XMLHttpRequest;xhrPackageFunctionDescr.open("GET",cleanPath+xhrCacheSuffix);let xhrPackageFunctionDescrError=function(evt){if(1e4!==TcHmi.System.Init.__initStep)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load function description: '"+cleanPath+"'. Related functions will not be available. Details: Status: "+xhrPackageFunctionDescr.status+", StatusText: "+xhrPackageFunctionDescr.statusText+"."),PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=16,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))):void 0};xhrPackageFunctionDescr.addEventListener("load",(function(evt){if(200!==xhrPackageFunctionDescr.status)return void xhrPackageFunctionDescrError(evt);if(1e4===TcHmi.System.Init.__initStep)return;let descr=TcHmi.ValueConverter.toObject(xhrPackageFunctionDescr.responseText);if(!descr||!descr.function)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load function description: '"+cleanPath+"'. Related functions will not be available. Response is no valid function JSON: \n"+xhrPackageFunctionDescr.responseText),PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=16,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))):void 0;let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,manifestData:packageFunction.module,package:packageFunction.package,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}):TcHmi.System.Data.Modules.functions.map.set(name,module),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Registration of function '"+qname+"' is not valid and function will therefore not be available. Details: "+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Function '"+qname+"' is not registered and will therefore not be available.\nPossible reason/s:\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' contains a call to 'TcHmi.Functions.registerFunctionEx', 'TcHmi.Functions.registerFunction' (deprecated) or 'TcHmi.Functions.registerFrameworkFunction' (deprecated) with name and/or namespace not matching the definition in function description file: '"+cleanPath+"'.\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' contains no call to 'TcHmi.Functions.registerFunctionEx', 'TcHmi.Functions.registerFunction' (deprecated) or 'TcHmi.Functions.registerFrameworkFunction' (deprecated).\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' is not included in html document.\n");return PendingCounter.PackagesFunctionDescriptionLoaded--,PendingCounter.PackagesFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=16,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))):void 0})),xhrPackageFunctionDescr.addEventListener("error",xhrPackageFunctionDescrError),xhrPackageFunctionDescr.send()};for(let i=0,ii=packageFunctions.length;i<ii;i++)loadPackageFunctionDescription(packageFunctions[i]);break}TcHmi.System.Init.__initStep=16,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()});break;case 16:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.USER_FUNCTION_DESCRIPTION_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.USER_FUNCTION_DESCRIPTION_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.UserFunctionDescriptionLoaded=userFunctions.length,userFunctions&&userFunctions.length>0){const loadUserFunctionDescription=function(url){const cleanPath=tchmi_path(url);let xhrUserFunctionDescr=new XMLHttpRequest;xhrUserFunctionDescr.open("GET",url+xhrCacheSuffix);let xhrUserFunctionDescrError=function(evt){TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load function description: '"+cleanPath+"'. Related functions will not be available. Details: Status: "+xhrUserFunctionDescr.status+", StatusText: "+xhrUserFunctionDescr.statusText+"."),PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=18,initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=18,initStage=5,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))};xhrUserFunctionDescr.addEventListener("load",(function(evt){if(200!==xhrUserFunctionDescr.status)return void xhrUserFunctionDescrError(evt);let descr=TcHmi.ValueConverter.toObject(xhrUserFunctionDescr.responseText);if(!descr||!descr.function)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load function description: '"+cleanPath+"'. Related functions will not be available. Response is no valid function JSON: \n"+xhrUserFunctionDescr.responseText),PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0?(TcHmi.System.Init.__initStep=18,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{InitStateMachine()}))):void 0;let name=descr.function.name,namespace=descr.function.namespace,qname=TcHmi.System.resolveQualifiedName(name,namespace),registration=TcHmi.System.Data.Registrations.functions.map.get(name);if(registration&&registration.error!==TcHmi.Errors.E_NOT_UNIQUE||(registration=TcHmi.System.Data.Registrations.functions.map.get(qname)),registration&&registration.error===TcHmi.Errors.NONE){let module={error:TcHmi.Errors.NONE,reg:registration,description:descr};TcHmi.System.Data.Modules.functions.map.has(name)?TcHmi.System.Data.Modules.functions.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:'Ambiguous module definitions for the name: "'+name+'". Please try fully qualified name.'}}):(TcHmi.System.Data.Modules.functions.map.set(name,module),!TCHMI_DESIGNER&&indexedDbRequest&&"done"===indexedDbRequest.readyState&&indexedDbRequest.result&&indexedDbRequest.result.objectStoreNames&&indexedDbRequest.result.objectStoreNames.contains("userFunctionConfig")&&indexedDbRequest.result.transaction("userFunctionConfig","readwrite").objectStore("userFunctionConfig").put({descr:descr,name:name,qname:qname},url)),qname!==name&&(TcHmi.System.Data.Modules.functions.map.has(qname)?TcHmi.System.Data.Modules.functions.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi",reason:"Multiple module definitions with the name "+qname+" found."}}):TcHmi.System.Data.Modules.functions.map.set(qname,module))}else registration?registration.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Registration of function '"+qname+"' is not valid and function will therefore not be available. Details: "+TcHmi.Log.buildMessage(registration.errorDetails)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Function '"+qname+"' is not registered and will therefore not be available.\nPossible reason/s:\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' contains a call to 'TcHmi.Functions.registerFunctionEx', 'TcHmi.Functions.registerFunction' (deprecated) or 'TcHmi.Functions.registerFrameworkFunction' (deprecated) with name and/or namespace not matching the definition in function description file: '"+url+"'.\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' contains no call to 'TcHmi.Functions.registerFunctionEx', 'TcHmi.Functions.registerFunction' (deprecated) or 'TcHmi.Functions.registerFrameworkFunction' (deprecated).\n- Source file: '"+cleanPath.replace(".function.json",".js")+"' is not included in html document.\n");PendingCounter.UserFunctionDescriptionLoaded--,PendingCounter.UserFunctionDescriptionLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=18,initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=18,initStage=5,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))})),xhrUserFunctionDescr.addEventListener("error",xhrUserFunctionDescrError),xhrUserFunctionDescr.send()};for(const userFunction of userFunctions){let url=userFunction.url.replace(".js",".function.json");userFunction.url.endsWith(".js")?cachedFunctionDescrUrls.includes(url)?PendingCounter.UserFunctionDescriptionLoaded--:loadUserFunctionDescription(url):(TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Configuration file: 'Properties/tchmiconfig.json' is not valid. userFunctions includes a wrong formed entry. url must end with \".js\". Reference will be skipped. Entry: ",userFunction),PendingCounter.UserFunctionDescriptionLoaded--)}}PendingCounter.UserFunctionDescriptionLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=18,initStage=5,InitStateMachine()):(initStageInfo.get(initStage).done++,updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=18,initStage=5,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})));break;case 18:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_SERVER_CONNECTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_SERVER_CONNECTION")),TcHmi.System.Init.__initStep=1,PendingCounter.OpenServerConnection=1,TcHmi.System.Services.serverManager.open(resultObject=>{if(0===PendingCounter.OpenServerConnection)return;if(1e4===TcHmi.System.Init.__initStep)return;let finalized=!1;const finalize=()=>{finalized||(finalized=!0,initStageInfo.get(initStage).done++,updateSplashScreen(),resultObject.error===TcHmi.Errors.NONE?(PendingCounter.OpenServerConnection=0,TcHmi.System.Init.__initStep=17,initStage=7,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})):(resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_CHECK_FAILED?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to check server license: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_License_Check_Failed failed",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error)):resultObject.error===TcHmi.Errors.E_SERVER_COMMAND_ERROR?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Server license symbol invalid: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Command_Error",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error)):resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_LICENSE_MISSING?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Server license is missing: "+TcHmi.Log.buildMessage(resultObject.details)),TCHMI_DESIGNER?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Reopen_Editor_Window",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error)):(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("License_Missing",{level:TcHmi.Locale.Level.Engineering})+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error))):resultObject.error===TcHmi.Errors.E_WEBSOCKET_OPEN_SERVER_NO_ACCESS?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Server_Denied_Access",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Reload_In_N_Seconds",{level:TcHmi.Locale.Level.Engineering}),"5")+"<br/>\n"+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error),window.setTimeout((function(){window.location.reload()}),5e3)):!0===TCHMI_DESIGNER?(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Opening connection to server engineering server failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.System.Services.localization.getText("Please_Start_Engineering_Server",{level:TcHmi.Locale.Level.Engineering})+'<br/>\n<br/>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error)):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Opening connection to server failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+"<br />\n"+TcHmi.System.Services.localization.getText("Possible_Reasons",{level:TcHmi.Locale.Level.Engineering})+":<br />\n- "+TcHmi.System.Services.localization.getText("Possibly_Reason_Server_Websocket_Certificate_Not_Trusted",{level:TcHmi.Locale.Level.Engineering})+"<br />\n- "+tchmi_format_string(TcHmi.System.Services.localization.getText("Possibly_Reason_Url_Targets_No_Running_Websocket_Server",{level:TcHmi.Locale.Level.Engineering}),resultObject.url)+"<br />\n- "+TcHmi.System.Services.localization.getText("Possibly_Reason_Proxy_Problem",{level:TcHmi.Locale.Level.Engineering})+"<br />\n<br />\n"+TcHmi.System.Services.localization.getText("Browser_Console_Could_Have_More_Information",{level:TcHmi.Locale.Level.Engineering})+'<br />\n<br />\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error)),TcHmi.System.Init.__initStep=1e4,InitStateMachine()))};if(TcHmi.System.Services.accessManager.isReady()||resultObject.error!==TcHmi.Errors.NONE)finalize();else{let timeoutId=0,destroy=TcHmi.EventProvider.register("System.onAccessManagerReady",(e,data)=>{clearTimeout(timeoutId),e.destroy(),destroy=null,finalize()});timeoutId=setTimeout(()=>{destroy&&(destroy(),destroy=null),finalize()},5e3)}});break;case 17:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_ENGINEERING_CONNECTION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.OPEN_ENGINEERING_CONNECTION")),!TCHMI_ENGINEERING)return TcHmi.System.Init.__initStep=19,initStage=5,void InitStateMachine();TcHmi.System.Init.__initStep=1,PendingCounter.OpenEngineeringConnection=1,TcHmi.System.Services.Engineering.designerModeComManager.open(resultObject=>{0!==PendingCounter.OpenEngineeringConnection&&1e4!==TcHmi.System.Init.__initStep&&(resultObject.error===TcHmi.Errors.NONE?(PendingCounter.OpenEngineeringConnection=0,TcHmi.System.Init.__initStep=19,initStage=5,InitStateMachine()):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Communication to TwinCAT HMI Creator failed: "+TcHmi.Log.buildMessage(resultObject.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TCHMI_DESIGNER?TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.DialogManager.buildMessage(resultObject.details)+"<br/>\n"+TcHmi.System.Services.localization.getText("Try_Reopen_Designer_Window",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error):TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Open_Engineering_Server_Connection_Failed",{level:TcHmi.Locale.Level.Engineering})+" "+TcHmi.DialogManager.buildMessage(resultObject.details)+'<br>\n<br>\n<input type="submit" value="'+TcHmi.System.Services.localization.getText("Reload",{level:TcHmi.Locale.Level.Engineering})+'" style="padding:10px;" onclick="window.location.reload()">',TcHmi.DialogManager.DialogSeverity.Error),PendingCounter.OpenEngineeringConnection=0,TcHmi.System.Init.__initStep=1e4,InitStateMachine()))});break;case 19:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.TYPEDEFINITIONS"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.TYPEDEFINITIONS")),TcHmi.System.Init.__initStep=1,PendingCounter.TypeDefinitionsResolved=1,System.Services.typeManager.doWatchSchemaDefinitions((function(data){data.error===TcHmi.Errors.NONE?(PendingCounter.TypeDefinitionsResolved=0,TCHMI_CONSOLE_LOG_LEVEL>=4&&TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Resolving type definitions finished."),TcHmi.System.Init.__initStep=20):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Resolving type definitions failed: "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Type_Definition_Failed",{level:TcHmi.Locale.Level.Engineering})+": "+TcHmi.Log.buildMessage(data.details),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4),InitStateMachine()}));break;case 20:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.SERVER_SYMBOL_SCHEMA_CACHE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.SERVER_SYMBOL_SCHEMA_CACHE")),TcHmi.System.Init.__initStep=1,PendingCounter.ServerSymbolSchemaCacheResolved=1,System.Symbol.resolveServerSymbolSchemaCache((function(data){initStageInfo.get(initStage).done++,updateSplashScreen(),data.error===TcHmi.Errors.NONE?(PendingCounter.ServerSymbolSchemaCacheResolved=0,TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=21,initStage=6,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=21,initStage=6,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})):(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Resolving server symbol schema cache failed: "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Resolving_Server_Symbol_Schema_Cache_Failed",{level:TcHmi.Locale.Level.Engineering})+": "+TcHmi.Log.buildMessage(data.details),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine())}));break;case 21:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VALIDATION"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VALIDATION")),TcHmi.System.Data.Modules.controls.array.forEach(module=>{var _a;null===(_a=module.description)||void 0===_a||_a.attributes.forEach(attribute=>{var _a;const res=TcHmi.System.Services.typeManager.getSchemaEx(attribute.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Attribute "+attribute.propertyName+" of control "+System.resolveQualifiedName(module.description.name,null===(_a=module.description)||void 0===_a?void 0:_a.namespace)+" uses invalid data type "+attribute.type+": "+TcHmi.Log.buildMessage(res.details))})}),TcHmi.System.Data.Modules.functions.array.forEach(module=>{var _a,_b,_c,_d,_e;let qname=TcHmi.System.resolveQualifiedName(module.description.function.name,null===(_a=module.description)||void 0===_a?void 0:_a.function.namespace);if(null===(_c=null===(_b=module.description)||void 0===_b?void 0:_b.function.returnValue)||void 0===_c?void 0:_c.type){const res=TcHmi.System.Services.typeManager.getSchemaEx(module.description.function.returnValue.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] ReturnValue of function "+qname+" uses invalid data type "+(null===(_d=module.description)||void 0===_d?void 0:_d.function.returnValue.type)+": "+TcHmi.Log.buildMessage(res.details))}(null===(_e=module.description)||void 0===_e?void 0:_e.function.arguments)&&module.description.function.arguments.forEach((argument,index)=>{const res=TcHmi.System.Services.typeManager.getSchemaEx(argument.type);res.error!==TcHmi.Errors.NONE&&TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Argument#"+index+" "+argument.name+" of function "+qname+" uses invalid data type "+argument.type+": "+TcHmi.Log.buildMessage(res.details))})}),TcHmi.System.Init.__initStep=22,initStage=8,TCHMI_DESIGNER?InitStateMachine():(updateSplashScreen(),setTimeout(()=>{InitStateMachine()}));break;case 22:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.USERCONTROL_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.USERCONTROL_LOAD")),TcHmi.System.Init.__initStep=1,userControlPartials&&userControlPartials.length>0){PendingCounter.UserControlsLoaded=2*userControlPartials.length;const loadUserControlMarkup=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=23,initStage=9,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=23,initStage=9,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=23,initStage=9,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=23,initStage=9,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))}});else{let xhrUserControl=new XMLHttpRequest;xhrUserControl.open("GET",url+xhrCacheSuffix);let xhrUserControlSuccess=function(evt){200===xhrUserControl.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrUserControl.responseText}),!TCHMI_DESIGNER&&indexedDbRequest&&"done"===indexedDbRequest.readyState&&indexedDbRequest.result&&indexedDbRequest.result.objectStoreNames&&indexedDbRequest.result.objectStoreNames.contains("userControlMarkup")&&indexedDbRequest.result.transaction("userControlMarkup","readwrite").objectStore("userControlMarkup").put(xhrUserControl.responseText,url),initStageInfo.get(initStage).done++,PendingCounter.UserControlsLoaded--,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=23,initStage=9,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=23,initStage=9,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))):xhrUserControlError(evt)},xhrUserControlError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrUserControl.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrUserControl.statusText),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=23,initStage=9,InitStateMachine()):setTimeout(()=>{TcHmi.System.Init.__initStep=23,initStage=9,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))))};xhrUserControl.addEventListener("load",xhrUserControlSuccess),xhrUserControl.addEventListener("error",xhrUserControlError),xhrUserControl.send()}},loadUserControlConfig=function(url){let xhrUserControlDescr=new XMLHttpRequest;xhrUserControlDescr.open("GET",url+xhrCacheSuffix);let xhrUserControlDescrError=function(evt){PendingCounter.UserControlsLoaded--,PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=23,initStage=9,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))};xhrUserControlDescr.addEventListener("load",(function(evt){if(200!==xhrUserControlDescr.status)return void xhrUserControlDescrError(evt);let ucConfig=TcHmi.ValueConverter.toObject(xhrUserControlDescr.responseText);ucConfig?(TcHmi.System.Data.Caches.partialCompositeConfigCache.set(url,ucConfig),!TCHMI_DESIGNER&&indexedDbRequest&&"done"===indexedDbRequest.readyState&&indexedDbRequest.result&&indexedDbRequest.result.objectStoreNames&&indexedDbRequest.result.objectStoreNames.contains("userControlConfig")&&indexedDbRequest.result.transaction("userControlConfig","readwrite").objectStore("userControlConfig").put(ucConfig,url)):TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Failed to load user control config: '"+url+"'. Response is no valid user control JSON: \n"+xhrUserControlDescr.responseText),PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=23,initStage=9,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))})),xhrUserControlDescr.addEventListener("error",xhrUserControlDescrError),xhrUserControlDescr.send()};for(const usercControlPartial of userControlPartials){if(TcHmi.System.Data.Caches.partialMarkupCache.has(usercControlPartial.url)?(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++):loadUserControlMarkup(usercControlPartial.url),!usercControlPartial.url.endsWith(".usercontrol")){TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi] Configuration file: 'Properties/tchmiconfig.json' is not valid. userControls includes a wrong formed entry. url must end with \".js\". Reference will be skipped. Entry: ",usercControlPartial),PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++;continue}let configurl=usercControlPartial.url.replace(".usercontrol",".usercontrol.json");TcHmi.System.Data.Caches.partialCompositeConfigCache.has(configurl)?(PendingCounter.UserControlsLoaded--,initStageInfo.get(initStage).done++):loadUserControlConfig(configurl)}PendingCounter.UserControlsLoaded<=0&&(TcHmi.System.Services.controlManager.resolveUcAttributes(),TcHmi.System.Services.themeManager.retriggerUserControls(),TcHmi.System.Init.__initStep=23,initStage=9,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))}else TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=23,initStage=9,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=23,initStage=9,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}));break;case 23:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.ContentLoaded=contentPartials.length,contentPartials&&contentPartials.length>0){const loadContent=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--,updateSplashScreen(),PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=24,initStage=10,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ContentLoaded--,PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=24,initStage=10,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))}});else{let xhrContent=new XMLHttpRequest;xhrContent.open("GET",url+xhrCacheSuffix);let xhrContentSuccess=function(evt){200===xhrContent.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrContent.responseText}),!TCHMI_DESIGNER&&indexedDbRequest&&"done"===indexedDbRequest.readyState&&indexedDbRequest.result&&indexedDbRequest.result.objectStoreNames&&indexedDbRequest.result.objectStoreNames.contains("contentMarkup")&&indexedDbRequest.result.transaction("contentMarkup","readwrite").objectStore("contentMarkup").put(xhrContent.responseText,url),initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--,updateSplashScreen(),PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=24,initStage=10,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))):xhrContentError(evt)},xhrContentError=function(evt){1e4!==TcHmi.System.Init.__initStep&&(TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrContent.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrContent.statusText),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ContentLoaded--,PendingCounter.ContentLoaded<=0&&(TcHmi.System.Init.__initStep=24,initStage=10,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))))};xhrContent.addEventListener("load",xhrContentSuccess),xhrContent.addEventListener("error",xhrContentError),xhrContent.send()}};for(const contentPartial of contentPartials)!0!==contentPartial.preload||!0===TCHMI_DESIGNER||!0===TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL?(TCHMI_DESIGNER||!0!==contentPartial.preload||!0!==contentPartial.preload||!0!==TCHMI_ENGINEERING||contentPartial.url!==TCHMI_TARGET_PARTIAL||(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ContentLoaded--):System.Data.Caches.partialMarkupCache.has(contentPartial.url)?(initStageInfo.get(initStage).done++,PendingCounter.ContentLoaded--):loadContent(contentPartial.url)}PendingCounter.ContentLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=24,initStage=10,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=24,initStage=10,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})));break;case 24:if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_LOAD"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_LOAD")),TcHmi.System.Init.__initStep=1,PendingCounter.ViewLoaded=viewPartials.length,viewPartials&&viewPartials.length>0){const loadView=function(url){if(TCHMI_ENGINEERING)TcHmi.System.Services.Engineering.designerModeManager.partialContentManager.requestCurrentPartialContent(url,data=>{if(data.error===TcHmi.Errors.NONE){if(1e4===TcHmi.System.Init.__initStep)return;System.Data.Caches.partialMarkupCache.set(url,{markup:data.content}),initStageInfo.get(initStage).done++,PendingCounter.ViewLoaded--,updateSplashScreen(),PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=25,initStage=11,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))}else{if(1e4===TcHmi.System.Init.__initStep)return;TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+TcHmi.Log.buildMessage(data.details)),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,InitStateMachine()):(PendingCounter.ViewLoaded--,PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=25,initStage=11,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})))}});else{let xhrView=new XMLHttpRequest;xhrView.open("GET",url+xhrCacheSuffix);let xhrViewSuccess=function(evt){200===xhrView.status?1e4!==TcHmi.System.Init.__initStep&&(System.Data.Caches.partialMarkupCache.set(url,{markup:xhrView.responseText}),initStageInfo.get(initStage).done++,PendingCounter.ViewLoaded--,updateSplashScreen(),PendingCounter.ViewLoaded<=0&&(TcHmi.System.Init.__initStep=25,initStage=11,TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))):xhrViewError(evt)},xhrViewError=function(evt){if(1e4!==TcHmi.System.Init.__initStep)return TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("[Source=Framework, Module=TcHmi] Loading "+url+" failed. Errordetail: "+xhrView.statusText),url===TCHMI_TARGET_PARTIAL?(TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),url)+" "+TcHmi.System.Services.localization.getText("Propably_Syntax_Error_Html_Or_Wrong_Entry_Config",{level:TcHmi.Locale.Level.Engineering})+" "+tchmi_format_string(TcHmi.System.Services.localization.getText("Details_Placeholder",{level:TcHmi.Locale.Level.Engineering}),xhrView.statusText),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine()):(PendingCounter.ViewLoaded--,PendingCounter.ViewLoaded<=0?(TcHmi.System.Init.__initStep=25,initStage=11,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))):void 0)};xhrView.addEventListener("load",xhrViewSuccess),xhrView.addEventListener("error",xhrViewError),xhrView.send()}};for(const viewPartial of viewPartials)!0!==viewPartial.preload||!0===TCHMI_DESIGNER||!0===TCHMI_ENGINEERING&&viewPartial.url===TCHMI_TARGET_PARTIAL?(TCHMI_DESIGNER||!0!==TCHMI_ENGINEERING||!0!==viewPartial.preload||viewPartial.url!==TCHMI_TARGET_PARTIAL||(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ViewLoaded--):loadView(viewPartial.url)}PendingCounter.ViewLoaded<=0&&(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=25,initStage=11,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=25,initStage=11,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})));break;case 25:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_COMPILE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.CONTENT_COMPILE")),TcHmi.System.Init.__initStep=1;for(let contentPartial of contentPartials)!0!==contentPartial.preload||!0===TCHMI_DESIGNER||!0===TCHMI_ENGINEERING&&contentPartial.url===TCHMI_TARGET_PARTIAL?(TCHMI_DESIGNER||!0!==contentPartial.preload||!0!==TCHMI_ENGINEERING||contentPartial.url!==TCHMI_TARGET_PARTIAL||(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ContentCompiled--):function(contentPartial){setTimeout(()=>{const cleanPath=contentPartial.url;let htmlFiltered=System.Data.Caches.partialMarkupCache.get(cleanPath);if(htmlFiltered){let tempDiv=document.createElement("div");tempDiv.innerHTML=htmlFiltered.markup;let tempContentPartial=tempDiv.firstElementChild;if(tempContentPartial){htmlFiltered.partialId=tempContentPartial.id,tempContentPartial.setAttribute("data-tchmi-partial-url",cleanPath);let contentControl=TcHmi.System.Services.controlManager.compile(tempContentPartial);void 0!==contentControl&&contentControl.__setKeepAlive(!0)}}if(PendingCounter.ContentCompiled--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.ContentCompiled<=0)return TcHmi.System.Init.__initStep=26,initStage=12,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))})}(contentPartial);if(PendingCounter.ContentCompiled<=0)return void(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=26,initStage=12,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=26,initStage=12,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})));break;case 26:TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_COMPILE"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.VIEW_COMPILE")),TcHmi.System.Init.__initStep=1;for(let viewPartial of viewPartials)!0!==viewPartial.preload||!0===TCHMI_DESIGNER||!0===TCHMI_ENGINEERING&&viewPartial.url===TCHMI_TARGET_PARTIAL?(TCHMI_DESIGNER||!0!==viewPartial.preload||!0!==TCHMI_ENGINEERING||!0!==viewPartial.preload||viewPartial.url!==TCHMI_TARGET_PARTIAL||(initStageInfo.get(initStage).done++,updateSplashScreen()),PendingCounter.ViewCompiled--):function(viewPartial){setTimeout(()=>{const cleanPath=viewPartial.url;let htmlFiltered=System.Data.Caches.partialMarkupCache.get(cleanPath);if(htmlFiltered){let tempDiv=document.createElement("div");tempDiv.innerHTML=htmlFiltered.markup;let tempViewPartial=tempDiv.firstElementChild;if(tempViewPartial){tempViewPartial.setAttribute("data-tchmi-partial-url",cleanPath),htmlFiltered.partialId=tempViewPartial.id;let viewControl=TcHmi.System.Services.controlManager.compile(tempViewPartial);void 0!==viewControl&&viewControl.__setKeepAlive(!0),htmlFiltered=void 0}}if(PendingCounter.ViewCompiled--,initStageInfo.get(initStage).done++,updateSplashScreen(),PendingCounter.ViewCompiled<=0)return TcHmi.System.Init.__initStep=27,initStage=14,void(TCHMI_DESIGNER?InitStateMachine():setTimeout(()=>{updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))})}(viewPartial);if(PendingCounter.ViewCompiled<=0)return void(TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=27,initStage=13,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=27,initStage=13,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})})));break;case 27:{const done=()=>{TCHMI_DESIGNER?(TcHmi.System.Init.__initStep=1e3,initStage=14,InitStateMachine()):(updateSplashScreen(),setTimeout(()=>{TcHmi.System.Init.__initStep=1e3,initStage=14,updateSplashScreen(),setTimeout(()=>{InitStateMachine()})}))};let preloadingBindings=TcHmi.System.Services.bindingManager.getPreloadingBindings();if(0===preloadingBindings.size)done();else{let preloadingBindingsSizeStart=preloadingBindings.size;initStageInfo.get(13).toDo=preloadingBindingsSizeStart,TcHmi.System.Services.bindingManager.watchPreloadingBindings(data=>{var _a;initStageInfo.get(13).done=preloadingBindingsSizeStart-data.result.size,updateSplashScreen(),0===data.result.size&&(null===(_a=data.destroy)||void 0===_a||_a.call(data),done())})}}break;case 1e3:{let vurl;if(TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.FINAL"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.FINAL")),TcHmi.System.Init.__initStep=1,TcHmi.System.Services.triggerManager.register(TcHmi.System.config.trigger),!0===TCHMI_DESIGNER)vurl=tchmi_path(TCHMI_TARGET_PARTIAL);else{const cfgvurl=TcHmi.System.config.startupView;if(!cfgvurl)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Startup_View_Not_Defined_Please_Configure",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();let bValid=!1;const cleanStartupPath=tchmi_path(cfgvurl);for(const viewPartial of viewPartials)if(tchmi_path(viewPartial.url)===cleanStartupPath){bValid=!0;break}if(!bValid)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",TcHmi.System.Services.localization.getText("Unable_To_Find_View_Definition_Matching_Startup_View_Definition",{level:TcHmi.Locale.Level.Engineering}),TcHmi.DialogManager.DialogSeverity.Error),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();vurl=cfgvurl}TcHmi.System.Services.viewManager.setScaleMode(TcHmi.System.config.scaleMode),TcHmi.System.Services.viewManager.loadView(vurl,(function(data){if(initStageInfo.get(initStage).done++,updateSplashScreen(),data.error!==TcHmi.Errors.NONE)return TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),TcHmi.System.Services.dialogManager.updateText("__TcHmiMain",tchmi_format_string(TcHmi.System.Services.localization.getText("Loading_File_Failed",{level:TcHmi.Locale.Level.Engineering}),vurl),TcHmi.DialogManager.DialogSeverity.Error),TCHMI_CONSOLE_LOG_LEVEL>=1&&TcHmi.Log.error("Failed to load "+vurl+": "+TcHmi.Log.buildMessage(data.details)),TcHmi.System.Init.__initStep=1e4,void InitStateMachine();TcHmi.System.isInitialized=!0,TcHmi.EventProvider.raise("onInitialized"),TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] End"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms")),setTimeout(()=>{TcHmi.System.Services.splashScreen.hide()})}))}break;case 1e4:if(TcHmi.System.Services.splashScreen.hide(),TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] INIT_STATE.ERROR"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] INIT_STATE.ERROR")),"loading"===document.readyState){let restartStatemaschine=function(){document.removeEventListener("readystatechange",restartStatemaschine),TcHmi.System.Services.dialogManager.showDialog("__TcHmiMain",!0,TcHmi.DialogManager.DialogType.Overlay),InitStateMachine()};document.addEventListener("readystatechange",restartStatemaschine);break}TCHMI_CONSOLE_LOG_LEVEL>=4&&(TcHmi.Log.performanceLog("[Source=Framework, Module=TcHmi] End"),TcHmi.Log.debug("[Source=Framework, Module=TcHmi] Time elapsed: "+performance.now().toFixed(3).toString()+"ms"));break;default:TcHmi.System.Init.__initStep=1}}()}}Init.__initStep=0,System.Init=Init}(TcHmi.System||(TcHmi.System={}))}(TcHmi||(TcHmi={})),!0!==TCHMI_UNITTEST_MODE&&(TcHmi.System.Init.printDebugOutput(),TcHmi.System.Init.prepare(),TcHmi.System.Init.run(2));