function GUID(){function t(){return Math.floor(65536*Math.random()).toString(16)}return t()+t()+t()+t()+t()+t()+t()+t()}function event(t){this.name=t,this.eventAction=null,this.subscribe=function(t){this.eventAction=t},this.fire=function(t,e){null!=this.eventAction&&this.eventAction(t,e)}}!function(t){"use strict";var T=t.setTimeout,_=t.clearTimeout,O=t.XMLHttpRequest,n=t.XDomainRequest,e=t.EventSource,r=t.document;null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e});var l=function(){};function o(t){this.withCredentials=!1,this.responseType="",this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=l,this.onreadystatechange=l,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=l}function N(t){this._xhr=new o(t)}function s(){this._listeners=Object.create(null)}function k(t){T(function(){throw t},0)}function D(t){this.type=t,this.target=void 0}function U(t,e){D.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}o.prototype.open=function(t,e){this._abort(!0);var o=this,s=this._xhr,a=1,n=0;this._abort=function(t){0!==o._sendTimeout&&(_(o._sendTimeout),o._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=l,s.onerror=l,s.onabort=l,s.onprogress=l,s.onreadystatechange=l,s.abort(),0!==n&&(_(n),n=0),t||(o.readyState=4,o.onreadystatechange())),a=0};function r(){if(1===a){var e=0,n="",r=void 0;if("contentType"in s)e=200,n="OK",r=s.contentType;else try{e=s.status,n=s.statusText,r=s.getResponseHeader("Content-Type")}catch(t){n="",r=void(e=0)}0!==e&&(a=2,o.readyState=2,o.status=e,o.statusText=n,o._contentType=r,o.onreadystatechange())}}function i(){if(r(),2===a||3===a){a=3;var t="";try{t=s.responseText}catch(t){}o.readyState=3,o.responseText=t,o.onprogress()}}function c(){i(),1!==a&&2!==a&&3!==a||(a=4,0!==n&&(_(n),n=0),o.readyState=4,o.onreadystatechange())}var u=function(){n=T(function(){u()},500),3===s.readyState&&i()};s.onload=c,s.onerror=c,s.onabort=c,"sendAsBinary"in O.prototype||"mozAnon"in O.prototype||(s.onprogress=i),s.onreadystatechange=function(){null!=s&&(4===s.readyState?c():3===s.readyState?i():2===s.readyState&&r())},"contentType"in s&&(e+=(-1===e.indexOf("?",0)?"?":"&")+"padding=true"),s.open(t,e,!0),"readyState"in s&&(n=T(function(){u()},0))},o.prototype.abort=function(){this._abort(!1)},o.prototype.getResponseHeader=function(t){return this._contentType},o.prototype.setRequestHeader=function(t,e){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,e)},o.prototype.send=function(){if("ontimeout"in O.prototype||null==r||null==r.readyState||"complete"===r.readyState){var t=this._xhr;t.withCredentials=this.withCredentials,t.responseType=this.responseType;try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=T(function(){e._sendTimeout=0,e.send()},4)}},N.prototype.open=function(r,e,o,t,n,s){var a=this._xhr;a.open("GET",t);var i=0;for(var c in a.onprogress=function(){var t=a.responseText.slice(i);i+=t.length,e(t)},a.onreadystatechange=function(){var t,e,n;2===a.readyState?(t=a.status,e=a.statusText,n=a.getResponseHeader("Content-Type"),r(t,e,n)):4===a.readyState&&o()},a.withCredentials=n,a.responseType="text",s)Object.prototype.hasOwnProperty.call(s,c)&&a.setRequestHeader(c,s[c]);a.send()},N.prototype.cancel=function(){this._xhr.abort()},s.prototype.dispatchEvent=function(t){var e=(t.target=this)._listeners[t.type];if(null!=e)for(var n=e.length,r=0;r>>8&255,t[s]>>>16&255,t[s]>>>24&255);return e?t.join("").substring(0,r):t.join("")}function p(t,e){for(var n=t.length,r=[],o=0;o>2]=t.charCodeAt(o)|t.charCodeAt(o+1)<<8|t.charCodeAt(o+2)<<16|t.charCodeAt(o+3)<<24;return e&&(r[r.length]=n),r}this.encrypt=function(t,e){if(""==t)return"";var n=p(t,!0),r=p(e,!1);r.length<4&&(r.length=4);for(var o,s,a,i=n.length-1,c=n[i],u=n[0],l=Math.floor(6+52/(1+i)),h=0;0>>2&3,a=0;a>>5^(u=n[a+1])<<2)+(u>>>3^c<<4)^(h^u)+(r[3&a^s]^c),c=n[a]=n[a]+o&4294967295;o=(c>>>5^(u=n[0])<<2)+(u>>>3^c<<4)^(h^u)+(r[3&a^s]^c),c=n[i]=n[i]+o&4294967295}return d(n,!1)},this.decrypt=function(t,e){if(""==t)return"";var n=p(t,!1),r=p(e,!1);r.length<4&&(r.length=4);for(var o,s,a,i=n.length-1,c=n[i-1],u=n[0],l=Math.floor(6+52/(1+i))*f&4294967295;0!=l;){for(s=l>>>2&3,a=i;0>>5^u<<2)+(u>>>3^c<<4)^(l^u)+(r[3&a^s]^c),u=n[a]=n[a]-o&4294967295;o=((c=n[i])>>>5^u<<2)+(u>>>3^c<<4)^(l^u)+(r[3&a^s]^c),u=n[0]=n[0]-o&4294967295,l=l-f&4294967295}return d(n,!0)}};String.prototype.toUTF8=function(){var t,e,n,r,o,s,a=this;if(null!=a.match(/^[\x00-\x7f]*$/))return a.toString();for(t=[],r=a.length,n=e=0;e>>6,128|63&o):o<55296||57343>>12,128|o>>>6&63,128|63&o):++e>>18&63,128|o>>>12&63,128|o>>>6&63,128|63&o):"?"):(e--,t[n]="?")):(e--,t[n]="?");return t.join("")},String.prototype.toUTF16=function(){var t,e,n,r,o,s,a,i,c=this;if(null!=c.match(/^[\x00-\x7f]*$/)||null==c.match(/^[\x00-\xff]*$/))return c.toString();for(t=[],r=c.length,e=n=0;e>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t[n++]=c.charAt(e-1);break;case 12:case 13:s=c.charCodeAt(e++),t[n++]=String.fromCharCode((31&o)<<6|63&s);break;case 14:s=c.charCodeAt(e++),a=c.charCodeAt(e++),t[n++]=String.fromCharCode((15&o)<<12|(63&s)<<6|63&a);break;case 15:switch(15&o){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:i=(7&o)<<18|(63&(s=c.charCodeAt(e++)))<<12|(63&(a=c.charCodeAt(e++)))<<6|(63&c.charCodeAt(e++))-65536,t[n++]=0<=i&&i<=1048575?String.fromCharCode(i>>>10&1023|55296,1023&i|56320):"?";break;case 8:case 9:case 10:case 11:e+=4,t[n++]="?";break;case 12:case 13:e+=5,t[n++]="?"}}return t.join("")},"undefined"==typeof btoa&&(btoa=function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return function(t){var e,n,r,o=n=0,s=t.length,a=s%3,i=(s-=a)/3<<2;for(0>18]+c[r>>12&63]+c[r>>6&63]+c[63&r];return 1==a?(r=t.charCodeAt(o++),e[n++]=c[r>>2]+c[(3&r)<<4]+"=="):2==a&&(r=t.charCodeAt(o++)<<8|t.charCodeAt(o++),e[n++]=c[r>>10]+c[r>>4&63]+c[(15&r)<<2]+"="),e.join("")}}()),"undefined"==typeof atob&&(atob=function(){var h=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,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,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];return function(t){var e,n,r,o,s,a,i,c,u,l=t.length;if(l%4!=0)return"";if(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+\/\=]/.test(t))return"";for(c=l,0<(i="="==t.charAt(l-2)?1:"="==t.charAt(l-1)?2:0)&&(c-=4),c=3*(c>>2)+i,u=new Array(c),s=a=0;s>4),-1!=(r=h[t.charCodeAt(s++)]))&&(u[a++]=String.fromCharCode((15&n)<<4|(60&r)>>2),-1!=(o=h[t.charCodeAt(s++)]));)u[a++]=String.fromCharCode((3&r)<<6|o);return u.join("")}}());var taxnet_call={ver:"2020-07-06",isConnect:!1,ydcal_start:function(t,e,n){YDCal_send("ydcal_start",t,e,n)}},socket;function myEncode(t){var e=PHPSerializer.serialize(t),n="taxnet".toUTF8(),r=XXTEA.encrypt(e,n);return btoa(r)}function myDecode(t){var e="taxnet".toUTF8(),n=XXTEA.decrypt(atob(t),e);return PHPSerializer.unserialize(n)}function YDCal_send(){if(0!=arguments.length){if(0==taxnet_call.isConnect)return console.log("YdCal Not Connected."),!1;var t=myEncode(arguments);socket.send("CMD"+t+"\n")}}function start_sse(){(socket=new rbWebSocket("sse","http://127.0.0.1:5204","sse")).on("open",function(t){$("#divflexrms #status").html("Open"),$("#divflexrms #status").attr("class","online"),taxnet_call.isConnect=!0}),socket.on("close",function(t){$("#divflexrms #status").html("Close"),$("#divflexrms #status").attr("class","offline"),taxnet_call.isConnect=!1}),socket.on("message",function(t){var e,n=t.message;if("ACK"==n.substr(0,3)){if((e=myDecode(n.substr(3,n.length-3))).guid!=vGUID)return console.log(e.guid+" >>>>> "+vGUID),!1;console.log("<<"+e.work+"<<"+e.msg+"\n")}else if("EVT"==n.substr(0,3)){var r=(e=myDecode(n.substr(3,n.length-3)))[0],o=e[2];if(o!=vGUID)return console.log(o+" >>>>> "+vGUID),!1;var s=e[1].toString().split("\n");console.log("<<"+r+"<<"+s.length.toString()+"\n"),3==s.length?window[r](s[0],s[1]):4==s.length?window[r](s[0],s[1],s[2]):5==s.length?window[r](s[0],s[1],s[2],s[3]):6==s.length?window[r](s[0],s[1],s[2],s[3],s[4]):7==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5]):8==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6]):9==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]):10==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8]):11==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]):12==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10]):13==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11]):14==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12]):15==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13]):16==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14]):17==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15]):18==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15],s[16]):19==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15],s[16],s[17]):20==s.length?window[r](s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15],s[16],s[17],s[18]):console.log(">> err \n")}}),socket.on("error",function(t){taxnet_call.isConnect=!1,$("#divflexrms #status").html("Error"),$("#divflexrms #status").attr("class","fail")})}function stop_sse(){socket.close()}