diff --git a/README.md b/README.md index 6da9633e..7efda9d3 100644 --- a/README.md +++ b/README.md @@ -327,7 +327,7 @@ where you have to replace `username` and `password` with the credentials generat As you can see, you have to specify a few parameters: - `--address`: the Lightstreamer Server address - - `--adapter-set`: the name of the requested Adapter Set, which triggers Ligthtreamer to activate the Kafka Connector deployed into the `adapters` folder + - `--adapter-set`: the name of the requested Adapter Set, which triggers Ligthstreamer to activate the Kafka Connector deployed into the `adapters` folder - `--data-adapter`: the name of the requested Data Adapter, which identifies the selected Kafka connection configuration - `--items`: the list of items to subscribe to - `--fields`: the list of requested fields for the items @@ -337,7 +337,7 @@ where you have to replace `username` and `password` with the credentials generat ### 3. Publish the Events - The [`examples/quickstart-producer`](/examples/quickstart-producer/) folder hosts a simple Kafka producer to publish simulated market events for the _QuickStart_ app. + The [`examples/quickstart-producer`](/examples/quickstart-producer/) folder hosts a simple Kafka producer to publish simulated market events for the _Quick Start_ app. Before launching the producer, you first need to build it. Open a new shell from the folder and execute the command: diff --git a/examples/compose-templates/web/index.html b/examples/compose-templates/web/index.html index 7de5d8a9..3162002a 100644 --- a/examples/compose-templates/web/index.html +++ b/examples/compose-templates/web/index.html @@ -26,6 +26,40 @@ Lightstreamer Kafka Connector | Basic Stock-List Demo + + @@ -199,56 +233,8 @@
Simulated market data.
- - - - - - - + - diff --git a/examples/compose-templates/web/js/lightstreamer.min.js b/examples/compose-templates/web/js/lightstreamer.min.js deleted file mode 100644 index 12be2675..00000000 --- a/examples/compose-templates/web/js/lightstreamer.min.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @preserve - * LIGHTSTREAMER - www.lightstreamer.com - * Lightstreamer Web Client - * Version 9.2.0+20240216 - * Copyright (c) Lightstreamer Srl. All Rights Reserved. - * Contains: LightstreamerClient, Subscription, ConsoleLogLevel, - * ConsoleLoggerProvider, MpnDevice, MpnSubscription, SafariMpnBuilder, - * FirebaseMpnBuilder, Chart, DynaGrid, SimpleChartListener, - * StaticGrid, StatusWidget, Logger, LoggerProvider, - * ClientListener, ClientMessageListener, ItemUpdate, SubscriptionListener, - * MpnDeviceListener, MpnSubscriptionListener, ChartListener, DynaGridListener, - * StaticGridListener - * UMD - */ -!function(t,e){var s,i=(s=function(t){"use strict";function e(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var s=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};s.prototype=e.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),s}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;const s=t=>(e,s)=>(t.set(e,s),s),i=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,r=2*n,a=(t,e)=>s=>{const a=e.get(s);let o=void 0===a?s.size:ai)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;s.has(o);)o=Math.floor(Math.random()*i);return t(s,o)},o=new WeakMap,h=a(s(o),o),u=t=>void 0!==t.method&&"call"===t.method,l=t=>null===t.error&&"number"==typeof t.id,c=t=>{const e=new Map([[0,()=>{}]]),s=new Map([[0,()=>{}]]),i=new Map,n=new Worker(t);return n.addEventListener("message",(({data:t})=>{if(u(t)){const{params:{timerId:n,timerType:r}}=t;if("interval"===r){const t=e.get(n);if("number"==typeof t){const e=i.get(t);if(void 0===e||e.timerId!==n||e.timerType!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===t)throw new Error("The timer is in an undefined state.");t()}}else if("timeout"===r){const t=s.get(n);if("number"==typeof t){const e=i.get(t);if(void 0===e||e.timerId!==n||e.timerType!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===t)throw new Error("The timer is in an undefined state.");t(),s.delete(n)}}}else{if(!l(t)){const{error:{message:e}}=t;throw new Error(e)}{const{id:n}=t,r=i.get(n);if(void 0===r)throw new Error("The timer is in an undefined state.");const{timerId:a,timerType:o}=r;i.delete(n),"interval"===o?e.delete(a):s.delete(a)}}})),{clearInterval:t=>{const s=h(i);i.set(s,{timerId:t,timerType:"interval"}),e.set(t,s),n.postMessage({id:s,method:"clear",params:{timerId:t,timerType:"interval"}})},clearTimeout:t=>{const e=h(i);i.set(e,{timerId:t,timerType:"timeout"}),s.set(t,e),n.postMessage({id:e,method:"clear",params:{timerId:t,timerType:"timeout"}})},setInterval:(t,s=0)=>{const i=h(e);return e.set(i,(()=>{t(),"function"==typeof e.get(i)&&n.postMessage({id:null,method:"set",params:{delay:s,now:performance.now(),timerId:i,timerType:"interval"}})})),n.postMessage({id:null,method:"set",params:{delay:s,now:performance.now(),timerId:i,timerType:"interval"}}),i},setTimeout:(t,e=0)=>{const i=h(s);return s.set(i,t),n.postMessage({id:null,method:"set",params:{delay:e,now:performance.now(),timerId:i,timerType:"timeout"}}),i}}},d=(t,e)=>{let s=null;return()=>{if(null!==s)return s;const i=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=URL.createObjectURL(i);return s=t(n),setTimeout((()=>URL.revokeObjectURL(n))),s}},_=d(c,'(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error(\'There is no interval scheduled with the given id "\'.concat(t,\'".\'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error(\'The given type "\'.concat(i,\'" is not supported\'));(e=>{const r=t.get(e);if(void 0===r)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error(\'The given method "\'.concat(s.method,\'" is not supported\'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error(\'The given type "\'.concat(d,\'" is not supported\'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();'),p=t=>_().clearInterval(t),f=t=>_().clearTimeout(t),m=(...t)=>_().setInterval(...t),g=(...t)=>_().setTimeout(...t);var v,S=e(Object.freeze({__proto__:null,clearInterval:p,clearTimeout:f,setInterval:m,setTimeout:g})),y={exports:{}};function b(){return v||(v=1,t=y,function(e,s){s(t.exports)}(0,(function(t){var e,s,i,n;function r(t){Error.call(this,t),this.message=t}function a(t){Error.call(this,t),this.message=t}function o(t){var e,s;if(n(t))return t.slice();if(null===t)return t;if("object"==typeof t){for(s in e={},t)Object.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}return t}function h(t,e){var s;if(t===e)return!0;if(typeof t!=typeof e)return!1;if("object"==typeof t){var i=n(t);if(i!==n(e))return!1;if(i){if(t.length!=e.length)return!1;for(var r=0;rt.length)throw new a("Add operation must not attempt to create a sparse array!");t.splice(s,0,e)}else t[s]=e;return t}),s)},s.prototype.remove=function(t,e){if(0!==this.length)return this._action(t,(function(t,e){if(!Object.hasOwnProperty.call(t,e))throw new a("Remove operation must point to an existing value!");return n(t)?t.splice(e,1):delete t[e],t}),e)},s.prototype.replace=function(t,e,s){return 0===this.length?e:this._action(t,(function(t,s){if(!Object.hasOwnProperty.call(t,s))throw new a("Replace operation must point to an existing value!");return n(t)?t.splice(s,1,e):t[s]=e,t}),s)},s.prototype.get=function(t){var e;return 0===this.length?t:(this._action(t,(function(t,s){if(!Object.hasOwnProperty.call(t,s))throw new a("Path not found in document");return e=t[s],t}),!0),e)},s.prototype.subsetOf=function(t){if(this.length<=t.length)return!1;for(var e=0;e=e.length&&0==t.lastIndexOf(e,0)},d.endsWith=function(t,e){var s=e.length,i=t.length;return i>=s&&t.indexOf(e,i-s)==i-s},d.isSpace=function(t,e){var s=a.cca(t,e);return s>8&&s<14||32==s},d.ltrim=function(t){for(var e=t.length,s=0;s0?a.substr(t,s,e-s):t},d.rtrim=function(t){for(var e=t.length,s=0;s0?a.substr(t,0,e-s):t},d.trim=function(t){return d.ltrim(d.rtrim(t))},d.replace=function(t,e,s){return t.split(e).join(s)};var _=function(){};_.__name__=!0,_.enumEq=function(t,e){if(t==e)return!0;try{var s=t.__enum__;if(null==s||s!=e.__enum__)return!1;if(t._hx_index!=e._hx_index)return!1;for(var n=i[s].__constructs__[t._hx_index].__params__,r=0;r=5)return"<...>";var s=typeof t;switch("function"==s&&(t.__name__||t.__ename__)&&(s="object"),s){case"function":return"";case"object":if(t.__enum__){var n=i[t.__enum__].__constructs__[t._hx_index],r=n._hx_name;return n.__params__?(e+="\t",r+"("+function(s){for(var i=[],r=0,a=n.__params__;r0?",":"")+U.__string_rec(t[u],e)}return a+="]"}var l;try{l=t.toString}catch(o){return"???"}if(null!=l&&l!=Object.toString&&"function"==typeof l){var c=t.toString();if("[object Object]"!=c)return c}a="{\n",e+="\t";var d=null!=t.hasOwnProperty,_=null;for(_ in t)d&&!t.hasOwnProperty(_)||"prototype"!=_&&"__class__"!=_&&"__super__"!=_&&"__interfaces__"!=_&&"__properties__"!=_&&(2!=a.length&&(a+=", \n"),a+=e+_+" : "+U.__string_rec(t[_],e));return a+="\n"+(e=e.substring(1))+"}";case"string":return t;default:return String(t)}},U.__interfLoop=function(t,e){for(;;){if(null==t)return!1;if(t==e)return!0;var s=t.__interfaces__;if(null!=s)for(var i=0,n=s.length;ithis.rec_clientProg?(this.disposeHTTP(),this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="prog.mismatch."+t+"."+this.rec_serverProg,this.state.goto_m_from_rec(113),this.exit_rec_to_m(),this.entry_m113(e)):(this.state.s_rec=1001,this.state.traceState(),this.doPROG(t)))}},evtLOOP:function(t){if(this.traceEvent("LOOP"),ri.isDebugEnabled()&&ri.debug("LOOP "+t),300==(null!=(e=this.state.s_w)?e.p:null))this.closeWS(),this.cause="ws.loop",this.state.clear_w(),this.state.s_tr=200,this.state.traceState(),this.exit_w(),this.evtSwitchTransport();else if(220==this.state.s_tr)this.closeHTTP(),this.cause="http.loop",this.state.s_tr=200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtSwitchTransport();else if(230==this.state.s_tr)this.closeHTTP(),this.cause="ttl.loop",this.state.s_tr=200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtSwitchTransport();else{var e;510==(null!=(e=this.state.s_ws)?e.p:null)?(this.closeWS(),this.cause="ws.loop",this.state.clear_ws(),this.state.s_tr=200,this.state.traceState(),this.exit_ws(),this.evtSwitchTransport()):611==(null!=(e=this.state.s_wp)?e.p:null)?this.isSwitching()?(this.closeWS(),this.cause="ws.loop",this.state.clear_wp(),this.state.s_tr=200,this.state.traceState(),this.exit_wp(),this.evtSwitchTransport()):(this.doLOOP(t),this.state.s_wp.p=612,this.state.traceState(),this.cancel_evtIdleTimeout(),this.schedule_evtPollingTimeout(this.options.pollingInterval)):810==(null!=(e=this.state.s_hs)?e.p:null)?(this.closeHTTP(),this.cause="http.loop",this.state.s_hs.p=811,this.state.traceState(),this.evtSwitchTransport()):901==(null!=(e=this.state.s_hp)?e.m:null)?this.isSwitching()?(this.closeHTTP(),this.state.s_hp.m=904,this.state.traceState(),this.cancel_evtIdleTimeout(),this.evtSwitchTransport()):(this.doLOOP(t),this.closeHTTP(),this.state.s_hp.m=902,this.state.traceState(),this.cancel_evtIdleTimeout(),this.schedule_evtPollingTimeout(this.options.pollingInterval)):1001==this.state.s_rec&&(this.closeHTTP(),this.cause="recovery.loop",this.state.goto_200_from_rec(),this.exit_rec(),this.evtSwitchTransport())}},evtCONOK:function(t,e,s,i){if(this.traceEvent("CONOK"),ri.isDebugEnabled()&&ri.debug("CONOK "+t+" "+e+" "+s+" "+i),122==this.state.s_m)this.doCONOK_CreateWS(t,e,s,i),this.resetCurrentRetryDelay(),this.notifyStatus("CONNECTED:WS-STREAMING"),this.state.s_m=150,this.state.s_tr=210,this.state.s_w=new J(300,310,340),this.state.s_rhb=320,this.state.s_slw=330,this.state.s_swt=1300,this.state.s_bw=1200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtSendPendingControls(),this.evtSendPendingMessages(),this.evtStartSession(),this.schedule_evtKeepaliveTimeout(Pe.sure(this.keepaliveInterval)),this.evtSelectRhb(),this.evtCheckTransport(),this.evtCheckBW();else if(130==this.state.s_m)this.doCONOK_CreateHTTP(t,e,s,i),this.resetCurrentRetryDelay(),this.notifyStatus("CONNECTED:STREAM-SENSING"),this.state.s_m=150,this.state.s_tr=220,this.state.s_swt=1300,this.state.s_bw=1200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtStartSession(),this.schedule_evtTransportTimeout(this.options.retryDelay),this.evtCheckTransport(),this.evtCheckBW();else if(140==this.state.s_m)this.doCONOK_CreateHTTP(t,e,s,i),this.resetCurrentRetryDelay(),this.notifyStatus("CONNECTED:STREAM-SENSING"),this.state.s_m=150,this.state.s_tr=230,this.state.s_swt=1300,this.state.s_bw=1200,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtStartSession(),this.schedule_evtTransportTimeout(this.options.retryDelay),this.evtCheckTransport(),this.evtCheckBW();else{var n;502==(null!=(n=this.state.s_ws)?n.m:null)?(this.doCONOK_BindWS_Streaming(t,e,s,i),this.notifyStatus("CONNECTED:WS-STREAMING"),this.state.s_ws.m=503,this.state.s_ws.p=510,this.state.s_ws.k=520,this.state.s_ws.s=550,this.state.s_rhb=320,this.state.s_slw=330,this.state.traceState(),this.cancel_evtTransportTimeout(),this.evtSendPendingControls(),this.evtSendPendingMessages(),this.schedule_evtKeepaliveTimeout(Pe.sure(this.keepaliveInterval)),this.evtSelectRhb()):610==(null!=(n=this.state.s_wp)?n.p:null)?(this.doCONOK_BindWS_Polling(t,e,s,i),this.notifyStatus("CONNECTED:WS-POLLING"),this.state.s_wp.p=611,this.state.traceState()):613==(null!=(n=this.state.s_wp)?n.p:null)?(this.doCONOK_BindWS_Polling(t,e,s,i),this.state.s_wp.p=611,this.state.traceState()):800==(null!=(n=this.state.s_hs)?n.m:null)||801==(null!=(n=this.state.s_hs)?n.m:null)?(this.doCONOK_BindHTTP_Streaming(t,e,s,i),this.notifyStatus("CONNECTED:HTTP-STREAMING"),this.state.s_hs.m=802,this.state.s_hs.p=810,this.state.s_hs.k=820,this.state.s_rhb=320,this.state.s_slw=330,this.state.traceState(),this.cancel_evtTransportTimeout(),this.schedule_evtKeepaliveTimeout(Pe.sure(this.keepaliveInterval)),this.evtSelectRhb()):900==(null!=(n=this.state.s_hp)?n.m:null)?(this.doCONOK_BindHTTP_Polling(t,e,s,i),this.notifyStatus("CONNECTED:HTTP-POLLING"),this.state.s_hp.m=901,this.state.traceState()):903==(null!=(n=this.state.s_hp)?n.m:null)&&(this.doCONOK_BindHTTP_Polling(t,e,s,i),this.state.s_hp.m=901,this.state.traceState())}},evtSERVNAME:function(t){this.traceEvent("SERVNAME"),ri.isDebugEnabled()&&ri.debug("SERVNAME "+t),this.state.inPushing()&&(this.doSERVNAME(t),this.state.inStreaming()&&this.evtRestartKeepalive())},evtCLIENTIP:function(t){this.traceEvent("CLIENTIP"),ri.isDebugEnabled()&&ri.debug("CLIENTIP "+t),this.state.inPushing()&&(this.doCLIENTIP(t),this.state.inStreaming()&&this.evtRestartKeepalive())},evtCONS:function(t){this.traceEvent("CONS"),ri.isDebugEnabled()&&ri.debug("CONS "+l.string(t)),this.state.inPushing()&&(this.doCONS(t),this.state.inStreaming()&&this.evtRestartKeepalive())},evtPROBE:function(){this.traceEvent("PROBE"),ri.isDebugEnabled()&&ri.debug("PROBE"),this.clientEventDispatcher.onServerKeepalive(),this.state.inPushing()&&this.state.inStreaming()&&this.evtRestartKeepalive()},evtNOOP:function(){this.traceEvent("NOOP"),this.state.inPushing()&&this.state.inStreaming()&&this.evtRestartKeepalive()},evtSYNC:function(t){this.traceEvent("SYNC"),ri.isDebugEnabled()&&ri.debug("SYNC "+t);var e,s,i=!0;(s=300==(null!=(e=this.state.s_w)?e.p:null)||510==(null!=(e=this.state.s_ws)?e.p:null),!s&&810!=(null!=(s=this.state.s_hs)?s.p:null))?(!!(s=220==this.state.s_tr||230==this.state.s_tr||611==(null!=(e=this.state.s_wp)?e.p:null))||901==(null!=(s=this.state.s_hp)?s.m:null)||1001==this.state.s_rec)&&(i=this.evtSYNC_PushingRegion(t)):(i=this.evtSYNC_PushingRegion(t),this.evtRestartKeepalive());i&&this.evtSYNC_PushingRegion(t)},evtSYNC_PushingRegion:function(t){var e=1e3*t;if(null!=this.state.s_slw){var s=this.state.s_slw;if(null!=s)switch(s){case 330:this.doSYNC(e),this.state.s_slw=331,this.state.traceState();break;case 331:var i=this.doSYNC_G(e);this.state.s_slw=332,this.state.traceState(),this.evtCheckAvg(i);break;case 333:i=this.doSYNC_NG(e),this.state.s_slw=332,this.state.traceState(),this.evtCheckAvg(i)}}return!1},evtMSGDONE:function(t,e,s){this.traceEvent("MSGDONE"),ri.isDebugEnabled()&&ri.debug("MSGDONE "+t+" "+e+" "+s),this.state.inPushing()&&(this.isFreshData()?(this.doMSGDONE(t,e,s),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtMSGFAIL:function(t,e,s,i){this.traceEvent("MSGFAIL"),ri.isDebugEnabled()&&ri.debug("MSGFAIL "+t+" "+e+" "+s+" "+i),this.state.inPushing()&&(this.isFreshData()?(this.doMSGFAIL(t,e,s,i),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtU:function(t,e,s,i){this.traceEvent("U"),ri.isDebugEnabled()&&ri.debug(""+i),this.state.inPushing()&&(this.isFreshData()?(this.doU(t,e,s),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtSUBOK:function(t,e,s){this.traceEvent("SUBOK"),ri.isDebugEnabled()&&ri.debug("SUBOK "+t+" "+e+" "+s),this.state.inPushing()&&(this.isFreshData()?(this.doSUBOK(t,e,s),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtSUBCMD:function(t,e,s,i,n){this.traceEvent("SUBCMD"),ri.isDebugEnabled()&&ri.debug("SUBCMD "+t+" "+e+" "+s+" "+i+" "+n),this.state.inPushing()&&(this.isFreshData()?(this.doSUBCMD(t,e,s,i,n),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtUNSUB:function(t){this.traceEvent("UNSUB"),ri.isDebugEnabled()&&ri.debug("UNSUB "+t),this.state.inPushing()&&(this.isFreshData()?(this.doUNSUB(t),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtEOS:function(t,e){this.traceEvent("EOS"),ri.isDebugEnabled()&&ri.debug("EOS "+t+" "+e),this.state.inPushing()&&(this.isFreshData()?(this.doEOS(t,e),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtCS:function(t,e){this.traceEvent("CS"),ri.isDebugEnabled()&&ri.debug("CS "+t+" "+e),this.state.inPushing()&&(this.isFreshData()?(this.doCS(t,e),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtOV:function(t,e,s){this.traceEvent("OV"),ri.isDebugEnabled()&&ri.debug("OV "+t+" "+e+" "+s),this.state.inPushing()&&(this.isFreshData()?(this.doOV(t,e,s),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtCONF:function(t,e){this.traceEvent("CONF"),ri.isDebugEnabled()&&ri.debug("CONF "+t+" "+l.string(e)),this.state.inPushing()&&(this.isFreshData()?(this.doCONF(t,e),this.state.inStreaming()&&this.evtRestartKeepalive()):(this.onStaleData(),this.state.inStreaming()&&this.evtRestartKeepalive()))},evtCheckAvg:function(t){if(this.traceEvent("check.avg"),332==this.state.s_slw)switch(t._hx_index){case 0:this.state.s_slw=331,this.state.traceState();break;case 1:this.state.s_slw=333,this.state.traceState();break;case 2:this.disableStreaming(),this.cause="slow",this.state.s_slw=334,this.state.traceState(),this.evtForcePolling()}},evtSendPendingControls:function(){this.traceEvent("send.pending.controls");var t,e=this.getPendingControls();340!=(null!=(t=this.state.s_w)?t.s:null)||h.empty(e)?550!=(null!=(t=this.state.s_ws)?t.s:null)||h.empty(e)?630!=(null!=(t=this.state.s_wp)?t.s:null)||h.empty(e)||(this.sendPengingControlsWS(e),this.state.s_wp.s=630,this.state.traceState()):(this.sendPengingControlsWS(e),this.state.s_ws.s=550,this.state.traceState(),this.evtRestartHeartbeat()):(this.sendPengingControlsWS(e),this.state.s_w.s=340,this.state.traceState(),this.evtRestartHeartbeat())},evtSendPendingMessages:function(){var t;this.traceEvent("send.pending.messages"),340==(null!=(t=this.state.s_w)?t.s:null)&&h.exists(this.messageManagers,(function(t){return t.isPending()}))?(this.sendPendingMessagesWS(),this.state.s_w.s=340,this.state.traceState(),this.genAckMessagesWS(),this.evtRestartHeartbeat()):550==(null!=(t=this.state.s_ws)?t.s:null)&&h.exists(this.messageManagers,(function(t){return t.isPending()}))?(this.sendPendingMessagesWS(),this.state.s_ws.s=550,this.state.traceState(),this.genAckMessagesWS(),this.evtRestartHeartbeat()):630==(null!=(t=this.state.s_wp)?t.s:null)&&h.exists(this.messageManagers,(function(t){return t.isPending()}))&&(this.sendPendingMessagesWS(),this.state.s_wp.s=630,this.state.traceState(),this.genAckMessagesWS())},evtSelectRhb:function(){this.traceEvent("select.rhb"),320==this.state.s_rhb&&(0==this.rhb_grantedInterval?0==this.options.reverseHeartbeatInterval?(this.state.s_rhb=321,this.state.traceState()):(this.rhb_currentInterval=this.options.reverseHeartbeatInterval,this.state.s_rhb=322,this.state.traceState(),this.schedule_evtRhbTimeout(this.rhb_currentInterval)):this.options.reverseHeartbeatInterval>0&&this.options.reverseHeartbeatInterval0&&this.options.reverseHeartbeatInterval0&&this.options.reverseHeartbeatIntervalXe.toMillis(s)?ss.minus(e,Xe.toMillis(s)):ss.ZERO;this.state.s_rec=1003,this.state.traceState(),oi.isErrorEnabled()&&(i>0?oi.isErrorEnabled()&&oi.error("Retrying recovery in "+i+"ms. Cause: "+l.string(t)):oi.isErrorEnabled()&&oi.error("Retrying recovery. Cause: "+l.string(t))),this.schedule_evtRetryTimeout(i)}else this.notifyStatus("DISCONNECTED:WILL-RETRY"),this.cause="recovery.timeout",this.state.goto_m_from_rec(113),this.exit_rec_to_m(),this.entry_m113(Y.recovery_timeout)}},evtCreate:function(){this.traceEvent("du:create"),(20==this.state.s_du||23==this.state.s_du)&&(this.state.s_du=21,this.state.traceState())},evtCheckTransport:function(){if(this.traceEvent("check.transport"),1300==this.state.s_swt)if(220==this.state.s_tr||230==this.state.s_tr||260==this.state.s_tr)this.state.s_swt=1301,this.state.traceState();else{var t=this.getBestForBinding();t==V.BFB_ws_streaming&&(210==this.state.s_tr||240==this.state.s_tr)||t==V.BFB_http_streaming&&270==this.state.s_tr&&710==this.state.s_h||t==V.BFB_ws_polling&&250==this.state.s_tr||t==V.BFB_http_polling&&270==this.state.s_tr&&720==this.state.s_h?(this.state.s_swt=1301,this.state.traceState()):(this.state.s_swt=1302,this.state.traceState(),this.evtSendControl(Pe.sure(this.switchRequest)))}},evtCheckBW:function(){this.traceEvent("check.bw"),1200==this.state.s_bw&&(this.bw_requestedMaxBandwidth!=this.options.requestedMaxBandwidth&&this.options.realMaxBandwidth!=ps.BWUnmanaged?(this.bw_requestedMaxBandwidth=this.options.requestedMaxBandwidth,this.state.s_bw=1202,this.state.traceState(),this.evtSendControl(Pe.sure(this.constrainRequest))):(this.state.s_bw=1201,this.state.traceState()))},evtCheckCtrlRequests:function(){if(this.traceEvent("check.ctrl.requests"),1100==this.state.s_ctrl){var t=this.getPendingControls();h.empty(t)?h.exists(this.messageManagers,(function(t){return t.isPending()}))?(this.sendPendingMessagesHTTP(),this.state.s_ctrl=1102,this.state.traceState(),this.evtRestartHeartbeat(),this.schedule_evtCtrlTimeout(this.options.retryDelay)):324==this.state.s_rhb?(this.sendHeartbeatHTTP(),this.state.s_ctrl=1102,this.state.traceState(),this.evtRestartHeartbeat(),this.schedule_evtCtrlTimeout(this.options.retryDelay)):(this.state.s_ctrl=1101,this.state.traceState()):(this.sendPendingControlsHTTP(t),this.state.s_ctrl=1102,this.state.traceState(),this.evtRestartHeartbeat(),this.schedule_evtCtrlTimeout(this.options.retryDelay))}},evtCtrlDone:function(){this.traceEvent("ctrl.done"),1102==this.state.s_ctrl&&(this.closeCtrl(),this.state.s_ctrl=1100,this.state.traceState(),this.cancel_evtCtrlTimeout(),this.evtCheckCtrlRequests())},evtCtrlError:function(){if(this.traceEvent("ctrl.error"),1102==this.state.s_ctrl){this.disposeCtrl();var t=this.waitingInterval(this.options.retryDelay,this.ctrl_connectTs);this.state.s_ctrl=1103,this.state.traceState(),this.cancel_evtCtrlTimeout(),this.schedule_evtCtrlTimeout(t)}},evtCtrlTimeout:function(){if(this.traceEvent("ctrl.timeout"),null!=this.state.s_ctrl)if(1102==this.state.s_ctrl){this.disposeCtrl();var t=this.waitingInterval(this.options.retryDelay,this.ctrl_connectTs);this.state.s_ctrl=1103,this.state.traceState(),this.cancel_evtCtrlTimeout(),this.schedule_evtCtrlTimeout(t)}else 1103==this.state.s_ctrl&&(this.state.s_ctrl=1100,this.state.traceState(),this.cancel_evtCtrlTimeout(),this.evtCheckCtrlRequests())},evtSendControl:function(t){var e;this.traceEvent("send.control"),340==(null!=(e=this.state.s_w)?e.s:null)?(this.sendControlWS(t),this.state.s_w.s=340,this.state.traceState(),this.evtRestartHeartbeat()):550==(null!=(e=this.state.s_ws)?e.s:null)?(this.sendControlWS(t),this.state.s_ws.s=550,this.state.traceState(),this.evtRestartHeartbeat()):630==(null!=(e=this.state.s_wp)?e.s:null)?(this.sendControlWS(t),this.state.s_wp.s=630,this.state.traceState()):1101==this.state.s_ctrl&&(this.state.s_ctrl=1100,this.state.traceState(),this.evtCheckCtrlRequests())},evtSendHeartbeat:function(){var t;this.traceEvent("send.heartbeat"),340==(null!=(t=this.state.s_w)?t.s:null)?(this.sendHeartbeatWS(),this.state.s_w.s=340,this.state.traceState(),this.evtRestartHeartbeat()):550==(null!=(t=this.state.s_ws)?t.s:null)?(this.sendHeartbeatWS(),this.state.s_ws.s=550,this.state.traceState(),this.evtRestartHeartbeat()):1101==this.state.s_ctrl&&(this.state.s_ctrl=1100,this.state.traceState(),this.evtCheckCtrlRequests())},evtStartSession:function(){this.traceEvent("du:start.session"),oi.isInfoEnabled()&&oi.info("Starting new session: "+this.sessionId),21==this.state.s_du&&(this.state.s_du=22,this.state.traceState())},evtEndSession:function(){oi.isInfoEnabled()&&oi.info("Destroying session: "+this.sessionId)},evtRetry:function(t,e){this.traceEvent("du:retry"),oi.isErrorEnabled()&&(null!=e&&e>0?oi.isErrorEnabled()&&oi.error("Retrying connection in "+e+"ms. Cause: "+j(t)):oi.isErrorEnabled()&&oi.error("Retrying connection. Cause: "+j(t)));var s=!0;switch(this.state.s_du){case 21:this.resetSequenceMap(),this.state.s_du=23,this.state.traceState(),s=this.evtRetry_NextRegion(),this.genAbortMessages();break;case 22:this.disposeSession(),this.state.s_du=23,this.state.traceState(),s=this.evtRetry_NextRegion(),this.genAbortSubscriptions(),this.genAbortMessages()}s&&this.evtRetry_NextRegion()},evtRetry_NextRegion:function(){return!1},evtTerminate:function(t){if(this.traceEvent("du:terminate"),oi.isInfoEnabled()&&2==t._hx_index&&oi.isInfoEnabled()&&oi.info("Disconnected. Cause: Requested by user"),oi.isErrorEnabled())switch(t._hx_index){case 0:oi.isErrorEnabled()&&oi.error("Disconnected. Cause: "+t.code+" - "+t.msg);break;case 1:oi.isErrorEnabled()&&oi.error("Disconnected. Cause: "+t.error)}var e=!0;switch(this.state.s_du){case 20:case 21:case 23:this.disposeClient(),this.doUnistallPageLifecycle(),this.state.s_du=20,this.state.traceState(),e=this.evtTerminate_NextRegion(),this.genAbortMessages();break;case 22:this.disposeSession(),this.disposeClient(),this.doUnistallPageLifecycle(),this.state.s_du=20,this.state.traceState(),e=this.evtTerminate_NextRegion(),this.genAbortSubscriptions(),this.genAbortMessages()}e&&this.evtTerminate_NextRegion()},evtTerminate_NextRegion:function(){return this.evtTerminate_NetworkReachabilityRegion()},evtTerminate_NetworkReachabilityRegion:function(){switch(this.state.s_nr){case 1410:case 1411:case 1412:var t=this.nr_reachabilityManager;this.nr_reachabilityManager=null,this.state.s_nr=1400,this.state.traceState(),null!=t&&t.stopListening()}return!1},evtRetryTimeout:function(){switch(this.traceEvent("retry.timeout"),this.state.s_m){case 110:this.notifyStatus("CONNECTING"),this.sendCreateTTL(),this.state.s_m=140,this.state.traceState(),this.evtCreate(),this.schedule_evtTransportTimeout(6e4);break;case 111:this.notifyStatus("CONNECTING"),this.delayCounter.increase(),this.sendCreateTTL(),this.state.s_m=140,this.state.traceState(),this.cancel_evtRetryTimeout(),this.evtCreate(),this.schedule_evtTransportTimeout(6e4);break;case 112:this.delayCounter.increase(),this.state.s_m=116,this.state.traceState(),this.cancel_evtRetryTimeout(),this.evtSelectCreate();break;case 113:this.state.s_m=116,this.state.traceState(),this.cancel_evtRetryTimeout(),this.evtSelectCreate();break;case 115:this.state.s_m=116,this.state.traceState(),this.evtSelectCreate();break;case 150:1003==this.state.s_rec&&(this.sendRecovery(),this.state.s_rec=1001,this.state.traceState(),this.cancel_evtRetryTimeout(),this.schedule_evtTransportTimeout(this.options.retryDelay))}},evtExtSetForcedTransport:function(){this.traceEvent("setForcedTransport"),1301==this.state.s_swt&&(this.state.s_swt=1300,this.state.traceState(),this.evtCheckTransport())},evtExtSetRequestedMaxBandwidth:function(){this.traceEvent("setRequestedMaxBandwidth"),1201==this.state.s_bw&&(this.state.s_bw=1200,this.state.traceState(),this.evtCheckBW())},evtForceSlowing:function(){this.traceEvent("force.slowing"),1301==this.state.s_swt&&(this.state.s_swt=1300,this.state.traceState(),this.evtCheckTransport())},evtForcePolling:function(){this.traceEvent("force.polling"),1301==this.state.s_swt&&(this.state.s_swt=1300,this.state.traceState(),this.evtCheckTransport())},evtSendMessage:function(t){var e;this.traceEvent("send.message"),340==(null!=(e=this.state.s_w)?e.s:null)?(this.sendMsgWS(t),this.state.s_w.s=340,this.state.traceState(),t.evtWSSent(),this.evtRestartHeartbeat()):550==(null!=(e=this.state.s_ws)?e.s:null)?(this.sendMsgWS(t),this.state.s_ws.s=550,this.state.traceState(),t.evtWSSent(),this.evtRestartHeartbeat()):630==(null!=(e=this.state.s_wp)?e.s:null)?(this.sendMsgWS(t),this.state.s_wp.s=630,this.state.traceState(),t.evtWSSent()):1101==this.state.s_ctrl&&(this.state.s_ctrl=1100,this.state.traceState(),this.evtCheckCtrlRequests())},evtSwitchTransport:function(){this.traceEvent("switch.transport");var t=!0;1302!=this.state.s_swt&&1303!=this.state.s_swt||(this.state.s_swt=1300,this.state.traceState(),t=this.evtSwitchTransport_forwardToTransportRegion(),this.evtCheckTransport()),t&&this.evtSwitchTransport_forwardToTransportRegion()},evtSwitchTransport_forwardToTransportRegion:function(){var t,e=G.TC_otherError("Selected transport "+this.options.forcedTransport+" is not available");if(200==this.state.s_tr)switch(this.getBestForBinding()._hx_index){case 0:this.notifyStatus("DISCONNECTED"),this.state.goto_m_from_session(100),this.evtEndSession(),this.evtTerminate(e);break;case 1:this.openWS_Bind(),this.state.s_tr=240,this.state.s_ws=new $(500),this.state.traceState(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 2:this.openWS_Bind(),this.state.s_tr=250,this.state.s_wp=new tt(600),this.state.traceState(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 3:this.sendBindHTTP_Streaming(),this.state.s_tr=270,this.state.s_h=710,this.state.s_hs=new et(800),this.state.s_ctrl=1100,this.state.traceState(),this.evtCheckCtrlRequests(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 4:this.sendBindHTTP_Polling(),this.state.s_tr=270,this.state.s_h=720,this.state.s_hp=new st(900),this.state.s_rhb=320,this.state.s_ctrl=1100,this.state.traceState(),this.evtCheckCtrlRequests(),this.schedule_evtIdleTimeout(ss.plus(Pe.sure(this.idleTimeout),this.options.retryDelay)),this.evtSelectRhb()}else if(811==(null!=(t=this.state.s_hs)?t.p:null))switch(this.getBestForBinding()._hx_index){case 0:this.notifyStatus("DISCONNECTED"),this.state.goto_m_from_hs(100),this.exit_hs_to_m(),this.evtTerminate(e);break;case 1:this.openWS_Bind(),this.state.clear_hs(),this.state.s_h=null,this.state.s_ctrl=null,this.state.s_tr=240,this.state.s_ws=new $(500),this.state.traceState(),this.exit_hs(),this.exit_ctrl(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 2:this.openWS_Bind(),this.state.clear_hs(),this.state.s_h=null,this.state.s_ctrl=null,this.state.s_tr=250,this.state.s_wp=new tt(600),this.state.traceState(),this.exit_hs(),this.exit_ctrl(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 3:this.sendBindHTTP_Streaming(),this.state.s_hs=new et(800),this.state.traceState(),this.exit_hs(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 4:this.sendBindHTTP_Polling(),this.state.clear_hs(),this.state.s_h=720,this.state.s_hp=new st(900),this.state.s_rhb=320,this.state.traceState(),this.exit_hs(),this.schedule_evtIdleTimeout(ss.plus(Pe.sure(this.idleTimeout),this.options.retryDelay)),this.evtSelectRhb()}else if(904==(null!=(t=this.state.s_hp)?t.m:null))switch(this.getBestForBinding()._hx_index){case 0:this.notifyStatus("DISCONNECTED"),this.state.goto_m_from_hp(100),this.exit_hp_to_m(),this.evtTerminate(e);break;case 1:this.openWS_Bind(),this.state.clear_hp(),this.state.s_h=null,this.state.s_ctrl=null,this.state.s_tr=240,this.state.s_ws=new $(500),this.state.traceState(),this.exit_hp(),this.exit_ctrl(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 2:this.openWS_Bind(),this.state.clear_hp(),this.state.s_h=null,this.state.s_ctrl=null,this.state.s_tr=250,this.state.s_wp=new tt(600),this.state.traceState(),this.exit_hp(),this.exit_ctrl(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 3:this.sendBindHTTP_Streaming(),this.state.clear_hp(),this.state.s_h=710,this.state.s_hs=new et(800),this.state.traceState(),this.exit_hp(),this.schedule_evtTransportTimeout(this.options.retryDelay);break;case 4:this.sendBindHTTP_Polling(),this.state.s_hp=new st(900),this.state.s_rhb=320,this.state.traceState(),this.exit_hp(),this.schedule_evtIdleTimeout(ss.plus(Pe.sure(this.idleTimeout),this.options.retryDelay)),this.evtSelectRhb()}return!1},onFreshData:function(){if(this.rec_serverProg!=this.rec_clientProg)throw new Me("Assertion failure: rec_serverProg == rec_clientProg");this.rec_serverProg+=1,this.rec_clientProg+=1},onStaleData:function(){if(this.rec_serverProg>=this.rec_clientProg)throw new Me("Assertion failure: rec_serverProg < rec_clientProg");this.rec_serverProg+=1},isFreshData:function(){return this.rec_serverProg==this.rec_clientProg},openWS:function(t,e){var s=this,i=function(t){wi((function(){s.lock.synchronized((function(){t.isDisposed()||s.evtWSOpen()}))}))},n=function(t,e){wi((function(){s.lock.synchronized((function(){if(!t.isDisposed())try{s.evtMessage(e)}catch(t){var i=g.caught(t);oi.isErrorEnabled()&&oi.error(i.get_message()+"\n"+i.details()),s.evtExtDisconnect(G.TC_standardError(61,i.get_message()))}}))}))},r=function(t,e){wi((function(){s.lock.synchronized((function(){t.isDisposed()||s.evtTransportError()}))}))};return this.wsFactory(t,e,i,n,r)},openWS_Create:function(){this.connectTs=a.now()/1e3,this.serverInstanceAddress=this.getServerAddress(),this.ws=this.openWS(Es.build(this.serverInstanceAddress,"lightstreamer"),this.options.httpExtraHeaders)},openWS_Bind:function(){this.connectTs=a.now()/1e3,this.ws=this.openWS(Es.build(Pe.sure(this.serverInstanceAddress),"lightstreamer"),this.getHeadersForRequestOtherThanCreate())},sendCreateWS:function(){var t=new Ke;this.options.keepaliveInterval>0&&t.LS_keepalive_millis(this.options.keepaliveInterval),this.rhb_grantedInterval=this.options.reverseHeartbeatInterval,this.rhb_grantedInterval>0&&t.LS_inactivity_millis(this.rhb_grantedInterval),this.bw_requestedMaxBandwidth=this.options.requestedMaxBandwidth;var e=this.bw_requestedMaxBandwidth;null!=e&&0==e._hx_index&&t.LS_requested_max_bandwidth_Float(e.bw),null!=this.details.adapterSet&&t.LS_adapter_set(this.details.adapterSet),null!=this.details.user&&t.LS_user(this.details.user),t.LS_cid(ei),null!=this.sessionId&&t.LS_old_session(this.sessionId),this.options.slowingEnabled||t.LS_send_sync(!1),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session create: "+l.string(t)),null!=this.details.password&&t.LS_password(this.details.password),Pe.sure(this.ws).send("wsok"),Pe.sure(this.ws).send("create_session\r\n"+t.getEncodedString())},sendBindWS_Streaming:function(){var t=new Ke;t.LS_session(Pe.sure(this.sessionId)),this.options.keepaliveInterval>0&&t.LS_keepalive_millis(this.options.keepaliveInterval),this.rhb_grantedInterval=this.options.reverseHeartbeatInterval,this.rhb_grantedInterval>0&&t.LS_inactivity_millis(this.rhb_grantedInterval),this.options.slowingEnabled||t.LS_send_sync(!1),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session bind: "+l.string(t)),Pe.sure(this.ws).send("wsok"),Pe.sure(this.ws).send("bind_session\r\n"+t.getEncodedString())},sendBindWS_FirstPolling:function(){var t=new Ke;t.LS_session(Pe.sure(this.sessionId)),t.LS_polling(!0),t.LS_polling_millis(this.options.pollingInterval),this.idleTimeout=this.options.idleTimeout,t.LS_idle_millis(this.idleTimeout),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session bind: "+l.string(t)),Pe.sure(this.ws).send("bind_session\r\n"+t.getEncodedString())},sendBindWS_Polling:function(){var t=new Ke;t.LS_polling(!0),t.LS_polling_millis(this.options.pollingInterval),this.idleTimeout=this.options.idleTimeout,t.LS_idle_millis(this.idleTimeout),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session bind: "+l.string(t)),Pe.sure(this.ws).send("bind_session\r\n"+t.getEncodedString())},sendDestroyWS:function(t){null==t&&(t="api");var e=new Ke;e.LS_reqId(this.generateFreshReqId()),e.LS_op("destroy"),e.LS_close_socket(!0),e.LS_cause(t),ri.isInfoEnabled()&&ri.info("Sending session destroy: "+l.string(e)),Pe.sure(this.ws).send("control\r\n"+e.getEncodedString())},sendHttpRequest:function(t,e,s){var i=this,n=function(t,e){wi((function(){i.lock.synchronized((function(){if(!t.isDisposed())try{i.evtMessage(e)}catch(t){var s=g.caught(t);oi.isErrorEnabled()&&oi.error(s.get_message()+"\n"+s.details()),i.evtExtDisconnect(G.TC_standardError(61,s.get_message()))}}))}))},r=function(t,e){wi((function(){i.lock.synchronized((function(){t.isDisposed()||i.evtTransportError()}))}))};return this.httpFactory(t,e.getEncodedString(),s,n,r,(function(t){}))},sendCreateHTTP:function(){var t=new Ke;t.LS_polling(!0),t.LS_polling_millis(0),t.LS_idle_millis(0),this.bw_requestedMaxBandwidth=this.options.requestedMaxBandwidth;var e=this.bw_requestedMaxBandwidth;null!=e&&0==e._hx_index&&t.LS_requested_max_bandwidth_Float(e.bw),null!=this.details.adapterSet&&t.LS_adapter_set(this.details.adapterSet),null!=this.details.user&&t.LS_user(this.details.user),t.LS_cid(ei),null!=this.sessionId&&t.LS_old_session(this.sessionId),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session create: "+l.string(t)),null!=this.details.password&&t.LS_password(this.details.password),this.connectTs=a.now()/1e3,this.serverInstanceAddress=this.getServerAddress(),this.http=this.sendHttpRequest(Es.build(this.serverInstanceAddress,"/lightstreamer"+ii+"/create_session.txt?LS_protocol="+Js),t,this.options.httpExtraHeaders)},sendBindHTTP_Streaming:function(){var t=new Ke;t.LS_session(Pe.sure(this.sessionId)),t.LS_content_length(this.options.contentLength),this.options.keepaliveInterval>0&&t.LS_keepalive_millis(this.options.keepaliveInterval),this.rhb_grantedInterval=this.options.reverseHeartbeatInterval,this.rhb_grantedInterval>0&&t.LS_inactivity_millis(this.rhb_grantedInterval),this.options.slowingEnabled||t.LS_send_sync(!1),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session bind: "+l.string(t)),this.connectTs=a.now()/1e3,this.http=this.sendHttpRequest(Es.build(Pe.sure(this.serverInstanceAddress),"/lightstreamer/bind_session.txt?LS_protocol="+Js),t,this.getHeadersForRequestOtherThanCreate())},sendBindHTTP_Polling:function(){var t=new Ke;t.LS_session(Pe.sure(this.sessionId)),t.LS_polling(!0),t.LS_polling_millis(this.options.pollingInterval),this.idleTimeout=this.options.idleTimeout,t.LS_idle_millis(this.idleTimeout),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),this.rhb_grantedInterval=0,ri.isInfoEnabled()&&ri.info("Sending session bind: "+l.string(t)),this.connectTs=a.now()/1e3,this.http=this.sendHttpRequest(Es.build(Pe.sure(this.serverInstanceAddress),"/lightstreamer/bind_session.txt?LS_protocol="+Js),t,this.getHeadersForRequestOtherThanCreate())},sendCreateTTL:function(){var t=new Ke;t.LS_ttl_millis("unlimited"),t.LS_polling(!0),t.LS_polling_millis(0),t.LS_idle_millis(0),this.bw_requestedMaxBandwidth=this.options.requestedMaxBandwidth;var e=this.bw_requestedMaxBandwidth;null!=e&&0==e._hx_index&&t.LS_requested_max_bandwidth_Float(e.bw),null!=this.details.adapterSet&&t.LS_adapter_set(this.details.adapterSet),null!=this.details.user&&t.LS_user(this.details.user),t.LS_cid(ei),null!=this.sessionId&&t.LS_old_session(this.sessionId),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session create: "+l.string(t)),null!=this.details.password&&t.LS_password(this.details.password),this.connectTs=a.now()/1e3,this.serverInstanceAddress=this.getServerAddress(),this.http=this.sendHttpRequest(Es.build(this.serverInstanceAddress,"/lightstreamer"+ii+"/create_session.txt?LS_protocol="+Js),t,this.options.httpExtraHeaders)},sendRecovery:function(){var t=new Ke;t.LS_session(Pe.sure(this.sessionId)),t.LS_recovery_from(this.rec_clientProg),t.LS_polling(!0),t.LS_polling_millis(0),t.LS_idle_millis(0),null!=this.cause&&(t.LS_cause(this.cause),this.cause=null),ri.isInfoEnabled()&&ri.info("Sending session recovery: "+l.string(t)),this.connectTs=a.now()/1e3,this.http=this.sendHttpRequest(Es.build(Pe.sure(this.serverInstanceAddress),"/lightstreamer/bind_session.txt?LS_protocol="+Js),t,this.getHeadersForRequestOtherThanCreate())},disposeWS:function(){null!=this.ws&&(this.ws.dispose(),this.ws=null)},closeWS:function(){null!=this.ws&&(this.ws.dispose(),this.ws=null)},suspendWS_Streaming:function(){oi.isWarnEnabled()&&oi.warn("Websocket suspended"),this.suspendedTransports.insert("WS-STREAMING")},disableWS:function(){oi.isWarnEnabled()&&oi.warn("Websocket disabled"),this.disabledTransports=this.disabledTransports.union(["WS-STREAMING","WS-POLLING"])},disableHTTP_Streaming:function(){oi.isWarnEnabled()&&oi.warn("HTTP streaming disabled"),this.disabledTransports=this.disabledTransports.union(["HTTP-STREAMING"])},disableStreaming:function(){oi.isWarnEnabled()&&oi.warn("Streaming disabled"),this.disabledTransports=this.disabledTransports.union(["WS-STREAMING","HTTP-STREAMING"])},enableAllTransports:function(){oi.isInfoEnabled()&&(this.disabledTransports.count()>0||this.suspendedTransports.count()>0)&&oi.isInfoEnabled()&&oi.info("Transports enabled again."),this.disabledTransports=new je,this.suspendedTransports=new je},disposeHTTP:function(){null!=this.http&&(this.http.dispose(),this.http=null)},closeHTTP:function(){null!=this.http&&(this.http.dispose(),this.http=null)},disposeCtrl:function(){null!=this.ctrl_http&&(this.ctrl_http.dispose(),this.ctrl_http=null)},closeCtrl:function(){null!=this.ctrl_http&&(this.ctrl_http.dispose(),this.ctrl_http=null)},notifyStatus:function(t){var e=this.m_status;this.m_status=t,e!=t&&(oi.isInfoEnabled()&&oi.info("Status: "+t),this.clientEventDispatcher.onStatusChange(t))},getBestForCreating:function(){if(0==this.getBestForBinding()._hx_index)return H.BFC_none;var t=this.options.forcedTransport,e=this.suspendedTransports.union(this.disabledTransports.toArray()),s=this.options.httpExtraHeaders,i=null==s||h.empty(s);if(null==t)return i?e.contains("WS-STREAMING")?H.BFC_http:H.BFC_ws:H.BFC_http;switch(t){case"WS":case"WS-STREAMING":return i?e.contains("WS-STREAMING")?H.BFC_http:H.BFC_ws:H.BFC_http;default:return H.BFC_http}},getBestForBinding:function(){var t=this.options.forcedTransport,e=this.disabledTransports,s=this.options.httpExtraHeaders,i=null==s||h.empty(s),n=this.options.httpExtraHeadersOnSessionCreationOnly;if(null==t)return i||n?e.contains("WS-STREAMING")?e.contains("HTTP-STREAMING")?e.contains("WS-POLLING")?V.BFB_http_polling:V.BFB_ws_polling:V.BFB_http_streaming:V.BFB_ws_streaming:e.contains("HTTP-STREAMING")?V.BFB_http_polling:V.BFB_http_streaming;switch(t){case"HTTP":return e.contains("HTTP-STREAMING")?V.BFB_http_polling:V.BFB_http_streaming;case"HTTP-POLLING":return V.BFB_http_polling;case"HTTP-STREAMING":return e.contains("HTTP-STREAMING")?V.BFB_none:V.BFB_http_streaming;case"WS":return i||n?e.contains("WS-STREAMING")?e.contains("WS-POLLING")?V.BFB_none:V.BFB_ws_polling:V.BFB_ws_streaming:V.BFB_none;case"WS-POLLING":return i||n?e.contains("WS-POLLING")?V.BFB_none:V.BFB_ws_polling:V.BFB_none;case"WS-STREAMING":return i||n?e.contains("WS-STREAMING")?V.BFB_none:V.BFB_ws_streaming:V.BFB_none}},resetCurrentRetryDelay:function(){this.delayCounter.reset(this.options.retryDelay)},notifyServerErrorIfCauseIsError:function(t){switch(t._hx_index){case 0:this.clientEventDispatcher.onServerError(t.code,t.msg);break;case 1:this.clientEventDispatcher.onServerError(61,t.error)}},notifyServerError_CONERR:function(t,e){this.clientEventDispatcher.onServerError(t,e)},notifyServerError_END:function(t,e){039?this.clientEventDispatcher.onServerError(39,e):this.clientEventDispatcher.onServerError(t,e)},notifyServerError_ERROR:function(t,e){this.clientEventDispatcher.onServerError(t,e)},notifyServerError_REQERR:function(t,e){11==t?this.clientEventDispatcher.onServerError(21,e):this.clientEventDispatcher.onServerError(t,e)},doCONOK:function(t,e,s,i,n){this.sessionId=t,this.details.setSessionId(t),this.requestLimit=e,null!=s?(this.keepaliveInterval=s,this.options.setKeepaliveInterval(s)):null!=i&&(this.idleTimeout=i,this.options.setIdleTimeout(i)),"*"==n||this.options.serverInstanceAddressIgnored||(n=Es.completeControlLink(n,this.getServerAddress()),this.serverInstanceAddress=n,this.details.setServerInstanceAddress(n))},doCONOK_CreateWS:function(t,e,s,i){this.doCONOK(t,e,s,null,i)},doCONOK_BindWS_Streaming:function(t,e,s,i){this.doCONOK(t,e,s,null,i)},doCONOK_BindWS_Polling:function(t,e,s,i){this.doCONOK(t,e,null,s,i)},doCONOK_CreateHTTP:function(t,e,s,i){this.doCONOK(t,e,null,null,i)},doCONOK_BindHTTP_Streaming:function(t,e,s,i){this.doCONOK(t,e,s,null,i)},doCONOK_BindHTTP_Polling:function(t,e,s,i){this.doCONOK(t,e,null,s,i)},doSERVNAME:function(t){this.details.setServerSocketName(t)},doCLIENTIP:function(t){this.details.setClientIp(t);var e=this.lastKnownClientIp;null!=e&&e!=t&&(oi.isInfoEnabled()&&oi.info("Client IP changed: "+e+" -> "+t),this.enableAllTransports()),this.lastKnownClientIp=t},doCONS:function(t){this.options.setRealMaxBandwidth(t)},doLOOP:function(t){this.options.setPollingInterval(t)},doPROG:function(t){if(t>this.rec_clientProg)throw new Me("Assertion failure: prog <= rec_clientProg");this.rec_serverProg=t},doMSGDONE:function(t,e,s){this.onFreshData();var i=this.messageManagers.filter((function(s){return s.sequence==t&&s.prog==e}));if(i.values.length-i.nRemoved>1)throw new Me("Assertion failure: messages.length <= 1");for(var n=new Ne(i);n.hasNext();)n.next().evtMSGDONE(s)},doMSGFAIL:function(t,e,s,i){if(this.onFreshData(),39==s){var n=l.parseInt(i);if(null==n)throw new Me("Assertion failure: count != null");for(var r=e-n+1,a=e+1;r1)throw new Me("Assertion failure: messages.length <= 1");for(var h=new Ne(o);h.hasNext();)h.next().evtMSGFAIL(s,i)}}else{if(o=this.messageManagers.filter((function(s){return s.sequence==t&&s.prog==e})),o.values.length-o.nRemoved>1)throw new Me("Assertion failure: messages.length <= 1");for(h=new Ne(o);h.hasNext();)h.next().evtMSGFAIL(s,i)}},doU:function(t,e,s){this.onFreshData();var i=this.subscriptionManagers._innerMap.h[t];null!=i?i.evtU(e,s):new Wt(t,this).evtU(e,s)},doSUBOK:function(t,e,s){this.onFreshData();var i=this.subscriptionManagers._innerMap.h[t];null!=i?i.evtSUBOK(e,s):new Wt(t,this).evtSUBOK(e,s)},doSUBCMD:function(t,e,s,i,n){this.onFreshData();var r=this.subscriptionManagers._innerMap.h[t];null!=r?r.evtSUBCMD(e,s,i,n):new Wt(t,this).evtSUBCMD(e,s,i,n)},doUNSUB:function(t){this.onFreshData();var e=this.subscriptionManagers._innerMap.h[t];null!=e&&e.evtUNSUB()},doEOS:function(t,e){this.onFreshData();var s=this.subscriptionManagers._innerMap.h[t];null!=s?s.evtEOS(e):new Wt(t,this).evtEOS(e)},doCS:function(t,e){this.onFreshData();var s=this.subscriptionManagers._innerMap.h[t];null!=s?s.evtCS(e):new Wt(t,this).evtCS(e)},doOV:function(t,e,s){this.onFreshData();var i=this.subscriptionManagers._innerMap.h[t];null!=i?i.evtOV(e,s):new Wt(t,this).evtOV(e,s)},doCONF:function(t,e){this.onFreshData();var s=this.subscriptionManagers._innerMap.h[t];null!=s?s.evtCONF(e):new Wt(t,this).evtCONF(e)},doREQOK:function(t){for(var e=this.subscriptionManagers,s=e.keys();s.hasNext();)e.get(s.next()).evtREQOK(t);this.subscriptionManagers._orderedKeys.compact();for(var i=new Ne(this.messageManagers);i.hasNext();)i.next().evtREQOK(t);this.messageManagers.compact()},doREQERR:function(t,e,s){for(var i=this.subscriptionManagers,n=i.keys();n.hasNext();)i.get(n.next()).evtREQERR(t,e,s);this.subscriptionManagers._orderedKeys.compact();for(var r=new Ne(this.messageManagers);r.hasNext();)r.next().evtREQERR(t,e,s);this.messageManagers.compact()},doSYNC:function(t){this.slw_refTime=a.now()/1e3,this.slw_avgDelayMs=-t},doSYNC_G:function(t){var e=this.diffTimeSync(t);return e>this.slw_hugeDelayMs&&e>2*this.slw_avgDelayMs?this.slw_avgDelayMs>this.slw_maxAvgDelayMs&&this.options.slowingEnabled?z.SCR_bad:z.SCR_not_good:(this.slw_avgDelayMs=this.slowAvg(e),this.slw_avgDelayMs>this.slw_maxAvgDelayMs&&this.options.slowingEnabled?z.SCR_bad:(this.slw_avgDelayMs<60&&(this.slw_avgDelayMs=0),z.SCR_good))},doSYNC_NG:function(t){var e=this.diffTimeSync(t);return e>this.slw_hugeDelayMs&&e>2*this.slw_avgDelayMs?(this.slw_avgDelayMs=this.slowAvg(e),this.slw_avgDelayMs>this.slw_maxAvgDelayMs&&this.options.slowingEnabled?z.SCR_bad:(this.slw_avgDelayMs<60&&(this.slw_avgDelayMs=0),z.SCR_good)):(this.slw_avgDelayMs=this.slowAvg(e),this.slw_avgDelayMs>this.slw_maxAvgDelayMs&&this.options.slowingEnabled?z.SCR_bad:(this.slw_avgDelayMs<60&&(this.slw_avgDelayMs=0),z.SCR_not_good))},diffTimeSync:function(t){return Ze.minus(a.now()/1e3,this.slw_refTime)-t},slowAvg:function(t){return this.slw_avgDelayMs*this.slw_m+t*(1-this.slw_m)},schedule_evtTransportTimeout:function(t){this.transportTimer=this.createTimer("transport.timeout",t,Vs(this,this.evtTransportTimeout))},schedule_evtRetryTimeout:function(t){this.retryTimer=this.createTimer("retry.timeout",t,Vs(this,this.evtRetryTimeout))},schedule_evtRecoveryTimeout:function(t){this.recoveryTimer=this.createTimer("recovery.timeout",t,Vs(this,this.evtRecoveryTimeout))},schedule_evtIdleTimeout:function(t){this.idleTimer=this.createTimer("idle.timeout",t,Vs(this,this.evtIdleTimeout))},schedule_evtPollingTimeout:function(t){this.pollingTimer=this.createTimer("polling.timeout",t,Vs(this,this.evtPollingTimeout))},schedule_evtCtrlTimeout:function(t){this.ctrlTimer=this.createTimer("ctrl.timeout",t,Vs(this,this.evtCtrlTimeout))},schedule_evtKeepaliveTimeout:function(t){this.keepaliveTimer=this.createTimer("keepalive.timeout",t,Vs(this,this.evtKeepaliveTimeout))},schedule_evtStalledTimeout:function(t){this.stalledTimer=this.createTimer("stalled.timeout",t,Vs(this,this.evtStalledTimeout))},schedule_evtReconnectTimeout:function(t){this.reconnectTimer=this.createTimer("reconnect.timeout",t,Vs(this,this.evtReconnectTimeout))},schedule_evtRhbTimeout:function(t){this.rhbTimer=this.createTimer("rhb.timeout",t,Vs(this,this.evtRhbTimeout))},createTimer:function(t,e,s){var i=this;return this.timerFactory(t,e,(function(t){i.lock.synchronized((function(){t.isCanceled()||s()}))}))},cancel_evtTransportTimeout:function(){null!=this.transportTimer&&(this.transportTimer.cancel(),this.transportTimer=null)},cancel_evtRetryTimeout:function(){null!=this.retryTimer&&(this.retryTimer.cancel(),this.retryTimer=null)},cancel_evtKeepaliveTimeout:function(){null!=this.keepaliveTimer&&(this.keepaliveTimer.cancel(),this.keepaliveTimer=null)},cancel_evtStalledTimeout:function(){null!=this.stalledTimer&&(this.stalledTimer.cancel(),this.stalledTimer=null)},cancel_evtReconnectTimeout:function(){null!=this.reconnectTimer&&(this.reconnectTimer.cancel(),this.reconnectTimer=null)},cancel_evtRhbTimeout:function(){null!=this.rhbTimer&&(this.rhbTimer.cancel(),this.rhbTimer=null)},cancel_evtIdleTimeout:function(){null!=this.idleTimer&&(this.idleTimer.cancel(),this.idleTimer=null)},cancel_evtPollingTimeout:function(){null!=this.pollingTimer&&(this.pollingTimer.cancel(),this.pollingTimer=null)},cancel_evtCtrlTimeout:function(){null!=this.ctrlTimer&&(this.ctrlTimer.cancel(),this.ctrlTimer=null)},cancel_evtRecoveryTimeout:function(){null!=this.recoveryTimer&&(this.recoveryTimer.cancel(),this.recoveryTimer=null)},waitingInterval:function(t,e){var s=Ze.minus(a.now()/1e3,e);return s 0");for(var i=[],n=0,r=e[0].encode(!0);n 0");var s=new Ft,i=0,n=t[0].encode(!1);for(s.addSubRequest(n),i=1;i"},__class__:J};var $=function(t){this.m=t};$.__name__=!0,$.prototype={toString:function(){var t=""},__class__:$};var tt=function(t){this.m=t};tt.__name__=!0,tt.prototype={toString:function(){var t=""},__class__:tt};var et=function(t){this.m=t};et.__name__=!0,et.prototype={toString:function(){var t=""},__class__:et};var st=function(t){this.m=t};st.__name__=!0,st.prototype={toString:function(){return""},__class__:st};var it=function(){this.s_mpn=new Et,this.s_m=100,this.s_du=20,this.s_nr=1400};it.__name__=!0,it.prototype={goto_m_from_w:function(t){this.clear_w(),this.goto_m_from_session(t)},goto_m_from_ws:function(t){this.clear_ws(),this.goto_m_from_session(t)},goto_rec_from_w:function(){this.clear_w(),this.goto_rec()},goto_rec_from_ws:function(){this.clear_ws(),this.goto_rec()},goto_m_from_wp:function(t){this.clear_wp(),this.goto_m_from_session(t)},goto_rec_from_wp:function(){this.clear_wp(),this.goto_rec()},goto_m_from_hs:function(t){this.clear_hs(),this.s_ctrl=null,this.s_h=null,this.goto_m_from_session(t)},goto_m_from_rec:function(t){this.s_tr=null,this.goto_m_from_session(t)},goto_rec_from_hs:function(){this.clear_hs(),this.s_ctrl=null,this.s_h=null,this.goto_rec()},goto_m_from_hp:function(t){this.clear_hp(),this.s_ctrl=null,this.s_h=null,this.goto_m_from_session(t)},goto_rec_from_hp:function(){this.clear_hp(),this.s_ctrl=null,this.s_h=null,this.goto_rec()},goto_rec:function(){this.s_tr=260,this.s_rec=1e3,this.traceState()},goto_m_from_session:function(t){this.s_tr=null,this.s_swt=null,this.s_bw=null,this.s_m=t,this.traceState()},goto_m_from_ctrl:function(t){this.clear_hs(),this.clear_hp(),this.s_ctrl=null,this.s_h=null,this.goto_m_from_session(t)},goto_200_from_rec:function(){this.s_rec=null,this.s_tr=200,this.traceState()},clear_w:function(){this.s_w=null,this.s_rhb=null,this.s_slw=null},clear_ws:function(){this.s_ws=null,this.s_rhb=null,this.s_slw=null},clear_wp:function(){this.s_wp=null},clear_hs:function(){this.s_hs=null,this.s_rhb=null,this.s_slw=null},clear_hp:function(){this.s_hp=null,this.s_rhb=null},isSwitching:function(){return 150==this.s_m&&(1302==this.s_swt||1303==this.s_swt)},inPushing:function(){return!!this.inStreaming()||this.inPolling()},inStreaming:function(){var t,e;return!!(e=300==(null!=(t=this.s_w)?t.p:null)||510==(null!=(t=this.s_ws)?t.p:null))||810==(null!=(e=this.s_hs)?e.p:null)},inPolling:function(){var t;if(220!=this.s_tr&&230!=this.s_tr){var e=this.s_wp;t=611==(null!=e?e.p:null)}else t=!0;return!!(!!t||901==(null!=(t=this.s_hp)?t.m:null))||1001==this.s_rec},inRetryUnit:function(){switch(this.s_m){case 110:case 111:case 112:case 113:case 114:case 115:case 116:return!0;default:return!1}},inDisconnected:function(){return 100==this.s_m},toString:function(){var t="=0&&i.LS_max_wait(this.maxWait)):!e&&s?i.LS_msg_prog(this.prog):e&&!s?(i.LS_outcome(!1),i.LS_sequence(this.sequence),i.LS_msg_prog(this.prog),this.maxWait>=0&&i.LS_max_wait(this.maxWait)):e||s||(i.LS_outcome(!1),t&&i.LS_ack(!1)),ri.isInfoEnabled()&&ri.info("Sending message: "+l.string(i)),i.getEncodedString()},fireOnProcessed:function(t){ci.isInfoEnabled()&&ci.info("Message "+this.sequence+":"+this.prog+" processed"),this.eventDispatcher.onProcessed(this.txt,t)},fireOnDiscarded:function(){ci.isWarnEnabled()&&ci.warn("Message "+this.sequence+":"+this.prog+" discarded"),this.eventDispatcher.onDiscarded(this.txt)},fireOnDeny:function(t,e){ci.isWarnEnabled()&&ci.warn("Message "+this.sequence+":"+this.prog+" denied: "+t+" - "+e),this.eventDispatcher.onDeny(this.txt,t,e)},fireOnError:function(){ci.isWarnEnabled()&&ci.warn("Message "+this.sequence+":"+this.prog+" failed"),this.eventDispatcher.onError(this.txt)},fireOnAbort:function(){ci.isWarnEnabled()&&ci.warn("Message "+this.sequence+":"+this.prog+" aborted"),this.eventDispatcher.onAbort(this.txt,!1)},traceEvent:function(t){ai.isTraceEnabled()&&ai.trace("msg#"+t+"("+this.sequence+":"+this.prog+") in "+this.s_m)},goto:function(t){this.s_m=t,ai.isTraceEnabled()&&ai.trace("msg#goto("+this.sequence+":"+this.prog+") "+this.s_m)},toString:function(){var t=Ce._new();return Ce.set(t,"text",this.txt),Ce.set(t,"sequence",this.sequence),Ce.set(t,"prog",this.prog),Ce.set(t,"timeout",this.maxWait),Ce.set(t,"enqueueWhileDisconnected",this.enqueueWhileDisconnected),ks.stringify(t.h)},__class__:rt};var at=function(t,e,s){this.items=new Ps,this.s_m=1,this.lock=e.lock,this.client=e,this.subscription=t,this.m_subId=s};at.__name__=!0,at.prototype={finalize:function(){},evtAbort:function(){this.traceEvent("abort"),1==this.s_m?(this.doAbort(),this.goto(1)):2==this.s_m&&(this.doAbort(),this.goto(1),this.genDisposeItems())},evtOnSUB:function(t,e,s,i,n){this.traceEvent("onSUB"),1==this.s_m&&(this.doSUB(t,e),this.goto(2))},evtOnCONF:function(t){this.traceEvent("onCONF"),2==this.s_m&&(this.doCONF(t),this.goto(2))},evtOnCS:function(t){this.traceEvent("onCS"),2==this.s_m&&(this.doCS(t),this.goto(2))},evtOnEOS:function(t){this.traceEvent("onEOS"),2==this.s_m&&(this.doEOS(t),this.goto(2))},evtUpdate:function(t,e){this.traceEvent("update"),2==this.s_m&&(this.doUpdate(t,e),this.goto(2))},evtUnsubscribe:function(){this.traceEvent("unsubscribe"),1==this.s_m?(this.finalize(),this.goto(3)):2==this.s_m&&(this.finalize(),this.goto(3),this.genDisposeItems())},evtOnUNSUB:function(){this.traceEvent("onUNSUB"),2==this.s_m&&(this.finalize(),this.goto(3),this.genDisposeItems())},evtDispose:function(){this.traceEvent("dispose"),1!=this.s_m&&2!=this.s_m||(this.finalize(),this.goto(3),this.genDisposeItems())},evtSetRequestedMaxFrequency:function(t){},getValue:function(t,e){var s=this.items.h[t];return null!=s?s.getValue(e):null},getCommandValue:function(t,e,s){throw new Me("Unsupported operation")},createItem:function(t){throw new Me("Abstract method")},doSUB:function(t,e){var s=this.subscription.fetchItems(),i=this.subscription.fetchFields();if(null!=s&&t!=s.length)throw new Me("Assertion failure: items != null ? nItems == items.length : true");if(null!=i&&e!=i.length)throw new Me("Assertion failure: fields != null ? nFields == fields.length : true")},doUpdate:function(t,e){this.selectItem(t).evtUpdate(e)},doEOS:function(t){this.selectItem(t).evtOnEOS()},doCS:function(t){this.selectItem(t).evtOnCS()},doCONF:function(t){this.realMaxFrequency=t,this.subscription.fireOnRealMaxFrequency(t,this.m_subId)},doAbort:function(){this.realMaxFrequency=null},genDisposeItems:function(){for(var t=this.items.copy(),e=t.keys();e.hasNext();)t.get(e.next()).evtDispose(this)},selectItem:function(t){var e=this.items.h[t];return null==e&&(e=this.createItem(t),this.items.h[t]=e),e},unrelate:function(t){this.items.remove(t)},traceEvent:function(t){ai.isTraceEnabled()&&ai.trace("sub#mod#"+t+"("+this.m_subId+") in "+this.s_m)},goto:function(t){this.s_m=t,ai.isTraceEnabled()&&ai.trace("sub#mod#goto("+this.m_subId+") "+this.s_m)},__class__:at};var ot=function(t,e,s){at.call(this,t,e,s)};ot.__name__=!0,ot.__super__=at,ot.prototype=n(at.prototype,{evtOnSUB:function(t,e,s,i,n){this.traceEvent("onSUB"),1==this.s_m&&(this.doSUBCMD(t,e,s,i),this.goto(2))},getCommandValue:function(t,e,s){var i=this.items.h[t];return null!=i?i.getCommandValue(e,s):null},doSUBCMD:function(t,e,s,i){var n=this.subscription.fetchItems(),r=this.subscription.fetchFields();if(null!=n&&t!=n.length)throw new Me("Assertion failure: items != null ? nItems == items.length : true");if(null!=r&&e!=r.length)throw new Me("Assertion failure: fields != null ? nFields == fields.length : true");if(null!=r&&s-1!=r.indexOf("command"))throw new Me('Assertion failure: fields != null ? cmdIdx - 1 == fields.indexOf("command") : true');if(null!=r&&i-1!=r.indexOf("key"))throw new Me('Assertion failure: fields != null ? keyIdx - 1 == fields.indexOf("key") : true')},__class__:ot});var ht=function(t,e,s){ot.call(this,t,e,s)};ht.__name__=!0,ht.__super__=ot,ht.prototype=n(ot.prototype,{createItem:function(t){return new Yt(t,this.subscription,this.client,this.m_subId)},__class__:ht});var ut=function(t,e,s){ot.call(this,t,e,s)};ut.__name__=!0,ut.__super__=ot,ut.prototype=n(ot.prototype,{evtOnSUB:function(t,e,s,i,n){this.traceEvent("onSUB"),1==this.s_m&&(this.doSUBCMD2Level(t,e,s,i,n),this.goto(2))},evtSetRequestedMaxFrequency:function(t){switch(this.traceEvent("setRequestedMaxFrequency"),this.s_m){case 1:case 2:this.doSetRequestedMaxFrequency(t),this.goto(this.s_m),this.genSetRequestedMaxFrequency()}},evtOnRealMaxFrequency2LevelAdded:function(t){this.traceEvent("onRealMaxFrequency2LevelAdded"),2==this.s_m&&(this.doAggregateFrequenciesWhenFreqIsAdded(t),this.goto(2))},evtOnRealMaxFrequency2LevelRemoved:function(){this.traceEvent("onRealMaxFrequency2LevelRemoved"),2==this.s_m&&(this.doAggregateFrequenciesWhenFreqIsRemoved(),this.goto(2))},evtOnCONF:function(t){this.traceEvent("onCONF"),2==this.s_m&&(this.doCONF2Level(t),this.doAggregateFrequenciesWhenFreqIsAdded(t),this.goto(2))},createItem:function(t){return new Gt(t,this.subscription,this,this.client,this.m_subId)},doSUBCMD2Level:function(t,e,s,i,n){var r=this.subscription.fetchItems(),a=this.subscription.fetchFields();if(null!=r&&t!=r.length)throw new Me("Assertion failure: items != null ? nItems == items.length : true");if(null!=a&&e!=a.length)throw new Me("Assertion failure: fields != null ? nFields == fields.length : true");if(null!=a&&s-1!=a.indexOf("command"))throw new Me('Assertion failure: fields != null ? cmdIdx - 1 == fields.indexOf("command") : true');if(null!=a&&i-1!=a.indexOf("key"))throw new Me('Assertion failure: fields != null ? keyIdx - 1 == fields.indexOf("key") : true');this.requestedMaxFrequency=n},doSetRequestedMaxFrequency:function(t){this.requestedMaxFrequency=t},genSetRequestedMaxFrequency:function(){for(var t=this.items,e=t.keys();e.hasNext();)U.__cast(t.get(e.next()),Gt).evtSetRequestedMaxFrequency()},doCONF2Level:function(t){this.realMaxFrequency=t},maxFreq:function(t,e){var s;if(null==t)s=e;else switch(t._hx_index){case 0:var i=t.freq;if(null==e)s=t;else switch(e._hx_index){case 0:s=_s.RFreqLimited(Math.max(i,e.freq));break;case 1:s=e}break;case 1:s=t}return s},doAggregateFrequenciesWhenFreqIsAdded:function(t){var e=this.maxFreq(this.aggregateRealMaxFrequency,t),s=this.aggregateRealMaxFrequency;this.aggregateRealMaxFrequency=e,bs(s,e)||this.subscription.fireOnRealMaxFrequency(e,this.m_subId)},doAggregateFrequenciesWhenFreqIsRemoved:function(){for(var t=this.realMaxFrequency,e=!1,s=this.items,i=s.keys();i.hasNext();){for(var n=U.__cast(s.get(i.next()),Gt).keys.h,r=Object.keys(n),a=r.length,o=0;o0?(this.state.s_mpn.sbs=424,this.state.traceState(),this.genSUBS_EOS()):(this.state.s_mpn.sbs=424,this.state.traceState(),this.genSUBS_EOS(),this.notifyOnSubscriptionsUpdated()))},evtExtMpnUnsubscribeFilter:function(){this.traceEvent("mpn.unsubscribe.filter"),431==this.state.s_mpn.ft&&(this.state.s_mpn.ft=430,this.state.traceState(),this.evtMpnCheckFilter())},evtMpnCheckFilter:function(){this.traceEvent("mpn.check.filter"),430==this.state.s_mpn.ft&&(h.empty(this.mpn_filter_pendings)?(this.state.s_mpn.ft=431,this.state.traceState()):(this.state.s_mpn.ft=432,this.state.traceState(),this.genSendMpnUnsubscribeFilter()))},evtExtMpnResetBadge:function(){this.traceEvent("mpn.reset.badge"),441==this.state.s_mpn.bg&&(this.state.s_mpn.bg=440,this.state.traceState(),this.evtMpnCheckReset())},evtMpnCheckReset:function(){this.traceEvent("mpn.check.reset"),440==this.state.s_mpn.bg&&(this.mpn_badge_reset_requested?(this.state.s_mpn.bg=442,this.state.traceState(),this.genSendMpnResetBadge()):(this.state.s_mpn.bg=441,this.state.traceState()))},doREQOK:function(t){W.prototype.doREQOK.call(this,t);for(var e=new Ne(this.mpnSubscriptionManagers);e.hasNext();)e.next().evtREQOK(t);this.mpnSubscriptionManagers.compact()},doREQERR:function(t,e,s){W.prototype.doREQERR.call(this,t,e,s);for(var i=new Ne(this.mpnSubscriptionManagers);i.hasNext();)i.next().evtREQERR(t,e,s);this.mpnSubscriptionManagers.compact()},genAbortSubscriptions:function(){W.prototype.genAbortSubscriptions.call(this);for(var t=new Ne(this.mpnSubscriptionManagers);t.hasNext();)t.next().evtAbort();this.mpnSubscriptionManagers.compact()},getPendingControls:function(){var t=W.prototype.getPendingControls.call(this);this.mpnRegisterRequest.isPending()&&t.push(this.mpnRegisterRequest);for(var e=new Ne(this.mpnSubscriptionManagers.filter((function(t){return t.isPending()})));e.hasNext();)t.push(e.next());return this.mpnFilterUnsubscriptionRequest.isPending()&&t.push(this.mpnFilterUnsubscriptionRequest),this.mpnBadgeResetRequest.isPending()&&t.push(this.mpnBadgeResetRequest),t},doRegisterMpnDevice:function(){if(h.empty(this.mpn_candidate_devices))throw new Me("Assertion failure: !mpn_candidate_devices.empty()");this.mpn_device=this.mpn_candidate_devices.shift()},doRemoveMpnSpecialListeners:function(){this.mpn_deviceSubscription.removeListener(this.mpn_deviceListener),this.mpn_deviceListener.disable(),this.mpn_deviceListener=null,this.mpn_itemSubscription.removeListener(this.mpn_itemListener),this.mpn_itemListener.disable(),this.mpn_itemListener=null},genSendMpnRegister:function(){this.evtSendControl(this.mpnRegisterRequest)},genUnsubscribeMpnSpecialItems:function(){this.client.unsubscribe(Pe.sure(this.mpn_deviceSubscription)),this.client.unsubscribe(Pe.sure(this.mpn_itemSubscription))},doResetMpnDevice:function(){this.mpn_deviceId=null,this.mpn_deviceToken=null,this.mpn_adapterName=null,this.mpn_lastRegisterReqId=null,this.mpn_deviceSubscription=null,this.mpn_itemSubscription=null,this.mpn_deviceListener=null,this.mpn_itemListener=null,this.mpn_snapshotSet.removeAll(),be(this.mpn_filter_pendings),this.mpn_filter_lastDeactivateReqId=null,this.mpn_badge_reset_requested=!1,this.mpn_badge_lastResetReqId=null},notifyDeviceReset:function(){Pe.sure(this.mpn_device).onReset()},notifyDeviceError:function(t,e){Pe.sure(this.mpn_device).onError(t,e)},doMPNREG:function(){this.onFreshData()},doMPNREG_Register:function(t,e){if(null==this.mpn_device)throw new Me("Assertion failure: mpn_device != null");this.mpn_deviceId=t,this.mpn_deviceToken=this.mpn_device.getDeviceToken(),this.mpn_adapterName=e,this.mpn_device.setDeviceId(t,e),this.createSpecialItems(t,e)},doMPNZERO:function(t){this.onFreshData(),null!=this.mpn_deviceId&&t==this.mpn_deviceId&&Pe.sure(this.mpn_device).fireOnBadgeReset()},createSpecialItems:function(t,e){this.mpn_deviceListener=new mt(this);var s=new D("MERGE",["DEV-"+t].slice(),["status","status_timestamp"].slice());s.setInternal(),s.setDataAdapter(e),s.setRequestedMaxFrequency("unfiltered"),s.addListener(this.mpn_deviceListener),this.mpn_deviceSubscription=s,this.mpn_itemListener=new gt(this);var i=new D("COMMAND",["SUBS-"+t].slice(),["key","command"].slice());i.setInternal(),i.setDataAdapter(e),i.setRequestedMaxFrequency("unfiltered"),i.setCommandSecondLevelFields(["status","status_timestamp","notification_format","trigger","group","schema","adapter","mode","requested_buffer_size","requested_max_frequency"].slice()),i.setCommandSecondLevelDataAdapter(e),i.addListener(this.mpn_itemListener),this.mpn_itemSubscription=i},genDeviceActive:function(){for(var t=new Ne(this.mpnSubscriptionManagers);t.hasNext();)t.next().evtDeviceActive();this.mpnSubscriptionManagers.compact()},genSubscribeSpecialItems:function(){if(null==this.mpn_deviceSubscription)throw new Me("Assertion failure: mpn_deviceSubscription != null");if(null==this.mpn_itemSubscription)throw new Me("Assertion failure: mpn_itemSubscription != null");this.subscribeExt(this.mpn_deviceSubscription,!0),this.subscribeExt(this.mpn_itemSubscription,!0)},doMPNREG_Error:function(){},notifyDeviceError_DifferentDevice:function(){Pe.sure(this.mpn_device).onError(62,"DeviceId or Adapter Name has unexpectedly been changed")},doMPNREG_RefreshToken:function(t,e){if(null==this.mpn_device)throw new Me("Assertion failure: mpn_device != null");this.mpn_deviceToken=this.mpn_device.getDeviceToken(),this.mpn_device.setDeviceId(t,e)},notifyDeviceRegistered:function(t){Pe.sure(this.mpn_device).onRegistered(t)},notifyDeviceSuspended:function(t){Pe.sure(this.mpn_device).onSuspend(t)},notifyDeviceResume:function(t){Pe.sure(this.mpn_device).onResume(t)},doClearMpnSnapshot:function(){this.mpn_snapshotSet.removeAll()},exists:function(t){return h.exists(this.mpnSubscriptionManagers,(function(e){return e.fetch_mpnSubId()==t}))},genSUBS_update:function(t,e){for(var s=new Ne(this.mpnSubscriptionManagers);s.hasNext();){var i=s.next();t==i.fetch_mpnSubId()&&i.evtMpnUpdate(e)}this.mpnSubscriptionManagers.compact()},doAddToMpnSnapshot:function(t){this.mpn_snapshotSet.insert(t)},doRemoveFromMpnSnapshot:function(t){this.mpn_snapshotSet.remove(t)},doAddMpnSubscription:function(t){new Rt(Tt.Ctor2(t,this)).start()},notifyOnSubscriptionsUpdated:function(){Pe.sure(this.mpn_device).fireOnSubscriptionsUpdated()},genSUBS_EOS:function(){for(var t=new Ne(this.mpnSubscriptionManagers);t.hasNext();)t.next().evtMpnEOS();this.mpnSubscriptionManagers.compact()},genSendMpnUnsubscribeFilter:function(){this.evtSendControl(this.mpnFilterUnsubscriptionRequest)},genSendMpnResetBadge:function(){this.evtSendControl(this.mpnBadgeResetRequest)},doREQMpnUnsubscribeFilter:function(){this.mpn_filter_pendings.shift()},doREQOKMpnResetBadge:function(){this.mpn_badge_reset_requested=!1},doREQERRMpnResetBadge:function(){this.mpn_badge_reset_requested=!1},notifyOnBadgeResetFailed:function(t,e){Pe.sure(this.mpn_device).fireOnBadgeResetFailed(t,e)},doMPNOK:function(t,e){this.onFreshData();for(var s=new Ne(this.mpnSubscriptionManagers);s.hasNext();){var i=s.next();i.m_subId==t&&i.evtMPNOK(e)}this.mpnSubscriptionManagers.compact()},doMPNDEL:function(t){this.onFreshData();for(var e=new Ne(this.mpnSubscriptionManagers);e.hasNext();){var s=e.next();s.fetch_mpnSubId()==t&&s.evtMPNDEL()}this.mpnSubscriptionManagers.compact()},doMPNCONF:function(t){this.onFreshData()},encodeMpnRegister:function(){if(null==this.mpn_device)throw new Me("Assertion failure: mpn_device != null");var t=new Ke,e=this.mpn_device.getDeviceToken(),s=this.mpn_device.getPreviousDeviceToken();return this.mpn_lastRegisterReqId=this.generateFreshReqId(),t.LS_reqId(this.mpn_lastRegisterReqId),t.LS_op("register"),t.PN_type(this.mpn_device.getPlatform()),t.PN_appId(this.mpn_device.getApplicationId()),null==s||s==e?t.PN_deviceToken(e):(t.PN_deviceToken(s),t.PN_newDeviceToken(e)),ri.isInfoEnabled()&&ri.info("Sending MPNDevice register: "+l.string(t)),t.getEncodedString()},encodeMpnRefreshToken:function(){if(null==this.mpn_device)throw new Me("Assertion failure: mpn_device != null");var t=new Ke;return this.mpn_lastRegisterReqId=this.generateFreshReqId(),t.LS_reqId(this.mpn_lastRegisterReqId),t.LS_op("register"),t.PN_type(this.mpn_device.getPlatform()),t.PN_appId(this.mpn_device.getApplicationId()),t.PN_deviceToken(Pe.sure(this.mpn_deviceToken)),t.PN_newDeviceToken(this.mpn_device.getDeviceToken()),t.LS_cause("refresh.token"),ri.isInfoEnabled()&&ri.info("Sending MPNDevice refresh: "+l.string(t)),t.getEncodedString()},encodeMpnRestore:function(){if(null==this.mpn_device)throw new Me("Assertion failure: mpn_device != null");var t=new Ke;return this.mpn_lastRegisterReqId=this.generateFreshReqId(),t.LS_reqId(this.mpn_lastRegisterReqId),t.LS_op("register"),t.PN_type(this.mpn_device.getPlatform()),t.PN_appId(this.mpn_device.getApplicationId()),t.PN_deviceToken(Pe.sure(this.mpn_deviceToken)),t.PN_newDeviceToken(this.mpn_device.getDeviceToken()),t.LS_cause("restore.token"),ri.isInfoEnabled()&&ri.info("Sending MPNDevice restore: "+l.string(t)),t.getEncodedString()},encodeDeactivateFilter:function(){var t=new Ke;switch(this.mpn_filter_lastDeactivateReqId=this.generateFreshReqId(),t.LS_reqId(this.mpn_filter_lastDeactivateReqId),t.LS_op("deactivate"),t.PN_deviceId(Pe.sure(this.mpn_deviceId)),this.mpn_filter_pendings[0]._hx_index){case 1:t.PN_subscriptionStatus("ACTIVE");break;case 2:t.PN_subscriptionStatus("TRIGGERED")}return ri.isInfoEnabled()&&ri.info("Sending multiple MPNSubscription deactivate: "+l.string(t)),t.getEncodedString()},encodeBadgeReset:function(){var t=new Ke;return this.mpn_badge_lastResetReqId=this.generateFreshReqId(),t.LS_reqId(this.mpn_badge_lastResetReqId),t.LS_op("reset_badge"),t.PN_deviceId(Pe.sure(this.mpn_deviceId)),ri.isInfoEnabled()&&ri.info("Sending MPNDevice badge reset: "+l.string(t)),t.getEncodedString()},relate:function(t){if(h.has(this.mpnSubscriptionManagers,t))throw new Me("Assertion failure: !mpnSubscriptionManagers.contains(subManager)");this.mpnSubscriptionManagers.values.push(new Le(t))},unrelate:function(t){this.mpnSubscriptionManagers.remove(t)},fetch_mpn_deviceId:function(){return this.mpn_deviceId},fetch_mpn_device:function(){return this.mpn_device},registerForMpn:function(t){if(null==t)throw new v("Device cannot be null");this.mpn_candidate_devices.push(t),hi.isInfoEnabled()&&hi.info("MPN registration requested: "+l.string(t)),this.evtExtMpnRegister()},subscribeMpn:function(t,e){if(null==this.mpn_device)throw new Me(mi);if(t.isActive())throw new v(fi);if(null==t.getNotificationFormat())throw new v(gi);if(null==t.getItems()&&null==t.getItemGroup())throw new v("Specify property 'items' or 'itemGroup'");if(null==t.getFields()&&null==t.getFieldSchema())throw new v("Specify property 'fields' or 'fieldSchema'");var s=new Rt(Tt.Ctor1(t,e,this));hi.isInfoEnabled()&&hi.info("MPN Subscription requested: subId: "+s.m_subId+" "+l.string(t)+" coalescing: "+(null==e?"null":""+e)),s.evtExtMpnSubscribe()},unsubscribeMpn:function(t){if(null==this.mpn_device)throw new Me(mi);var e=t.fetch_subManager();if(null!=e){if(!h.has(this.mpnSubscriptionManagers,e))throw new Me("The MPNSubscription is not subscribed to this Client");hi.isInfoEnabled()&&hi.info("MPN Unsubscription requested: pnSubId: "+t.getSubscriptionId()+" "+l.string(t)),e.evtExtMpnUnsubscribe()}},unsubscribeMpnSubscriptions:function(t){if(null==this.mpn_device)throw new Me(mi);var e=vt(t);this.mpn_filter_pendings.push(e),hi.isInfoEnabled()&&hi.info("Multiple MPN Unsubscriptions requested: "+l.string(e)),this.evtExtMpnUnsubscribeFilter()},getMpnSubscriptions:function(t){if(null==this.mpn_device)throw new Me(mi);var e;switch(vt(t)._hx_index){case 0:e=this.mpnSubscriptionManagers.map((function(t){return t.m_subscription})).filter((function(t){return t.fetch_status()==pe.Subscribed||t.fetch_status()==pe.Triggered}));break;case 1:e=this.mpnSubscriptionManagers.map((function(t){return t.m_subscription})).filter((function(t){return t.fetch_status()==pe.Subscribed}));break;case 2:e=this.mpnSubscriptionManagers.map((function(t){return t.m_subscription})).filter((function(t){return t.fetch_status()==pe.Triggered}))}for(var s=Object.create(null),i=new Ne(e);i.hasNext();){var n=i.next(),r=n.getSubscriptionId();if(null!=r){var a=s[r];null==a?s[r]=[n]:a.push(n)}}for(var o=[],h=Object.keys(s),u=h.length,l=0;l"},__class__:Et};var wt=function(t,e){this.s_tu=30,this.s_fu=20,this.s_uu=10,this.s_m=t,this.manager=e};wt.__name__=!0,wt.prototype={toString:function(){var t=""},traceState:function(){ai.isTraceEnabled()&&ai.trace("mpn#sub#goto("+this.manager.m_subId+":"+this.manager.fetch_mpnSubId()+") "+this.toString())},__class__:wt};var Tt=i["com.lightstreamer.client.internal._MpnSubscriptionManager.CtorArgs"]={__ename__:!0,__constructs__:null,Ctor1:(e=function(t,e,i){return{_hx_index:0,sub:t,coalescing:e,client:i,__enum__:"com.lightstreamer.client.internal._MpnSubscriptionManager.CtorArgs",toString:s}},e._hx_name="Ctor1",e.__params__=["sub","coalescing","client"],e),Ctor2:(e=function(t,e){return{_hx_index:1,mpnSubId:t,client:e,__enum__:"com.lightstreamer.client.internal._MpnSubscriptionManager.CtorArgs",toString:s}},e._hx_name="Ctor2",e.__params__=["mpnSubId","client"],e)};Tt.__constructs__=[Tt.Ctor1,Tt.Ctor2];var Rt=function(t){var e=null,s=null,i=null,n=null;switch(t._hx_index){case 0:e=t.sub,s=t.coalescing,i=t.client;break;case 1:n=t.mpnSubId,i=t.client}null==n?(this.lock=i.lock,this.m_subId=i.generateFreshSubId(),this.m_coalescing=s,this.m_initFormat=e.getNotificationFormat(),this.m_initTrigger=e.getTriggerExpression(),this.m_subscription=e,this.m_client=i,this.state=new wt(40,this),this.m_subscription.relate(this),this.m_client.relate(this)):(this.lock=i.lock,this.m_subId=null,this.m_coalescing=!1,this.m_initFormat=null,this.m_initTrigger=null,this.m_subscription=new me("MERGE",null,null),this.m_subscription.reInit(n),this.m_client=i,this.state=new wt(45,this),this.m_subscription.relate(this),this.m_client.relate(this))};Rt.__name__=!0,Rt.__interfaces__=[Q],Rt.prototype={finalize:function(){this.m_subscription.reset(),this.m_client.unrelate(this),this.m_subscription.unrelate(this)},fetch_mpnSubId:function(){return this.m_subscription.fetch_mpnSubId()},start:function(){},evtExtMpnUnsubscribe:function(){this.traceEvent("unsubscribe");var t=!0;41==this.state.s_m?(this.notifyStatus(pe.Unknown),this.notifyOnSubscriptionDiscarded(),this.finalize(),this.state.s_m=50,this.state.traceState(),t=this.evtExtMpnUnsubscribe_UnsubRegion()):71==this.state.s_ct&&(this.state.s_ct=70,this.state.traceState(),t=this.evtExtMpnUnsubscribe_UnsubRegion(),this.evtCheck()),t&&this.evtExtMpnUnsubscribe_UnsubRegion()},evtExtMpnUnsubscribe_UnsubRegion:function(){return this.traceEvent("unsubscribe"),(10==this.state.s_uu||12==this.state.s_uu)&&(this.state.s_uu=11,this.state.traceState()),!1},evtAbort:function(){this.traceEvent("abort"),41==this.state.s_m?(this.notifyStatus(pe.Unknown),this.notifyOnSubscriptionDiscarded(),this.finalize(),this.state.s_m=50,this.state.traceState()):42==this.state.s_m||43==this.state.s_m?(this.notifyStatus(pe.Unknown),this.notifyOnSubscriptionAbort(),this.finalize(),this.state.s_m=50,this.state.traceState()):44==this.state.s_m&&(this.state.s_m=44,this.state.traceState(),this.evtAbort_AbortRegion())},evtAbort_AbortRegion:function(){this.traceEvent("abort");var t=!0;80==this.state.s_ab&&(this.state.s_ab=81,this.state.traceState(),t=this.evtAbort_ControlRegion()),t&&this.evtAbort_ControlRegion()},evtAbort_ControlRegion:function(){return this.traceEvent("abort"),70!=this.state.s_ct&&71!=this.state.s_ct&&72!=this.state.s_ct&&73!=this.state.s_ct&&74!=this.state.s_ct||(this.state.s_ct=76,this.state.traceState(),this.evtAbortFormat(),this.evtAbortTrigger(),this.evtAbortUnsubscribe()),!1},evtRestoreSession:function(){this.traceEvent("restore.session"),76==this.state.s_ct&&(this.state.s_ct=70,this.state.traceState(),this.evtCheck())},evtREQOK:function(t){this.traceEvent("REQOK");var e=!0;22==this.state.s_fu&&t==this.m_lastConfigureReqId?(this.state.s_fu=20,this.state.traceState(),e=this.evtREQOK_TriggerRegion(t)):23==this.state.s_fu&&t==this.m_lastConfigureReqId&&(this.state.s_fu=21,this.state.traceState(),e=this.evtREQOK_TriggerRegion(t)),e&&this.evtREQOK_TriggerRegion(t)},evtREQOK_TriggerRegion:function(t){this.traceEvent("REQOK");var e=!0;return 32==this.state.s_tu&&t==this.m_lastConfigureReqId?(this.state.s_tu=30,this.state.traceState(),e=this.evtREQOK_MainRegion(t)):33==this.state.s_tu&&t==this.m_lastConfigureReqId&&(this.state.s_tu=31,this.state.traceState(),e=this.evtREQOK_MainRegion(t)),e&&this.evtREQOK_MainRegion(t),!1},evtREQOK_MainRegion:function(t){return this.traceEvent("REQOK"),42==this.state.s_m&&t==this.m_lastActivateReqId?(this.state.s_m=43,this.state.traceState()):44==this.state.s_m&&(this.state.s_m=44,this.state.traceState(),this.evtREQOK_ControlRegion(t)),!1},evtREQOK_ControlRegion:function(t){this.traceEvent("REQOK"),72==this.state.s_ct&&t==this.m_lastDeactivateReqId?(this.notifyStatus(pe.Unknown),this.notifyOnUnsubscription(),this.notifyOnSubscriptionsUpdated(),this.finalize(),this.state.s_m=52,this.state.s_st=null,this.state.s_ct=null,this.state.s_ab=null,this.state.traceState()):73!=this.state.s_ct&&74!=this.state.s_ct||t!=this.m_lastConfigureReqId||(this.state.s_ct=70,this.state.traceState(),this.evtCheck())},evtREQERR:function(t,e,s){this.traceEvent("REQERR");var i=!0;11==this.state.s_uu&&t==this.m_lastDeactivateReqId&&(this.notifyOnUnsubscriptionError(e,s),this.state.s_uu=12,this.state.traceState(),i=this.evtREQERR_FormatRegion(t,e,s)),i&&this.evtREQERR_FormatRegion(t,e,s)},evtREQERR_FormatRegion:function(t,e,s){this.traceEvent("REQERR");var i=!0;return 22==this.state.s_fu&&t==this.m_lastConfigureReqId?(this.notifyOnModificationError_Format(e,s),this.state.s_fu=20,this.state.traceState(),i=this.evtREQERR_TriggerRegion(t,e,s)):23==this.state.s_fu&&t==this.m_lastConfigureReqId&&(this.state.s_fu=21,this.state.traceState(),i=this.evtREQERR_TriggerRegion(t,e,s)),i&&this.evtREQERR_TriggerRegion(t,e,s),!1},evtREQERR_TriggerRegion:function(t,e,s){this.traceEvent("REQERR");var i=!0;return 32==this.state.s_tu&&t==this.m_lastConfigureReqId?(this.notifyOnModificationError_Trigger(e,s),this.state.s_tu=30,this.state.traceState(),i=this.evtREQERR_MainRegion(t,e,s)):33==this.state.s_tu&&t==this.m_lastConfigureReqId&&(this.state.s_tu=31,this.state.traceState(),i=this.evtREQERR_MainRegion(t,e,s)),i&&this.evtREQERR_MainRegion(t,e,s),!1},evtREQERR_MainRegion:function(t,e,s){return this.traceEvent("REQERR"),42==this.state.s_m&&t==this.m_lastActivateReqId?(this.notifyStatus(pe.Unknown),this.notifyOnSubscriptionError(e,s),this.finalize(),this.state.s_m=50,this.state.traceState()):44==this.state.s_m&&(this.state.s_m=44,this.state.traceState(),this.evtREQERR_ControlRegion(t,e,s)),!1},evtREQERR_ControlRegion:function(t,e,s){this.traceEvent("REQERR"),72==this.state.s_ct&&t==this.m_lastDeactivateReqId?(this.state.s_ct=70,this.state.traceState(),this.evtCheck()):73!=this.state.s_ct&&74!=this.state.s_ct||t!=this.m_lastConfigureReqId||(this.state.s_ct=70,this.state.traceState(),this.evtCheck())},evtAbortUnsubscribe:function(){this.traceEvent("abort.unsubscribe"),11==this.state.s_uu&&(this.notifyOnUnsubscriptionAbort(),this.state.s_uu=12,this.state.traceState())},evtExtMpnSetFormat:function(){this.traceEvent("setFormat");var t=!0;20==this.state.s_fu?(this.state.s_fu=21,this.state.traceState(),t=this.evtExtMpnSetFormat_ControlRegion()):22==this.state.s_fu&&(this.state.s_fu=23,this.state.traceState(),t=this.evtExtMpnSetFormat_ControlRegion()),t&&this.evtExtMpnSetFormat_ControlRegion()},evtExtMpnSetFormat_ControlRegion:function(){return this.traceEvent("setFormat"),71==this.state.s_ct&&(this.state.s_ct=70,this.state.traceState(),this.evtCheck()),!1},evtExtMpnSetTrigger:function(){this.traceEvent("setTrigger");var t=!0;30==this.state.s_tu?(this.state.s_tu=31,this.state.traceState(),t=this.evtExtMpnSetTrigger_ControlRegion()):32==this.state.s_tu&&(this.state.s_tu=33,this.state.traceState(),t=this.evtExtMpnSetTrigger_ControlRegion()),t&&this.evtExtMpnSetTrigger_ControlRegion()},evtExtMpnSetTrigger_ControlRegion:function(){return this.traceEvent("setTrigger"),71==this.state.s_ct&&(this.state.s_ct=70,this.state.traceState(),this.evtCheck()),!1},evtChangeFormat:function(){this.traceEvent("change.format"),21==this.state.s_fu&&(this.doSetCurrentFormat(),this.state.s_fu=22,this.state.traceState())},evtChangeTrigger:function(){this.traceEvent("change.trigger"),31==this.state.s_tu&&(this.doSetCurrentTrigger(),this.state.s_tu=32,this.state.traceState())},evtAbortFormat:function(){switch(this.traceEvent("abort.format"),this.state.s_fu){case 21:case 22:case 23:this.notifyOnModificationAbort_Format(),this.state.s_fu=20,this.state.traceState()}},evtAbortTrigger:function(){switch(this.traceEvent("abort.trigger"),this.state.s_tu){case 31:case 32:case 33:this.notifyOnModificationAbort_Trigger(),this.state.s_tu=30,this.state.traceState()}},evtCheck:function(){this.traceEvent("check"),70==this.state.s_ct&&(11==this.state.s_uu?(this.state.s_ct=72,this.state.traceState(),this.genSendUnsubscribe()):21==this.state.s_fu?(this.state.s_ct=74,this.state.traceState(),this.evtChangeFormat(),this.genSendConfigure()):31==this.state.s_tu?(this.state.s_ct=73,this.state.traceState(),this.evtChangeTrigger(),this.genSendConfigure()):(this.state.s_ct=71,this.state.traceState()))},evtExtMpnSubscribe:function(){this.traceEvent("subscribe"),40==this.state.s_m&&(405==this.m_client.state.s_mpn.m?(this.notifyStatus(pe.Active),this.state.s_m=42,this.state.traceState(),this.genSendSubscribe()):(this.notifyStatus(pe.Active),this.state.s_m=41,this.state.traceState()))},evtDeviceActive:function(){this.traceEvent("device.active"),41==this.state.s_m&&(this.state.s_m=42,this.state.traceState(),this.genSendSubscribe())},evtMPNOK:function(t){this.traceEvent("MPNOK"),(42==this.state.s_m||43==this.state.s_m)&&(this.doMPNOK(t),this.notifyStatus(pe.Subscribed),this.notifyOnSubscription(),this.notifyOnSubscriptionsUpdated(),this.state.s_m=44,this.state.s_st=60,this.state.s_ct=70,this.state.s_ab=80,this.state.traceState(),this.evtCheck())},evtMPNDEL:function(){this.traceEvent("MPNDEL"),72==this.state.s_ct&&(this.notifyStatus(pe.Unknown),this.notifyOnUnsubscription(),this.notifyOnSubscriptionsUpdated(),this.finalize(),this.state.s_m=52,this.state.s_st=null,this.state.s_ct=null,this.state.s_ab=null,this.state.traceState())},evtMpnUpdate:function(t){this.traceEvent("update");var e=t.getValue("status_timestamp"),s=t.getValue("status");s=null!=s?s.toUpperCase():null;var i=t.getValue("command");i=null!=i?i.toUpperCase():null,44==this.state.s_m&&"DELETE"==i?(this.notifyStatus(pe.Unknown),this.notifyOnUnsubscription(),this.notifyOnSubscriptionsUpdated(),this.finalize(),this.state.s_m=52,this.state.s_st=null,this.state.s_ct=null,this.state.s_ab=null,this.state.traceState()):45==this.state.s_m?"ACTIVE"==s?(this.notifyStatus(pe.Subscribed,e),this.notifyOnSubscription(),this.notifyUpdate(t),this.state.s_m=44,this.state.s_st=60,this.state.s_ct=70,this.state.s_ab=80,this.state.traceState(),this.evtCheck()):"TRIGGERED"==s&&(this.notifyStatus(pe.Triggered,e),this.notifyOnSubscription(),this.notifyOnTriggered(),this.notifyUpdate(t),this.state.s_m=44,this.state.s_st=61,this.state.s_ct=70,this.state.s_ab=80,this.state.traceState(),this.evtCheck()):44==this.state.s_m&&(this.state.s_m=44,this.state.traceState(),this.evtMpnUpdate_AbortRegion(t))},evtMpnUpdate_AbortRegion:function(t){this.traceEvent("update");var e=!0;81==this.state.s_ab&&(this.state.s_ab=80,this.state.traceState(),e=this.evtMpnUpdate_StatusRegion(t),this.evtRestoreSession()),e&&this.evtMpnUpdate_StatusRegion(t)},evtMpnUpdate_StatusRegion:function(t){this.traceEvent("update");var e=t.getValue("status_timestamp"),s=t.getValue("status");return s=null!=s?s.toUpperCase():null,60==this.state.s_st?"ACTIVE"==s?(this.notifyUpdate(t),this.state.s_st=60,this.state.traceState()):"TRIGGERED"==s&&(this.notifyStatus(pe.Triggered,e),this.notifyOnTriggered(),this.notifyUpdate(t),this.state.s_st=61,this.state.traceState()):61==this.state.s_st&&("ACTIVE"==s?(this.notifyStatus(pe.Subscribed,e),this.notifyUpdate(t),this.state.s_st=60,this.state.traceState()):"TRIGGERED"==s&&(this.notifyUpdate(t),this.state.s_st=61,this.state.traceState())),!1},evtMpnEOS:function(){this.traceEvent("EOS"),81==this.state.s_ab&&(this.notifyStatus(pe.Unknown),this.notifyOnUnsubscription(),this.notifyOnSubscriptionsUpdated(),this.finalize(),this.state.s_m=51,this.state.s_st=null,this.state.s_ct=null,this.state.s_ab=null,this.state.traceState())},isPending:function(){return 42==this.state.s_m||72==this.state.s_ct||73==this.state.s_ct||74==this.state.s_ct},encode:function(t){if(42==this.state.s_m)return this.encodeActivate();if(72==this.state.s_ct)return this.encodeDeactivate();if(73==this.state.s_ct||74==this.state.s_ct)return this.encodeConfigure();throw new Me("Can't encode request")},encodeWS:function(){return"control\r\n"+this.encode(!0)},encodeActivate:function(){var t=new Ke;this.m_lastActivateReqId=this.m_client.generateFreshReqId(),t.LS_reqId(this.m_lastActivateReqId),t.LS_op("activate"),t.LS_subId(Pe.sure(this.m_subId)),t.LS_mode(Pe.sure(this.m_subscription.fetch_mode()));var e=this.m_subscription.getItemGroup(),s=this.m_subscription.getItems();null!=e?t.LS_group(e):null!=s&&t.LS_group(Oe.copy(s,s).join(" "));var i=this.m_subscription.getFieldSchema(),n=this.m_subscription.getFields();null!=i?t.LS_schema(i):null!=n&&t.LS_schema(Oe.copy(n,n).join(" "));var r=this.m_subscription.getDataAdapter();null!=r&&t.LS_data_adapter(r);var a=this.m_subscription.fetch_requestedMaxFrequency();if(null!=a)switch(a._hx_index){case 0:t.LS_requested_max_frequency_Float(a.max);break;case 1:t.LS_requested_max_frequency("unlimited")}var o=this.m_subscription.fetch_requestedBufferSize();if(null!=o)switch(o._hx_index){case 0:t.LS_requested_buffer_size_Int(o.size);break;case 1:t.LS_requested_buffer_size("unlimited")}t.PN_deviceId(Pe.sure(this.m_client.fetch_mpn_deviceId())),t.PN_notificationFormat(Pe.sure(this.m_initFormat));var h=this.m_initTrigger;return null!=h&&t.PN_trigger(h),this.m_coalescing&&t.PN_coalescing(!0),ri.isInfoEnabled()&&ri.info("Sending MPNSubscription activate: "+l.string(t)),t.getEncodedString()},encodeDeactivate:function(){var t=new Ke;return this.m_lastDeactivateReqId=this.m_client.generateFreshReqId(),t.LS_reqId(this.m_lastDeactivateReqId),t.LS_op("deactivate"),t.PN_deviceId(Pe.sure(this.m_client.fetch_mpn_deviceId())),t.PN_subscriptionId(Pe.sure(this.m_subscription.getSubscriptionId())),ri.isInfoEnabled()&&ri.info("Sending MPNSubscription deactivate: "+l.string(t)),t.getEncodedString()},encodeConfigure:function(){var t=new Ke;this.m_lastConfigureReqId=this.m_client.generateFreshReqId(),t.LS_reqId(this.m_lastConfigureReqId),t.LS_op("pn_reconf"),t.LS_mode(Pe.sure(this.m_subscription.fetch_mode()));var e=this.m_subscription.getItemGroup(),s=this.m_subscription.getItems();null!=e?t.LS_group(e):null!=s&&t.LS_group(Oe.copy(s,s).join(" "));var i=this.m_subscription.getFieldSchema(),n=this.m_subscription.getFields();null!=i?t.LS_schema(i):null!=n&&t.LS_schema(Oe.copy(n,n).join(" "));var r=this.m_subscription.getDataAdapter();if(null!=r&&t.LS_data_adapter(r),t.PN_deviceId(Pe.sure(this.m_client.fetch_mpn_deviceId())),t.PN_subscriptionId(Pe.sure(this.m_subscription.getSubscriptionId())),74==this.state.s_ct&&t.PN_notificationFormat(Pe.sure(this.m_currentFormat)),73==this.state.s_ct){var a=this.m_currentTrigger;t.PN_trigger(null!=a?a:"")}return ri.isInfoEnabled()&&ri.info("Sending MPNSubscription configuration: "+l.string(t)),t.getEncodedString()},genSendSubscribe:function(){this.m_client.evtSendControl(this)},genSendConfigure:function(){this.m_client.evtSendControl(this)},genSendUnsubscribe:function(){this.m_client.evtSendControl(this)},notifyStatus:function(t,e){this.m_subscription.changeStatus(t,e)},notifyOnSubscriptionError:function(t,e){this.m_subscription.fireOnSubscriptionError(t,e)},notifyOnSubscriptionAbort:function(){this.m_subscription.fireOnSubscriptionError(54,"The request was aborted because the operation could not be completed")},notifyOnSubscriptionDiscarded:function(){this.m_subscription.fireOnSubscriptionError(55,"The request was discarded because the operation could not be completed")},notifyOnUnsubscriptionError:function(t,e){this.m_subscription.fireOnUnsubscriptionError(t,e)},notifyOnUnsubscriptionAbort:function(){this.m_subscription.fireOnUnsubscriptionError(54,"The request was aborted because the operation could not be completed")},doMPNOK:function(t){this.m_subscription.setSubscriptionId(t)},notifyOnSubscription:function(){this.m_subscription.fireOnSubscription()},notifyOnUnsubscription:function(){this.m_subscription.fireOnUnsubscription()},notifyOnTriggered:function(){this.m_subscription.fireOnTriggered()},notifyOnSubscriptionsUpdated:function(){Pe.sure(this.m_client.fetch_mpn_device()).fireOnSubscriptionsUpdated()},notifyUpdate:function(t){this.m_subscription.changeStatusTs(t.getValue("status_timestamp")),this.m_subscription.changeMode(t.getValue("mode")),this.m_subscription.changeAdapter(t.getValue("adapter")),this.m_subscription.changeGroup(t.getValue("group")),this.m_subscription.changeSchema(t.getValue("schema")),this.m_subscription.changeFormat(t.getValue("notification_format")),this.m_subscription.changeTrigger(t.getValue("trigger")),this.m_subscription.changeBufferSize(t.getValue("requested_buffer_size")),this.m_subscription.changeMaxFrequency(t.getValue("requested_max_frequency"))},doSetCurrentFormat:function(){this.m_currentFormat=this.m_subscription.fetch_requestedFormat()},doSetCurrentTrigger:function(){this.m_currentTrigger=this.m_subscription.fetch_requestedTrigger()},notifyOnModificationError_Format:function(t,e){this.m_subscription.fireOnModificationError(t,e,"notification_format")},notifyOnModificationAbort_Format:function(){this.m_subscription.fireOnModificationError(54,"The request was aborted because the operation could not be completed","notification_format")},notifyOnModificationError_Trigger:function(t,e){this.m_subscription.fireOnModificationError(t,e,"trigger")},notifyOnModificationAbort_Trigger:function(){this.m_subscription.fireOnModificationError(54,"The request was aborted because the operation could not be completed","trigger")},traceEvent:function(t){ai.isTraceEnabled()&&ai.trace("mpn#sub#"+t+"("+this.m_subId+":"+this.fetch_mpnSubId()+") in "+l.string(this.state))},__class__:Rt};var It=function(t,e,s){this.subId=t,this.itemIdx=e,this.values=s};function Ct(t){return Pe.sure(l.parseInt(t))}function xt(t){return Pe.sure(parseFloat(t))}function Lt(t){return Ct(t)}function Nt(t){for(var e=Mt(t,",")+1,s=Mt(t,",",e)+1,i=Mt(t,",",s)+1,n=Ct(t.substring(e,s-1)),r=Ct(t.substring(s,i-1)),a=new Ps,o=i-1,h=1;o>8}return new Pt(s.buffer)}var o=[];for(r=0;r>6),o.push(128|63&a)):a<=65535?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a));return new Pt(new Uint8Array(o).buffer)},Pt.prototype={getString:function(t,e,s){if(t<0||e<0||t+e>this.length)throw g.thrown(qs.OutsideBounds);null==s&&(s=kt.UTF8);var i="",n=this.b,r=t,a=t+e;switch(s._hx_index){case 0:for(;r10?this._currentRetryDelay<6e4&&(2*this._currentRetryDelay<6e4?this._currentRetryDelay*=2:this._currentRetryDelay=6e4):this.attempt+=1},reset:function(t){this.attempt=1,this._currentRetryDelay=t},__class__:At};var qt=function(){};qt.__name__=!0,qt.__isInterface__=!0,qt.__interfaces__=[Q],qt.prototype={__class__:qt};var Bt=function(t){this.subId=t,this.s_m=1};Bt.__name__=!0,Bt.prototype={toString:function(){var t=""},traceState:function(){ai.isTraceEnabled()&&ai.trace("sub#goto("+this.subId+") "+this.toString())},__class__:Bt};var Ut=function(t,e){var s;switch(this.lock=e.lock,this.subId=e.generateFreshSubId(),t.fetch_mode()){case"COMMAND":s=Ut.is2LevelCommand(t)?new ut(t,e,this.subId):new ht(t,e,this.subId);break;case"DISTINCT":s=new lt(t,e,this.subId);break;case"MERGE":s=new ct(t,e,this.subId);break;case"RAW":s=new dt(t,e,this.subId)}this.m_strategy=s,this.state=new Bt(this.subId),this.m_client=e,this.m_subscription=t,this.m_client.relateSubManager(this),this.m_subscription.relate(this)};Ut.__name__=!0,Ut.__interfaces__=[qt],Ut.is2LevelCommand=function(t){return"COMMAND"==t.fetch_mode()&&(null!=t.getCommandSecondLevelFields()||null!=t.getCommandSecondLevelFieldSchema())},Ut.prototype={finalize:function(){this.m_strategy.evtDispose(),this.m_client.unrelateSubManager(this),this.m_subscription.unrelate(this)},evtExtSubscribe:function(){this.traceEvent("subscribe"),1==this.state.s_m&&(this.doSetActive(),this.doSubscribe(),this.state.s_m=2,this.state.traceState(),this.genSendControl())},evtExtUnsubscribe:function(){this.traceEvent("unsubscribe"),2==this.state.s_m?(this.doSetInactive(),this.finalize(),this.state.s_m=30,this.state.traceState()):3==this.state.s_m?(this.doUnsubscribe(),this.doSetInactive(),this.state.s_m=5,this.state.traceState(),this.genSendControl()):10==this.state.s_s&&(this.doUnsubscribe(),this.m_subscription.setInactive(),this.notifyOnUnsubscription(),this.state.s_m=5,this.state.s_s=null,this.state.s_c=null,this.state.traceState(),this.genSendControl())},evtExtAbort:function(){this.traceEvent("abort"),2==this.state.s_m?(this.state.s_m=2,this.state.traceState()):3==this.state.s_m?(this.doAbort(),this.doSetActive(),this.state.s_m=2,this.state.traceState()):10==this.state.s_s?(this.doAbort(),this.doSetActive(),this.notifyOnUnsubscription(),this.state.s_s=null,this.state.s_c=null,this.state.s_m=2,this.state.traceState()):5==this.state.s_m&&(this.finalize(),this.state.s_m=32,this.state.traceState())},evtREQERR:function(t,e,s){this.traceEvent("REQERR"),2==this.state.s_m&&t==this.m_lastAddReqId?(this.doSetInactive(),this.notifyOnSubscriptionError(e,s),this.finalize(),this.state.s_m=30,this.state.traceState()):5==this.state.s_m&&t==this.m_lastDeleteReqId?(this.finalize(),this.state.s_m=32,this.state.traceState()):22==this.state.s_c&&t==this.m_lastReconfReqId&&(ds.extEquals(this.m_reqMaxFrequency,this.m_subscription.fetch_requestedMaxFrequency())?(this.state.s_c=21,this.state.traceState()):(this.state.s_c=20,this.state.traceState(),this.evtCheckFrequency()))},evtREQOK:function(t){this.traceEvent("REQOK"),2==this.state.s_m&&t==this.m_lastAddReqId?(this.state.s_m=3,this.state.traceState()):5==this.state.s_m&&t==this.m_lastDeleteReqId?(this.finalize(),this.state.s_m=32,this.state.traceState()):22==this.state.s_c&&t==this.m_lastReconfReqId&&(this.doREQOKConfigure(),this.state.s_c=20,this.state.traceState(),this.evtCheckFrequency())},checkItems:function(t,e){return null==t||t==e},checkFields:function(t,e){return null==t||t==e},checkItemsAndFields:function(t,e,s,i){return!!this.checkItems(t,s)&&this.checkFields(e,i)},evtSUBOK:function(t,e){if(this.traceEvent("SUBOK"),2==this.state.s_m||3==this.state.s_m){var s,i=null!=(s=this.m_subscription.fetch_items())?s.length:null,n=null!=(s=this.m_subscription.fetch_fields())?s.length:null;this.checkItemsAndFields(i,n,t,e)?(this.doSUBOK(t,e),this.notifyOnSubscription(),this.state.s_m=4,this.state.s_s=10,this.state.s_c=20,this.state.traceState(),this.evtCheckFrequency()):(this.doUnsubscribe(),this.doSetInactive(),this.notifyOnSubscriptionError_CountMismatch(i,n,t,e),this.state.s_m=5,this.state.traceState(),this.genSendControl())}},evtSUBCMD:function(t,e,s,i){if(this.traceEvent("SUBCMD"),2==this.state.s_m||3==this.state.s_m){var n,r=null!=(n=this.m_subscription.fetch_items())?n.length:null,a=null!=(n=this.m_subscription.fetch_fields())?n.length:null;this.checkItemsAndFields(r,a,t,e)?(this.doSUBCMD(t,e,i,s),this.notifyOnSubscription(),this.state.s_m=4,this.state.s_s=10,this.state.s_c=20,this.state.traceState(),this.evtCheckFrequency()):(this.doUnsubscribe(),this.doSetInactive(),this.notifyOnSubscriptionError_CountMismatch(r,a,t,e),this.state.s_m=5,this.state.traceState(),this.genSendControl())}},evtUNSUB:function(){this.traceEvent("UNSUB"),10==this.state.s_s?(this.doUNSUB(),this.doSetInactive(),this.notifyOnUnsubscription(),this.finalize(),this.state.s_m=31,this.state.s_s=null,this.state.s_c=null,this.state.traceState()):5==this.state.s_m&&(this.finalize(),this.state.s_m=32,this.state.traceState())},evtU:function(t,e){this.traceEvent("U"),10==this.state.s_s&&(this.doU(t,e),this.state.s_s=10,this.state.traceState())},evtEOS:function(t){this.traceEvent("EOS"),10==this.state.s_s&&(this.doEOS(t),this.state.s_s=10,this.state.traceState())},evtCS:function(t){this.traceEvent("CS"),10==this.state.s_s&&(this.doCS(t),this.state.s_s=10,this.state.traceState())},evtOV:function(t,e){this.traceEvent("OV"),10==this.state.s_s&&(this.doOV(t,e),this.state.s_s=10,this.state.traceState())},evtCONF:function(t){this.traceEvent("CONF"),10==this.state.s_s&&(this.doCONF(t),this.state.s_s=10,this.state.traceState())},evtCheckFrequency:function(){this.traceEvent("check.frequency"),20==this.state.s_c&&(ds.extEquals(this.m_subscription.fetch_requestedMaxFrequency(),this.m_currentMaxFrequency)?(this.state.s_c=21,this.state.traceState()):(this.doConfigure(),this.state.s_c=22,this.state.traceState(),this.genSendControl()))},evtExtConfigure:function(){this.traceEvent("configure"),21==this.state.s_c&&(this.state.s_c=20,this.state.traceState(),this.evtCheckFrequency())},isPending:function(){return 2==this.state.s_m||5==this.state.s_m||22==this.state.s_c},encode:function(t){if(2==this.state.s_m)return this.encodeAdd(t);if(5==this.state.s_m)return this.encodeDelete(t);if(22==this.state.s_c)return this.encodeReconf(t);throw new Me("Can't encode request")},encodeWS:function(){return"control\r\n"+this.encode(!0)},getValue:function(t,e){return this.m_strategy.getValue(t,e)},getCommandValue:function(t,e,s){return this.m_strategy.getCommandValue(t,e,s)},encodeAdd:function(t){var e=new Ke;this.m_lastAddReqId=this.m_client.generateFreshReqId(),e.LS_reqId(this.m_lastAddReqId),e.LS_op("add"),e.LS_subId(this.subId),e.LS_mode(this.m_subscription.fetch_mode());var s=this.m_subscription.getItemGroup(),i=this.m_subscription.fetchItems();null!=s?e.LS_group(s):null!=i&&e.LS_group(i.join(" "));var n=this.m_subscription.getFieldSchema(),r=this.m_subscription.fetchFields();null!=n?e.LS_schema(n):null!=r&&e.LS_schema(r.join(" "));var a=this.m_subscription.getDataAdapter();null!=a&&e.LS_data_adapter(a);var o=this.m_subscription.getSelector();null!=o&&e.LS_selector(o);var h=this.m_subscription.fetch_requestedSnapshot();if(null!=h)switch(h._hx_index){case 0:e.LS_snapshot(!0);break;case 1:e.LS_snapshot(!1);break;case 2:e.LS_snapshot_Int(h.len)}var u=this.m_currentMaxFrequency;if(null!=u)switch(u._hx_index){case 0:e.LS_requested_max_frequency_Float(u.max);break;case 1:e.LS_requested_max_frequency("unlimited");break;case 2:e.LS_requested_max_frequency("unfiltered")}var c=this.m_subscription.fetch_requestedBufferSize();if(null!=c)switch(c._hx_index){case 0:e.LS_requested_buffer_size_Int(c.size);break;case 1:e.LS_requested_buffer_size("unlimited")}return t&&e.LS_ack(!1),ri.isInfoEnabled()&&ri.info("Sending Subscription add: "+l.string(e)),e.getEncodedString()},encodeDelete:function(t){var e=new Ke;return this.m_lastDeleteReqId=this.m_client.generateFreshReqId(),e.LS_reqId(this.m_lastDeleteReqId),e.LS_subId(this.subId),e.LS_op("delete"),t&&e.LS_ack(!1),ri.isInfoEnabled()&&ri.info("Sending Subscription delete: "+l.string(e)),e.getEncodedString()},encodeReconf:function(t){var e=new Ke;this.m_lastReconfReqId=this.m_client.generateFreshReqId(),e.LS_reqId(this.m_lastReconfReqId),e.LS_subId(this.subId),e.LS_op("reconf");var s=this.m_reqMaxFrequency;if(null!=s)switch(s._hx_index){case 0:e.LS_requested_max_frequency_Float(s.max);break;case 1:e.LS_requested_max_frequency("unlimited");break;case 2:e.LS_requested_max_frequency("unfiltered")}return ri.isInfoEnabled()&&ri.info("Sending Subscription configuration: "+l.string(e)),e.getEncodedString()},doSetActive:function(){this.m_subscription.setActive()},doSetInactive:function(){this.m_subscription.setInactive()},doSubscribe:function(){this.m_currentMaxFrequency=this.m_subscription.fetch_requestedMaxFrequency()},doUnsubscribe:function(){this.m_strategy.evtUnsubscribe(),this.m_subscription.unrelate(this)},doAbort:function(){this.m_lastAddReqId=null,this.m_lastDeleteReqId=null,this.m_lastReconfReqId=null,this.m_reqMaxFrequency=null,this.m_currentMaxFrequency=this.m_subscription.fetch_requestedMaxFrequency(),this.m_strategy.evtAbort()},genSendControl:function(){this.m_client.evtSendControl(this)},notifyOnSubscription:function(){this.m_subscription.fireOnSubscription(this.subId)},notifyOnUnsubscription:function(){this.m_subscription.fireOnUnsubscription(this.subId)},notifyOnSubscriptionError:function(t,e){this.m_subscription.fireOnSubscriptionError(this.subId,t,e)},notifyOnSubscriptionError_CountMismatch:function(t,e,s,i){this.checkItems(t,s)?this.m_subscription.fireOnSubscriptionError(this.subId,61,"Expected "+e+" fields but got "+i):this.m_subscription.fireOnSubscriptionError(this.subId,61,"Expected "+t+" items but got "+s)},doConfigure:function(){this.m_reqMaxFrequency=this.m_subscription.fetch_requestedMaxFrequency(),this.m_strategy.evtSetRequestedMaxFrequency(this.m_reqMaxFrequency)},doREQOKConfigure:function(){this.m_currentMaxFrequency=this.m_reqMaxFrequency},doSUBOK:function(t,e){this.m_subscription.setSubscribed(this.subId,t,e),this.m_strategy.evtOnSUB(t,e,null,null,null)},doSUBCMD:function(t,e,s,i){this.m_subscription.setSubscribedCMD(this.subId,t,e,s,i),this.m_strategy.evtOnSUB(t,e,s,i,this.m_currentMaxFrequency)},doUNSUB:function(){this.m_strategy.evtOnUNSUB()},doU:function(t,e){if(t>Pe.sure(this.m_subscription.fetch_nItems()))throw new Me("Assertion failure: itemIdx <= m_subscription.fetch_nItems().sure()");this.m_strategy.evtUpdate(t,e)},doEOS:function(t){this.m_strategy.evtOnEOS(t),this.m_subscription.fireOnEndOfSnapshot(t,this.subId)},doCS:function(t){this.m_strategy.evtOnCS(t),this.m_subscription.fireOnClearSnapshot(t,this.subId)},doOV:function(t,e){this.m_subscription.fireOnLostUpdates(t,e,this.subId)},doCONF:function(t){this.m_strategy.evtOnCONF(t)},traceEvent:function(t){ai.isTraceEnabled()&&ai.trace("sub#"+t+"("+this.subId+") in "+l.string(this.state))},__class__:Ut};var Wt=function(t,e){this.s_m=1,this.subId=t,this.lock=e.lock,this.m_client=e,e.relateSubManager(this)};Wt.__name__=!0,Wt.__interfaces__=[qt],Wt.prototype={finalize:function(){this.m_client.unrelateSubManager(this)},evtExtAbort:function(){this.traceEvent("abort"),2==this.s_m&&(this.finalize(),this.goto(3))},evtREQERR:function(t,e,s){this.traceEvent("REQERR"),2==this.s_m&&t==this.m_lastDeleteReqId&&(this.finalize(),this.goto(3))},evtREQOK:function(t){this.traceEvent("REQOK"),2==this.s_m&&t==this.m_lastDeleteReqId&&(this.finalize(),this.goto(3))},evtSUBOK:function(t,e){this.traceEvent("SUBOK"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtSUBCMD:function(t,e,s,i){this.traceEvent("SUBCMD"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtUNSUB:function(){this.traceEvent("UNSUB"),2==this.s_m&&(this.finalize(),this.goto(3))},evtU:function(t,e){this.traceEvent("U"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtEOS:function(t){this.traceEvent("EOS"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtCS:function(t){this.traceEvent("CS"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtOV:function(t,e){this.traceEvent("OV"),1==this.s_m&&(this.goto(2),this.genSendControl())},evtCONF:function(t){this.traceEvent("CONF"),1==this.s_m&&(this.goto(2),this.genSendControl())},isPending:function(){return 2==this.s_m},encode:function(t){if(this.isPending())return this.encodeDelete(t);throw new Me("Can't encode unsubscription request")},encodeWS:function(){return"control\r\n"+this.encode(!0)},genSendControl:function(){this.m_client.evtSendControl(this)},encodeDelete:function(t){var e=new Ke;return this.m_lastDeleteReqId=this.m_client.generateFreshReqId(),e.LS_reqId(this.m_lastDeleteReqId),e.LS_subId(this.subId),e.LS_op("delete"),t&&e.LS_ack(!1),e.LS_cause("zombie"),ri.isInfoEnabled()&&ri.info("Sending Subscription delete: "+l.string(e)),e.getEncodedString()},traceEvent:function(t){ai.isTraceEnabled()&&ai.trace("zsub#"+t+"("+this.subId+") in "+this.s_m)},goto:function(t){this.s_m=t,ai.isTraceEnabled()&&ai.trace("zsub#goto("+this.subId+") "+this.s_m)},__class__:Wt};var Ht=function(){};Ht.__name__=!0,Ht.__interfaces__=[I],Ht.prototype={__class__:Ht};var Vt=function(t,e,s,i){this.m_subId=i,this.itemIdx=t,this.subscription=e,this.client=s,this.lock=s.lock};Vt.__name__=!0,Vt.prototype={finalize:function(){},evtUpdate:function(t){this.fatalError()},evtOnEOS:function(){this.fatalError()},evtOnCS:function(){this.fatalError()},evtDispose:function(t){this.fatalError()},getValue:function(t){return null!=this.currValues?ie.toString(this.currValues.h[t]):null},getCommandValue:function(t,e){throw new Me("Unsupported operation")},fatalError:function(){throw new Me("Unsupported operation")},doFirstUpdate:function(t){this.doUpdate(t,!1)},doUpdate0:function(t){this.doUpdate(t,!1)},doFirstSnapshot:function(t){this.doUpdate(t,!0)},doSnapshot:function(t){this.doUpdate(t,!0)},doUpdate:function(t,e){var s=this.currValues;this.currValues=ne(s,t);var i=re(s,this.currValues),n=ae(s,t),r=new Jt(this.itemIdx,this.subscription,this.currValues,i,e,n);this.subscription.fireOnItemUpdate(r,this.m_subId)},__class__:Vt};var zt=function(t,e,s,i){this.keys=new ks,Vt.call(this,t,e,s,i),this.s_m=e.hasSnapshot()?3:1};zt.__name__=!0,zt.__super__=Vt,zt.prototype=n(Vt.prototype,{finalize:function(){},unrelate:function(t){var e=this.keys;Object.prototype.hasOwnProperty.call(e.h,t)&&delete e.h[t]},evtUpdate:function(t){switch(this.traceEvent("update"),this.s_m){case 1:this.doFirstUpdate(t),this.goto(2);break;case 2:this.doUpdate0(t),this.goto(2);break;case 3:this.doFirstSnapshot(t),this.goto(4);break;case 4:this.doSnapshot(t),this.goto(4)}},evtOnEOS:function(){switch(this.traceEvent("onEOS"),this.s_m){case 3:this.goto(1);break;case 4:this.goto(2)}},evtOnCS:function(){throw new Me("Unsupported method")},evtDispose:function(t){switch(this.traceEvent("dispose"),this.s_m){case 1:case 2:case 3:case 4:this.finalize(),this.goto(5),this.genDisposeKeys(),t.unrelate(this.itemIdx)}},getCommandValue:function(t,e){var s=this.keys.h[t];return null!=s?s.getCommandValue(e):null},createKey:function(t){throw new Me("Abstract method")},doUpdate:function(t,e){this.currValues=ne(this.currValues,t),this.selectKey().evtUpdate(this.currValues,e)},genDisposeKeys:function(){for(var t=ks.createCopy(this.keys.h).h,e=Object.keys(t),s=e.length,i=0;i1&&(t+=","),t+=null==a?"null":""+a,t+=":",t+=null==o?"null":""+o}return t+="]"},__class__:Zt});var Jt=function(t,e,s,i,n,r){var a=e.fetch_items(),o=e.fetch_fields();this.m_itemIdx=t,this.m_items=oe(a),this.m_nFields=Pe.sure(e.fetch_nFields()),this.m_fields=oe(o),null!=o&&o.length!=this.m_nFields&&li.isErrorEnabled()&&li.error("Expected "+this.m_nFields+" field names but got "+o.length+": "+l.string(o)),this.m_newValues=s.copy(),this.m_changedFields=i.copy(),this.m_isSnapshot=n,this.m_jsonPatches=r};Jt.__name__=!0,Jt.__super__=Ht,Jt.prototype=n(Ht.prototype,{getItemName:function(){return null!=this.m_items?this.m_items.h[this.m_itemIdx]:null},getItemPos:function(){return this.m_itemIdx},isSnapshot:function(){return this.m_isSnapshot},getValue:function(t){return"number"==typeof t&&(0|t)===t?this.getValuePos(t):this.getValueName(l.string(t))},isValueChanged:function(t){return"number"==typeof t&&(0|t)===t?this.isValueChangedPos(t):this.isValueChangedName(l.string(t))},_getValueAsJSONPatchIfAvailable:function(t){if("number"==typeof t&&(0|t)===t)return this.m_jsonPatches.h[t];var e=this.getFieldIdxFromName(l.string(t));return this.m_jsonPatches.h[e]},getValueAsJSONPatchIfAvailable:function(t){return this._getValueAsJSONPatchIfAvailable(t)},forEachChangedField:function(t){for(var e=this.m_changedFields.iterator();e.current1&&(t+=","),t+=null==a?"null":""+a,t+=":",t+=null==o?"null":""+o}return t+="]"},__class__:Jt});var $t=function(t,e){this.s_m=1,this.keyName=t,this.item=e,this.lock=e.lock};$t.__name__=!0,$t.__interfaces__=[jt],$t.prototype={finalize:function(){this.currKeyValues=null,this.item.unrelate(this.keyName)},evtUpdate:function(t,e){switch(this.traceEvent("update"),this.s_m){case 1:this.isDelete(t)?(this.doLightDelete(t,e),this.finalize(),this.goto(3)):(this.doFirstUpdate(t,e),this.goto(2));break;case 2:this.isDelete(t)?(this.doDelete(t,e),this.finalize(),this.goto(3)):(this.doUpdate(t,e),this.goto(2))}},evtDispose:function(){switch(this.traceEvent("dispose"),this.s_m){case 1:case 2:this.finalize(),this.goto(3)}},evtSetRequestedMaxFrequency:function(){},getCommandValue:function(t){return null!=this.currKeyValues?ie.toString(this.currKeyValues.h[t]):null},doFirstUpdate:function(t,e){var s=Pe.sure(this.item.subscription.fetch_nFields()),i=this.item.subscription.getCommandPosition();this.currKeyValues=t,this.currKeyValues.h[i]=se.StringVal("ADD");var n=new je(new o(1,s+1));this.fireOnItemUpdate(new Jt(this.item.itemIdx,this.item.subscription,this.currKeyValues,n,e,new Ps))},doUpdate:function(t,e){var s=this.item.subscription.getCommandPosition(),i=this.currKeyValues;this.currKeyValues=t,this.currKeyValues.h[s]=se.StringVal("UPDATE");var n=re(i,this.currKeyValues);this.fireOnItemUpdate(new Jt(this.item.itemIdx,this.item.subscription,this.currKeyValues,n,e,new Ps))},doLightDelete:function(t,e){this.currKeyValues=null;var s=new je(t.keys()),i=new Jt(this.item.itemIdx,this.item.subscription,this.nullify(t),s,e,new Ps);this.item.unrelate(this.keyName),this.fireOnItemUpdate(i)},doDelete:function(t,e){this.currKeyValues=null;var s=new je(t.keys()).subtracting([this.item.subscription.getKeyPosition()]),i=new Jt(this.item.itemIdx,this.item.subscription,this.nullify(t),s,e,new Ps);this.item.unrelate(this.keyName),this.fireOnItemUpdate(i)},nullify:function(t){for(var e=new Ps,s=t,i=s.keys();i.hasNext();){var n=i.next(),r=s.get(n),a=n==this.item.subscription.getCommandPosition()||n==this.item.subscription.getKeyPosition();e.h[n]=a?r:null}return e},isDelete:function(t){var e=this.item.subscription.getCommandPosition();return"DELETE"==ie.toString(t.h[e])},fireOnItemUpdate:function(t){this.item.subscription.fireOnItemUpdate(t,this.item.m_subId)},goto:function(t){this.s_m=t,this.traceEvent("goto")},traceEvent:function(t){if(ai.isTraceEnabled()){var e=this.item.m_subId,s=this.item.itemIdx;ai.isTraceEnabled()&&ai.trace("sub#key#"+t+"("+e+":"+s+":"+this.keyName+") in "+this.s_m)}},__class__:$t};var te=function(t,e){this.s_m=1,this.keyName=t,this.item=e,this.lock=e.lock};te.__name__=!0,te.__interfaces__=[jt],te.prototype={finalize:function(){this.currKeyValues=null,this.currKey2Values=null,this.item.unrelate(this.keyName)},evtUpdate:function(t,e){switch(this.traceEvent("update"),this.s_m){case 1:if(this.isDelete(t))this.doLightDelete(t,e),this.finalize(),this.goto(11),this.genOnRealMaxFrequency2LevelRemoved();else{var s=this.create2LevelSubscription();null!=s?(this.doFirstUpdate(t,e),this.subscription2Level=s,this.goto(4),this.item.strategy.client.subscribeExt(s,!0)):(this.doFirstUpdate(t,e),this.notify2LevelIllegalArgument(),this.goto(3))}break;case 3:this.isDelete(t)?(this.doDelete1LevelOnly(t,e),this.finalize(),this.goto(11),this.genOnRealMaxFrequency2LevelRemoved()):(this.doUpdate(t,e),this.goto(3));break;case 4:this.isDelete(t)?(this.doDelete(t,e),this.finalize(),this.goto(11),this.genOnRealMaxFrequency2LevelRemoved()):(this.doUpdate(t,e),this.goto(4));break;case 5:this.isDelete(t)?(this.doDeleteExt(t,e),this.finalize(),this.goto(11),this.genOnRealMaxFrequency2LevelRemoved()):(this.doUpdate1Level(t,e),this.goto(5))}},evtDispose:function(){switch(this.traceEvent("dispose"),this.s_m){case 1:case 2:case 3:this.finalize(),this.goto(10);break;case 4:case 5:this.doUnsubscribe(),this.finalize(),this.goto(12)}},evtOnSubscriptionError2Level:function(t,e){this.traceEvent("onSubscriptionError2Level"),4==this.s_m&&(this.notify2LevelSubscriptionError(t,e),this.goto(3))},evtUpdate2Level:function(t){switch(this.traceEvent("update2Level"),this.s_m){case 4:case 5:this.doUpdate2Level(t),this.goto(5)}},evtOnUnsubscription2Level:function(){switch(this.traceEvent("onUnsubscription2Level"),this.s_m){case 4:case 5:this.doUnsetRealMaxFrequency(),this.goto(this.s_m),this.genOnRealMaxFrequency2LevelRemoved()}},evtOnItemLostUpdates2Level:function(t){switch(this.traceEvent("onItemLostUpdates2Level"),this.s_m){case 4:case 5:this.goto(this.s_m),this.notify2LevelLostUpdates(t)}},evtOnRealMaxFrequency2Level:function(t){switch(this.traceEvent("onRealMaxFrequency2Level"),this.s_m){case 4:case 5:this.doSetRealMaxFrequency(t),this.goto(this.s_m),this.genOnRealMaxFrequency2LevelAdded()}},evtSetRequestedMaxFrequency:function(){switch(this.traceEvent("setRequestedMaxFrequency"),this.s_m){case 4:case 5:this.doChangeRequestedMaxFrequency(),this.goto(this.s_m)}},getCommandValue:function(t){if(null!=(e=this.currKeyValues)&&null!=e.h[t])return ie.toString(e.h[t]);var e=this.currKey2Values,s=this.item.subscription.fetch_nFields();return null!=e&&null!=s?e.h[t-s]:null},doFirstUpdate:function(t,e){var s=this.item.subscription.getCommandPosition();this.currKeyValues=t,this.currKeyValues.h[s]=se.StringVal("ADD");var i=re(null,this.currKeyValues);this.fireOnItemUpdate(new Zt(this.item.itemIdx,this.item.subscription,this.currKeyValues,i,e,new Ps))},doUpdate:function(t,e){var s=this.item.subscription.getCommandPosition(),i=this.currKeyValues;this.currKeyValues=t,this.currKeyValues.h[s]=se.StringVal("UPDATE");var n=re(i,this.currKeyValues);this.fireOnItemUpdate(new Zt(this.item.itemIdx,this.item.subscription,this.currKeyValues,n,e,new Ps))},doUpdate2Level:function(t){var e=this.item.subscription.getCommandPosition(),s=Pe.sure(this.item.subscription.fetch_nFields()),i=Pe.sure(this.currKeyValues).copy();this.currKeyValues.h[e]=se.StringVal("UPDATE"),this.currKey2Values=ue(t);for(var n=Pe.sure(this.currKeyValues).copy(),r=(u=this.currKey2Values).keys();r.hasNext();){var a=r.next(),o=u.get(a);n.h[a+s]=null==o?null:se.StringVal(o)}var h=new je;for(ie.toString(i.h[e])!=ie.toString(this.currKeyValues.h[e])&&h.insert(e),r=(u=le(t)).keys();r.hasNext();)a=r.next(),u.get(a),h.insert(a+s);var u,l=t.isSnapshot(),c=new Ps;for(r=(u=this.currKey2Values).keys();r.hasNext();){a=r.next(),u.get(a);var d=t.getValueAsJSONPatchIfAvailable(a);null!=d&&(c.h[a+s]=d)}this.fireOnItemUpdate(new Zt(this.item.itemIdx,this.item.subscription,n,h,l,c))},doUpdate1Level:function(t,e){var s=this.item.subscription.getCommandPosition(),i=Pe.sure(this.item.subscription.fetch_nFields()),n=Pe.sure(this.currKeyValues);this.currKeyValues=t,this.currKeyValues.h[s]=se.StringVal("UPDATE");for(var r=Pe.sure(this.currKeyValues).copy(),a=Pe.sure(this.currKey2Values),o=a.keys();o.hasNext();){var h=o.next(),u=a.get(h);r.h[h+i]=null==u?null:se.StringVal(u)}for(var l=new je,c=1,d=i+1;c0)return Se.FreqLimited(e);throw new v("The given value is not valid for this setting; use null, 'unlimited' or a positive number instead")},ye.toString=function(t){if(null==t)return null;switch(t._hx_index){case 0:var e=t.max;return null==e?"null":""+e;case 1:return"unlimited"}},ye.extEquals=function(t,e){return null==t?null==e:null!=e&&_.enumEq(t,e)};var Ee=function(){};Ee.__name__=!0,Ee.prototype={submit:function(t){wi(t)},schedule:function(t,e){return new we(bi(t,e))},stop:function(){},__class__:Ee};var we=function(t){this.handle=t};we.__name__=!0,we.prototype={isCanceled:function(){return null==this.handle},cancel:function(){null!=this.handle&&(Ei(this.handle),this.handle=null)},__class__:we};var Te=function(){this.hasMicroTasks=void 0!==t.queueMicrotask,this.hasWorkers="undefined"!=typeof Worker};Te.__name__=!0,Te.prototype={toString:function(){return"{ hasWorkers: "+l.string(this.hasWorkers)+", hasMicroTasks: "+l.string(this.hasMicroTasks)+" }"},__class__:Te};var Re=function(){};Re.__name__=!0,Re.__isInterface__=!0,Re.prototype={__class__:Re};var Ie=function(t,e,s,i,n,r,a){this.isCanceled=!1,this.reader=new Qe;var o=this;if(ni.isDebugEnabled()&&ni.debug("HTTP sending: "+t+" "+e+" headers("+(null==s?"null":ks.stringify(s.h))+")"),this.xhr=new XMLHttpRequest,this.xhr.open("POST",t),this.xhr.withCredentials=i,null!=s)for(var h=s.h,u=Object.keys(h),l=u.length,c=0;c=200&&e<300||(ni.isDebugEnabled()&&ni.debug("HTTP event: error(HTTP code "+e+")"),r(o,"Unexpected HTTP code: "+e),o.xhr.abort())}else if(t>2){for(var s=3==t?o.reader.extractNewData(o.xhr.responseText,!1):o.reader.extractNewData(o.xhr.responseText,!0),i=0;ithis.values.length/2&&(this.nRemoved=0,this.values=this.copy().values)},push:function(t){this.values.push(new Le(t))},remove:function(t){for(var e=0,s=this.values.length;e "+l.string(this._innerMap.h[r])+(t!=s-1?", ":""),++t}return i+"]"},__class__:Fe};var Ae=function(t){this.map=t,this.it=new Ne(t._orderedKeys)};Ae.__name__=!0,Ae.prototype={hasNext:function(){return this.it.hasNext()},next:function(){var t=this.map,e=this.it.next();return t._innerMap.h[e]},__class__:Ae};var qe=function(){};qe.__name__=!0,qe.__isInterface__=!0,qe.prototype={__class__:qe};var Be=function(){};Be.__name__=!0,Be.__isInterface__=!0,Be.prototype={__class__:Be};var Ue=i["com.lightstreamer.internal.ReachabilityStatus"]={__ename__:!0,__constructs__:null,RSReachable:{_hx_name:"RSReachable",_hx_index:0,__enum__:"com.lightstreamer.internal.ReachabilityStatus",toString:s},RSNotReachable:{_hx_name:"RSNotReachable",_hx_index:1,__enum__:"com.lightstreamer.internal.ReachabilityStatus",toString:s}};Ue.__constructs__=[Ue.RSReachable,Ue.RSNotReachable];var We=function(){};We.__name__=!0,We.__isInterface__=!0,We.prototype={__class__:We};var He=i["com.lightstreamer.internal.PageState"]={__ename__:!0,__constructs__:null,Frozen:{_hx_name:"Frozen",_hx_index:0,__enum__:"com.lightstreamer.internal.PageState",toString:s},Resumed:{_hx_name:"Resumed",_hx_index:1,__enum__:"com.lightstreamer.internal.PageState",toString:s}};He.__constructs__=[He.Frozen,He.Resumed];var Ve=function(){};Ve.__name__=!0,Ve.__isInterface__=!0,Ve.prototype={__class__:Ve};var ze=function(t){this.connectionOptions=t.connectionOptions};ze.__name__=!0,ze.__interfaces__=[Ve],ze.prototype={createWsClient:function(t,e,s,i,n){return new ws(t,s,i,n)},createHttpClient:function(t,e,s,i,n,r){return new Ie(t,e,s,this.connectionOptions.isCookieHandlingRequired(),i,n,r)},createCtrlClient:function(t,e,s,i,n,r){return this.createHttpClient(t,e,s,i,n,r)},createReachabilityManager:function(t){return new Ye},createTimer:function(t,e,s){return new Je(t,e,s)},randomMillis:function(t){return l.random(t)},createPageLifecycleFactory:function(t){return new P(t)},__class__:ze};var Ye=function(){};Ye.__name__=!0,Ye.__interfaces__=[We],Ye.prototype={startListening:function(t){f.get_supported()&&(window.ononline=function(){t(Ue.RSReachable)},window.onoffline=function(){t(Ue.RSNotReachable)})},stopListening:function(){f.get_supported()&&(window.ononline=null,window.onoffline=null)},__class__:Ye};var Ge=function(t,e){this.key=t,this.val=e};Ge.__name__=!0,Ge.prototype={toEncodedPair:function(){var t=this.key,e=encodeURIComponent(t)+"=";return t=this.val,e+encodeURIComponent(t)},toString:function(){return this.key+"="+this.val},__class__:Ge};var Ke=function(){this.params=[]};Ke.__name__=!0,Ke.prototype={LS_reqId:function(t){this.addParamAny("LS_reqId",t)},LS_message:function(t){this.addParamString("LS_message",t)},LS_sequence:function(t){this.addParamString("LS_sequence",t)},LS_msg_prog:function(t){this.addParamAny("LS_msg_prog",t)},LS_max_wait:function(t){this.addParamAny("LS_max_wait",t)},LS_outcome:function(t){this.addParamBool("LS_outcome",t)},LS_ack:function(t){this.addParamBool("LS_ack",t)},LS_op:function(t){this.addParamString("LS_op",t)},LS_subId:function(t){this.addParamAny("LS_subId",t)},LS_mode:function(t){this.addParamString("LS_mode",t)},LS_group:function(t){this.addParamString("LS_group",t)},LS_schema:function(t){this.addParamString("LS_schema",t)},LS_data_adapter:function(t){this.addParamString("LS_data_adapter",t)},LS_requested_max_frequency:function(t){this.addParamString("LS_requested_max_frequency",t)},LS_requested_max_frequency_Float:function(t){this.addParamAny("LS_requested_max_frequency",t)},LS_requested_buffer_size:function(t){this.addParamString("LS_requested_buffer_size",t)},LS_requested_buffer_size_Int:function(t){this.addParamAny("LS_requested_buffer_size",t)},LS_cause:function(t){this.addParamString("LS_cause",t)},LS_keepalive_millis:function(t){this.addParamAny("LS_keepalive_millis",t)},LS_inactivity_millis:function(t){this.addParamAny("LS_inactivity_millis",t)},LS_requested_max_bandwidth:function(t){this.addParamString("LS_requested_max_bandwidth",t)},LS_requested_max_bandwidth_Float:function(t){this.addParamAny("LS_requested_max_bandwidth",t)},LS_adapter_set:function(t){this.addParamString("LS_adapter_set",t)},LS_user:function(t){this.addParamString("LS_user",t)},LS_password:function(t){this.addParamString("LS_password",t)},LS_cid:function(t){this.addParamString("LS_cid",t)},LS_old_session:function(t){this.addParamString("LS_old_session",t)},LS_session:function(t){this.addParamString("LS_session",t)},LS_send_sync:function(t){this.addParamBool("LS_send_sync",t)},LS_polling:function(t){this.addParamBool("LS_polling",t)},LS_polling_millis:function(t){this.addParamAny("LS_polling_millis",t)},LS_idle_millis:function(t){this.addParamAny("LS_idle_millis",t)},LS_content_length:function(t){this.addParamAny("LS_content_length",t)},LS_ttl_millis:function(t){this.addParamString("LS_ttl_millis",t)},LS_recovery_from:function(t){this.addParamAny("LS_recovery_from",t)},LS_close_socket:function(t){this.addParamBool("LS_close_socket",t)},LS_selector:function(t){this.addParamString("LS_selector",t)},LS_snapshot:function(t){this.addParamBool("LS_snapshot",t)},LS_snapshot_Int:function(t){this.addParamAny("LS_snapshot",t)},addParamString:function(t,e){this.params.push(new Ge(t,e))},addParamAny:function(t,e){this.addParamString(t,""+(null==e?"null":l.string(e)))},addParamBool:function(t,e){this.addParamString(t,e?"true":"false")},getEncodedString:function(){for(var t=this.params,e=new Array(t.length),s=0,i=t.length;se},gt:function(t,e){return t>e},lt:function(t,e){return t0)return rs.BWLimited(e);throw new v('The given value is a not valid value for RequestedMaxBandwidth. Use a positive number or the string "unlimited"')},as.toString=function(t){switch(t._hx_index){case 0:var e=t.bw;return null==e?"null":""+e;case 1:return"unlimited"}};var os=i["com.lightstreamer.internal.RequestedBufferSize"]={__ename__:!0,__constructs__:null,BSLimited:(e=function(t){return{_hx_index:0,size:t,__enum__:"com.lightstreamer.internal.RequestedBufferSize",toString:s}},e._hx_name="BSLimited",e.__params__=["size"],e),BSUnlimited:{_hx_name:"BSUnlimited",_hx_index:1,__enum__:"com.lightstreamer.internal.RequestedBufferSize",toString:s}};os.__constructs__=[os.BSLimited,os.BSUnlimited];var hs=function(){};hs.__name__=!0,hs.fromString=function(t){if(null==t)return null;var e;if("unlimited"==t.toLowerCase())return os.BSUnlimited;if(null!=(e=l.parseInt(t))&&e>0)return os.BSLimited(e);throw new v("The given value is not valid for this setting; use null, 'unlimited' or a positive integer instead")},hs.toString=function(t){if(null==t)return null;switch(t._hx_index){case 0:var e=t.size;return null==e?"null":""+e;case 1:return"unlimited"}},hs.extEquals=function(t,e){return null==t?null==e:null!=e&&_.enumEq(t,e)};var us=i["com.lightstreamer.internal.RequestedSnapshot"]={__ename__:!0,__constructs__:null,SnpYes:{_hx_name:"SnpYes",_hx_index:0,__enum__:"com.lightstreamer.internal.RequestedSnapshot",toString:s},SnpNo:{_hx_name:"SnpNo",_hx_index:1,__enum__:"com.lightstreamer.internal.RequestedSnapshot",toString:s},SnpLength:(e=function(t){return{_hx_index:2,len:t,__enum__:"com.lightstreamer.internal.RequestedSnapshot",toString:s}},e._hx_name="SnpLength",e.__params__=["len"],e)};us.__constructs__=[us.SnpYes,us.SnpNo,us.SnpLength];var ls=function(){};ls.__name__=!0,ls.fromString=function(t){if(null==t)return null;var e;switch(t.toLowerCase()){case"no":return us.SnpNo;case"yes":return us.SnpYes;default:if(null!=(e=l.parseInt(t))&&e>0)return us.SnpLength(e);throw new v("The given value is not valid for this setting; use null, 'yes', 'no' or a positive number instead")}},ls.toString=function(t){if(null==t)return null;switch(t._hx_index){case 0:return"yes";case 1:return"no";case 2:var e=t.len;return null==e?"null":""+e}};var cs=i["com.lightstreamer.internal.RequestedMaxFrequency"]={__ename__:!0,__constructs__:null,FreqLimited:(e=function(t){return{_hx_index:0,max:t,__enum__:"com.lightstreamer.internal.RequestedMaxFrequency",toString:s}},e._hx_name="FreqLimited",e.__params__=["max"],e),FreqUnlimited:{_hx_name:"FreqUnlimited",_hx_index:1,__enum__:"com.lightstreamer.internal.RequestedMaxFrequency",toString:s},FreqUnfiltered:{_hx_name:"FreqUnfiltered",_hx_index:2,__enum__:"com.lightstreamer.internal.RequestedMaxFrequency",toString:s}};cs.__constructs__=[cs.FreqLimited,cs.FreqUnlimited,cs.FreqUnfiltered];var ds=function(){};ds.__name__=!0,ds.fromString=function(t){if(null==t)return null;var e;switch(t.toLowerCase()){case"unfiltered":return cs.FreqUnfiltered;case"unlimited":return cs.FreqUnlimited;default:if(e=parseFloat(t),!isNaN(e)&&e>0)return cs.FreqLimited(e);throw new v("The given value is not valid for this setting; use null, 'unlimited', 'unfiltered' or a positive number instead")}},ds.toString=function(t){if(null==t)return null;switch(t._hx_index){case 0:var e=t.max;return null==e?"null":""+e;case 1:return"unlimited";case 2:return"unfiltered"}},ds.extEquals=function(t,e){return null==t?null==e:null!=e&&_.enumEq(t,e)};var _s=i["com.lightstreamer.internal.RealMaxFrequency"]={__ename__:!0,__constructs__:null,RFreqLimited:(e=function(t){return{_hx_index:0,freq:t,__enum__:"com.lightstreamer.internal.RealMaxFrequency",toString:s}},e._hx_name="RFreqLimited",e.__params__=["freq"],e),RFreqUnlimited:{_hx_name:"RFreqUnlimited",_hx_index:1,__enum__:"com.lightstreamer.internal.RealMaxFrequency",toString:s}};_s.__constructs__=[_s.RFreqLimited,_s.RFreqUnlimited];var ps=i["com.lightstreamer.internal.RealMaxBandwidth"]={__ename__:!0,__constructs__:null,BWLimited:(e=function(t){return{_hx_index:0,bw:t,__enum__:"com.lightstreamer.internal.RealMaxBandwidth",toString:s}},e._hx_name="BWLimited",e.__params__=["bw"],e),BWUnlimited:{_hx_name:"BWUnlimited",_hx_index:1,__enum__:"com.lightstreamer.internal.RealMaxBandwidth",toString:s},BWUnmanaged:{_hx_name:"BWUnmanaged",_hx_index:2,__enum__:"com.lightstreamer.internal.RealMaxBandwidth",toString:s}};ps.__constructs__=[ps.BWLimited,ps.BWUnlimited,ps.BWUnmanaged];var fs=function(){};fs.__name__=!0,fs.toString=function(t){if(null==t)return null;switch(t._hx_index){case 0:var e=t.bw;return null==e?"null":""+e;case 1:return"unlimited";case 2:return"unmanaged"}},fs.eq=function(t,e){return null==t?null==e:null!=e&&_.enumEq(t,e)};var ms={fromString:function(t){switch(t){case"COMMAND":return"COMMAND";case"DISTINCT":return"DISTINCT";case"MERGE":return"MERGE";case"RAW":return"RAW";default:throw new v("The given value is not a valid subscription mode. Admitted values are MERGE, DISTINCT, RAW, COMMAND")}}},gs={_new:function(t){return t},getPos:function(t,e){var s=t.indexOf(e);return-1!=s?s+1:-1},allValidNames:function(t){return!h.exists(t,(function(t){return new r("^$| |^\\d+$","").match(t)}))},fromArray:function(t){if(null==t)return null;if(0==t.length)throw new v("Item List is empty");if(gs.allValidNames(t))return t;throw new v("Item List is invalid")}},vs={_new:function(t){return t},getPos:function(t,e){var s=t.indexOf(e);return-1!=s?s+1:-1},hasKeyField:function(t){return-1!=t.indexOf("key")},hasCommandField:function(t){return-1!=t.indexOf("command")},fromArray:function(t){if(null==t)return null;if(0==t.length)throw new v("Field List is empty");if(h.exists(t,(function(t){return new r("^$| ","").match(t)})))throw new v("Field List is invalid");return t}},Ss={};function ys(t){if(null==t)return"null";switch(t._hx_index){case 0:return""+t.freq;case 1:return"unlimited"}}function bs(t,e){return null==t?null==e:null!=e&&_.enumEq(t,e)}Ss._new=function(t){return t},Ss.fromString=function(t){if(null==t)return null;if(""==t)throw new v("The value is empty");return t};var Es=function(t,e){var s=t.indexOf("://");-1!=s?(this._protocol=t.substring(0,s)+":",t=t.substring(s+3)):this._protocol="";var i=t.indexOf("/");-1!=i?(this._pathname=t.substring(i),t=t.substring(0,i)):this._pathname="/";var n=this.extractPortStart(t);-1!=n?(this._port=t.substring(n),this._hostname=t.substring(0,n-1)):(this._port="",this._hostname=t),null!=e&&this.set_pathname(e)};Es.__name__=!0,Es.build=function(t,e){if(null!=e){var s=d.endsWith(t,"/"),i=d.startsWith(e,"/");t+=s?i?e.substring(1):e:i?e:"/"+e}return t},Es.completeControlLink=function(t,e){var s=new Es(e),i=new Es(t);return""==i.get_protocol()&&i.set_protocol(s.get_protocol()),""==i.get_port()&&i.set_port(s.get_port()),i.get_href()},Es.prototype={get_protocol:function(){return this._protocol},set_protocol:function(t){return""==t||d.endsWith(t,":")||(t+=":"),this._protocol=t,this._protocol},get_hostname:function(){return this._hostname},set_hostname:function(t){return this._hostname=t,this._hostname},get_port:function(){return this._port},set_port:function(t){return this._port=t,this._port},get_pathname:function(){return this._pathname},set_pathname:function(t){return d.startsWith(t,"/")||(t="/"+t),this._pathname=t,this._pathname},get_href:function(){var t=this._hostname;return""!=this._protocol&&(t=this._protocol+"//"+t),""!=this._port&&(t+=":"+this._port),""!=this.get_pathname()&&(t+=this._pathname),t},toString:function(){return this.get_href()},extractPortStart:function(t){var e=t.indexOf(":");return e<=-1?-1:t.indexOf("]")>-1?(e=t.indexOf("]:"))<=-1?-1:e+2:e!=t.lastIndexOf(":")?-1:e+1},__class__:Es};var ws=function(t,e,s,i){this.isCanceled=!1;var n=this;d.startsWith(t,"https://")?t=d.replace(t,"https://","wss://"):d.startsWith(t,"http://")&&(t=d.replace(t,"http://","ws://")),ni.isDebugEnabled()&&ni.debug("WS connecting: "+t),this.ws=new WebSocket(t,$s),this.ws.onopen=function(){n.isCanceled||(ni.isDebugEnabled()&&ni.debug("WS event: open"),e(n))},this.ws.onmessage=function(t){if(!n.isCanceled)for(var e=0,i=t.data.split("\r\n");e0&&(this.appendToBuf(this.base,this.basePos,t),this.basePos+=t)},applyAdd:function(){var t=this.decodeVarint();t>0&&(this.appendToBuf(this.diff,this.diffPos,t),this.diffPos+=t)},applyDel:function(){var t=this.decodeVarint();t>0&&(this.basePos+=t)},decodeVarint:function(){for(var t=0;;){var e=this.charAt(this.diff,this.diffPos);if(this.diffPos+=1,e>=97&&e<123)return 26*t+(e-97);if(!(e>=65&&e<91))throw new g("The code point "+e+" is not in the range A-Z");t=26*t+(e-65)}},appendToBuf:function(t,e,s){if(!(e+s<=t.length))throw new g("Index out of range: startIndex="+e+" count="+s+" length="+t.length);this.buf.b+=null==s?a.substr(t,e,null):a.substr(t,e,s)},charAt:function(t,e){if(e=t.length)break}else s=-1;if(s>=0)break}return s>=0?t.slice(0,s):t},equalItems:function(t,e){if(null==t)return null==e;switch(t._hx_index){case 0:return null!=e&&0==e._hx_index;case 1:return null!=e&&1==e._hx_index&&t.m==e.m;case 2:return null!=e&&2==e._hx_index&&t.file==e.file&&t.line==e.line&&t.column==e.column&&Ms.equalItems(t.s,e.s);case 3:return null!=e&&3==e._hx_index&&t.classname==e.classname&&t.method==e.method;case 4:return null!=e&&4==e._hx_index&&t.v==e.v}},itemToString:function(t,e){switch(e._hx_index){case 0:t.b+="a C function";break;case 1:var s=e.m;t.b=(t.b+="module ")+(null==s?"null":""+s);break;case 2:s=e.s;var i=e.file,n=e.line,r=e.column;null!=s&&(Ms.itemToString(t,s),t.b+=" ("),t.b=(t.b+=null==i?"null":""+i)+" line ",t.b+=null==n?"null":""+n,null!=r&&(t.b=(t.b+=" column ")+(null==r?"null":""+r)),null!=s&&(t.b+=")");break;case 3:s=e.classname,i=e.method,t.b=(t.b+=l.string(null==s?"":s))+".",t.b+=null==i?"null":""+i;break;case 4:s=e.v,t.b=(t.b+="local function #")+(null==s?"null":""+s)}}},Ds=function(){};Ds.__name__=!0,Ds.toHaxe=function(t,e){if(null==e&&(e=0),null==t)return[];if("string"==typeof t){var s=t.split("\n");"Error"==s[0]&&s.shift();for(var i=[],n=0,r=s.length;na)){var o=s[a],h=o.match(/^ at ([$A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);if(null!=h){var u=h[1].split(".");"$hxClasses"==u[0]&&u.shift();var c=u.pop(),_=h[2],p=l.parseInt(h[3]),f=l.parseInt(h[4]);i.push(Ns.FilePos("Anonymous function"==c?Ns.LocalFunction():"Global code"==c?null:Ns.Method(u.join("."),c),_,p,f))}else i.push(Ns.Module(d.trim(o)))}}return i}return e>0&&Array.isArray(t)?t.slice(e):t},Ds.normalize=function(t,e){if(null==e&&(e=0),Array.isArray(t)&&e>0)return t.slice(e);if("string"==typeof t){switch(t.substring(0,6)){case"Error\n":case"Error:":++e}return Ds.skipLines(t,e)}return t},Ds.skipLines=function(t,e,s){for(null==s&&(s=0);;){if(!(e>0))return t.substring(s);if((s=t.indexOf("\n",s))<0)return"";e=--e,s+=1}};var Os=function(t,e,s){g.call(this,String(t),e,s),this.value=t,this.__skipStack++};Os.__name__=!0,Os.__super__=g,Os.prototype=n(g.prototype,{__class__:Os});var Ps=function(){this.h={}};Ps.__name__=!0,Ps.__interfaces__=[ke],Ps.prototype={get:function(t){return this.h[t]},remove:function(t){return!!this.h.hasOwnProperty(t)&&(delete this.h[t],!0)},keys:function(){var t=[];for(var e in this.h)this.h.hasOwnProperty(e)&&t.push(+e);return new Bs(t)},iterator:function(){return{ref:this.h,it:this.keys(),hasNext:function(){return this.it.hasNext()},next:function(){var t=this.it.next();return this.ref[t]}}},copy:function(){for(var t=new Ps,e=this.keys();e.hasNext();){var s=e.next();t.h[s]=this.h[s]}return t},__class__:Ps};var ks=function(){this.h=Object.create(null)};ks.__name__=!0,ks.__interfaces__=[ke],ks.createCopy=function(t){var e=new ks;for(var s in t)e.h[s]=t[s];return e},ks.stringify=function(t){var e="[",s=!0;for(var i in t)s?s=!1:e+=",",e+=i+" => "+l.string(t[i]);return e+"]"},ks.prototype={get:function(t){return this.h[t]},keys:function(){return new Fs(this.h)},iterator:function(){return new As(this.h)},__class__:ks};var Fs=function(t){this.h=t,this.keys=Object.keys(t),this.length=this.keys.length,this.current=0};Fs.__name__=!0,Fs.prototype={hasNext:function(){return this.current>10))+String.fromCharCode(56320+(1023&t))}),Object.defineProperty(String.prototype,"__class__",{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,Date.prototype.__class__=Date,Date.__name__="Date";var zs={},Ys={},Gs=Number,Ks=Boolean,js={},Qs={};U.__toStr={}.toString;var Xs,Zs=!f.get_supported()||"http:"!=(null!=(Xs=t.location)?Xs.protocol:null)&&"https:"!=(null!=(Xs=t.location)?Xs.protocol:null)?null:m.fromString(t.location.protocol+"//"+t.location.hostname+(""!=t.location.port?":"+t.location.port:"")+"/"),Js="TLCP-2.5.0",$s=Js+".lightstreamer.com",ti="9.2.0 build 20240216",ei="pcYgxn8m8 feOojyA1V681f3g2.pz482hA5DLAk",si="javascript_client",ii="";x.LIB_NAME=si,x.LIB_VERSION=ti,q.lock=new A,q.logInstances=new ks,q.emptyLogger=new F;var ni=q.getLogger("lightstreamer.stream"),ri=q.getLogger("lightstreamer.protocol"),ai=q.getLogger("lightstreamer.internal"),oi=q.getLogger("lightstreamer.session"),hi=q.getLogger("lightstreamer.actions"),ui=q.getLogger("lightstreamer.reachability"),li=q.getLogger("lightstreamer.subscriptions"),ci=q.getLogger("lightstreamer.messages");q.getLogger("lightstreamer.cookies");var di=q.getLogger("lightstreamer.page"),_i=q.getLogger("lightstreamer.mpn.device"),pi=q.getLogger("lightstreamer.mpn.subscriptions");W.frz_globalPageLifecycle=P.newLoggingInstance();var fi="Cannot subscribe to an active MPNSubscription",mi="No MPNDevice Registered",gi="Specify property 'notificationFormat'";Ft.EOL_LEN=Ft.lengthOfBytes("\r\n");var vi="The Subscription was initiated using a Field Schema: the field names are not available",Si="The field position is out of bounds",yi="The field name is unknown";ve.Merge="MERGE",ve.Distinct="DISTINCT",Te.instance=new Te;var bi=Te.instance.hasWorkers?$e.setTimeout:t.setTimeout,Ei=Te.instance.hasWorkers?$e.clearTimeout:t.clearTimeout,wi=Te.instance.hasMicroTasks?t.queueMicrotask:function(t){Ti.push(t),bi(ts,0)},Ti=[];ss.ZERO=0,ns.WS="WS",ns.WS_STREAMING="WS-STREAMING",ns.WS_POLLING="WS-POLLING",ns.HTTP="HTTP",ns.HTTP_STREAMING="HTTP-STREAMING",ns.HTTP_POLLING="HTTP-POLLING",ms.Merge="MERGE",ms.Distinct="DISTINCT",ms.Command="COMMAND",ms.Raw="RAW",Ts.VARINT_RADIX=26,Cs.TRACE=0,Cs.DEBUG=10,Cs.INFO=20,Cs.WARN=30,Cs.ERROR=40,Cs.FATAL=50}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0);var M=N.LSLightstreamerClient,D=N.LSSubscription,O=N.LSFirebaseMpnBuilder,P=N.LSMpnDevice,k=N.LSMpnSubscription,F=N.LSSafariMpnBuilder,A=N.LSConsoleLogLevel,q=N.LSConsoleLoggerProvider,B=function(){var t=function(t){this.name="IllegalStateException",this.message=t};return t.prototype={toString:function(){return["[",this.name,this.message,"]"].join("|")}},t}(),U=function(){function t(t,e,s){if(e)return s?e.apply(t,s):e.apply(t)}function e(t,e){for(var s in t)if(t[e]==t[s]&&e!=s)return s;return null}var s={Inheritance:function(t,i,n,r){for(var a in i.prototype)if(t.prototype[a]){if(r){var o=e(i.prototype,a);if(o){if(t.prototype[o]&&t.prototype[o]!==t.prototype[a]&&i.prototype[o]!=i.prototype[o])throw new B("Can't solve alias collision, try to minify the classes again ("+o+", "+a+")");t.prototype[o]=t.prototype[a]}}}else t.prototype[a]=i.prototype[a];return n||(t.prototype._super_=i,t.prototype._callSuperConstructor=s._callSuperConstructor,t.prototype._callSuperMethod=s._callSuperMethod),t},_callSuperMethod:function(e,s,i){return t(this,e.prototype._super_.prototype[s],i)},_callSuperConstructor:function(e,s){t(this,e.prototype._super_,s)}};return s.Inheritance}(),W=function(){var t=function(t){this.matrix=t||{}};return t.prototype={insert:function(t,e,s){e in this.matrix||(this.matrix[e]={}),this.matrix[e][s]=t},get:function(t,e){return t in this.matrix&&e in this.matrix[t]?this.matrix[t][e]:null},del:function(t,e){if(!(!t in this.matrix)){for(var s in e in this.matrix[t]&&delete this.matrix[t][e],this.matrix[t])return;delete this.matrix[t]}},insertRow:function(t,e){this.matrix[e]=t},getRow:function(t){return t in this.matrix?this.matrix[t]:null},delRow:function(t){t in this.matrix&&delete this.matrix[t]},getEntireMatrix:function(){return this.matrix},isEmpty:function(){for(var t in this.matrix)return!1;return!0},forEachElement:function(t){for(var e in this.matrix)this.forEachElementInRow(e,t)},forEachRow:function(t){for(var e in this.matrix)t(e)},forEachElementInRow:function(t,e){var s=this.matrix[t];for(var i in s)e(s[i],t,i)}},t.prototype.insert=t.prototype.insert,t.prototype.get=t.prototype.get,t.prototype.del=t.prototype.del,t.prototype.insertRow=t.prototype.insertRow,t.prototype.getRow=t.prototype.getRow,t.prototype.delRow=t.prototype.delRow,t.prototype.getEntireMatrix=t.prototype.getEntireMatrix,t.prototype.forEachElement=t.prototype.forEachElement,t.prototype.forEachElementInRow=t.prototype.forEachElementInRow,t.prototype.forEachRow=t.prototype.forEachRow,t.prototype.isEmpty=t.prototype.isEmpty,t}(),H=function(){var t="undefined"!=typeof window&&"undefined"!=typeof navigator&&"undefined"!=typeof document,e="undefined"!=typeof importScripts,s="object"==typeof process&&(/node(\.exe)?$/.test(process.execPath)||process.node&&process.v8||process.versions&&process.versions.node&&process.versions.v8);if(t&&!document.getElementById)throw new B("Not supported browser");var i={isBrowserDocument:function(){return t},isBrowser:function(){return!s&&(t||e)},isNodeJS:function(){return!t&&s},isWebWorker:function(){return!t&&!s&&e},isOther:function(){return!t&&!s&&!e},browserDocumentOrDie:function(){if(!this.isBrowserDocument())throw new B("Trying to load a browser-only module on non-browser environment")}};return i.isBrowserDocument=i.isBrowserDocument,i.isBrowser=i.isBrowser,i.isNodeJS=i.isNodeJS,i.isWebWorker=i.isWebWorker,i.browserDocumentOrDie=i.browserDocumentOrDie,i}(),V=function(){var t=new RegExp("^\\s*([\\s\\S]*?)\\s*$"),e=new RegExp(",","g"),s=new RegExp("\\.","g"),i={getTimeStamp:function(){return(new Date).getTime()},randomG:function(t){return t=t||1e3,Math.round(Math.random()*t)},trim:function(e){return e.replace(t,"$1")},getNumber:function(t,i){return t?t.replace?(t=i?(t=t.replace(s,"")).replace(e,"."):t.replace(e,""),new Number(t)):t:0},isArray:function(t){return t&&t.join&&"function"==typeof t.join},addEvent:function(t,e,s){return!!H.isBrowserDocument()&&(void 0!==t.addEventListener?t.addEventListener(e,s,!1):void 0!==t.attachEvent&&t.attachEvent("on"+e,s),!0)},removeEvent:function(t,e,s){return!!H.isBrowserDocument()&&(void 0!==t.removeEventListener?t.removeEventListener(e,s,!1):void 0!==t.detachEvent&&t.detachEvent("on"+e,s),!0)}};return i.getTimeStamp=i.getTimeStamp,i.randomG=i.randomG,i.trim=i.trim,i.getNumber=i.getNumber,i.isArray=i.isArray,i.addEvent=i.addEvent,i.removeEvent=i.removeEvent,i}(),z=function(){var t=function(){return!1},e={error:t,warn:t,info:t,debug:t,fatal:t,isDebugEnabled:t,isInfoEnabled:t,isWarnEnabled:t,isErrorEnabled:t,isFatalEnabled:t},s=function(t){this.setWrappedInstance(t)};return s.prototype={setWrappedInstance:function(t){this.wrappedLogger=t||e},logFatal:function(t){this.isFatalLogEnabled()&&(t+=this.logArguments(arguments,1),this.fatal(t))},fatal:function(t,e){this.wrappedLogger.fatal(t,e)},isFatalLogEnabled:function(){return!this.wrappedLogger.isFatalEnabled||this.wrappedLogger.isFatalEnabled()},logError:function(t){this.isErrorLogEnabled()&&(t+=this.logArguments(arguments,1),this.error(t))},logErrorExc:function(t,e){this.isErrorLogEnabled()&&(e+=this.logArguments(arguments,2),this.error(e,t))},error:function(t,e){this.wrappedLogger.error(t,e)},isErrorLogEnabled:function(){return!this.wrappedLogger.isErrorEnabled||this.wrappedLogger.isErrorEnabled()},logWarn:function(t){this.isWarnLogEnabled()&&(t+=this.logArguments(arguments,1),this.warn(t))},warn:function(t,e){this.wrappedLogger.warn(t,e)},isWarnLogEnabled:function(){return!this.wrappedLogger.isWarnEnabled||this.wrappedLogger.isWarnEnabled()},logInfo:function(t){this.isInfoLogEnabled()&&(t+=this.logArguments(arguments,1),this.info(t))},info:function(t,e){this.wrappedLogger.info(t,e)},isInfoLogEnabled:function(){return!this.wrappedLogger.isInfoEnabled||this.wrappedLogger.isInfoEnabled()},logDebug:function(t){this.isDebugLogEnabled()&&(t+=this.logArguments(arguments,1),this.debug(t))},debug:function(t,e){this.wrappedLogger.debug(t,e)},isDebugLogEnabled:function(){return!this.wrappedLogger.isDebugEnabled||this.wrappedLogger.isDebugEnabled()},logArguments:function(t,e){for(var s=" {",i=e=e||0;i=e:t==e)}function i(t){return e.indexOf(t)>-1}function n(e){var s=t;return function(){return null===s&&(s=i(e)),s}}function r(e){var s=t;return function(){if(null===s){s=!0;for(var t=0;t=2)return t[1]}return null}}function u(){if(opera.version){var t=opera.version();return t=t.replace(new RegExp("[^0-9.]+","g"),""),parseInt(t)}return 7}function l(){return"undefined"!=typeof opera}function c(t){return function(){return!t()}}var d=t,_={isProbablyRekonq:n("rekonq"),isProbablyAWebkit:n("webkit"),isProbablyPlaystation:n("playstation 3"),isProbablyChrome:o(n("chrome/"),h(new RegExp("chrome/([0-9]+)","g"))),isProbablyAKhtml:function(){return null===d&&(d=document.childNodes&&!document.all&&!navigator.taintEnabled&&!navigator.accentColorName),d},isProbablyKonqueror:o(n("konqueror"),h(new RegExp("konqueror/([0-9.]+)","g"))),isProbablyIE:function(t,e){return!(!o(n("msie"),h(new RegExp("msie\\s([0-9]+)[.;]","g")))(t,e)&&!o(n("rv:11.0"),(function(){return"11"}))(t,e))},isProbablyEdge:n("edge"),isProbablyFX:o(n("firefox"),h(new RegExp("firefox\\/(\\d+\\.?\\d*)"))),isProbablyOldOpera:o(l,u)};return _.isProbablyAndroidBrowser=r([n("android"),_.isProbablyAWebkit,c(_.isProbablyChrome)]),_.isProbablyOperaMobile=r([_.isProbablyOldOpera,n("opera mobi")]),_.isProbablyApple=o(r([n("safari"),a([n("ipad"),n("iphone"),n("ipod"),r([c(_.isProbablyAndroidBrowser),c(_.isProbablyChrome),c(_.isProbablyRekonq)])])]),h(new RegExp("version\\/(\\d+\\.?\\d*)"))),_.isProbablyRekonq=_.isProbablyRekonq,_.isProbablyChrome=_.isProbablyChrome,_.isProbablyAWebkit=_.isProbablyAWebkit,_.isProbablyPlaystation=_.isProbablyPlaystation,_.isProbablyAndroidBrowser=_.isProbablyAndroidBrowser,_.isProbablyOperaMobile=_.isProbablyOperaMobile,_.isProbablyApple=_.isProbablyApple,_.isProbablyAKhtml=_.isProbablyAKhtml,_.isProbablyKonqueror=_.isProbablyKonqueror,_.isProbablyIE=_.isProbablyIE,_.isProbablyEdge=_.isProbablyEdge,_.isProbablyFX=_.isProbablyFX,_.isProbablyOldOpera=_.isProbablyOldOpera,_}(),Q=function(){var t=function(){this.data=[]};return t.prototype={add:function(t){this.data.push(t)},remove:function(t){var e=this.find(t);return!(e<0||(this.data.splice(e,1),0))},contains:function(t){return this.find(t)>=0},find:function(t){for(var e=0;e0)for(e&&(s.sort(u),e=!1);s.length>0&&s[0].time<=i&&!X.unloaded;)(t=s.shift()).fun&&(v.executeTask(t),t.step&&a.push(t));for(s.length<=0&&(h=0);a.length>0;)(l=a.shift()).step&&(l.orderId=h++,v.addPackedTimedTask(l,l.step,!0));i>=r&&(r=i+n,s=[].concat(s))}}var v={toString:function(){return["[","Executor",t,s.length,"]"].join("|")},getQueueLength:function(){return s.length},packTask:function(t,e,s){return{fun:t,context:e||null,params:s||null,orderId:h++}},addPackedTimedTask:function(t,n,r){if(t.step=r?n:null,t.time=i+parseInt(n),isNaN(t.time))try{throw new Error}catch(t){var a="Executor error for time: "+n;throw t.stack&&(a+=" "+t.stack),a}s.push(t),e=!0},addRepetitiveTask:function(t,e,s,i){return this.addTimedTask(t,e,s,i,!0)},stopRepetitiveTask:function(t){t&&(t.fun=null,t.step=null)},addTimedTask:function(t,e,s,i,n){var r=this.packTask(t,s,i);return this.addPackedTimedTask(r,e,n),0==e&&f(),r},modifyTaskParam:function(t,e,s){t.params[e]=s},modifyAllTaskParams:function(t,e){t.params=e},delayTask:function(t,s){t.time+=s,e=!0},executeTask:function(t,e){try{var s=e||t.params;t.context?s?t.fun.apply(t.context,s):t.fun.apply(t.context):s?t.fun.apply(null,s):t.fun()}catch(e){try{t.fun.name||t.fun.toString()}catch(t){}}}};return H.isWebWorker()?setTimeout(m,1):m(),v.getQueueLength=v.getQueueLength,v.packTask=v.packTask,v.addPackedTimedTask=v.addPackedTimedTask,v.addRepetitiveTask=v.addRepetitiveTask,v.stopRepetitiveTask=v.stopRepetitiveTask,v.addTimedTask=v.addTimedTask,v.modifyTaskParam=v.modifyTaskParam,v.modifyAllTaskParams=v.modifyAllTaskParams,v.delayTask=v.delayTask,v.executeTask=v.executeTask,v}(),J=function(){var t=function(){this.initDispatcher()};t.prototype={initDispatcher:function(){this.theListeners=new e,this.synchEvents=!1},addListener:function(t){if(t&&!this.theListeners.contains(t)){var e={handler:t,listening:!0};this.theListeners.add(e),this.dispatchToOneListener("onListenStart",[this],e,!0)}},removeListener:function(t){if(t){var e=this.theListeners.remove(t);e&&this.dispatchToOneListener("onListenEnd",[this],e,!0)}},getListeners:function(){return this.theListeners.asArray()},useSynchEvents:function(t){this.synchEvents=!0===t},dispatchToOneListener:function(t,e,s,i){this.synchEvents?this.dispatchToOneListenerExecution(t,e,s,!0):Z.addTimedTask(this.dispatchToOneListenerExecution,0,this,[t,e,s,i])},dispatchToOneListenerExecution:function(t,e,s,i){if(s&&s.handler[t]&&(i||s.listening))try{e?s.handler[t].apply(s.handler,e):s.handler[t].apply(s.handler)}catch(t){}},dispatchEvent:function(t,e){var s=this;this.theListeners.forEach((function(i){s.dispatchToOneListener(t,e,i,!1)}))}},t.prototype.initDispatcher=t.prototype.initDispatcher,t.prototype.addListener=t.prototype.addListener,t.prototype.removeListener=t.prototype.removeListener,t.prototype.getListeners=t.prototype.getListeners,t.prototype.useSynchEvents=t.prototype.useSynchEvents,t.prototype.dispatchEvent=t.prototype.dispatchEvent;var e=function(){this._callSuperConstructor(e)};return e.prototype={remove:function(t){var e=this.find(t);if(e<0)return!1;var s=this.data[e];return s.listening=!1,this.data.splice(e,1),s},find:function(t){for(var e=0;e=this.fifoKeys.length?null:this.fifoKeys[this.fifoHead]},removeFromFifo:function(t){var e=this.fifoMap[t];if(delete this.fifoMap[t],this.fifoKeys[e]=null,this.fifoHoles++,e==this.fifoHead){for(;null===this.fifoKeys[this.fifoHead]&&this.fifoHead=this.fifoKeys.length)return this.fifoKeys=[],this.fifoMap={},this.fifoHoles=0,void(this.fifoHead=0)}if(this.fifoHoles>=o){this.fifoMap={};var s=this.fifoKeys;this.fifoKeys=[],this.fifoHead=0,this.fifoHoles=0;for(var i=0;i0;){var t=this.suspendedUpdates.shift();t.type==r?this.removeRow(t.key):this.updateRow(t.key,t.obj)}},updateRow:function(e,s){if(this.checkParsed(),this.updateInProgress)e==this.updateInProgress?this.mergeUpdate(e,s):this.updateLater(e,s);else{this.updateInProgress=e;var i=null;try{if(this.updateRowExecution(e,s),this.values.getRow(e))for(var n in t.isDebugLogEnabled()&&t.logDebug("Updating row",e,this),s)this.values.insert(s[n],e,n);else t.isDebugLogEnabled()&&t.logDebug("Inserting new row",e,this),this.updateIsKey()&&this.newKey(e),this.values.insertRow(s,e)}catch(t){i=t}if(this.updateInProgress=null,this.dequeuePostponedUpdates(),null!==i)throw i}},clean:function(){t.logInfo("Cleaning the model",this);var e=[];this.values.forEachRow((function(t){e.push(t)}));for(var s=0;s0;)(t.length>1&&t[1]>=this.parent.xMin||t[0]>=this.parent.xMin)&&this.addPoint(t[0],e[0]),t.shift(),e.shift();s.logDebug("ChartLine re-painted",this)},addPoint:function(t,e){this.xArray.push(t),this.yArray.push(e),this.parent.drawLine(t,e,this)},calcYUnit:function(){this.yUnit=(this.yMax-this.yMin)/this.parent.screenY,s.logDebug("Calculated Y unit",this,this.yUnit)},isYAxisPositioned:function(){return null!==this.yMax},isPointInRange:function(t){return tthis.yMin},getMin:function(){return this.yMin},getMax:function(){return this.yMax},paintYLabels:function(){this.clearLabels();var t="",e=-1;if(!(this.numYLabels<=0)){if(this.numYLabels>0&&(t=this.labelsFormatter?this.labelsFormatter(this.yMin):this.yMin,e=this.getRelativeY(this.yMin),this.labels[this.labels.length]=this.parent.createLabel(this.classYLabels,t,e,"Y")),this.numYLabels>1&&(t=this.labelsFormatter?this.labelsFormatter(this.yMax):this.yMax,e=this.getRelativeY(this.yMax),this.labels[this.labels.length]=this.parent.createLabel(this.classYLabels,t,e,"Y")),this.numYLabels>2)for(var i=this.numYLabels-1,n=(this.yMax-this.yMin)/i,r=this.yMin,a=1;athis.yMax)throw new Y("The maximum value must be greater than the minimum value");this.parent&&null!=this.parent.screenY&&this.parent.painter&&(this.calcYUnit(),this.paintYLabels(),this.isEmpty()||this.repaint()),s.logDebug("Y axis is now positioned",this)},getYField:function(){return this.yField}},n.prototype.setYLabels=n.prototype.setYLabels,n.prototype.setStyle=n.prototype.setStyle,n.prototype.positionYAxis=n.prototype.positionYAxis,n.prototype.getYField=n.prototype.getYField,U(n,K,"O"),n}(),nt=function(){var t=function(t){var e=!1;if(!t)try{document.createElement("canvas").getContext&&(e=!0)}catch(t){}this.useCanvas=e,this.chartArea,this.lines={}};t.prototype={setContainer:function(t){this.chartArea=document.createElement("div"),this.chartArea.style.position="absolute",this.chartArea.style.overflow="hidden",t.appendChild(this.chartArea)},clean:function(){this.chartArea&&st.isAttachedToDOM(this.chartArea)&&this.chartArea.parentNode.removeChild(this.chartArea)},setSize:function(t,e){this.chartArea.style.width=t+"px",this.chartArea.style.height=e+"px",this.areaHeight=e,this.areaWidth=t},setOffset:function(t,e){this.chartArea.style.top=e+"px",this.chartArea.style.left=t+"px"},setAreaStyle:function(t){this.chartArea.className=t},addLine:function(t){var i=t.getId();this.lines[i]=this.useCanvas?new e(t,this):new s(t,this)},removeLine:function(t){var e=t.getId();this.lines[e]&&(this.lines[e].remove(),delete this.lines[e])},clearLine:function(t){var e=t.getId();this.lines[e]&&this.lines[e].clear()},paintLine:function(t,e,s){var i=t.getId();this.lines[i]||this.addLine(t),this.lines[i].drawTo(e,s)}};var e=function(t,e){this.chartLine=t,this.lastX=null,this.lastY=null,this.painter=e,this.canvasObj=null,this.canvasEl=null};e.prototype={initCanvas:function(){if(!this.canvasEl){var t=document.createElement("canvas");t.style.position="absolute",t.style.overflow="hidden";var e=t.getContext("2d");this.painter.chartArea.appendChild(t),this.canvasEl=t,this.canvasObj=e}this.canvasEl.width=this.painter.areaWidth,this.canvasEl.height=this.painter.areaHeight},drawTo:function(t,e){if(e=this.painter.areaHeight-e,null===this.lastX)return this.initCanvas(),void this.drawPoint(t,e);this.canvasObj.beginPath(),this.canvasObj.strokeStyle=this.chartLine.lineColor,this.canvasObj.lineWidth=this.chartLine.lineSize,this.canvasObj.moveTo(this.lastX,this.lastY),this.canvasObj.lineTo(t,e),this.canvasObj.stroke(),this.drawPoint(t,e)},drawPoint:function(t,e){this.lastX=t,this.lastY=e;var s=Math.round(this.chartLine.pointSize/2);this.canvasObj.fillStyle=this.chartLine.pointColor,this.canvasObj.fillRect(t-s,e-s,this.chartLine.pointSize,this.chartLine.pointSize)},clear:function(){this.lastX=null,this.lastY=null,this.canvasObj.clearRect(0,0,this.canvasEl.width,this.canvasEl.height)},remove:function(){this.lastX=null,this.lastY=null,this.painter.chartArea.removeChild(this.canvasEl),this.canvasEl=null}};var s=function(t,e){this.chartLine=t,this.lastX=null,this.lastY=null,this.painter=e,this.pointArray=[]};return s.prototype={drawTo:function(t,e){if(null!==this.lastX){var s=t-this.lastX,i=e-this.lastY,n=Math.abs(s),r=Math.abs(i),a=null,o=0,h=0,u=0;n>=r?(u=i/s,o=s,h=s>=0?1:-1):(u=s/i,o=i,h=i>=0?1:-1);var l=0,c=0,d=null,_=null,p=!0,f=!0;n0&&(v-=w)}g-=Math.floor(d/2),v-=Math.floor(_/2),a.style.left=g+"px",a.style.top=v+"px",a.style.width=S+"px",a.style.height=y+"px"}this.drawPoint(t,e)}else this.drawPoint(t,e)},drawPoint:function(t,e){this.lastX=t,this.lastY=e},clear:function(){if(this.pointArray[0]&&st.isAttachedToDOM(this.pointArray[0]))for(var t=0;t0&&(t=this.labelsFormatter?this.labelsFormatter(this.xMin):this.xMin,e=this.getRelativeX(this.xMin),this.labels[this.labels.length]=this.createLabel(this.classXLabels,t,e,"X")),this.numXLabels>1&&(t=this.labelsFormatter?this.labelsFormatter(this.xMax):this.xMax,e=this.getRelativeX(this.xMax),this.labels[this.labels.length]=this.createLabel(this.classXLabels,t,e,"X")),this.numXLabels>2)for(var i=this.numXLabels-1,n=(this.xMax-this.xMin)/i,r=this.xMin,a=1;athis.xMax&&this.dispatchEvent("onXOverflow",[t,i,this.xMin,this.xMax]),this.chartArray){var r=this.parseValue(t,e,n,this.yParsers[n]);if(!isNaN(r)){var a=this.chartArray[n][t];if(null!=i&&null!=r){if(!a){if(a=new it(t,this,this.xFieldCode,n),this.dispatchEvent("onNewLine",[t,a,i,r]),!a.isYAxisPositioned())return void s.logError("Cannot create line. Please declare the Y axis",this);a.calcYUnit(),a.paintYLabels(),this.chartArray[n][t]=a}a.isPointInRange(r)||this.dispatchEvent("onYOverflow",[t,a,r,a.getMin(),a.getMax()]),a.addPoint(i,r)}else{if(a&&null==i&&null==r){s.logInfo("Got double nulls, clear line",this,a),a.reset();continue}s.logDebug("Got a null, ignore point",this,a)}}}},removeRowExecution:function(t){for(var e in this.chartArray)this.deleteChartLine(t,e)},deleteChartLine:function(t,e){if(this.chartArray[e]){var i=this.chartArray[e][t];i.reset(),i.clearLabels(),this.painter.removeLine(i),delete this.chartArray[e][t],this.dispatchEvent("onRemovedLine",[t,i]),s.logDebug("Line removed",this,t,e)}},clean:function(){this._callSuperMethod(i,"clean"),this.clearLabels(),this.painter&&this.painter.clean(),delete this.painter,this.setChartAnchor(this.caContainer.parentNode,!0),s.logDebug("Cleaned all",this)},parseHtml:function(){s.logInfo("Parse html for Chart",this);var e=document.getElementById(this.id);if(e){if(!st.verifyTag(e))throw new B(t);this.setChartAnchor(e),this.parsed=!0}},configureArea:function(t,e,s,i,n){if(t&&(this.areaClass=t),i&&(this.offsetY=this.checkPositiveNumber(i,!0)),n&&(this.offsetX=this.checkPositiveNumber(n,!0)),e&&(this.screenY=this.checkPositiveNumber(e,!0)),s&&(this.screenX=this.checkPositiveNumber(s,!0)),this.configurePainter(),s||e)for(var r in s&&null!=this.xMax&&(this.calcXUnit(),this.paintXLabels()),this.chartArray)for(var a in this.chartArray[r]){var o=this.chartArray[r][a];o&&o.isYAxisPositioned()&&null!=this.xMax&&(e&&(o.calcYUnit(),o.paintYLabels()),o&&!o.isEmpty()&&o.repaint())}},setXAxis:function(t,e){this.xFieldCode=t,this.xParser=e,this.clean(),s.logDebug("X axis is now configured on field",t,this)},addYAxis:function(t,e){if(V.isArray(t)){s.logDebug("Configuring multiple Y axis",this);for(var i=0;ithis.xMax)throw new Y("The maximum value must be greater than the minimum value");null!=this.screenX&&(this.calcXUnit(),this.paintXLabels()),this.repaintAll(),s.logDebug("X axis is now positioned",this)},setXLabels:function(t,e,i){this.numXLabels=this.checkPositiveNumber(t,!0),this.classXLabels=e,this.labelsFormatter=i||null,null!=this.xUnit&&this.paintXLabels(),s.logDebug("X labels now configured",this)},addListener:function(t){this._callSuperMethod(i,"addListener",[t])},removeListener:function(t){this._callSuperMethod(i,"removeListener",[t])},getListeners:function(){return this._callSuperMethod(i,"getListeners")}},i.prototype.parseHtml=i.prototype.parseHtml,i.prototype.configureArea=i.prototype.configureArea,i.prototype.setXAxis=i.prototype.setXAxis,i.prototype.addYAxis=i.prototype.addYAxis,i.prototype.removeYAxis=i.prototype.removeYAxis,i.prototype.positionXAxis=i.prototype.positionXAxis,i.prototype.setXLabels=i.prototype.setXLabels,i.prototype.addListener=i.prototype.addListener,i.prototype.removeListener=i.prototype.removeListener,i.prototype.getListeners=i.prototype.getListeners,i.prototype.clean=i.prototype.clean,i.prototype.onListenStart=i.prototype.onListenStart,i.prototype.updateRowExecution=i.prototype.updateRowExecution,i.prototype.removeRowExecution=i.prototype.removeRowExecution,U(i,et),i}(),at=function(){function t(t){var s=!1;for(var i in t)e(t[i])?s=!0:delete t[i];return s}function e(t){if(t.isCell)return t.isAttachedToDOMById();for(var e=!1,s=0;s=0&&e<=9?new Number(e):(e=e.toUpperCase(),s[e]?s[e]:(t.warn("A hexadecimal number must contain numbers between 0 and 9 and letters between A and F. An invalid value was specified, will be ignored"),null))}function n(t){var e,s=0,n=0;for(e=t.length;e>=1;e--){var r,a=i(t.substring(e-1,e));if(null==a)return null;for(r=1;r<=n;r++)a*=16;n++,s+=a}return s}function r(e){if(e.indexOf("%")==e.length-1){if((e=parseFloat(e.substring(0,e.length-1)))>100||e<0)return t.warn("A RGB element must be a number >=0 and <=255 or a percentile >=0 and <=100. An invalid value was specified, will be ignored"),null;e*=2.55}return e}function a(t,e){return!(!t||""==t||e&&t==e)}function o(t){var e=document.createElement("DIV");e.style.backgroundColor=t;var s=f.getStyle(e,c,t);if(null==s)return null;if(255==s[0]&&255==s[1]&&255==s[2]&&"WHITE"!=t.toUpperCase()){var i=document.getElementsByTagName("BODY")[0];i&&(i.appendChild(e),s=f.getStyle(e,c,t),i.removeChild(e))}return _[t]=s,_[t]}function h(t){var s="";if(_[t])return _[t];if(!j.isProbablyIE())return o(t);try{(p=ot.getFrameWindow("weswit__ColorFrame",!0))&&(p.document.bgColor=t,s=p.document.bgColor)}catch(t){s=null}if(!s||s==t){var i=document.bgColor;document.bgColor=t,s=document.bgColor,document.bgColor=i}return s&&s!=t?(_[t]=e(s),_[t]):o(t)}function u(e){var s,i;if(0==e.indexOf("rgb("))s=4,i=")";else{if(0!=e.indexOf("rgba("))return t.warn("A RGB color value must be in the form 'rgb(x, y, z)' or 'rgba(x, y, z, a)'. An invalid value was specified, will be ignored"),null;s=5,i=","}var n=(e=e.substring(s,e.length)).indexOf(","),a=r(e.substring(0,n)),o=e.indexOf(",",n+1),h=r(e.substring(n+1,o)),u=e.indexOf(i,o+1),l=r(e.substring(o+1,u));return null==a||null==h||null==l?null:[a,h,l]}var l="background-color",c="backgroundColor",d="transparent",_={},p=null,f={translateToRGBArray:function(t){return 0==t.indexOf("rgb")?u(t):0==t.indexOf("#")?e(t):h(t)},getStyle:function(t,e,s){if(null==t)return[255,255,255];var i="";try{if(window.getComputedStyle||document.defaultView&&document.defaultView.getComputedStyle){var n=document.defaultView.getComputedStyle(t,null);if(n){var r=e==c?l:e;i=n.getPropertyValue(r)}}}catch(t){}try{!a(i,s)&&t.currentStyle&&(r=e==l?c:e,i=t.currentStyle[r])}catch(t){}try{if(!a(i,s)){var o=e==l?c:e;if(""==t.style[o])return[255,255,255];i=t.style[o]}}catch(t){}return i==d&&t.parentNode?this.getStyle(t.parentNode,e):i==d?[255,255,255]:a(i,s)?this.translateToRGBArray(i):[255,255,255]}};return f}(),ut=function(){H.browserDocumentOrDie();var t=function(t){this.fadeInterval=t,this.freeFaders=new s,this.faderId=0,this.faderList={},this.fadeThread=!1,this.runningFaders={}};function e(t){return function(){t.style.backgroundColor="transparent"}}t.prototype={getNewFaderId:function(t,e,s,n,r,a){var o=this.getHowManySteps(r),h=t.incFadePhase();if(h){var u=this.freeFaders.get();return null==u?(this.faderList[this.faderId]=new i(t,e,s,n,o,h,a),this.faderId++):(this.faderList[u].init(t,e,s,n,o,h,a),u)}},getHowManySteps:function(t){var e=t/this.fadeInterval;return e>1?e:1},launchFader:function(t){var e=this.faderList[t],s=e.cell.getFadePhase();if(s){if(!(e.phaseo.steps)this.freeFaders.put(a),delete this.runningFaders[r],o.endCommand&&Z.addPackedTimedTask(o.endCommand,0);else{var h=o.cell.getEl();if(!h){this.stopFader(o.cell);continue}if("transparent"==o.endBack)try{h.style.backgroundColor="rgba("+o.startBack[0]+","+o.startBack[1]+","+o.startBack[2]+","+this.easeInOut(100,0,o.steps,o.actStep)/100+")"}catch(t){var u=(o.steps-o.actStep)*this.fadeInterval;Z.addTimedTask(e(h),u),o.endCommand&&Z.addPackedTimedTask(o.endCommand,u),this.stopFader(o.cell);continue}else o.endBack&&(h.style.backgroundColor="rgb("+this.easeInOut(o.startBack[0],o.endBack[0],o.steps,o.actStep)+","+this.easeInOut(o.startBack[1],o.endBack[1],o.steps,o.actStep)+","+this.easeInOut(o.startBack[2],o.endBack[2],o.steps,o.actStep)+")");o.endFore&&(h.style.color="rgb("+this.easeInOut(o.startFore[0],o.endFore[0],o.steps,o.actStep)+","+this.easeInOut(o.startFore[1],o.endFore[1],o.steps,o.actStep)+","+this.easeInOut(o.startFore[2],o.endFore[2],o.steps,o.actStep)+")"),n=!0}o.actStep++}if(n){var l=V.getTimeStamp(),c=l-s+i;if(c>this.fadeInterval){var d=c/this.fadeInterval,_=Math.floor(d),p=d-_;this.recoverCycles(_),c=this.fadeInterval*p}this.nextFade(this.fadeInterval-c,l)}else this.fadeThread=!1},nextFade:function(t,e){Z.addTimedTask(this.doFade,t,this,[e])},recoverCycles:function(t){for(var e in this.runningFaders){var s=this.runningFaders[e],i=this.faderList[s];i.actStep>i.steps||(i.actStep+te:t0))throw new Y(s);this.tagsToCheck=t},getNodeTypes:function(){return this.tagsToCheck},setAddOnTop:function(t){null!=this.sortField&&o.logWarn("Scroll direction is ignored if sort is enabled"),this.addOnTop=this.checkBool(t)},isAddOnTop:function(){return this.addOnTop},setSort:function(t,e,s,i){t?(this.sortField=t,this.descendingSort=this.checkBool(e,!0),this.numericSort=this.checkBool(s,!0),this.commaAsDecimalSeparator=this.checkBool(i,!0),this.sortTable()):this.sortField=null},getSortField:function(){return this.sortField},isDescendingSort:function(){return null===this.sortField?null:this.descendingSort},isNumericSort:function(){return null===this.sortField?null:this.numericSort},isCommaAsDecimalSeparator:function(){return null!==this.sortField&&this.numericSort?this.commaAsDecimalSeparator:null},extractFieldList:function(){return this.extractTypedFieldList(st.FIRST_LEVEL)},extractCommandSecondLevelFieldList:function(){return this.extractTypedFieldList(st.SECOND_LEVEL)},parseHtml:function(){},forceSubscriptionInterpretation:function(t){if(this.rowCount>0)throw new B(n);if(t){if(t!=et.UPDATE_IS_KEY&&t!=et.ITEM_IS_KEY)throw new Y(i);this.kind=t,this.forcedInterpretation=!0}else this.forcedInterpretation=!1,this.chooseInterpretation()},extractTypedFieldList:function(t){var e=this.computeFieldSymbolsSet(t),s=[];for(var i in e)s.push(i);return s},makeSortValue:function(t){return this.numericSort?V.getNumber(t,this.commaAsDecimalSeparator):null===t?t:new String(t).toUpperCase()},visualUpdateExecution:function(s,i,n){n=n||s;var r=i.coldToHotTime,a=r+i.hotTime,o=a+i.hotToColdTime,h=i.hotRowStyle,u=i.coldRowStyle,l=[],c=this.grid.getRow(s);for(var d in c)for(var _=-1,p=c[d],f=0;p&&(p.isCell||f0){var x=Z.packTask(g.asynchUpdateValue,g,[v,this.useInner]),L=this.fader.getNewFaderId(g,!1,T,I,r,x);this.fader.launchFader(L),E=!0}else this.fader.stopFader(g);if(i.hotToColdTime>0){var N=Z.packTask(g.asynchUpdateStyles,g,[v,st.COLD]);L=this.fader.getNewFaderId(g,!0,R,C,i.hotToColdTime,N),Z.addTimedTask(this.fader.launchFader,a,this.fader,[L]),w=!0}}if(!E)if(r>0)Z.addTimedTask(g.asynchUpdateValue,r,g,[v,this.useInner]);else{var M=Z.packTask(g.asynchUpdateValue,g,[v,this.useInner]);l.push(M)}w||Z.addTimedTask(g.asynchUpdateStyles,o,g,[v,st.COLD])}else r>0?Z.addTimedTask(g.asynchUpdateValue,r,g,[v,this.useInner]):(M=Z.packTask(g.asynchUpdateValue,g,[v,this.useInner]),l.push(M)),S&&(i.hotToColdTime>0?(R=S[t],C=S[e],N=Z.packTask(g.asynchUpdateStyles,g,[v,st.COLD]),L=this.fader.getNewFaderId(g,!0,R,C,i.hotToColdTime,N),Z.addTimedTask(this.fader.launchFader,a,this.fader,[L])):Z.addTimedTask(g.asynchUpdateStyles,o,g,[v,st.COLD]))}}for(var D=0;D=s+1;i--)this.map[i]=this.map[i-1],this.hashMap[this.map[i].getId()]=i;this.insertOperation(t,s)}else this.appendChild(t,!0);else this.appendChild(t,!0)},appendChild:function(t,e){t&&(t.isolation(),e||0==this.length?this.insertOperation(t,this.length):this.insertBefore(t,this.map[0]))},insertOperation:function(t,e){this.length++,this.hashMap[t.getId()]=e,this.map[e]=t,t.setParentNode(this),t.invisible()},getChild:function(t){return this.map[t]},getElementById:function(t){return this.map[this.hashMap[t]]},clean:function(){for(var t=0;t0;){var i=this.getNodeByIndex(s);if(i)if(null!=t){var n=i.getKey();if(""!=n){for(var r=this.makeSortValue(this.values.get(n,this.sortField)),a=0,o=e.length-1;a=t)for(;this.shiftDown(this.prevParent,this.clonedContainer,(t-1)*this.maxRow);)this.shiftDown(this.clonedContainer,this.nextParent,this.maxRow);else for(;this.fitFreeSpace(this.clonedContainer,this.prevParent,(t-1)*this.maxRow,!1);)this.fitFreeSpace(this.nextParent,this.clonedContainer,this.maxRow,!1);this.pageNumber=t}},calculatePages:function(){l.isDebugLogEnabled()&&l.logDebug("Calculate number of pages",this);var t=0;return t=this.maxRow<=0?1:Math.ceil(this.rowCount/this.maxRow),this.currentPages!=t&&(this.currentPages=t,this.dispatchEvent("onCurrentPagesChanged",[this.currentPages])),t},removeRowExecution:function(t){var e=this.clonesArray[t];if(e){this.rowCount--,this.calculatePages();var s=!1,i=this.prevParent,n=this.nextParent;this.dispatchEvent("onVisualUpdate",[t,null,e.element()]),this.updateIsKey()&&this.addOnTop&&null==this.sortField&&(s=this.addOnTop,i=this.nextParent,n=this.prevParent),e.isSonOf(this.clonedContainer)?(this.clonedContainer.removeChild(e),this.fitFreeSpace(n,this.clonedContainer,this.maxRow,s)):e.isSonOf(n)?n.removeChild(e):(this.prevParent.removeChild(e),this.fitFreeSpace(this.clonedContainer,i,this.maxRow*(this.pageNumber-1),s)&&this.fitFreeSpace(n,this.clonedContainer,this.maxRow,s)),this.grid.delRow(t),delete this.clonesArray[t]}},updateRowExecution:function(t,e){var s=!1,i=this.clonesArray[t];i||(i=new pt(t,this),this.clonesArray[t]=i,i.element()),mt.verifyOk(i),this.fillFormattedValues(t,e);var n=this.dispatchVisualUpdateEvent(t,e,i),r=this.willAutoScroll(),a=!this.values.getRow(t),o=null!=this.sortField?this.makeSortValue(this.values.get(t,this.sortField)):null,h=null!=this.sortField?this.makeSortValue(e[this.sortField]):null,u=o==h||!e[this.sortField]&&null!==e[this.sortField];if(null!=this.sortField&&0==u){var l=this.calculateSortedPosition(i,o,h);this.insertNodeAtIndex(l,i),a&&(this.rowCount++,s=!0)}else a&&(this.appendNode(i,!this.addOnTop),this.rowCount++,s=!0);if(this.visualUpdateExecution(t,n),this.updateInProgress=null,a&&this.updateIsKey()&&this.limitRows(),r&&i.isSonOf(this.clonedContainer)){var c=this.getNewScrollPosition(i.element());this.doAutoScroll(c)}s&&this.calculatePages()},dispatchVisualUpdateEvent:function(t,e,s){this.currentUpdateKey=t,this.currentUpdateValues=e;var i=new ft(this.grid,e,t);return this.dispatchEvent("onVisualUpdate",[t,i,s.element()]),this.currentUpdateKey=null,this.currentUpdateValues=null,i},calculateSortedPosition:function(t,e,s){for(var i=1,n=this.rowCount,r=-1;ithis.rowCount||t<=0?null:t<=this.prevParent.length?this.prevParent.getChild(t-1):(t-=this.prevParent.length)<=this.clonedContainer.length?this.clonedContainer.getChild(t-1):(t-=this.clonedContainer.length,this.nextParent.getChild(t-1))},appendNode:function(t,e){var s=e?this.prevParent:this.nextParent,i=e?this.nextParent:this.prevParent;return i.length>0||this.clonedContainer.length==this.maxRow&&this.maxRow>0?(i.appendChild(t,e),i):this.clonedContainer.length>0||s.length==this.maxRow*(this.pageNumber-1)?(this.clonedContainer.appendChild(t,e),this.clonedContainer):(s.appendChild(t,e),s)},insertNodeAtIndex:function(t,e){if(!(t>this.rowCount+1||t<=0)&&e!=this.getNodeByIndex(t)){var s,i=e.getParentNode(),n=this.clonedContainer,r=this.nextParent,a=this.prevParent,o=this.getNodeByIndex(t);null==o?s=this.appendNode(e,!0):(s=o.getParentNode()).insertBefore(e,o),s==n?i&&i!=r?i==a&&this.fitFreeSpace(n,a,this.maxRow*(this.pageNumber-1),!1):this.shiftDown(n,r,this.maxRow):s==a?i!=a&&this.shiftDown(a,n,this.maxRow*(this.pageNumber-1))&&this.shiftDown(n,r,this.maxRow):s==r&&(i==a&&this.fitFreeSpace(n,a,this.maxRow*(this.pageNumber-1),!1),this.fitFreeSpace(r,n,this.maxRow,!1))}},fitFreeSpace:function(t,e,s,i){if(this.maxRow<=0)return!1;if(e.length0){var n=t.getChild(0);return e.appendChild(n,!i),!0}return!1},shiftDown:function(t,e,s){if(this.maxRow<=0)return!1;if(t.length>s){var i=t.getChild(t.length-1);return e.insertBefore(i,e.getChild(0)),!0}return!1},limitRows:function(){for(;this.maxRow>0&&this.rowCount>this.maxRow;)this.removeRow(this.getOldestKey())},addListener:function(t){this._callSuperMethod(c,"addListener",[t])},removeListener:function(t){this._callSuperMethod(c,"removeListener",[t])},getListeners:function(){return this._callSuperMethod(c,"getListeners")}},c.prototype.setMaxDynaRows=c.prototype.setMaxDynaRows,c.prototype.getMaxDynaRows=c.prototype.getMaxDynaRows,c.prototype.goToPage=c.prototype.goToPage,c.prototype.getCurrentPages=c.prototype.getCurrentPages,c.prototype.setAutoScroll=c.prototype.setAutoScroll,c.prototype.parseHtml=c.prototype.parseHtml,c.prototype.clean=c.prototype.clean,c.prototype.addListener=c.prototype.addListener,c.prototype.removeListener=c.prototype.removeListener,c.prototype.getListeners=c.prototype.getListeners,c.prototype.updateRowExecution=c.prototype.updateRowExecution,c.prototype.removeRowExecution=c.prototype.removeRowExecution,U(c,lt),c}(),vt=function(){var t=function(t,e){this.xSpan=t||60,e=(e||20)/100,this.moreY=1+e,this.lessY=1-e,this.handledLines=new Q,this.minY,this.maxY};return t.prototype={onListenStart:function(t){this.chartTable=t},onYOverflow:function(t,e,s,i,n){var r=(n-i)/2;if(s>n){var a=n+r;s>a&&(a=s),this.maxY=a,this.updateYAxis(i,a)}else if(si){var n=(i+s)/2,r=i-s;this.chartTable.positionXAxis(n,n+r)}},onNewLine:function(t,e,s,i){this.chartTable.positionXAxis(s,s+this.xSpan);var n=i*this.lessY,r=i*this.moreY;this.handledLines.add(e),this.minY=null!==this.minY&&this.minY<=n?this.minY:n,this.maxY=null!==this.maxY&&this.maxY>=r?this.maxY:r,this.updateYAxis(this.minY,this.maxY)},onRemovedLine:function(t,e){this.handledLines.remove(e)},updateYAxis:function(t,e){this.handledLines.forEach((function(s){s.positionYAxis(t,e)}))}},t.prototype.onListenStart=t.prototype.onListenStart,t.prototype.onYOverflow=t.prototype.onYOverflow,t.prototype.onXOverflow=t.prototype.onXOverflow,t.prototype.onNewLine=t.prototype.onNewLine,t.prototype.onRemovedLine=t.prototype.onRemovedLine,t}(),St=function(){var t=0,e=function(e,s,i,n,r){this.ownerGrid=e,this.key=s,this.field=i,this.num=n||null,this.noNumIndex=r,this.cellId="s"+t++};return e.prototype={getCurrentCell:function(){var t=this.ownerGrid.getCellByKey(this.key,this.field,this.num);if(!t)return null;if(t.isCell){if(this.num===t.getNum()&&this.noNumIndex<=0)return t}else for(var e=-1,s=0;sthis.maxRow?i:this.maxRow),t[e].getField()&&(this.grid.alreadyInList(t[e])||this.grid.addCell(t[e]))}}}if(this.grid.isEmpty())throw new B(r)},computeFieldSymbolsSet:function(t){var e={};return this.grid.forEachCell((function(s,i,n){s.getFieldType()==t&&(e[n]=!0)})),e},computeItemSymbolsSet:function(){var t={};return this.grid.forEachRow((function(e){t[e]=!0})),t},updateRowExecution:function(t,e){var s,i=!this.values.getRow(t);if(this.usingItems)s=t;else{var n=null!=this.sortField?this.makeSortValue(this.values.get(t,this.sortField)):null,r=null!=this.sortField?this.makeSortValue(e[this.sortField]):null,a=n==r||void 0===e[this.sortField];if(s=null!=this.sortField&&0==a?this.calculateSortedPosition(t,n,r):i?this.addOnTop?1:this.updateIsKey()&&this.rowCount==this.maxRow?this.rowCount:this.rowCount+1:this.keyRowMap.get(t),this.updateIsKey()&&this.maxRow==this.rowCount&&i&&null!=this.sortField){var o=this.getOldestKey(),h=this.scrollOut(o);hthis.maxRow&&!this.grid.getRow(s)){var u=this.grid.getRow(s-1),l=at.scrollRow(u,null,this.useInner);this.grid.insertRow(l,s)}this.fillFormattedValues(s,e);var c=this.dispatchVisualUpdateEvent(t,s,e);this.visualUpdateExecution(s,c,t)},dispatchVisualUpdateEvent:function(t,e,s){this.currentUpdateKey=e,this.currentUpdateValues=s;var i=new ft(this.grid,s,e);return this.dispatchEvent("onVisualUpdate",[t,i,e]),this.currentUpdateKey=null,this.currentUpdateValues=null,i},getSlidingCell:function(t,e,s,i,n){return this.usingItems?t:new St(this,e,s,i,n)},getCellByKey:function(t,e,s){var i=this.keyRowMap.get(t);return this.grid.getCell(i,e,s)},removeRowExecution:function(t){var e=this.usingItems?t:this.keyRowMap.get(t);this.dispatchEvent("onVisualUpdate",[t,null,e]),this.usingItems||(e!=this.rowCount&&(this.makeRoom(this.rowCount,t),e=this.keyRowMap.get(t)),mt.verifyValue(this.rowCount,e)||o.logError("Unexpected position of row to be wiped")),this.grid.forEachCellInRow(e,(function(t){t.clean()})),this.rowCount--,this.usingItems||this.keyRowMap.remove(t)},scrollOut:function(t){var e=this.keyRowMap.get(t);return this.keyRowMap.remove(t),this.rowCount--,this.values.delRow(t),this.updateIsKey()&&this.removeFromFifo(t),e},makeRoom:function(t,e){var s=this.keyRowMap.get(e);if(t!=s){var i,n,r,a=s?at.scrollRow(this.grid.getRow(s),null,this.useInner):null,o=s?this.keyRowMap.getReverse(s):null;s?s>t?(n=s-1,r=t,i=-1):(n=s+1,r=t,i=1):null!=this.sortField||this.addOnTop?(r=t,n=this.rowCount,i=-1):(n=1,r=t,i=1);for(var h=n;h-i!=r;h+=i){var u=h-i,l=this.grid.getRow(h),c=this.grid.getRow(u);if(c||this.updateIsKey()||(c={},this.grid.insertRow(c,u),mt.verifyNotOk(s)),c)at.scrollRow(l,c,this.useInner),d=this.keyRowMap.getReverse(h),this.keyRowMap.set(d,u);else{mt.verifyOk(this.updateIsKey()),mt.verifyValue(h,n);var d=this.keyRowMap.getReverse(h);this.scrollOut(d)}}a?(at.scrollRow(a,this.grid.getRow(t),this.useInner),this.keyRowMap.set(o,t)):this.grid.forEachCellInRow(t,(function(t){t.clean()}))}},calculateSortedPosition:function(t,e,s){for(var i=1,n=this.rowCount,r=-1;i"+i+""},updateWidgetS:function(t,e){e&&this.stopBlinking(),this.widgetImageNode&&(this.widgetImageNode.style.display="none"),t.style.display="",this.widgetImageNode=t},stopBlinking:function(){this.blinkThread&&(this.blinkFlag=!1,Z.stopRepetitiveTask(this.blinkThread),this.blinkThread=null)},startBlinking:function(){},doBlinking:function(){this.updateWidgetS(this.blinkFlag?this.greyImg:this.greenImg),this.blinkFlag=!this.blinkFlag},onStatusChange:function(t){if(this.ready&&!s){var e=u;if(t==$.DISCONNECTED)this.updateWidget(x,x,x,"Disconnected",u,this.greyImg);else if(t==$.CONNECTING)this.updateWidget(x,x,"Connecting...",e,this.greyImg),this.startBlinking();else if(0==t.indexOf($.CONNECTED)){var i="Connected over ",n=this.lsClient&&0==this.lsClient.connectionDetails.getServerAddress().indexOf("https")?"S in ":" in ";t==$.CONNECTED+$.SENSE?(this.updateWidget(C,C,"Stream-sensing...",e,this.greyImg),this.startBlinking()):t==$.CONNECTED+$.WS_STREAMING?this.updateWidget(I,I,i+"WS"+n+"streaming mode",e,this.greenImg):t==$.CONNECTED+$.HTTP_STREAMING?this.updateWidget(C,I,i+"HTTP"+n+"streaming mode",e,this.greenImg):t==$.CONNECTED+$.WS_POLLING?this.updateWidget(I,C,i+"WS"+n+"polling mode",e,this.greenImg):t==$.CONNECTED+$.HTTP_POLLING&&this.updateWidget(C,C,i+"HTTP"+n+"polling mode",e,this.greenImg)}else t==$.STALLED?this.updateWidget(x,x,"Stalled",e,this.lgreenImg):t==$.TRYING_RECOVERY?(this.updateWidget(x,x,"Recovering...",e,this.lgreenImg),this.startBlinking()):this.updateWidget(x,x,"Disconnected (will retry)",e,this.greyImg)}else this.cachedStatus=t},openDetails:function(t){this.displayStatus!=c&&this.displayStatus!=d&&(this.displayStatus=d,b(this.statusTextsContainer,{visibility:"",opacity:"1",filter:"alpha(opacity=100)"}),T&&!t||this.transitionendHandler())},closeDetails:function(t){this.displayStatus!=_&&this.displayStatus!=p&&(this.displayStatus=p,b(this.statusTextsContainer,{visibility:"hidden",opacity:"0",filter:"alpha(opacity=0)"}),this.pinned=!1,T&&!t||this.transitionendHandler())},getMouseoverHandler:function(){var t=this;return function(){t.openDetails()}},getMouseoutHandler:function(){var t=this;return function(){t.pinned||t.closeDetails()}},getClickHandler:function(){var t=this;return function(){t.clickHandler()}},clickHandler:function(){this.pinned?this.closeDetails():(this.pinned=!0,this.openDetails())},getTransitionendHandler:function(){var t=this;return function(){t.transitionendHandler()}},transitionendHandler:function(){"hidden"==this.statusTextsContainer.style.visibility?this.toggleState=_:this.toggleState=c}};var I="#00C922",C="#F4DD80",x="#003D06";function L(t,e){this.led=E("div"),b(this.led,{position:"absolute",bottom:"3px",left:11+11*(e-1)+"px",width:"10px",height:"3px",borderRadius:"2px",backgroundColor:x}),t.appendChild(this.led)}return L.prototype.changeColor=function(t){b(this.led,{backgroundColor:t})},R.prototype.onStatusChange=R.prototype.onStatusChange,R.prototype.onListenStart=R.prototype.onListenStart,R.prototype.onListenEnd=R.prototype.onListenEnd,R.prototype.getDomNode=R.prototype.getDomNode,R}(),wt=function(){};wt.prototype={onNewLine:function(t,e,s,i){},onRemovedLine:function(t,e){},onXOverflow:function(t,e,s,i){},onYOverflow:function(t,e,s,i,n){}};var Tt=function(){};Tt.prototype={onCurrentPagesChanged:function(t){},onVisualUpdate:function(t,e,s){}};var Rt=function(){};Rt.prototype={onVisualUpdate:function(t,e,s){}};var It=function(t){this.delegate=t};It.prototype={setContentLength:function(t){this.delegate.setContentLength(t)},getContentLength:function(){return this.delegate.getContentLength()},setIdleTimeout:function(t){this.delegate.setIdleTimeout(t)},getIdleTimeout:function(){return this.delegate.getIdleTimeout()},setKeepaliveInterval:function(t){this.delegate.setKeepaliveInterval(t)},getKeepaliveInterval:function(){return this.delegate.getKeepaliveInterval()},setRequestedMaxBandwidth:function(t){this.delegate.setRequestedMaxBandwidth(t)},getRequestedMaxBandwidth:function(){return this.delegate.getRequestedMaxBandwidth()},getRealMaxBandwidth:function(){return this.delegate.getRealMaxBandwidth()},setPollingInterval:function(t){this.delegate.setPollingInterval(t)},getPollingInterval:function(){return this.delegate.getPollingInterval()},setReconnectTimeout:function(t){this.delegate.setReconnectTimeout(t)},getReconnectTimeout:function(){return this.delegate.getReconnectTimeout()},setStalledTimeout:function(t){this.delegate.setStalledTimeout(t)},getStalledTimeout:function(){return this.delegate.getStalledTimeout()},setRetryDelay:function(t){this.delegate.setRetryDelay(t)},getRetryDelay:function(){return this.delegate.getRetryDelay()},setFirstRetryMaxDelay:function(t){this.delegate.setFirstRetryMaxDelay(t)},getFirstRetryMaxDelay:function(){return this.delegate.getFirstRetryMaxDelay()},setSlowingEnabled:function(t){this.delegate.setSlowingEnabled(t)},isSlowingEnabled:function(){return this.delegate.isSlowingEnabled()},setForcedTransport:function(t){this.delegate.setForcedTransport(t)},getForcedTransport:function(){return this.delegate.getForcedTransport()},setServerInstanceAddressIgnored:function(t){this.delegate.setServerInstanceAddressIgnored(t)},isServerInstanceAddressIgnored:function(){return this.delegate.isServerInstanceAddressIgnored()},setCookieHandlingRequired:function(t){this.delegate.setCookieHandlingRequired(t)},isCookieHandlingRequired:function(){return this.delegate.isCookieHandlingRequired()},setReverseHeartbeatInterval:function(t){this.delegate.setReverseHeartbeatInterval(t)},getReverseHeartbeatInterval:function(){return this.delegate.getReverseHeartbeatInterval()},setHttpExtraHeaders:function(t){this.delegate.setHttpExtraHeaders(t)},getHttpExtraHeaders:function(){return this.delegate.getHttpExtraHeaders()},setHttpExtraHeadersOnSessionCreationOnly:function(t){this.delegate.setHttpExtraHeadersOnSessionCreationOnly(t)},isHttpExtraHeadersOnSessionCreationOnly:function(){return this.delegate.isHttpExtraHeadersOnSessionCreationOnly()},setSessionRecoveryTimeout:function(t){this.delegate.setSessionRecoveryTimeout(t)},getSessionRecoveryTimeout:function(){return this.delegate.getSessionRecoveryTimeout()}};var Ct=function(t){this.delegate=t};Ct.prototype={setServerAddress:function(t){this.delegate.setServerAddress(t)},getServerAddress:function(){return this.delegate.getServerAddress()},setAdapterSet:function(t){this.delegate.setAdapterSet(t)},getAdapterSet:function(){return this.delegate.getAdapterSet()},setUser:function(t){this.delegate.setUser(t)},getUser:function(){return this.delegate.getUser()},setPassword:function(t){this.delegate.setPassword(t)},getServerInstanceAddress:function(){return this.delegate.getServerInstanceAddress()},getServerSocketName:function(){return this.delegate.getServerSocketName()},getSessionId:function(){return this.delegate.getSessionId()},getClientIp:function(){return this.delegate.getClientIp()}};var xt=function(t,e){this.delegate=new M(t,e),this.connectionOptions=new It(this.delegate.connectionOptions),this.connectionDetails=new Ct(this.delegate.connectionDetails)};xt.setLoggerProvider=function(t){M.setLoggerProvider(t)},xt.LIB_NAME=M.LIB_NAME,xt.LIB_VERSION=M.LIB_VERSION,xt.prototype={connect:function(){this.delegate.connect()},disconnect:function(){this.delegate.disconnect()},getStatus:function(){return this.delegate.getStatus()},sendMessage:function(t,e,s,i,n){this.delegate.sendMessage(t,e,s,i,n)},getSubscriptions:function(){return this.delegate.getSubscriptionWrappers()},subscribe:function(t){this.delegate.subscribe(t.delegate)},unsubscribe:function(t){this.delegate.unsubscribe(t.delegate)},addListener:function(t){this.delegate.addListener(t)},removeListener:function(t){this.delegate.removeListener(t)},getListeners:function(){return this.delegate.getListeners()},registerForMpn:function(t){this.delegate.registerForMpn(t.delegate)},subscribeMpn:function(t,e){this.delegate.subscribeMpn(t.delegate,e)},unsubscribeMpn:function(t){this.delegate.unsubscribeMpn(t.delegate)},unsubscribeMpnSubscriptions:function(t){this.delegate.unsubscribeMpnSubscriptions(t)},getMpnSubscriptions:function(t){return this.delegate.getMpnSubscriptionWrappers(t)},findMpnSubscription:function(t){return this.delegate.findMpnSubscriptionWrapper(t)}};var Lt=function(t,e,s){this.delegate=new D(t,e,s,this)};Lt.prototype={isActive:function(){return this.delegate.isActive()},isSubscribed:function(){return this.delegate.isSubscribed()},setItems:function(t){this.delegate.setItems(t)},getItems:function(){return this.delegate.getItems()},setItemGroup:function(t){this.delegate.setItemGroup(t)},getItemGroup:function(){return this.delegate.getItemGroup()},setFields:function(t){this.delegate.setFields(t)},getFields:function(){return this.delegate.getFields()},setFieldSchema:function(t){this.delegate.setFieldSchema(t)},getFieldSchema:function(){return this.delegate.getFieldSchema()},getMode:function(){return this.delegate.getMode()},setDataAdapter:function(t){this.delegate.setDataAdapter(t)},getDataAdapter:function(){return this.delegate.getDataAdapter()},setSelector:function(t){this.delegate.setSelector(t)},getSelector:function(){return this.delegate.getSelector()},setRequestedMaxFrequency:function(t){this.delegate.setRequestedMaxFrequency(t)},getRequestedMaxFrequency:function(){return this.delegate.getRequestedMaxFrequency()},setRequestedBufferSize:function(t){this.delegate.setRequestedBufferSize(t)},getRequestedBufferSize:function(){return this.delegate.getRequestedBufferSize()},setRequestedSnapshot:function(t){this.delegate.setRequestedSnapshot(t)},getRequestedSnapshot:function(){return this.delegate.getRequestedSnapshot()},setCommandSecondLevelFields:function(t){this.delegate.setCommandSecondLevelFields(t)},getCommandSecondLevelFields:function(){return this.delegate.getCommandSecondLevelFields()},setCommandSecondLevelFieldSchema:function(t){this.delegate.setCommandSecondLevelFieldSchema(t)},getCommandSecondLevelFieldSchema:function(){return this.delegate.getCommandSecondLevelFieldSchema()},setCommandSecondLevelDataAdapter:function(t){this.delegate.setCommandSecondLevelDataAdapter(t)},getCommandSecondLevelDataAdapter:function(){return this.delegate.getCommandSecondLevelDataAdapter()},getValue:function(t,e){return this.delegate.getValue(t,e)},getCommandValue:function(t,e,s){return this.delegate.getCommandValue(t,e,s)},getKeyPosition:function(){return this.delegate.getKeyPosition()},getCommandPosition:function(){return this.delegate.getCommandPosition()},addListener:function(t){this.delegate.addListener(t)},removeListener:function(t){this.delegate.removeListener(t)},getListeners:function(){return this.delegate.getListeners()}};var Nt=function(){};Nt.TRACE=A.TRACE,Nt.DEBUG=A.DEBUG,Nt.INFO=A.INFO,Nt.WARN=A.WARN,Nt.ERROR=A.ERROR,Nt.FATAL=A.FATAL;var Mt=function(t){this.delegate=new q(t)};Mt.prototype.getLogger=function(t){return this.delegate.getLogger(t)};var Dt=function(t,e,s){this.delegate=new P(t,e,s)};Dt.prototype={addListener:function(t){this.delegate.addListener(t)},removeListener:function(t){this.delegate.removeListener(t)},getListeners:function(){return this.delegate.getListeners()},getPlatform:function(){return this.delegate.getPlatform()},getApplicationId:function(){return this.delegate.getApplicationId()},getDeviceToken:function(){return this.delegate.getDeviceToken()},getPreviousDeviceToken:function(){return this.delegate.getPreviousDeviceToken()},isRegistered:function(){return this.delegate.isRegistered()},isSuspended:function(){return this.delegate.isSuspended()},getStatus:function(){return this.delegate.getStatus()},getStatusTimestamp:function(){return this.delegate.getStatusTimestamp()},getDeviceId:function(){return this.delegate.getDeviceId()}};var Ot=function(){var t=arguments[0],e=arguments[1],s=arguments[2];if("string"==typeof t)this.delegate=new k(t,e,s,this);else{var i=t.delegate;this.delegate=new k(i,null,null,this)}};Ot.prototype={addListener:function(t){this.delegate.addListener(t)},removeListener:function(t){this.delegate.removeListener(t)},getListeners:function(){return this.delegate.getListeners()},getNotificationFormat:function(){return this.delegate.getNotificationFormat()},getActualNotificationFormat:function(){return this.delegate.getActualNotificationFormat()},setNotificationFormat:function(t){this.delegate.setNotificationFormat(t)},getTriggerExpression:function(){return this.delegate.getTriggerExpression()},getActualTriggerExpression:function(){return this.delegate.getActualTriggerExpression()},setTriggerExpression:function(t){this.delegate.setTriggerExpression(t)},isActive:function(){return this.delegate.isActive()},isSubscribed:function(){return this.delegate.isSubscribed()},isTriggered:function(){return this.delegate.isTriggered()},getStatus:function(){return this.delegate.getStatus()},getStatusTimestamp:function(){return this.delegate.getStatusTimestamp()},setItems:function(t){this.delegate.setItems(t)},getItems:function(){return this.delegate.getItems()},setItemGroup:function(t){this.delegate.setItemGroup(t)},getItemGroup:function(){return this.delegate.getItemGroup()},setFields:function(t){this.delegate.setFields(t)},getFields:function(){return this.delegate.getFields()},setFieldSchema:function(t){this.delegate.setFieldSchema(t)},getFieldSchema:function(){return this.delegate.getFieldSchema()},setDataAdapter:function(t){this.delegate.setDataAdapter(t)},getDataAdapter:function(){return this.delegate.getDataAdapter()},setRequestedBufferSize:function(t){this.delegate.setRequestedBufferSize(t)},getRequestedBufferSize:function(){return this.delegate.getRequestedBufferSize()},setRequestedMaxFrequency:function(t){this.delegate.setRequestedMaxFrequency(t)},getRequestedMaxFrequency:function(){return this.delegate.getRequestedMaxFrequency()},getMode:function(){return this.delegate.getMode()},getSubscriptionId:function(){return this.delegate.getSubscriptionId()}};var Pt=function(t){this.delegate=new F(t)};Pt.prototype={build:function(){return this.delegate.build()},getTitle:function(){return this.delegate.getTitle()},setTitle:function(t){return this.delegate.setTitle(t),this},getBody:function(){return this.delegate.getBody()},setBody:function(t){return this.delegate.setBody(t),this},getAction:function(){return this.delegate.getAction()},setAction:function(t){return this.delegate.setAction(t),this},getUrlArguments:function(){return this.delegate.getUrlArguments()},setUrlArguments:function(t){return this.delegate.setUrlArguments(t),this}};var kt=function(t){this.delegate=new O(t)};return kt.prototype={build:function(){return this.delegate.build()},getHeaders:function(){return this.delegate.getHeaders()},setHeaders:function(t){return this.delegate.setHeaders(t),this},getTitle:function(){return this.delegate.getTitle()},setTitle:function(t){return this.delegate.setTitle(t),this},getBody:function(){return this.delegate.getBody()},setBody:function(t){return this.delegate.setBody(t),this},getIcon:function(){return this.delegate.getIcon()},setIcon:function(t){return this.delegate.setIcon(t),this},getData:function(){return this.delegate.getData()},setData:function(t){return this.delegate.setData(t),this}},t.Chart=rt,t.ChartListener=wt,t.ClientListener=T,t.ClientMessageListener=R,t.ConsoleLogLevel=Nt,t.ConsoleLoggerProvider=Mt,t.DynaGrid=gt,t.DynaGridListener=Tt,t.FirebaseMpnBuilder=kt,t.ItemUpdate=I,t.LightstreamerClient=xt,t.Logger=E,t.LoggerProvider=w,t.MpnDevice=Dt,t.MpnDeviceListener=x,t.MpnSubscription=Ot,t.MpnSubscriptionListener=L,t.SafariMpnBuilder=Pt,t.SimpleChartListener=vt,t.StaticGrid=bt,t.StaticGridListener=Rt,t.StatusWidget=Et,t.Subscription=Lt,t.SubscriptionListener=C,t}({}),s);if("function"==typeof define&&define.amd)define("lightstreamer",["module"],(function(t){var e=t.config().ns?t.config().ns+"/":"";define(e+"LightstreamerClient",(function(){return i.LightstreamerClient})),define(e+"Subscription",(function(){return i.Subscription})),define(e+"ConsoleLogLevel",(function(){return i.ConsoleLogLevel})),define(e+"ConsoleLoggerProvider",(function(){return i.ConsoleLoggerProvider})),define(e+"MpnDevice",(function(){return i.MpnDevice})),define(e+"MpnSubscription",(function(){return i.MpnSubscription})),define(e+"SafariMpnBuilder",(function(){return i.SafariMpnBuilder})),define(e+"FirebaseMpnBuilder",(function(){return i.FirebaseMpnBuilder})),define(e+"Chart",(function(){return i.Chart})),define(e+"DynaGrid",(function(){return i.DynaGrid})),define(e+"SimpleChartListener",(function(){return i.SimpleChartListener})),define(e+"StaticGrid",(function(){return i.StaticGrid})),define(e+"StatusWidget",(function(){return i.StatusWidget})),define(e+"Logger",(function(){return i.Logger})),define(e+"LoggerProvider",(function(){return i.LoggerProvider})),define(e+"ClientListener",(function(){return i.ClientListener})),define(e+"ClientMessageListener",(function(){return i.ClientMessageListener})),define(e+"ItemUpdate",(function(){return i.ItemUpdate})),define(e+"SubscriptionListener",(function(){return i.SubscriptionListener})),define(e+"MpnDeviceListener",(function(){return i.MpnDeviceListener})),define(e+"MpnSubscriptionListener",(function(){return i.MpnSubscriptionListener})),define(e+"ChartListener",(function(){return i.ChartListener})),define(e+"DynaGridListener",(function(){return i.DynaGridListener})),define(e+"StaticGridListener",(function(){return i.StaticGridListener}))})),require(["lightstreamer"]);else{var n=function(t,e){if(!t)return e;for(var s=t.split("."),i=e||window,n=0;n.jar` file under the `kafka-connector-project/kafka-connector-utils/build/libs` folder. +This command generates the `quickstart-producer-all.jar` file under the `build/libs` folder. - Then, launch it with: +Next, create a properties file that includes encryption and authentication settings as follows: - ```sh - $ java -jar kafka-connector-utils/build/libs/lightstreamer-kafka-connector-utils-consumer-all-.jar --address http://localhost:8080 --adapter-set KafkaConnector --data-adapter QuickStartConfluentCloud --items stock-[index=1],stock-[index=2],stock-[index=3] --fields stock_name,ask,bid,min,max - ``` +```java +security.protocol=SASL_SSL +sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="" password=""; +sasl.mechanism=PLAIN +... +``` - As you can see, you have to specify a few parameters: +Replace `` and `` with the API key and API secret linked to your Confluent Cloud account, which you can generate using the *Confluent CLI* or from the *Confluent Cloud Console*. - - `--address`: the Lightstreamer Server address - - `--adapter-set`: the name of the requested Adapter Set, which triggers Ligthtreamer to activate the Kafka Connector deployed into the `adapters` folder - - `--data-adapter`: the name of the requested Data Adapter, which identifies the selected Kafka connection configuration - - `--items`: the list of items to subscribe to - - `--fields`: the list of requested fields for the items +Now, launch the producer: - > [!NOTE] - > While we've provided examples in JavaScript (suitable for web browsers) and Java (geared towards desktop applications), you are encouraged to utilize any of the [Lightstreamer client SDKs](https://lightstreamer.com/download/#client-sdks) for developing clients in other environments, including iOS, Android, Python, and more. +```sh +$ java -jar build/libs/quickstart-producer-all.jar --bootstrap-servers --topic stocks --config-file +``` -### 2. Publish the events +![producer_video](/pictures/producer-confluent.gif) - The [`examples/quickstart-producer`](/examples/quickstart-producer/) folder hosts a simple Kafka producer to publish simulated market events for the _QuickStart_ app. +### Connect a Lightstreamer Consumer - Before launching the producer, you first need to build it. Open a new shell from the folder and execute the command: +After starting the publisher, you can connect a client application to consume real-time data and display it in its frontend. Below, we'll demonstrate a browser-based example using **HTML and JavaScript**, and a **Java** example. However, you are encouraged to explore any of the [Lightstreamer client SDKs](https://lightstreamer.com/download/#client-sdks) for developing clients in other environments and languages, including **iOS, Android, Python, and more**. - ```sh - $ cd examples/quickstart-producer - $ ./gradlew build - ``` +#### Connect a Browser-based Consumer - which generates the `quickstart-producer-all.jar` file under the `build/libs` folder. +Download the provided [sample web client](web-client), based on HTML and JavaScript. Simply open the `index.html` file and watch real-time updates populate the frontend immediately. - Then, create a properties file that includes encryption and authentication settings, as follows: +![consumer_video](/pictures/end-to-end-streaming.gif) - ```java - security.protocol=SASL_SSL - sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="" password=""; - sasl.mechanism=PLAIN +As shown in the [source code](web-client/index.html), consuming live data from the Kafka Connector involves just a few steps: + +1. **Establishing a Connection:** + To connect to the Lightstreamer Kafka Connector, a `LightstreamerClient` object is created to connect to the server at `http://localhost:8080` and specifies the adapter set `KafkaConnector`, as [configured](#adapter_confid---kafka-connector-identifier) on the server side through the `id` attribute of the `adapters_conf` root tag in the `adapters.xml` file. + + ```js + var lsClient = new LightstreamerClient("http://localhost:8080", "KafkaConnector"); ... + lsClient.connect(); ``` - where you have to replace `` and `` with the API key and API secret linked to your Confluent Cloud account and generated on the _Confluent CLI_ or from the _Confluent Cloud Console_. +2. **Setting up the Data Grid:** + To visualize real-time updates, a `StaticGrid` object is instantiated and configured to display data from a `Subscription` into statically prepared HTML rows. This is a simple widget provided by the Lightstreamer client library for demonstration purposes. You are free to use any existing JavaScript framework or library to display the data. + + ```js + var stocksGrid = new StaticGrid("stocks", true); + stocksGrid.setAutoCleanBehavior(true, false); + stocksGrid.addListener({ + onVisualUpdate: function (key, info, pos) { + ... + var stockIndex = key.substring(13, key.indexOf(']')); + var color = (stockIndex % 2 == 1) ? "#fff" : "#e9fbf2"; + info.setAttribute("#fff7d5", color, "backgroundColor"); + } + }); + ``` - Now, launch the publisher: +3. **Subscribing to Live Data:** + To create a subscription, a `Subscription` object is created and configured in `MERGE` mode with a list of items and fields to subscribe to, extracted from the `StaticGrid`. - ```sh - $ java -jar build/libs/quickstart-producer-all.jar --bootstrap-servers --topic stocks --config-file + The subscription references the `QuickStartConfluentCloud` data adapter name, as [configured](#data_providername---kafka-connection-name) on the server side through the `name` attribute of the `data_provider` element in the `adapters.xml` file. The `StaticGrid` is attached as a listener to the subscription to receive and display updates. + + ```js + var stockSubscription = new Subscription("MERGE", stocksGrid.extractItemList(), stocksGrid.extractFieldList()); + stockSubscription.setDataAdapter("QuickStart"); + stockSubscription.addListener(stocksGrid); + lsClient.subscribe(stockSubscription); ``` - ![producer_video](/pictures/producer-confluent.gif) +#### Connect a Java Consumer + +In addition to the browser-based consumer above, you can set up a Java consumer. The [`kafka-connector-utils`](/kafka-connector-project/kafka-connector-utils) submodule hosts a simple Lightstreamer Java client that can be used to test the consumption of Kafka events from any Kafka topics. + +Before launching the consumer, you first need to build it from the [`kafka-connector-project`](/kafka-connector-project/) folder with the command: + +```sh +$ ./gradlew kafka-connector-utils:build +``` + +This command generates the `lightstreamer-kafka-connector-utils-consumer-all-.jar` file under the `kafka-connector-project/kafka-connector-utils/build/libs` folder. + +Then, launch it with: + +```sh +$ java -jar kafka-connector-utils/build/libs/lightstreamer-kafka-connector-utils-consumer-all-.jar --address http://localhost:8080 --adapter-set KafkaConnector --data-adapter QuickStartConfluentCloud --items stock-[index=1],stock-[index=2],stock-[index=3] --fields stock_name,ask,bid,min,max +``` -### 3. Check the consumed events +As you can see, you need to specify a few parameters: - After starting the publisher, you should immediately see the real-time updates flowing from the consumer shell: +- `--address`: the Lightstreamer Server address +- `--adapter-set`: the name of the requested Adapter Set, which triggers Lightstreamer to activate the Kafka Connector deployed into the `adapters` folder +- `--data-adapter`: the name of the requested Data Adapter, which identifies the selected Kafka connection configuration +- `--items`: the list of items to subscribe to +- `--fields`: the list of requested fields for the items - ![consumer_video](/pictures/consumer-confluent.gif) +![consumer_video](/pictures/consumer-confluent.gif) # Configuration diff --git a/examples/vendors/confluent/web-client/css/table.css b/examples/vendors/confluent/web-client/css/table.css new file mode 100644 index 00000000..f426da3e --- /dev/null +++ b/examples/vendors/confluent/web-client/css/table.css @@ -0,0 +1,110 @@ +/* + * LIGHTSTREAMER - www.lightstreamer.com + * Basic Stock-List Demo + * + * Copyright (c) Lightstreamer Srl + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + body { + font-family: Verdana, Arial, Helvetica, Sans-serif; + } + .banner { + width: 100%; + position: relative; + background-image: url("../images/banner.jpg"); + background-size: cover; + background-position: center; + font-size: 40px; + text-align: center; + color: #003D06; + padding: 20px; +} +.logo { + height: 60px; +} +.banner .title { + display: inline; + vertical-align: super; + padding-left: 4px; +} +.banner .subtitle { + font-size: 20px; +} +.ribbon { + z-index: 1; + background-color: #003D06; + overflow: hidden; + white-space: nowrap; + position: absolute; + right: -50px; + top: 40px; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + -webkit-box-shadow: 0 0 10px #888; + -moz-box-shadow: 0 0 10px #888; + box-shadow: 0 0 10px #888; +} +.ribbon a { + color: #fff; + display: block; + font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif; + margin: 1px 0; + padding: 10px 50px; + text-align: center; + text-decoration: none; + text-shadow: 0 0 5px #444; +} +.tableContainer { + overflow-x:auto; + margin-top: 1em; +} +.tableTitle { + color: #ffffff; + background-color: #003D06; + text-align: right; +} +.disc { + margin-top: 5px; + color: #000000; + background: #ffffff; + font-weight: normal; + text-align: right; + font-size: 10px; +} +.stockNameOdd { + color: #003D06; + background-color: #fff; + text-align: left; +} +.stockNameEven { + color: #003D06; + background-color: #e9fbf2; + text-align: left; +} +.coldOdd { + color: #003D06; + background-color: #fff; + text-align: right; +} +.coldEven { + color: #003D06; + background-color: #e9fbf2; + text-align: right; +} +#wrap { + margin: 0 auto; +} diff --git a/examples/vendors/confluent/web-client/images/banner.jpg b/examples/vendors/confluent/web-client/images/banner.jpg new file mode 100644 index 00000000..40bc11a5 Binary files /dev/null and b/examples/vendors/confluent/web-client/images/banner.jpg differ diff --git a/examples/vendors/confluent/web-client/images/logo.png b/examples/vendors/confluent/web-client/images/logo.png new file mode 100644 index 00000000..f074fe92 Binary files /dev/null and b/examples/vendors/confluent/web-client/images/logo.png differ diff --git a/examples/vendors/confluent/web-client/index.html b/examples/vendors/confluent/web-client/index.html new file mode 100644 index 00000000..4ea2713a --- /dev/null +++ b/examples/vendors/confluent/web-client/index.html @@ -0,0 +1,240 @@ + + + + + + + + + + Lightstreamer Kafka Connector | Basic Stock-List Demo + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameLastTimeChangeBid SizeBidAskAsk SizeMinMaxRef.Open
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
Loading...
-
-
-
-
-
-
-
-
-
-
-
+
+
Simulated market data.
+ +
+ + + diff --git a/pictures/end-to-end-streaming.gif b/pictures/end-to-end-streaming.gif new file mode 100644 index 00000000..98de95ae Binary files /dev/null and b/pictures/end-to-end-streaming.gif differ