@frangoteam/fuxa
Version:
Web-based Process Visualization (SCADA/HMI/Dashboard) software
1 lines • 6.83 MB
JavaScript
(self.webpackChunkFUXA=self.webpackChunkFUXA||[]).push([[179],{49:(Ot,Ie,re)=>{"use strict";re.d(Ie,{C:()=>T});var W=re(2340),Y=re(4650);let T=(()=>{class e{static url=null;static getURL(){if(!this.url)if(W.N.apiEndpoint)this.url=W.N.apiEndpoint;else{location;let h=location.origin.split("/")[2];const d=location.origin.split(":")[0],f=h.split(":")[0];f.length>1&&W.N.apiPort&&(h=f+":"+W.N.apiPort),this.url=d+"://"+h}return this.url}static getRemoteURL(_){return location.origin.split(":")[0]+"://"+_+":"+W.N.apiPort+"/api"}static \u0275fac=function(h){return new(h||e)};static \u0275prov=Y.Yz7({token:e,factory:e.\u0275fac})}return e})()},8257:(Ot,Ie,re)=>{"use strict";re.d(Ie,{T9:()=>T,cQ:()=>Y});var W=re(4650);class Y{static _seed=Date.now();static minDate=new Date(1970,0,1);static maxDate=new Date(2100,11,31);static defaultColor=["#FFFFFF","#000000","#EEECE1","#1F497D","#4F81BD","#C0504D","#9BBB59","#8064A2","#4BACC6","#F79646","#C00000","#FF0000","#FFC000","#FFD04A","#FFFF00","#92D050","#0AC97D","#00B050","#00B0F0","#4484EF","#3358C0","#002060","#7030A0","#D8D8D8","#BFBFBF","#A5A5A5","#7F7F7F","#595959","#3F3F3F","#262626"];static lineColor=["#4484ef","#ef0909","#00b050","#ffd04a","#7030a0","#a5a5a5","#c0504d","#000000"];static svgTagToType=["rect","line","path","circle","ellipse","text"];static walkTree(_,h){if(_&&1==_.nodeType){h(_);for(var d=_.childNodes.length;d--;)this.walkTree(_.childNodes.item(d),h)}}static searchTreeStartWith(_,h){if(_.id.startsWith(h))return _;if(null!=_.children){var d,f=null;for(d=0;null==f&&d<_.children.length;d++)f=Y.searchTreeStartWith(_.children[d],h);return f}return null}static childrenStartWith(_,h){let d=[];for(let f=0;f<_.children?.length;f++)_.children[f].id.startsWith(h)&&d.push(_.children[f]);return d}static searchTreeTagName(_,h){if(_.tagName===h)return _;if(null!=_.children){var d,f=null;for(d=0;null==f&&d<_.children.length;d++)f=Y.searchTreeTagName(_.children[d],h);return f}return null}static findElementByIdRecursive(_,h){if(!_)return null;if(_.id===h)return _;for(let d=0;d<_.children.length;d++){const C=this.findElementByIdRecursive(_.children[d],h);if(C)return C}return null}static searchValuesByAttribute(_,h){const d=[];return function f(C){if(Array.isArray(C))for(const v of C)f(v);else if("object"==typeof C&&null!==C){C.hasOwnProperty(h)&&d.push(C[h]);for(const v in C)f(C[v])}}(_),d}static changeAttributeValue(_,h,d,f){!function C(v){if(Array.isArray(v))for(const w of v)C(w);else if("object"==typeof v&&null!==v){v.hasOwnProperty(h)&&v[h]===d&&(v[h]=f);for(const w in v)C(v[w])}}(_)}static replaceStringInObject(_,h,d){let f=JSON.stringify(_);const C=new RegExp(h,"g");return f=f.replace(C,d),JSON.parse(f)}static getInTreeIdAndType(_){let h=_.getAttribute("type");!h&&Y.svgTagToType.includes(_.tagName.toLowerCase())&&(h="svg-ext-shapes-"+_.tagName.toLowerCase());let d=_.getAttribute("id"),f=[];d&&h&&(f=[{id:d,type:h}]);for(var C=0;C<_.children.length;C++){const v=Y.getInTreeIdAndType(_.children[C]);f=[...f,...v]}return f}static cleanObject(_){const h={};for(const d in _)null!=_[d]&&(h[d]=_[d]);return h}static isNullOrUndefined(_){return null==_}static enumKeys(_){return Object.keys(_)}static enumValues(_){return Object.keys(_).map(d=>Object(_)[d])}static getGUID(_=""){var d,f,h="";for(d=0;d<16;d++)f=16*Math.random()|0,8==d&&(h+="-"),h+=(12==d?4:16==d?3&f|8:f).toString(16);return _+h}static getShortGUID(_="",h="-"){var f,C,d="";for(f=0;f<12;f++)C=16*Math.random()|0,8==f&&(d+=h),d+=(4==f?4:6==f?3&C|8:C).toString(12);return _+d}static getNextName(_,h){let d=1,f=_+d;for(;h.indexOf(f)>=0;)d++,f=_+d;return f}static isObject(_){return"object"==typeof _&&null!==_}static getType(_){return typeof _}static getTextHeight(_){var d=document.createElement("canvas").getContext("2d");return d.font=_,d.measureText("M").width}static getDomTextHeight(_,h){let d=document.createElement("span");document.body.appendChild(d),d.style.font=h,d.style.fontSize=_+"px",d.style.height="auto",d.style.width="auto",d.style.position="absolute",d.style.whiteSpace="no-wrap",d.innerHTML="M";let f=Math.ceil(d.clientHeight);return document.body.removeChild(d),f}static getEnumKey(_,h){return Object.keys(_).find(d=>_[d]===h)}static isJson(_){try{let h=JSON.parse(_);if(h&&Object.keys(h).length)return!0}catch{}return!1}static isNumeric(_){return!isNaN(parseFloat(_))&&isFinite(_)}static Boolify(_){return-1===[!0,!1,"true","false",1,0].indexOf(_)?null:1==_||"true"==_||1==_}static toNumber(_){const h=Y.Boolify(_);return Y.isNullOrUndefined(h)?_:Number(h)}static toFloatOrNumber(_){let h=parseFloat(_);return h=Y.isNullOrUndefined(h)?Number(_):parseFloat(h.toFixed(5)),h}static formatValue(_,h){try{if(Y.isNumeric(_))return numeral(_).format(h)}catch(d){console.error(d)}return _}static arrayToObject=(_,h)=>{_.reduce((d,f)=>(d[f[h]]=f,d),{})};static rand(_,h){return _=_||0,h=h||0,this._seed=(9301*this._seed+49297)%233280,Math.round(_+this._seed/233280*(h-_))}static randNumbers(_,h,d){let f=[];for(let C=0;C<_;++C)f.push(this.rand(h,d));return f}static formatDate(_,h,d){var f=["\0","January","February","March","April","May","June","July","August","September","October","November","December"],C=["\x01","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],v=["\x02","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],w=["\x03","Sun","Mon","Tue","Wed","Thu","Fri","Sat"];let B=(X,ee)=>{var ie=X+"";for(ee=ee||2;ie.length<ee;)ie="0"+ie;return ie};var x=d?_.getUTCFullYear():_.getFullYear();h=(h=(h=h.replace(/(^|[^\\])yyyy+/g,"$1"+x)).replace(/(^|[^\\])yy/g,"$1"+x.toString().substr(2,2))).replace(/(^|[^\\])y/g,"$1"+x);var I=(d?_.getUTCMonth():_.getMonth())+1;h=(h=(h=(h=h.replace(/(^|[^\\])MMMM+/g,"$1"+f[0])).replace(/(^|[^\\])MMM/g,"$1"+C[0])).replace(/(^|[^\\])MM/g,"$1"+B(I))).replace(/(^|[^\\])M/g,"$1"+I);var k=d?_.getUTCDate():_.getDate();h=(h=(h=(h=h.replace(/(^|[^\\])dddd+/g,"$1"+v[0])).replace(/(^|[^\\])ddd/g,"$1"+w[0])).replace(/(^|[^\\])dd/g,"$1"+B(k))).replace(/(^|[^\\])d/g,"$1"+k);var E=d?_.getUTCHours():_.getHours(),A=E>12?E-12:0==E?12:E;h=(h=(h=(h=h.replace(/(^|[^\\])HH+/g,"$1"+B(E))).replace(/(^|[^\\])H/g,"$1"+E)).replace(/(^|[^\\])hh+/g,"$1"+B(A))).replace(/(^|[^\\])h/g,"$1"+A);var S=d?_.getUTCMinutes():_.getMinutes();h=(h=h.replace(/(^|[^\\])mm+/g,"$1"+B(S))).replace(/(^|[^\\])m/g,"$1"+S);var F=d?_.getUTCSeconds():_.getSeconds();h=(h=h.replace(/(^|[^\\])ss+/g,"$1"+B(F))).replace(/(^|[^\\])s/g,"$1"+F);var R=d?_.getUTCMilliseconds():_.getMilliseconds();h=h.replace(/(^|[^\\])fff+/g,"$1"+B(R,3)),R=Math.round(R/10),h=h.replace(/(^|[^\\])ff/g,"$1"+B(R)),R=Math.round(R/10);var Z=E<12?"AM":"PM";h=(h=(h=h.replace(/(^|[^\\])f/g,"$1"+R)).replace(/(^|[^\\])TT+/g,"$1"+Z)).replace(/(^|[^\\])T/g,"$1"+Z.charAt(0));var J=Z.toLowerCase();h=(h=h.replace(/(^|[^\\])tt+/g,"$1"+J)).replace(/(^|[^\\])t/g,"$1"+J.charAt(0));var O=-_.getTimezoneOffset(),H=d||!O?"Z":O>0?"+":"-";if(!d){var G=(O=Math.abs(O))%60;H+=B(Math.floor(O/60))+":"+B(G)}h=h.replace(/(^|[^\\])K/g,"$1"+H);var P=(d?_.getUTCDay():_.getDay())+1;return(h=(h=(h=(h=h.replace(new RegExp(v[0],"g"),v[P])).replace(new RegExp(w[0],"g"),w[P])).replace(new RegExp(f[0],"g"),f[I])).replace(new RegExp(C[0],"g"),C[I])).replace(/\\(.)/g,"$1")}static findBitPosition(_){let h=[];for(let d=0;d<32;d++)_&1<<d&&h.push(d);return h}static assign=(_,...h)=>(h.forEach(d=>Object.keys(d).forEach(f=>{_[f]=d[f]})),_);static clone=_=>JSON.parse(JSON.stringify(_));static convertArrayToObject=(_,h)=>_.reduce((d,f)=>({...d,[f]:h}),{});static resizeView=_=>{document.querySelectorAll(_).forEach(h=>{let d=h.parentNode;h.style.transform="scale("+Math.min(d.offsetWidth/h.offsetWidth,d.offsetHeight/h.offsetHeight)+")",h.style.transformOrigin="top left"})};static resizeViewExt=(_,h,d)=>{const f=document.getElementById(h);if(!f)return void console.error(`resizeViewExt -> Parent element with ID '${h}' not found.`);const C=f.getBoundingClientRect(),v=d??"none";f.querySelectorAll(_).forEach(w=>{const B=C?.width/w.offsetWidth,x=C?.height/w.offsetHeight;"contain"===v?w.style.transform="scale("+Math.min(B,x)+")":"stretch"===v?w.style.transform="scale("+B+", "+x+")":"none"===v&&(w.style.transform="scale(1)"),w.style.transformOrigin="top left"})};static resizeViewRev=(_,h,d)=>{function f(w,B,x){const I=B?.width/w.clientWidth,k=B?.height/w.clientHeight;"contain"===x?(w.style.transform="scale("+Math.min(I,k)+")",w.parentElement.style.margin="unset"):"stretch"===x?(w.style.transform="scale("+I+", "+k+")",w.parentElement.style.margin="unset"):"none"===x&&(w.style.transform="scale(1)"),w.style.top="unset",w.style.left="unset",w.style.transformOrigin="top left"}const C="string"==typeof h?document.getElementById(h):h;if(!C)return void console.error(`resizeViewExt -> Parent element with ID '${h}' not found.`);const v=C.getBoundingClientRect();"string"==typeof _?C.querySelectorAll(_).forEach(w=>{f(w,v,d??"none")}):_&&f(_,v,d??"none")};static mergeDeep(..._){const h={};return _.forEach(d=>{d&&Object.keys(d).forEach(f=>{d[f]&&"object"==typeof d[f]&&!Array.isArray(d[f])?h[f]=Y.mergeDeep(h[f],d[f]):Array.isArray(d[f])?(Array.isArray(h[f])||(h[f]=[]),h[f]=h[f].concat(d[f])):h[f]=d[f]})}),h}static mergeArray(_,h){const d=new Map;if(_)for(const f of _)if(f)for(const C of f){const v=C[h];v?d.set(v,{...d.get(v),...C}):console.warn(`L'oggetto ${JSON.stringify(C)} non ha la chiave ${h}`)}return Array.from(d.values())}static copyToClipboard(_){const h=document.createElement("textarea");h.value=_,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h)}static millisecondsToTime(_){const h=Math.floor(_/36e5);_%=36e5;const d=Math.floor(_/6e4);return _%=6e4,{hours:h,minutes:d,seconds:Math.floor(_/1e3),milliseconds:_%=1e3}}static timeToString(_,h){function d(C,v){return C.toString().padStart(v,"0")}let f=`${d(_.hours,2)}:${d(_.minutes,2)}`;return h&&(f+=`:${d(_.seconds,2)}`,h>=1e3&&(f+=`.${d(_.milliseconds,3)}`)),f}static millisecondsToTimeString(_,h){return Y.timeToString(Y.millisecondsToTime(_),h)}static millisecondsToDateString(_,h){const d=new Date(_),f=d.getFullYear(),C=(d.getMonth()+1).toString().padStart(2,"0"),v=d.getDate().toString().padStart(2,"0"),w=d.getHours().toString().padStart(2,"0"),B=d.getMinutes().toString().padStart(2,"0"),x=d.getSeconds().toString().padStart(2,"0"),I=d.getMilliseconds().toString().padStart(3,"0");let k=`${f}-${C}-${v}`;return h>0&&(k+=`T${w}:${B}`,h>1&&(k+=`:${x}`,h>100&&(k+=`.${I}`))),k}static getTimeDifferenceInSeconds(_){const d=Date.now()-_;return Math.floor(d/1e3)}static isValidUrl(_){try{return new URL(_),!0}catch{return!1}}static \u0275fac=function(h){return new(h||Y)};static \u0275prov=W.Yz7({token:Y,factory:Y.\u0275fac})}let T=(()=>{class l{transform(h){let d=[];for(var f=Object.keys(h),C=Object.values(h),v=0;v<f.length;v++)d.push({key:f[v],value:C[v]});return d}static \u0275fac=function(d){return new(d||l)};static \u0275pipe=W.Yjl({name:"enumToArray",type:l,pure:!0})}return l})()},8273:(Ot,Ie,re)=>{"use strict";re.d(Ie,{R:()=>W});class W{scriptSystemFunctions=[]}},8396:(Ot,Ie,re)=>{"use strict";re.d(Ie,{$2:()=>G,$u:()=>J,AS:()=>e,Bj:()=>Y,Bl:()=>K,Jo:()=>T,Lk:()=>I,M$:()=>A,MC:()=>H,Nq:()=>X,PC:()=>_,Qn:()=>B,Qv:()=>F,Qy:()=>w,TO:()=>k,TP:()=>C,Ug:()=>E,Vp:()=>l,Yi:()=>v,ef:()=>O,fm:()=>ee,jP:()=>h,mT:()=>d,nP:()=>S,p2:()=>x,pP:()=>Z,rq:()=>R});var W=re(8257);const Y={id:"0",name:"FUXA"},T={id:"@",name:"Placeholder",tags:[{id:"@",name:"@",device:"@"}]};let e=(()=>class ie{id;name;enabled;property;type;polling;tags;constructor(Se){this.id=Se}static descriptor={id:"Device id, GUID",name:"Device name",enabled:"Enabled",type:"Device Type: FuxaServer | SiemensS7 | OPCUA | BACnet | ModbusRTU | ModbusTCP | WebAPI | MQTTclient | internal | EthernetIP |Gpio",polling:"Polling interval in millisec., check changed value after ask value, by OPCUA there is a monitor",property:"Connection property depending of type",tags:"Tags list of Tag"};static isWebApiProperty(Se){return Se.type===v.WebAPI&&Se.property.getTags}})(),l=(()=>class ie{id;name;label;value;type;memaddress;address;divisor;access;options;format;daq;init;scale;scaleReadFunction;scaleReadParams;scaleWriteFunction;scaleWriteParams;sysType;description;deadband;direction;edge;constructor(Se){this.id=Se,this.daq=new _(!1,!1,60,!1)}static descriptor={id:"Tag id, GUID",name:"Tag name, is like the id",label:"Tag label, used by BACnet and WebAPI",type:"Tag type, Bool, Byte, etc. depending of device type",memaddress:"Address of Tag, combine with address by Modbus, some property for WebAPI",address:"Tag address, for OPCUA like the id",divisor:"Value divisor, used by Modbus",options:"Options is a string JSON object, used for WebAPI and MQTT, pubs: items to publish | subs: items to subscribe",init:"Init value",daq:{enabled:"Daq enabled storage",interval:"min storage interval (without change value)"},format:"Number of digits to appear after the decimal point",direction:"A string specifying whether the GPIO should be configured as an input or output. The valid values are: 'in', 'out', 'high', and 'low'. If 'out' is specified the GPIO will be configured as an output and the value of the GPIO will be set to 0. 'high' and 'low' are variants of 'out' that configure the GPIO as an output with an initial level of 1 or 0 respectively.",edge:"An optional string specifying the interrupt generating edge or edges for an input GPIO. The valid values are: 'none', 'rising', 'falling' or 'both'. The default value is 'none' indicating that the GPIO will not generate interrupts. Whether or not interrupts are supported by an input GPIO is GPIO specific. If interrupts are not supported by a GPIO the edge argument should not be specified. The edge argument is ignored for output GPIOs."}})();class _{enabled;interval;changed;restored=!1;constructor(ve,Se,De,Fe){this.enabled=ve,this.changed=Se,this.interval=De,this.restored=Fe}}var h=(()=>((h||(h={})).absolute="absolute",h))();let d=(()=>class ie{address;port;slot;rack;slaveid;baudrate;databits;stopbits;parity;options;method;format;connectionOption;delay=10;socketReuse;static descriptor={address:"Device address (IP)"}})();class C{mode;username;password;clientId;grant_type;certificateFileName;privateKeyFileName;caCertificateFileName}var v=(()=>{return(ie=v||(v={})).FuxaServer="FuxaServer",ie.SiemensS7="SiemensS7",ie.OPCUA="OPCUA",ie.BACnet="BACnet",ie.ModbusRTU="ModbusRTU",ie.ModbusTCP="ModbusTCP",ie.WebAPI="WebAPI",ie.MQTTclient="MQTTclient",ie.internal="internal",ie.EthernetIP="EthernetIP",ie.ODBC="ODBC",ie.GPIO="GPIO",v;var ie})(),w=(()=>{return(ie=w||(w={})).Bool="Bool",ie.Byte="Byte",ie.Int="Int",ie.Word="Word",ie.DInt="DInt",ie.DWord="DWord",ie.Real="Real",w;var ie})(),B=(()=>{return(ie=B||(B={})).Bool="Bool",ie.Int16="Int16",ie.UInt16="UInt16",ie.Int32="Int32",ie.UInt32="UInt32",ie.Float32="Float32",ie.Float64="Float64",ie.Int64="Int64",ie.Int16LE="Int16LE",ie.UInt16LE="UInt16LE",ie.Int32LE="Int32LE",ie.UInt32LE="UInt32LE",ie.Float32LE="Float32LE",ie.Float64LE="Float64LE",ie.Int64LE="Int64LE",ie.Float32MLE="Float32MLE",ie.Int32MLE="Int32MLE",ie.UInt32MLE="UInt32MLE",B;var ie})(),x=(()=>{return(ie=x||(x={})).Boolean="Boolean",ie.SByte="SByte",ie.Byte="Byte",ie.Int16="Int16",ie.UInt16="UInt16",ie.Int32="Int32",ie.UInt32="UInt32",ie.Int64="Int64",ie.UInt64="UInt64",ie.Float="Float",ie.Double="Double",ie.String="String",ie.DateTime="DateTime",ie.Guid="Guid",ie.ByteString="ByteString",x;var ie})(),I=(()=>{return(ie=I||(I={})).SerialPort="SerialPort",ie.RTUBufferedPort="RTUBufferedPort",ie.AsciiPort="AsciiPort",ie.TcpPort="TcpPort",ie.UdpPort="UdpPort",ie.TcpRTUBufferedPort="TcpRTUBufferedPort",ie.TelnetPort="TelnetPort",I;var ie})(),k=(()=>{return(ie=k||(k={})).Reuse="Reuse",ie.ReuseSerial="ReuseSerial",k;var ie})(),E=(()=>{return(ie=E||(E={})).in="in",ie.out="out",ie.high=" - high",ie.low=" - low",E;var ie})(),A=(()=>{return(ie=A||(A={})).none="none",ie.rising="rising",ie.falling="falling",ie.both="both",A;var ie})(),S=(()=>{return(ie=S||(S={}))[ie.INVALID=0]="INVALID",ie.NONE="1",ie.SIGN="2",ie.SIGNANDENCRYPT="3",S;var ie})(),F=(()=>{return(ie=F||(F={})).None="None",ie.Basic128="Basic128",ie.Basic128Rsa15="Basic128Rsa15",ie.Basic192="Basic192",ie.Basic192Rsa15="Basic192Rsa15",ie.Basic256="Basic256",ie.Basic256Rsa15="Basic256Rsa15",ie.Basic256Sha256="Basic256Sha256",ie.Aes256_Sha256_RsaPss="Aes256_Sha256_RsaPss",ie.Aes128_Sha256_RsaOaep="Aes128_Sha256_RsaOaep",F;var ie})(),R=(()=>{return(ie=R||(R={})).ANALOG_INPUT="Analog Input",ie.ANALOG_OUTPUT="Analog Output",ie.ANALOG_VALUE="Analog Value",ie.BINARY_INPUT="Binary Input",ie.BINARY_OUTPUT="Binary Output",ie.BINARY_VALUE="Binary Value",ie.CALENDAR="",ie.COMMAND="",ie.DEVICE="",R;var ie})();const Z="d_",J="t_";let O=(()=>{class ie{static getDeviceTagText(Se,De){for(let Fe=0;Fe<Se.length;Fe++)if(Se[Fe].tags[De])return`${Se[Fe].name} - ${Se[Fe].tags[De].name}`;return""}static getDeviceFromTagId(Se,De){for(let Fe=0;Fe<Se.length;Fe++)if(Se[Fe].tags[De])return Se[Fe];return null}static getTagFromTagId(Se,De){for(let Fe=0;Fe<Se.length;Fe++)if(Se[Fe].tags[De])return Se[Fe].tags[De];return null}static getTagFromTagAddress(Se,De){return Object.values(Se.tags).find(Fe=>Fe.address===De)}static columnDelimiter=",";static lineDelimiter="\n";static lineComment="#";static lineDevice="D@";static lineTag="T@";static lineSectionHeader="@";static columnMaske="~";static devicesToCsv(Se){let De="",Fe=`!! CSV separator property convertion to "~"${ie.lineDelimiter}`,Le=`${ie.lineSectionHeader}header${ie.columnDelimiter}`,ae="";const ce=Object.keys(e.descriptor).filter(Qe=>"tags"!==Qe),ye=Object.keys(d.descriptor);ce.forEach(Qe=>{"property"!==Qe&&(Fe+=`${ie.lineComment}${Qe}${ie.columnDelimiter}: ${e.descriptor[Qe]}${ie.lineDelimiter}`,Le+=`${Qe}${ie.columnDelimiter}`)}),ye.forEach(Qe=>{Fe+=`${ie.lineComment}property.${Qe}${ie.columnDelimiter}: ${d.descriptor[Qe]}${ie.lineDelimiter}`,Le+=`property.${Qe}${ie.columnDelimiter}`});for(let Qe=0;Qe<Se.length;Qe++)ae+=ie.device2Line(Se[Qe],ce,ye),ae+=`${ie.lineDelimiter}`;De+=`${Fe}${ie.lineDelimiter}`,De+=`${Le}${ie.lineDelimiter}${ae}`,De+=`${ie.lineDelimiter}`;let Te="",ze="",Ae="";const Ye=Object.keys(l.descriptor).filter(Qe=>"daq"!==Qe&&"options"!==Qe);Te+=`${ie.lineComment}deviceId${ie.columnDelimiter}:Reference to device${ie.lineDelimiter}`,ze+=`${ie.lineSectionHeader}header${ie.columnDelimiter}deviceId${ie.columnDelimiter}`,Ye.forEach(Qe=>{Te+=`${ie.lineComment}${Qe}${ie.columnDelimiter}: ${l.descriptor[Qe]}${ie.lineDelimiter}`,ze+=`${Qe}${ie.columnDelimiter}`}),Te+=`${ie.lineComment}options${ie.columnDelimiter}: ${l.descriptor.options}${ie.lineDelimiter}`,ze+=`options${ie.columnDelimiter}`,Te+=`${ie.lineComment}daq.enabled${ie.columnDelimiter}: ${l.descriptor.daq.enabled}${ie.lineDelimiter}`,ze+=`daq.enabled${ie.columnDelimiter}`,Te+=`${ie.lineComment}daq.interval${ie.columnDelimiter}: ${l.descriptor.daq.interval}${ie.lineDelimiter}`,ze+=`daq.interval${ie.columnDelimiter}`;for(let Qe=0;Qe<Se.length;Qe++){if(Se[Qe].tags){const ke=Object.values(Se[Qe].tags);for(let Xe=0;Xe<ke.length;Xe++)Ae+=ie.tag2Line(ke[Xe],Se[Qe].id,Ye),Ae+=`${ie.lineDelimiter}`}Ae+=`${ie.lineDelimiter}`}return De+=`${Te}${ie.lineDelimiter}`,De+=`${ze}${ie.lineDelimiter}${Ae}`,De+=`${ie.lineDelimiter}`,De}static csvToDevices(Se){try{const De=Object.keys(e.descriptor).length+Object.keys(d.descriptor).length,Fe=Object.keys(l.descriptor).length+4;let Le={};return Se.split(ie.lineDelimiter).filter(ce=>!ce.startsWith(ie.lineComment)&&!ce.startsWith(ie.lineSectionHeader)).forEach(ce=>{if(ce.startsWith(ie.lineDevice)){let ye=ie.line2Device(ce,De);Le[ye.id]=ye}else if(ce.startsWith(ie.lineTag)){let ye=ie.line2Tag(ce,Fe);if(!Le[ye.deviceId])throw new Error(`Device don't exist: ${ce}`);if(Le[ye.deviceId].tags[ye.tag.id])throw new Error(`Tag already exist: ${ce}`);Le[ye.deviceId].tags[ye.tag.id]=ye.tag}}),Object.values(Le)}catch(De){console.error(De)}return null}static device2Line(Se,De,Fe){let Le=`${ie.lineDevice}${ie.columnDelimiter}`;return De.forEach(ae=>{if("property"!==ae){let ce=Se[ae]?Se[ae].toString():"";Le+=`${ce.replace(new RegExp(ie.columnDelimiter,"g"),ie.columnMaske)}${ie.columnDelimiter}`}}),Se.property&&Fe.forEach(ae=>{Le+=`${Se.property[ae]||""}${ie.columnDelimiter}`}),Le}static line2Device(Se,De){const Fe=Se.split(ie.columnDelimiter);if(Fe.length<De-1)throw new Error(`Format Error ${Fe.length}/${De} ${Se}`);let Le=new e(Fe[1]);return Le.name=Fe[2].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),Le.enabled="true"===Fe[3].toLowerCase(),Le.type=Fe[4],Le.polling=parseInt(Fe[5])||1e3,Le.property={address:Fe[6],port:Fe[7],slot:Fe[8],rack:Fe[9],slaveid:Fe[10],baudrate:Fe[11],databits:Fe[12],stopbits:Fe[13],parity:Fe[14],options:Fe[15],method:Fe[16],format:Fe[17]},Le.tags={},Le}static tag2Line(Se,De,Fe){let Le=`${ie.lineTag}${ie.columnDelimiter}${De}${ie.columnDelimiter}`;Fe.forEach(ce=>{Le+=`${(Se[ce]||"").toString().replace(new RegExp(ie.columnDelimiter,"g"),ie.columnMaske)}${ie.columnDelimiter}`});let ae=Se.options?JSON.stringify(Se.options):"";return Le+=`${ae.replace(new RegExp(ie.columnDelimiter,"g"),ie.columnMaske)}${ie.columnDelimiter}`,Le+=`${Se.daq?Se.daq.enabled:""}${ie.columnDelimiter}`,Le+=`${Se.daq?Se.daq.interval:""}${ie.columnDelimiter}`,Le}static line2Tag(Se,De){const Fe=Se.split(ie.columnDelimiter);if(Fe.length<De-1)throw new Error(`Format Error: ${Fe.length}/${De} ${Se}`);const Le=Fe[1];let ae=new l(Fe[2]);return ae.name=Fe[3].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),ae.label=Fe[4].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),ae.type=Fe[5],ae.memaddress=Fe[6].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),ae.address=Fe[7].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),ae.divisor=parseInt(Fe[8])||1,ae.init=Fe[9],ae.format=Fe[10]?parseInt(Fe[10]):null,ae.options=Fe[11].replace(new RegExp(ie.columnMaske,"g"),ie.columnDelimiter),ae.options&&W.cQ.isJson(ae.options)&&(ae.options=JSON.parse(ae.options)),ae.daq={enabled:!!W.cQ.Boolify(Fe[12]),changed:!0,interval:parseInt(Fe[13])||60},{tag:ae,deviceId:Le}}}return ie})();var H=(()=>{return(ie=H||(H={})).tags="tags",ie.devices="devices",ie.list="devices-list",ie.map="devices-map",H;var ie})(),K=(()=>{return(ie=K||(K={})).ok="device.connect-ok",ie.error="device.connect-error",ie.failed="device.connect-failed",ie.off="device.connect-off",ie.busy="device.connect-busy",K;var ie})(),G=(()=>{return(ie=G||(G={})).number="number",ie.boolean="boolean",ie.string="string",G;var ie})(),X=(()=>{return(ie=X||(X={})).undefined="device.tag-scale-mode-undefined",ie.linear="device.tag-scale-mode-linear",ie.convertDateTime="device.tag-convert-datetime",ie.convertTickTime="device.tag-convert-ticktime",X;var ie})(),ee=(()=>{return(ie=ee||(ee={}))[ie.deviceConnectionStatus=1]="deviceConnectionStatus",ee;var ie})()},2830:(Ot,Ie,re)=>{"use strict";re.d(Ie,{$q:()=>ce,AQ:()=>O,B0:()=>ye,Bi:()=>F,Bx:()=>A,C6:()=>I,CG:()=>H,Dw:()=>Xt,F$:()=>G,G7:()=>e,Hs:()=>K,Hy:()=>R,I2:()=>_,I9:()=>De,Io:()=>k,KG:()=>X,KQ:()=>ae,NI:()=>E,Nd:()=>ke,Rw:()=>x,SC:()=>Pe,T2:()=>ze,Uk:()=>gt,Un:()=>ai,W9:()=>_t,XG:()=>Se,Zs:()=>Le,_w:()=>Ke,aL:()=>f,bW:()=>l,dm:()=>ge,eC:()=>Qt,eS:()=>ee,ew:()=>ie,f2:()=>Te,fH:()=>v,iS:()=>h,io:()=>Ae,jS:()=>wt,ju:()=>je,kH:()=>qe,lf:()=>we,ng:()=>J,nh:()=>d,nr:()=>S,pj:()=>bt,r8:()=>Qe,rC:()=>Ve,s7:()=>B,sB:()=>xt,sY:()=>Fe,tI:()=>Ye,tM:()=>T,tZ:()=>C,v7:()=>Xe,xA:()=>ve,zN:()=>w});var W=re(9583),Y=re(8396);class T{layout=new _;views=[]}class e{id="";name="";profile=new E;items={};variables={};svgcontent="";type;property;constructor(xi,bi,Ui){this.id=xi,this.name=Ui,this.type=bi}}var l=(()=>{return(pt=l||(l={})).svg="svg",pt.cards="cards",pt.maps="maps",l;var pt})();class _{autoresize=!1;start="";navigation=new h;header=new w;showdev=!0;zoom;inputdialog="false";hidenavigation=!1;theme="";loginonstart=!1;loginoverlaycolor=d.none;show_connection_error=!0;customStyles=""}class h{mode;type;bkcolor="#F4F5F7";fgcolor="#1D1D1D";items;logo=!1;constructor(){this.mode=Object.keys(f).find(xi=>f[xi]===f.over),this.type=Object.keys(C).find(xi=>C[xi]===C.block)}}var d=(()=>{return(pt=d||(d={})).none="none",pt.black="black",pt.white="white",d;var pt})(),f=(()=>{return(pt=f||(f={})).void="item.navsmode-none",pt.push="item.navsmode-push",pt.over="item.navsmode-over",pt.fix="item.navsmode-fix",f;var pt})(),C=(()=>{return(pt=C||(C={})).icon="item.navtype-icons",pt.text="item.navtype-text",pt.block="item.navtype-icons-text-block",pt.inline="item.navtype-icons-text-inline",C;var pt})();class v{text;link;view;icon;image;permission;permissionRoles}class w{title;alarms;infos;bkcolor="#ffffff";fgcolor="#000000";fontFamily;fontSize=13;items;itemsAnchor="left";loginInfo;dateTimeDisplay;language}var B=(()=>{return(pt=B||(B={})).hide="item.notifymode-hide",pt.fix="item.notifymode-fix",pt.float="item.notifymode-float",B;var pt})(),x=(()=>{return(pt=x||(x={})).disabled="item.zoommode-disabled",pt.enabled="item.zoommode-enabled",pt.autoresize="item.zoommode-autoresize",x;var pt})(),I=(()=>{return(pt=I||(I={})).false="item.inputmode-disabled",pt.true="item.inputmode-enabled",pt.keyboard="item.inputmode-keyboard",pt.keyboardFullScreen="item.inputmode-keyboard-full-screen",I;var pt})(),k=(()=>{return(pt=k||(k={})).true="item.headerbarmode-hide",pt.false="item.headerbarmode-show",k;var pt})();class E{width=1024;height=768;bkcolor="#ffffffff";margin=10;align=A.topCenter;gridType=W.tQ.Fixed}var A=(()=>{return(pt=A||(A={})).topCenter="topCenter",pt.middleCenter="middleCenter",A;var pt})();class S{id;type;name="";property=null;label="";hide=!1;lock=!1;constructor(xi,bi){this.id=xi,this.type=bi}}class F{events=[];startLocation;startZoom}class R{variableId;variableValue;bitmask;permission;permissionRoles;ranges;events=[];actions=[];options;readonly;text}var J=(()=>{return(pt=J||(J={})).number="number",pt.text="text",pt.date="date",pt.time="time",pt.datetime="datetime",J;var pt})(),O=(()=>{return(pt=O||(O={})).normal="normal",pt.seconds="seconds",pt.milliseconds="milliseconds",O;var pt})(),H=(()=>{return(pt=H||(H={})).milliseconds="milliseconds",pt.string="string",H;var pt})(),K=(()=>{return(pt=K||(K={})).update="update",pt.enter="enter",K;var pt})();class G{type;action;actparam;actoptions={}}var X=(()=>{return(pt=X||(X={})).hide="shapes.action-hide",pt.show="shapes.action-show",pt.blink="shapes.action-blink",pt.stop="shapes.action-stop",pt.clockwise="shapes.action-clockwise",pt.anticlockwise="shapes.action-anticlockwise",pt.downup="shapes.action-downup",pt.rotate="shapes.action-rotate",pt.move="shapes.action-move",pt.monitor="shapes.action-monitor",X;var pt})();class ee{variableId;bitmask;range;type;options={}}class ie{strokeA=null;strokeB=null;fillA=null;fillB=null;interval=1e3}class ve{minAngle=0;maxAngle=90;delay=0}class Se{toX=0;toY=0;duration=100}class De{fill;stroke}class Fe{variablesValue={};onlyChange=!1;takeValue=!1;actionRef}class Le{type;timer=null;animr=null;spool;constructor(xi){this.type=xi}}var ae=(()=>{return(pt=ae||(ae={})).click="shapes.event-click",pt.dblclick="shapes.event-dblclick",pt.mousedown="shapes.event-mousedown",pt.mouseup="shapes.event-mouseup",pt.mouseover="shapes.event-mouseover",pt.mouseout="shapes.event-mouseout",pt.enter="shapes.event-enter",pt.select="shapes.event-select",pt.onLoad="shapes.event-onLoad",ae;var pt})(),ce=(()=>{return(pt=ce||(ce={})).onpage="shapes.event-onpage",pt.onwindow="shapes.event-onwindow",pt.onOpenTab="shapes.event-onopentab",pt.ondialog="shapes.event-ondialog",pt.oniframe="shapes.event-oniframe",pt.oncard="shapes.event-oncard",pt.onSetValue="shapes.event-onsetvalue",pt.onToggleValue="shapes.event-ontogglevalue",pt.onSetInput="shapes.event-onsetinput",pt.onclose="shapes.event-onclose",pt.onRunScript="shapes.event-onrunscript",pt.onViewToPanel="shapes.event-onViewToPanel",pt.onMonitor="shapes.event-onmonitor",ce;var pt})(),ye=(()=>{return(pt=ye||(ye={})).onopen="shapes.event-onopen",pt.onclose="shapes.event-onclose",ye;var pt})(),Te=(()=>((Te||(Te={})).onRunScript="shapes.event-onrunscript",Te))(),ze=(()=>{return(pt=ze||(ze={})).window="window",pt.mouse="mouse",ze;var pt})(),Ae=(()=>{return(pt=Ae||(Ae={})).set="shapes.event-setvalue-set",pt.add="shapes.event-setvalue-add",pt.remove="shapes.event-setvalue-remove",Ae;var pt})();class Ye{min;max;text;textId;color;type;style;stroke}var Qe=(()=>{return(pt=Qe||(Qe={})).none="none",pt.contain="contain",pt.stretch="stretch",Qe;var pt})(),ke=(()=>{return(pt=ke||(ke={})).data="data",pt.history="history",pt.alarms="alarms",pt.alarmsHistory="alarmsHistory",pt.reports="reports",ke;var pt})(),Xe=(()=>{return(pt=Xe||(Xe={})).label="label",pt.variable="variable",pt.timestamp="timestamp",pt.device="device",Xe;var pt})();class bt{id;label;variableId;valueFormat;bitmask;type;constructor(xi,bi,Ui){this.id=xi,this.type=bi||Xe.label,this.label=Ui}}class Xt extends bt{align=ge.left;width=100;exname;constructor(xi,bi,Ui){super(xi,bi,Ui)}}class Pe{cells;constructor(xi){this.cells=xi}}var ge=(()=>{return(pt=ge||(ge={})).left="left",pt.center="center",pt.right="right",ge;var pt})(),Ve=(()=>{return(pt=Ve||(Ve={})).last1h="table.rangetype-last1h",pt.last1d="table.rangetype-last1d",pt.last3d="table.rangetype-last3d",Ve;var pt})();class Ke{id;name;source;value;error;timestamp;device;constructor(xi,bi,Ui){this.id=xi,this.name=bi,this.device=Ui,Ui?.type===Y.Yi.internal&&(this.value="0")}}class gt{type="";id;ele=null}class je{id="";dom;value=null;dbg="";type;ga;variableId}class wt{gid;from;to;event;sids;chunked}class xt{page;tag}var qe=(()=>{return(pt=qe||(qe={})).YYYY_MM_DD="1998/03/25",pt.MM_DD_YYYY="03/25/1998",pt.DD_MM_YYYY="25/03/1998",pt.MM_DD_YY="03/25/98",pt.DD_MM_YY="25/03/98",qe;var pt})(),we=(()=>{return(pt=we||(we={})).hh_mm_ss="16:58:10",pt.hh_mm_ss_AA="04:58:10 PM",we;var pt})(),_t=(()=>{return(pt=_t||(_t={})).view="view",pt.alarms="alarms",pt.iframe="iframe",pt.table="table",_t;var pt})(),ai=(()=>{return(pt=ai||(ai={})).address="[link]",pt.alarms="[alarms]",ai;var pt})();const Qt="rodevice"},9546:(Ot,Ie,re)=>{"use strict";re.d(Ie,{lI:()=>W,uM:()=>e});class W{default;options=[]}const e="@"},9806:(Ot,Ie,re)=>{"use strict";re.d(Ie,{Hy:()=>_,fH:()=>h});var W=re(8396),Y=re(2830),T=re(9546),e=re(8257),l=re(8273);class _{version="1.01";name;server=new W.AS(e.cQ.getGUID(W.pP));hmi=new Y.tM;devices={};charts=[];graphs=[];alarms=[];notifications=[];scripts=[];reports=[];texts=[];languages=new T.lI;plugin=[];mapsLocations=[];clientAccess=new l.R}var h=(()=>{return(f=h||(h={})).SetDevice="set-device",f.DelDevice="del-device",f.SetView="set-view",f.DelView="del-view",f.HmiLayout="layout",f.Charts="charts",f.Graphs="graphs",f.Languages="languages",f.ClientAccess="client-access",f.SetText="set-text",f.DelText="del-text",f.SetAlarm="set-alarm",f.DelAlarm="del-alarm",f.SetNotification="set-notification",f.DelNotification="del-notification",f.SetScript="set-script",f.DelScript="del-script",f.SetReport="set-report",f.DelReport="del-report",f.SetMapsLocation="set-maps-location",f.DelMapsLocation="del-maps-location",h;var f})()},3530:(Ot,Ie,re)=>{"use strict";re.d(Ie,{EN:()=>v,HO:()=>l,St:()=>w,Xf:()=>W,ZW:()=>e,ez:()=>h,lo:()=>T,mH:()=>C,ug:()=>_,ui:()=>f,vC:()=>Y});class W{id;name;code;sync=!1;parameters=[];scheduling;permission;permissionRoles;mode=v.SERVER;constructor(x){this.id=x}}class Y extends W{test=!0;outputId;constructor(x,I){super(x),this.name=I}}class T{name;type;value;constructor(x,I){this.name=x,this.type=I}}var e=(()=>{return(B=e||(e={})).tagid="tagid",B.value="value",B.chart="chart",e;var B})();const l="s_",_="params";var h=(()=>{return(B=h||(h={})).interval="interval",B.start="start",B.scheduling="scheduling",h;var B})();class f{functions=[];constructor(x){this.functions=this.allFunctions.filter(I=>!I.mode||!x||I.mode===x)}allFunctions=[{name:"$setTag",mode:null,text:"script.sys-fnc-settag-text",tooltip:"script.sys-fnc-settag-tooltip",params:[!0,!1]},{name:"$getTag",mode:null,text:"script.sys-fnc-gettag-text",tooltip:"script.sys-fnc-gettag-tooltip",params:[!0]},{name:"$getTagId",mode:null,text:"script.sys-fnc-getTagId-text",tooltip:"script.sys-fnc-getTagId-tooltip",params:[!1],paramsText:"script.sys-fnc-getTagId-params"},{name:"$getTagDaqSettings",mode:null,text:"script.sys-fnc-getTagDaqSettings-text",tooltip:"script.sys-fnc-getTagDaqSettings-tooltip",params:[!0],paramsText:"script.sys-fnc-getTagDaqSettings-params"},{name:"$setTagDaqSettings",mode:null,text:"script.sys-fnc-setTagDaqSettings-text",tooltip:"script.sys-fnc-setTagDaqSettings-tooltip",params:[!0,!1],paramsText:"script.sys-fnc-setTagDaqSettings-params"},{name:"$setView",mode:null,text:"script.sys-fnc-setview-text",tooltip:"script.sys-fnc-setview-tooltip",params:[!1],paramsText:"script.sys-fnc-setview-params"},{name:"$openCard",mode:null,text:"script.sys-fnc-opencard-text",tooltip:"script.sys-fnc-opencard-tooltip",params:[!1],paramsText:"script.sys-fnc-opencard-params"},{name:"$enableDevice",mode:null,text:"script.sys-fnc-enableDevice-text",tooltip:"script.sys-fnc-enableDevice-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-enableDevice-params"},{name:"$getDeviceProperty",mode:null,text:"script.sys-fnc-getDeviceProperty-text",tooltip:"script.sys-fnc-getDeviceProperty-tooltip",params:[!1],paramsText:"script.sys-fnc-getDeviceProperty-params"},{name:"$setDeviceProperty",mode:null,text:"script.sys-fnc-setDeviceProperty-text",tooltip:"script.sys-fnc-setDeviceProperty-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-setDeviceProperty-params"},{name:"$getDevice",mode:v.SERVER,text:"script.sys-fnc-getDevice-text",tooltip:"script.sys-fnc-getDevice-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-getDevice-params"},{name:"$invokeObject",mode:v.CLIENT,text:"script.sys-fnc-invokeObject-text",tooltip:"script.sys-fnc-invokeObject-tooltip",params:[!1,!1,!1],paramsText:"script.sys-fnc-invokeObject-params"},{name:"$runServerScript",mode:v.CLIENT,text:"script.sys-fnc-runServerScript-text",tooltip:"script.sys-fnc-runServerScript-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-runServerScript-params"},{name:"$getHistoricalTags",mode:null,text:"script.sys-fnc-getHistoricalTag-text",tooltip:"script.sys-fnc-getHistoricalTag-tooltip",params:["array",!1,!1],paramsText:"script.sys-fnc-getHistoricalTag-params",paramFilter:w.history},{name:"$sendMessage",mode:null,text:"script.sys-fnc-sendMessage-text",tooltip:"script.sys-fnc-sendMessage-tooltip",params:[!1,!1,!1],paramsText:"script.sys-fnc-sendMessage-params"},{name:"$getAlarms",mode:null,text:"script.sys-fnc-getAlarms-text",tooltip:"script.sys-fnc-getAlarms-tooltip",params:[],paramsText:"script.sys-fnc-getAlarms-params"},{name:"$getAlarmsHistory",mode:null,text:"script.sys-fnc-getAlarmsHistory-text",tooltip:"script.sys-fnc-getAlarmsHistory-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-getAlarmsHistory-params"},{name:"$ackAlarm",mode:null,text:"script.sys-fnc-ackAlarms-text",tooltip:"script.sys-fnc-ackAlarms-tooltip",params:[!1,!1],paramsText:"script.sys-fnc-ackAlarms-params"}]}class C{functions=[];constructor(x){this.functions=this.allFunctions.filter(I=>!I.mode||!x||I.mode===x)}allFunctions=[{name:"chart-data",mode:v.CLIENT,text:"script.template-chart-data-text",tooltip:"script.template-chart-data-tooltip",code:"// Add script parameter 'paramLines' as Chart lines (array)\nif (paramLines && Array.isArray(paramLines)) {\n const count = 10;\n paramLines.forEach(line => {\n var y = [];\n var x = [];\n for (var i = 0; i < count; i++) {\n const randomNumber = Math.floor(Math.random() * 21);\n y.push(randomNumber);\n x.push(i);\n }\n line['y'] = y;\n line['x'] = x;\n });\n return paramLines;\n} else {\n return 'Missing chart lines';\n}"},{name:"invoke-chart-update-options",mode:v.CLIENT,text:"script.template-invoke-chart-update-options-text",tooltip:"script.template-invoke-chart-update-options-tooltip",code:"let opt = $invokeObject('chart_1', 'getOptions');\nif (opt) {\n opt.scaleY1min = 100;\n opt.scaleY1max = 200;\n}\n$invokeObject('chart_1', 'updateOptions', opt);"},{name:"getHistoricalTags",mode:null,text:"script.template-getHistoricalTagsoptions-text",tooltip:"script.template-getHistoricalTagsoptions-tooltip",code:"const to = Date.now();\nvar from = Date.now() - (1000 * 3600); // 1 hour\nvar data = await $getHistoricalTags(['t_a95d5816-9f1e4a67' /* opcua - Byte */], from, to);\nconsole.log(JSON.stringify(data));"}]}var v=(()=>{return(B=v||(v={})).CLIENT="CLIENT",B.SERVER="SERVER",v;var B})(),w=(()=>((w||(w={})).history="history",w))()},8585:(Ot,Ie,re)=>{"use strict";re.d(Ie,{Nc:()=>Y,Or:()=>d,Tu:()=>l,_k:()=>_,de:()=>W,oZ:()=>f,r8:()=>T});class W{language="en";uiPort=1881;secureEnabled=!1;tokenExpiresIn="1h";secureOnlyEditor=!1;broadcastAll=!1;smtp=new Y;daqstore=new T;alarms=new e;logFull=!1;userRole=!1}class Y{host="";port=587;mailsender="";username="";password="";constructor(w=null){w&&(this.host=w.host,this.port=w.port,this.mailsender=w.mailsender,this.username=w.username,this.password=w.password)}}class T{type=_.SQlite;varsion;url;organization;credentials;bucket;database;retention=d.year1;constructor(w=null){w&&(this.type=w.type,this.url=w.url,this.organization=w.organization,this.credentials=w.credentials,this.bucket=w.bucket,this.database=w.database,this.retention=w.retention||d.year1)}isEquals(w){return!(this.type!==w.type||this.bucket!==w.bucket||this.url!==w.url||this.organization!==w.organization||this.database!==w.database||!this.credentials||!l.isEquals(this.credentials,w.credentials)||this.retention!==w.retention)}}class e{retention=f.year1}class l{token;username;password;static isEquals(w,B){return w.token===B.token&&w.username===B.username&&w.password===B.password}}var _=(()=>{return(v=_||(_={})).SQlite="SQlite",v.influxDB="influxDB",v.influxDB18="influxDB 1.8",v.TDengine="TDengine",_;var v})(),d=(()=>{return(v=d||(d={})).none="none",v.day1="day1",v.days2="days2",v.days3="days3",v.days7="days7",v.days14="days14",v.days30="days30",v.days90="days90",v.year1="year1",v.year3="year3",v.year5="year5",d;var v})(),f=(()=>{return(v=f||(f={})).none="none",v.days7="days7",v.days30="days30",v.days90="days90",v.year1="year1",v.year3="year3",v.year5="year5",f;var v})()},8427:(Ot,Ie,re)=>{"use strict";re.d(Ie,{n5:()=>W,uU:()=>Y,wt:()=>T});class W{username;fullname;password;groups;info}class Y{id;name;index;description}let T=(()=>class e{static ADMINMASK=[-1,255];static EXTENSION=8;static Groups=[{id:1,label:"Viewer"},{id:2,label:"Operator"},{id:4,label:"Engineer"},{id:8,label:"Supervisor"},{id:16,label:"Manager"},{id:32,label:"F"},{id:64,label:"G"},{id:128,label:"Administrator"}];static GroupsToValue(_,h){let d=0;if(_)for(let C=0;C<_.length;C++)d+=_[C].id;return d<<(h?this.EXTENSION:0)}static ValueToGroups(_,h){let d=[],f=h?this.EXTENSION:0;for(let C=0;C<this.Groups.length;C++)_>>f&this.Groups[C].id&&d.push(this.Groups[C]);return d}static GroupToLabel(_){let h=[];for(let d=0;d<this.Groups.length;d++)_&this.Groups[d].id&&h.push(this.Groups[d].label);return h.join(", ")}})()},2440:(Ot,Ie,re)=>{"use strict";re.d(Ie,{z:()=>e});var W=re(4650),Y=re(2340),T=re(3157);let e=(()=>{class l{settingsService;onShowModeChanged=new W.vpe;onShowLoading=new W.vpe;static APP_DEMO="demo";static APP_CLIENT="client";showMode;constructor(h){this.settingsService=h}setShowMode(h){return"editor"===h&&this.settingsService.isEditModeLocked()?(this.settingsService.notifyEditorLocked(),this.showMode):(this.showMode=h,this.onShowModeChanged.emit(this.showMode),this.showMode)}lockEditMode(){this.settingsService.lockEditMode()}unlockEditMode(){this.settingsService.unlockEditMode()}showLoading(h){this.onShowLoading.emit(h)}get isDemoApp(){return Y.N.type===l.APP_DEMO}get isClientApp(){return Y.N.type===l.APP_CLIENT}static \u0275fac=function(d){return new(d||l)(W.LFG(T.g))};static \u0275prov=W.Yz7({token:l,factory:l.\u0275fac})}return l})()},8368:(Ot,Ie,re)=>{"use strict";re.d(Ie,{e:()=>C});var W=re(529),Y=re(1135),T=re(9751),e=re(8427),l=re(2340),_=re(49),h=re(3157),d=re(8257),f=re(4650);let C=(()=>{class w{http;settings;currentUser;endPointConfig=_.C.getURL();currentUser$=new Y.X(null);constructor(x,I){this.http=x,this.settings=I;let k=JSON.parse(localStorage.getItem("currentUser"));k&&(this.currentUser=k),this.currentUser$.next(this.currentUser)}signIn(x,I){return new T.y(k=>{if(l.N.serverEnabled)return new W.WM({"Content-Type":"application/json"}),this.http.post(this.endPointConfig+"/api/signin",{username:x,password:I}).subscribe(A=>{A&&(this.currentUser=A.data,this.currentUser.info&&(this.currentUser.infoRoles=JSON.parse(this.currentUser.info)?.roles),this.saveUserToken(this.currentUser),this.currentUser$.next(this.currentUser)),k.next(null)},A=>{console.error(A),k.error(A)});k.next(null)})}signOut(){this.removeUser()}getUser(){return this.currentUser}getUserProfile(){return this.currentUser}getUserToken(){return this.currentUser?.token}isAdmin(){return!(!this.currentUser||-1===e.wt.ADMINMASK.indexOf(this.currentUser.groups))}setNewToken(x){this.currentUser.token=x,this.saveUserToken(this.currentUser)}saveUserToken(x){localStorage.setItem("currentUser",JSON.stringify(x))}removeUser(){this.currentUser=null,localStorage.removeItem("currentUser"),this.currentUser$.next(this.currentUser)}checkPermission(x,I=!1){var k=this.currentUser?.groups;const E=this.settings.getSettings();if(!k&&!x)return{show:I||!E.secureEnabled,enabled:I||!E.secureEnabled};if(-1===k||255===k||d.cQ.isNullOrUndefined(x))return{show:!0,enabled:!0};const A=E.userRole?x.permissionRoles:x.permission;if(E.userRole){if(k&&!A)return{show:I,enabled:I}}else if(k&&!x&&!A)return{show:!0,enabled:!1};var S={show:!1,enabled:!1};if(E.userRole){var F=this.currentUser?.infoRoles;if(F){let Z={show:!0,enabled:!0};if(A.show&&A.show.length&&(S.show=F.some(J=>A.show.includes(J)),Z.show=!1),A.enabled&&A.enabled.length&&(S.enabled=F.some(J=>A.enabled.includes(J)),Z.enabled=!1),Z.show&&Z.enabled)return Z}else S.show=!(A&&A.show&&A.show.length),S.enabled=!(A&&A.enabled&&A.enabled.length)}else if(k){var R=A>>8;S.show=!R||0!=(R&k),S.enabled=!(R=255&A)||0!=(R&k)}else S.show=!A,S.enabled=!A;return S}static \u0275fac=function(I){return new(I||w)(f.LFG(W.eN),f.LFG(h.g))};static \u0275prov=f.Yz7({token:w,factory:w.\u0275fac})}return w})()},3994:(Ot,Ie,re)=>{"use strict";re.d(Ie,{Bb:()=>x,uH:()=>E});var W=re(4650),Y=re(685),e=re(2340),l=re(8396),_=re(2830),h=re(2645),d=re(49),f=re(8257),C=re(1135),v=re(8368),w=re(9066),B=re(7185);let x=(()=>{class A{projectService;translateService;authService;toastr;onVariableChanged=new W.vpe;onDeviceChanged=new W.vpe;onDeviceBrowse=new W.vpe;onDeviceNodeAttribute=new W.vpe;onDaqResult=new W.vpe;onDeviceProperty=new W.vpe;onHostInterfaces=new W.vpe;onAlarmsStatus=new W.vpe;onDeviceWebApiRequest=new W.vpe;onDeviceTagsRequest=new W.vpe;onScriptConsole=new W.vpe;onGoTo=new W.vpe;onOpen=new W.vpe;onServerConnection$=new C.X(!1);static separator="^~^";hmi;viewSignalGaugeMap=new I;variables={};alarms={highhigh:0,high:0,low:0,info:0};socket;endPointConfig=d.C.getURL();bridge=null;addFunctionType=f.cQ.getEnumKey(_.io,_.io.add);removeFunctionType=f.cQ.getEnumKey(_.io,_.io.remove);homeTagsSubscription=[];viewsTagsSubscription=[];getGaugeMapped;constructor(F,R,Z,J){this.projectService=F,this.translateService=R,this.authService=Z,this.toastr=J,this.initSocket(),this.projectService.onLoadHmi.subscribe(()=>{this.hmi=this.projectService.getHmi()}),this.authService.currentUser$.subscribe(O=>{this.initSocket(O?.token)})}setSignalValue(F){this.onVariableChanged.emit(F)}putSignalValue(F,R,Z=null){if(this.variables[F]||(this.variables[F]=new _._w(F,null,null)),this.variables[F].value=this.getValueInFunction(this.variables[F].value,R,Z),this.socket){let J=this.projectService.getDeviceFromTagId(F);J&&(this.variables[F].source=J.id),J?.type===l.Yi.internal?(this.variables[F].timestamp=(new Date).getTime(),this.setSignalValue(this.variables[F]),J.tags[F].value=R):this.socket.emit(k.DEVICE_VALUES,{cmd:"set",var:this.variables[F],fnc:[Z,R]})}else this.bridge?this.bridge.setDeviceValue(this.variables[F],{fnc:[Z,R]}):e.N.serverEnabled||this.setSignalValue(this.variables[F])}getAllSignals(){return this.variables}getValueInFunction(F,R,Z){try{if(!Z)return R;if(F||(F=0),Z===this.addFunctionType)return parseFloat(F)+parseFloat(R);if(Z===this.removeFunctionType)return parseFloat(F)-parseFloat(R)}catch(J){console.error(J)}return R}initClient(F){return!!F&&(this.bridge=F,!!this.bridge&&(this.bridge.onDeviceValues=R=>this.onDeviceValues(R),this.askDeviceValues(),!0))}onDeviceValues(F){for(let R=0;R<F.length;R++){let Z=F[R].id;this.variables[Z]||(this.variables[Z]=new _._w(Z,null,null)),this.variables[Z].value=F[R].value,this.variables[Z].error=F[R].error,this.setSignalValue(this.variables[Z])}}initSocket(F=null){e.N.serverEnabled&&(this.socket?.close(),this.socket=Y(`${this.endPointConfig}/?token=${F}`),this.socket.on("connect",()=>{this.onServerConnection$.next(!0),this.tagsSubscribe()}),this.socket.on("disconnect",R=>{this.onServerConnection$.next(!1),console.log("socket disconnected: ",R)}),this.socket.io.on("reconnect_attempt",()=>{console.log("socket.io try to reconnect...")}),this.socket.on(k.DEVICE_STATUS,R=>{if(this.onDeviceChanged.emit(R),"connect-error"===R.status&&this.hmi?.layout?.show_connection_error){let Z=R.id,J=this.projectService.getDeviceFromId(R.id);J&&(Z=J.name);let O="";this.translateService.get("msg.device-connection-error",{value:Z}).subscribe(H=>{O=H}),this.toastr.error(O,"",{timeOut:3e3,closeButton:!0})}}),this.socket.on(k.DEVICE_PROPERTY,R=>{this.onDeviceProperty.emit(R)}),this.socket.on(k.DEVICE_VALUES,R=>{for(let Z=0;Z<R.values.length;Z++){let J=R.values[Z].id;this.variables[J]||(this.variables[J]=new _._w(J,null,null)),this.variables[J].value=R.values[Z].value,this.variables[J].timestamp=R.values[Z].timestamp,this.setSignalValue(this.variables[J])}}),this.socket.on(k.DEVICE_BROWSE,R=>{this.onDeviceBrowse.emit(R)}),this.socket.on(k.DEVICE_NODE_ATTRIBUTE,R=>{this.onDeviceNodeAttribute.emit(R)}),this.socket.on(k.DAQ_RESULT,R=>{this.onDaqResult.emit(R)}),this.socket.on(k.ALARMS_STATUS,R=>{this.onAlarmsStatus.emit(R)}),this.socket.on(k.HOST_INTERFACES,R=>{this.onHostInterfaces.emit(R)}),this.socket.on(k.DEVICE_WEBAPI_REQUEST,R=>{this.onDeviceWebApiRequest.emit(R)}),this.socket.on(k.DEVICE_TAGS_REQUEST,R=>{this.onDeviceTagsRequest.emit(R)}),this.socket.on(k.SCRIPT_CONSOLE,R=>{this.onScriptConsole.emit(R)}),this.socket.on(k.SCRIPT_COMMAND,R=>{this.onScriptCommand(R)}),this.socket.on(k.ALIVE,R=>{this.onServerConnection$.next(!0)}),this.askDeviceValues(),this.askAlarmsStatus())}askDeviceStatus(){this.socket&&this.socket.emit(k.DEVICE_STATUS,"get")}askDeviceProperty(F,R){this.socket&&this.socket.emit(k.DEVICE_PROPERTY,{endpoint:F,type:R})}askWebApiProperty(F){this.socket&&this.socket.emit(k.DEVICE_WEBAPI_REQUEST,{property:F})}askDeviceTags(F){this.socket&&this.socket.emit(k.DEVICE_TAGS_REQUEST,{deviceId:F})}askHostInterface(){this.socket&&this.socket.emit(k.HOST_INTERFACES,"get")}askDeviceValues(){this.socket?this.socket.emit(k.DEVICE_VALUES,{cmd:"get"}):this.bridge&&this.bridge.getDeviceValues(null)}askAlarmsStatus(){this.socket&&this.socket.emit(k.ALARMS_STATUS,"get")}emitMappedSignalsGauge(F){let R=this.viewSignalGaugeMap.getSignalIds(F);for(let Z=0;Z<R.length;Z++)this.variables[R[Z]]&&this.setSignalValue(this.variables[R[Z]])}askDeviceBrowse(F,R){this.socket&&this.socket.emit(k.DEVICE_BROWSE,{device:F,node:R})}askNodeAttributes(F,R){this.socket&&this.socket.emit(k.DEVICE_NODE_ATTRIBUTE,{device:F,node:R})}queryDaqValues(F){this.socket&&this.socket.emit(k.DAQ_QUERY,F)}tagsSubscribe(){if(this.socket){const F=this.viewsTagsSubscription.concat(this.homeTagsSubscription);let R={tagsId:[...new Set(F)]};this.socket.emit(k.DEVICE_TAGS_SUBSCRIBE,R)}}viewsTagsSubscribe(F){this.viewsTagsSubscription=F,this.tagsSubscribe()}homeTagsSubscribe(F){this.homeTagsSubscription=F,this.tagsSubscribe()}tagsUnsubscribe(F){this.socket&&this.socket.emit(k.DEVICE_TAGS_UNSUBSCRIBE,{tagsId:F})}deviceEnable(F,R){this.socket&&this.socket.emit(k.DEVICE_ENABLE,{deviceName:F,enable:R})}addSignal(F,R){this.variables[F]||(this.variables[F]=new _._w(F,null,this.projectService.getDeviceFromTagId(F)))}addSignalGaugeToMap(F,R,Z){this.viewSignalGaugeMap.add(F,R,Z),this.variables[R]||(this.variables[R]=new _._w(R,null,this.projectService.getDeviceFromTagId(R)))}removeSignalGaugeFromMap(F){let R=this.viewSignalGaugeMap.getSignalIds(F),Z={};return R.forEach(J=>{let O=this.viewSignalGaugeMap.signalsGauges(F,J);O&&(Z[J]=O.map(H=>H.id))}),this.viewSignalGaugeMap.remove(F),Z}getMappedSignalsGauges(F,R){return Object.values(this.viewSignalGaugeMap.signalsGauges(F,R))}getMappedVariables(F){let R=[];return this.viewSignalGaugeMap.getAllSignalIds().forEach(Z=>{if(this.variables[Z]){let J=this.variables[Z];if(F){J=Object.assign({},this.variables[Z]);let O=this.projectService.getDeviceFromTagId(J.id);O&&(J.source=O.name,O.tags[J.id]&&(J.name=this.getTagLabel(O.tags[J.id])))}R.push(J)}}),R}getMappedVariable(F,R){if(!this.variables[F])return null;if(this.variables[F]){let Z=this.variables[F];if(R){Z=Object.assign({},this.variables[F]);let J=this.projectService.getDeviceFromTagId(Z.id);J&&(Z.source=J.name,J.tags[Z.id]&&(Z.name=this.getTagLabel(J.tags[Z.id])))}return Z}}getTagLabel(F){return F.label?F.label:F.name}getChart(F){return this.projectService.getChart(F)}getChartSignal(F){let R=this.projectService.getChart(F);if(R){let Z=[];return R.lines.forEach(J=>{Z.push(J.id)}),Z}}getGraph(F){return this.projectService.getGraph(F)}getGraphSignal(F){let R=this.projectService.getGraph(F);if(R){let Z=[];return R.sources.forEach(J=>{Z.push(J.id)}),Z}}getAlarmsValues(F){return this.projectService.getAlarmsValues(F)}getAlarmsHistory(F){return this.projectService.getAlarmsHistory(F)}setAlarmAck(F){return this.projectService.setAlarmAck(F)}getDaqValues(F){return this.projectService.getDaq