UNPKG

diffusion

Version:

Diffusion JavaScript client

8 lines 95.2 kB
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.readOptional=t.writeOptional=t.writeBoolean=t.readBoolean=t.writeMap=t.readMap=t.readObject=t.writeObject=t.writeDictionary=t.readDictionary=t.readCollection=t.writeCollection=t.writeString=t.readString=t.writeBytes=t.readBytes=t.writeByte=t.writeInt32=t.readInt32=t.writeInt64=t.readInt64=t.readByte=void 0;var i=r(2),o=r(4),s=r(12),a=o.fromNumber(128),u=o.fromNumber(127),c=u.not();function l(e){var t=e.read();if(-1===t)throw new i.IOError("End of stream");return t}function f(e){for(var t=0,r=0;t<32;){var n=l(e);if(r|=(127&n)<<t,0==(128&n))return r;t+=7}throw new i.IOError("Malformed int32")}function h(e,t){for(;0!=(-128&t);)e.write(127&t|128),t>>>=7;e.write(t)}function p(e,t){e.write(t)}function d(e){var t=f(e);return e.readMany(t)}function g(e,t){h(e,t.length),e.writeMany(t)}function y(e){var t=d(e);return t?s.uint8toUtf8(t):""}function v(e,t){g(e,s.uint8FromUtf8(t))}function E(e,t,r,i){var o,s;h(e,Object.keys(t).length);try{for(var a=n(Object.getOwnPropertyNames(t)),u=a.next();!u.done;u=a.next()){var c=u.value;r(e,c),i(e,t[c])}}catch(e){o={error:e}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(o)throw o.error}}}function w(e,t,r){for(var n=f(e),i={},o=0;o<n;++o){i[t(e)]=r(e)}return i}t.readByte=l,t.readInt64=function(e){for(var t=o.fromNumber(0),r=0;r<64;){var n=l(e),s=o.fromNumber(n);if(t=t.or(s.and(u).shiftLeft(r)),s.and(a).equals(0))return t;r+=7}throw new i.IOError("Malformed int64")},t.writeInt64=function(e,t){for(var r=t instanceof o?t:o.fromNumber(t,!1);!r.and(c).equals(0);)e.write(r.and(u).or(a).toInt()),r=r.shiftRightUnsigned(7);e.write(r.toInt())},t.readInt32=f,t.writeInt32=h,t.writeByte=p,t.readBytes=d,t.writeBytes=g,t.readString=y,t.writeString=v,t.writeCollection=function(e,t,r){var i,o;h(e,t.length);try{for(var s=n(t),a=s.next();!a.done;a=s.next()){r(e,a.value)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}},t.readCollection=function(e,t){for(var r=f(e),n=[],i=0;i<r;++i)n.push(t(e));return n},t.readDictionary=function(e,t){return w(e,y,t)},t.writeDictionary=function(e,t,r){E(e,t,v,r)},t.writeObject=E,t.readObject=w,t.readMap=function(e,t,r){for(var n=f(e),i=new Map,o=0;o<n;++o){var s=t(e);i.set(s,r(e))}return i},t.writeMap=function(e,t,r,n){h(e,t.size),t.forEach((function(t,i){r(e,i),n(e,t)}))},t.readBoolean=function(e){return 0!==e.readInt8()},t.writeBoolean=function(e,t){e.writeInt8(t?1:0)},t.writeOptional=function(e,t,r,n){void 0===n&&(n=function(e){return null!=e}),n(t)?(p(e,1),r(e,t)):p(e,0)},t.readOptional=function(e,t){return l(e)?t(e):void 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractSerialiser=void 0;var n=r(2),i=function(){function e(){}return e.prototype.read=function(e){throw new n.InternalError("AbstractSerialiser#read is not implemented")},e.prototype.write=function(e,t){throw new n.InternalError("AbstractSerialiser#write is not implemented")},e}();t.AbstractSerialiser=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.InternalError=t.IllegalStateError=t.RetryLimitError=t.SchemaParseError=t.SchemaViolationError=t.InvalidFilterError=t.OutOfBoundsError=t.IllegalArgumentError=t.SessionError=t.IOError=t.InvalidDataError=t.AssertionError=t.RuntimeError=t.NullValueError=void 0;var o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="null_value_error",t}(Error);t.NullValueError=o;var s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.cause=r,n}return i(t,e),t.prototype.getType=function(){return t.type},t.type="runtime_error",t}(Error);t.RuntimeError=s;var a=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="assertion_error",t}(Error);t.AssertionError=a;var u=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="invalid_data_error",t}(Error);t.InvalidDataError=u;var c=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="io_error",t}(Error);t.IOError=c;var l=function(e){function t(t,r){var n=e.call(this,t)||this;return n.cause=r,n}return i(t,e),t.prototype.getType=function(){return t.type},t.type="session_error",t}(Error);t.SessionError=l;var f=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="illegal_argument_error",t}(Error);t.IllegalArgumentError=f;var h=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="out_of_bounds_error",t}(Error);t.OutOfBoundsError=h;var p=function(e){function t(t,r){var n=e.call(this,t)||this;return n.errors=r,n}return i(t,e),t.prototype.getType=function(){return t.type},t.type="invalid_filter_error",t}(Error);t.InvalidFilterError=p;var d=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="schema_violation_error",t}(Error);t.SchemaViolationError=d;var g=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="schema_parse_error",t}(Error);t.SchemaParseError=g;var y=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="retry_limit_error",t}(Error);t.RetryLimitError=y;var v=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="illegal_state_error",t}(Error);t.IllegalStateError=v;var E=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t.prototype.getType=function(){return t.type},t.type="internal_error",t}(Error);t.InternalError=E},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CIDSerialiser=t.CIDSerialiserClass=void 0;var n=r(32),i=r(0),o=function(){function e(){}return e.prototype.read=function(e){return new n.ConversationId(i.readInt64(e))},e.prototype.write=function(e,t){i.writeInt64(e,t.val)},e}();t.CIDSerialiserClass=o,t.CIDSerialiser=new o},function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},s={};function a(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),i&&(s[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),i&&(o[e]=r),r)}function u(e,t){if(isNaN(e))return t?E:v;if(t){if(e<0)return E;if(e>=d)return b}else{if(e<=-g)return I;if(e+1>=g)return R}return e<0?u(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=c;var l=Math.pow;function f(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return v;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return f(e.substring(1),t,r).neg();for(var i=u(l(r,8)),o=v,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var h=u(l(r,a));o=o.mul(h).add(u(c))}else o=(o=o.mul(i)).add(u(c))}return o.unsigned=t,o}function h(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?f(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=f,n.fromValue=h;var p=4294967296,d=p*p,g=d/2,y=a(1<<24),v=a(0);n.ZERO=v;var E=a(0,!0);n.UZERO=E;var w=a(1);n.ONE=w;var _=a(1,!0);n.UONE=_;var S=a(-1);n.NEG_ONE=S;var R=c(-1,2147483647,!1);n.MAX_VALUE=R;var b=c(-1,-1,!0);n.MAX_UNSIGNED_VALUE=b;var I=c(0,-2147483648,!1);n.MIN_VALUE=I;var T=n.prototype;T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(I)){var t=u(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(l(e,6),this.unsigned),o=this,s="";;){var a=o.div(i),c=(o.sub(a.mul(i)).toInt()>>>0).toString(e);if((o=a).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.eqz=T.isZero,T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return i(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.ne=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.le=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.ge=T.greaterThanOrEqual,T.compare=function(e){if(i(e)||(e=h(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(w)},T.neg=T.negate,T.add=function(e){i(e)||(e=h(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,f=0,p=0,d=0;return p+=(d+=o+(65535&e.low))>>>16,f+=(p+=n+u)>>>16,l+=(f+=r+a)>>>16,l+=t+s,c((p&=65535)<<16|(d&=65535),(l&=65535)<<16|(f&=65535),this.unsigned)},T.subtract=function(e){return i(e)||(e=h(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return v;if(i(e)||(e=h(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return v;if(this.eq(I))return e.isOdd()?I:v;if(e.eq(I))return this.isOdd()?I:v;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(y)&&e.lt(y))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,l=65535&e.high,f=e.low>>>16,p=65535&e.low,d=0,g=0,E=0,w=0;return E+=(w+=s*p)>>>16,g+=(E+=o*p)>>>16,E&=65535,g+=(E+=s*f)>>>16,d+=(g+=n*p)>>>16,g&=65535,d+=(g+=o*f)>>>16,g&=65535,d+=(g+=s*l)>>>16,d+=t*p+n*f+o*l+s*a,c((E&=65535)<<16|(w&=65535),(d&=65535)<<16|(g&=65535),this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(i(e)||(e=h(e)),e.isZero())throw Error("division by zero");var t,n,o;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?E:v;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return E;if(e.gt(this.shru(1)))return _;o=E}else{if(this.eq(I))return e.eq(w)||e.eq(S)?I:e.eq(I)?w:(t=this.shr(1).div(e).shl(1)).eq(v)?e.isNegative()?w:S:(n=this.sub(e.mul(t)),o=t.add(n.div(e)));if(e.eq(I))return this.unsigned?E:v;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=v}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),a=s<=48?1:l(2,s-48),f=u(t),p=f.mul(e);p.isNegative()||p.gt(n);)p=(f=u(t-=a,this.unsigned)).mul(e);f.isZero()&&(f=w),o=o.add(f),n=n.sub(p)}return o},T.div=T.divide,T.modulo=function(e){return i(e)||(e=h(e)),r?c((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.rem=T.modulo,T.not=function(){return c(~this.low,~this.high,this.unsigned)},T.and=function(e){return i(e)||(e=h(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return i(e)||(e=h(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return i(e)||(e=h(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.shr_u=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.enumerize=void 0,t.enumerize=function(e){Object.keys(e).forEach((function(t){var r=e[t].id;void 0!==r&&(e[r]=t)}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TopicTypeEnum=t.TopicType=void 0;var n=r(5),i=function(e,t,r){this.id=e,this.stateful=t,this.functional=r};t.TopicType=i,t.TopicTypeEnum={BINARY:new i(14,!0,!1),JSON:new i(15,!0,!1),STRING:new i(17,!0,!1),INT64:new i(18,!0,!1),DOUBLE:new i(19,!0,!1),TIME_SERIES:new i(16,!0,!1),RECORD_V2:new i(20,!0,!1),UNKNOWN_TOPIC_TYPE:new i(21,!1,!1)},n.enumerize(t.TopicTypeEnum)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionIdSerialiser=t.SessionIdSerialiserClass=void 0;var n=r(0),i=r(18),o=function(){function e(){}return e.prototype.read=function(e){var t=n.readInt64(e),r=n.readInt64(e);return new i.SessionId(t,r)},e.prototype.write=function(e,t){n.writeInt64(e,t.server),n.writeInt64(e,t.value)},e}();t.SessionIdSerialiserClass=o,t.SessionIdSerialiser=new o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT=t.ControlGroup=void 0;var n=function(e){this.name=e};t.ControlGroup=n,t.DEFAULT=Object.freeze(new n("default"))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MESSAGING_RECEIVER_CONTROL_DEREGISTRATION=t.MESSAGING_RECEIVER_CONTROL_REGISTRATION=t.NOTIFY_SUBSCRIPTION=t.MESSAGE_RECEIVER_CONTROL_DEREGISTRATION=t.MESSAGE_RECEIVER_CONTROL_REGISTRATION=t.UNSUBSCRIPTION_NOTIFICATION=t.TOPIC_CONTROL_DEREGISTRATION=t.TOPIC_CONTROL_REGISTRATION=void 0;var n=r(10),i=r(31),o=r(13),s=r(33),a=r(14),u=r(34),c=r(39);t.TOPIC_CONTROL_REGISTRATION={id:20,request:s.TopicControlRegistrationRequestSerialiser,response:a.NullSerialiser},t.TOPIC_CONTROL_DEREGISTRATION={id:21,request:o.TopicControlRegistrationParamsSerialiser,response:a.NullSerialiser},t.UNSUBSCRIPTION_NOTIFICATION={id:42,request:u.UnsubscriptionNotificationSerialiser,response:a.NullSerialiser},t.MESSAGE_RECEIVER_CONTROL_REGISTRATION={id:63,request:i.MessageReceiverControlRegistrationRequestSerialiser,response:a.NullSerialiser},t.MESSAGE_RECEIVER_CONTROL_DEREGISTRATION={id:64,request:n.MessageReceiverControlRegistrationParamsSerialiser,response:a.NullSerialiser},t.NOTIFY_SUBSCRIPTION={id:87,request:c.TopicSpecificationInfoSerialiser,response:a.NullSerialiser},t.MESSAGING_RECEIVER_CONTROL_REGISTRATION={id:97,request:i.MessageReceiverControlRegistrationRequestSerialiser,response:a.NullSerialiser},t.MESSAGING_RECEIVER_CONTROL_DEREGISTRATION={id:98,request:n.MessageReceiverControlRegistrationParamsSerialiser,response:a.NullSerialiser}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceiverControlRegistrationParamsSerialiser=t.MessageReceiverControlRegistrationParamsSerialiserClass=void 0;var o=r(11),s=r(0),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.write=function(e,t){s.writeInt32(e,t.definition.id),o.ControlGroupSerialiser.write(e,t.group),s.writeString(e,t.path),s.writeCollection(e,t.keys,s.writeString)},t}(r(1).AbstractSerialiser);t.MessageReceiverControlRegistrationParamsSerialiserClass=a,t.MessageReceiverControlRegistrationParamsSerialiser=new a},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.ControlGroupSerialiser=t.ControlGroupSerialiserClass=void 0;var o=r(8),s=r(0),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.read=function(e){var t=s.readString(e);return new o.ControlGroup(t)},t.prototype.write=function(e,t){s.writeString(e,t.name)},t}(r(1).AbstractSerialiser);t.ControlGroupSerialiserClass=a,t.ControlGroupSerialiser=new a},function(e,t,r){"use strict";(function(e){var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};function o(e){for(var t=[],r=0;r<e.length;r+=128)t.push(e.subarray(r,Math.min(r+128,e.length)));return t.map((function(e){return String.fromCharCode.apply(String,i([],n(e)))})).join("")}Object.defineProperty(t,"__esModule",{value:!0}),t.isUint8Array=t.isEqualUint8Arrays=t.uint8toUtf8=t.uint8ToBase64=t.uint8ToAscii=t.uint8FromDoubleBE=t.uint8FromBase64=t.uint8FromUtf8=t.uint8FromBinary=t.writeInt32BE=t.writeInt8=t.readDoubleBE=t.readFloatBE=t.readInt32BE=t.readUInt32BE=t.readUInt16BE=t.readInt8=t.concatUint8Arrays=void 0,t.concatUint8Arrays=function(e){var t,n,i=e.reduce((function(e,t){return e+t.length}),0),o=new Uint8Array(i),s=0;try{for(var a=r(e),u=a.next();!u.done;u=a.next()){var c=u.value;o.set(c,s),s+=c.length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},t.readInt8=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(t)},t.readUInt16BE=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(t,!1)},t.readUInt32BE=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!1)},t.readInt32BE=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(t,!1)},t.readFloatBE=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!1)},t.readDoubleBE=function(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!1)},t.writeInt8=function(e,t,r){e[t]=r},t.writeInt32BE=function(e,t,r){new DataView(e.buffer,e.byteOffset,e.byteLength).setInt32(t,r,!1)},t.uint8FromBinary=function(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t},t.uint8FromUtf8=function(e){return(new TextEncoder).encode(e)},t.uint8FromBase64="undefined"==typeof window||void 0===window.atob?function(t){return new Uint8Array(e.from(t,"base64"))}:function(e){return new Uint8Array(window.atob(e).split("").map((function(e){return e.charCodeAt(0)})))},t.uint8FromDoubleBE=function(e){var t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e,!1),new Uint8Array(t)},t.uint8ToAscii=o,t.uint8ToBase64="undefined"==typeof window||void 0===window.btoa?function(t){return e.from(t).toString("base64")}:function(e){return window.btoa(o(e))},t.uint8toUtf8=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.length),(new TextDecoder).decode(e.subarray(t,r))},t.isEqualUint8Arrays=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0},t.isUint8Array=function(e){return"function"==typeof Uint8Array&&e instanceof Uint8Array||"[object Uint8Array]"===Object.prototype.toString.call(e)}}).call(this,r(26).Buffer)},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.TopicControlRegistrationParamsSerialiser=t.TopicControlRegistrationParamsSerialiserClass=void 0;var o=r(11),s=r(0),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.write=function(e,t){s.writeInt32(e,t.definition.id),o.ControlGroupSerialiser.write(e,t.group),s.writeString(e,t.path)},t}(r(1).AbstractSerialiser);t.TopicControlRegistrationParamsSerialiserClass=a,t.TopicControlRegistrationParamsSerialiser=new a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NullSerialiser=void 0,t.NullSerialiser={read:function(){return null},write:function(){}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.write=t.read=void 0;var n=r(2),i=r(0);t.read=function(e,t){var r=i.readByte(e);if(void 0===t[r])throw new n.IllegalArgumentError("Unable to decode enum value "+r);return t[t[r]]},t.write=function(e,t){"number"==typeof t?i.writeByte(e,t):i.writeByte(e,t.id)}},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.TopicSpecification=void 0;var o=r(2),s=["PUBLISH_VALUES_ONLY","SCHEMA","VALIDATE_VALUES","TIDY_ON_UNSUBSCRIBE","TIME_SERIES_EVENT_VALUE_TYPE","TIME_SERIES_RETAINED_RANGE","TIME_SERIES_SUBSCRIPTION_RANGE","DONT_RETAIN_VALUE","PERSISTENT","REMOVAL","OWNER","COMPRESSION","CONFLATION","PRIORITY"],a=function(){function e(e,t){void 0===t&&(t={}),this.type=e,this.properties=t}return e.prototype.withProperty=function(t,r){var i;if("string"!=typeof t||s.indexOf(t.toUpperCase())<0)throw new o.IllegalArgumentError("Invalid key: "+t);if("string"!=typeof r)throw new o.IllegalArgumentError("Invalid value, must be string: "+r);var a=n(n({},this.properties),((i={})[t]=r,i));return new e(this.type,a)},e.prototype.withProperties=function(t){var r,a;try{for(var u=i(Object.getOwnPropertyNames(t)),c=u.next();!c.done;c=u.next()){var l=c.value;if("string"!=typeof l||s.indexOf(l.toUpperCase())<0)throw new o.IllegalArgumentError("Invalid key: "+l);var f=t[l];if("string"!=typeof f)throw new o.IllegalArgumentError("Invalid value, must be string: "+f)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(r)throw r.error}}var h=n(n({},this.properties),t);return new e(this.type,h)},e.PUBLISH_VALUES_ONLY="PUBLISH_VALUES_ONLY",e.VALIDATE_VALUES="VALIDATE_VALUES",e.TIDY_ON_UNSUBSCRIBE="TIDY_ON_UNSUBSCRIBE",e.TIME_SERIES_EVENT_VALUE_TYPE="TIME_SERIES_EVENT_VALUE_TYPE",e.TIME_SERIES_RETAINED_RANGE="TIME_SERIES_RETAINED_RANGE",e.TIME_SERIES_SUBSCRIPTION_RANGE="TIME_SERIES_SUBSCRIPTION_RANGE",e.SCHEMA="SCHEMA",e.DONT_RETAIN_VALUE="DONT_RETAIN_VALUE",e.PERSISTENT="PERSISTENT",e.REMOVAL="REMOVAL",e.CONFLATION="CONFLATION",e.OWNER="OWNER",e.COMPRESSION="COMPRESSION",e.PRIORITY="PRIORITY",e}();t.TopicSpecification=a},function(e,t,r){"use strict";var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.setLevel=t.create=t.LoggingLevel=void 0;var i,o=r(42);function s(e,t){var r="|"+e.toUpperCase()+"|"+t+"|",n=function(){return new Date};return function(t,i){i?o[e](n()+r+t,i):o[e](n()+r+t)}}!function(e){e.trace="trace",e.debug="debug",e.info="info",e.warn="warn",e.error="error"}(i=t.LoggingLevel||(t.LoggingLevel={})),t.create=function(e){var t,r,o={};try{for(var a=n(Object.keys(i)),u=a.next();!u.done;u=a.next()){var c=u.value;o[c]=s(c,e)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},t.setLevel=o.setLevel},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionId=void 0;var n=r(2),i=r(4),o=function(){function e(e,t){this.server=e,this.value=t}return e.fromString=function(t){var r,o=t.split("-");if(2!==o.length)throw new n.IllegalArgumentError("SessionId must consist of two hexadecimal parts, joined with a '-'");try{r=new e(i.fromString(o[0],!1,16),i.fromString(o[1],!1,16))}catch(e){throw new n.IllegalArgumentError("SessionId must consist of two hexadecimal parts, joined with a '-'")}return r},e.validate=function(t){if(t instanceof e)return t;if(0===t.length||t.indexOf("-")<0||t.indexOf(" ")>=0)return!1;try{return e.fromString(t)}catch(e){return!1}},e.prototype.toString=function(){var e="0000000000000000"+this.server.toUnsigned().toString(16),t="0000000000000000"+this.value.toUnsigned().toString(16);return(e.substr(e.length-16)+"-"+t.substr(t.length-16)).toLowerCase()},e}();t.SessionId=o},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0}),t.MessagingResponseSerialiser=t.MessagingResponseSerialiserClass=void 0;var o=r(0),s=r(1),a=r(49),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.read=function(e){var t=o.readString(e),r=o.readBytes(e);return new a.MessagingResponse(t,r)},t.prototype.write=function(e,t){o.writeString(e,t.responseDataType),o.writeBytes(e,t.data)},t}(s.AbstractSerialiser);t.MessagingResponseSerialiserClass=u,t.MessagingResponseSerialiser=new u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorReason=void 0;var n=function(){function e(e,t){this.id=e,this.reason=t}return e.prototype.toString=function(){return this.id+": "+this.reason},e}();t.ErrorReason=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requireNonNull=void 0;var n=r(2);t.requireNonNull=function(e,t){if(null==e)throw new n.NullValueError(t+" is null");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),void 0===window._diffusion_features&&(window._diffusion_features={client_control:{},gateway_control:{},log_retrieval:{},messages:{},metrics:{},ping:{},remote_servers:{},replace_license:{},security:{},session_lock:{},session_trees:{},topic_control:{},topic_notifications:{},topic_update:{},topic_views:{},time_series:{}});var n=r(23);window._diffusion_features.messages.MessagesImpl=n.MessagesImpl},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesImpl=void 0;var o=r(2),s=r(24),a=r(8),u=r(25),c=r(43),l=r(9),f=r(18),h=r(17),p=r(21),d=r(58),g=r(59),y=h.create("Session.Messages"),v=function(e,t,r){this.reqType=e,this.resType=t,this.stream=r},E=function(){function e(e,t,r){this.callback=e,this.context=t,this.responseType=r}return e.prototype.respond=function(e){var t=this.context.DataTypes;if(0===arguments.length)throw new o.IllegalArgumentError("No argument provided to the responder");if(null==e&&!this.responseType)throw new o.IllegalArgumentError("No response type has been provided and the value provided is null. Unable to determine the response type.");var r=this.responseType?t.getChecked(this.responseType):t.getByValue(e);if(void 0===r)throw new o.IllegalArgumentError("Unable to determine the response type.");var n=r.writeValueToArray(e);this.callback.respond({responseDataType:r.name(),data:n})},e.prototype.reject=function(e){this.callback.fail(g.ErrorReason.REJECTED_REQUEST,e)},e}();var w=function(){function e(e){var t=this;this.requestStreams={},this.internal=e;var r=this.internal.getContext().DataTypes,n=e.getServiceLocator();this.MESSAGING_SEND=n.obtain(c.MESSAGING_SEND),this.MESSAGING_FILTER_SEND=n.obtain(c.MESSAGING_FILTER_SEND),this.MESSAGING_RECEIVER_SERVER=n.obtain(c.MESSAGING_RECEIVER_SERVER),this.deregisterRequestHandler=n.obtain(l.MESSAGING_RECEIVER_CONTROL_DEREGISTRATION);var i=e.getServiceRegistry();i.add(c.MESSAGING_SEND,s.create((function(n,i,o){var s=t.requestStreams[i.path];if(void 0!==s){var a,u,c=new E(o,e.getContext(),s.resType),l=r.get(i.dataType),f=s.reqType?s.reqType:l.valueClass;if(l.canReadAs(f)){var h=void 0;try{h=l.readAs(f,i.request)}catch(e){return y.error("Failed to convert "+l.name()+" datatype to "+f),s.stream.onError(g.ErrorReason.INVALID_DATA),void delete t.requestStreams[i.path]}try{s.stream.onRequest(i.path,h,c)}catch(e){y.error("Messaging request stream threw an error",e),o.fail(g.ErrorReason.CALLBACK_EXCEPTION,e.stack)}}else{var p="Messaging request for path '"+i.path+"' with "+l.name()+" datatype is incompatible for stream ("+f.name+")";y.debug(p),o.fail(g.ErrorReason.INCOMPATIBLE_DATATYPE,p)}}else o.fail(g.ErrorReason.UNHANDLED_MESSAGE,(a=n.getSessionId(),u=i.path,"Session "+a+" has no registered streams for message sent to path '"+u+"'"))}))),i.add(c.FILTER_RESPONSE,s.create((function(e,t,r){r.respond(),e.getConversationSet().respondIfPresent(t.cid,t)}))),i.add(c.MESSAGING_RECEIVER_CLIENT,s.create((function(e,t,r){e.getConversationSet().respondIfPresent(t.cid,{request:t,callback:r.respond,fail:r.fail})})))}return e.prototype.addRequestHandler=function(e,t,r,n){var i=this,o=this.internal.getContext().DataTypes;return new Promise((function(s,l){if(i.internal.checkConnected(l)){try{p.requireNonNull(e,"Message path"),p.requireNonNull(t,"Request handler")}catch(e){return void l(e)}y.debug("Adding request handler",e);var f={definition:c.MESSAGING_RECEIVER_CLIENT,group:a.DEFAULT,path:e,keys:void 0!==r?r:[]},h={active:function(r,n){y.debug("Request handler active",e),s({close:function(){return new Promise((function(e){i.deregisterRequestHandler.send(f,(function(r,o){r?(i.internal.getConversationSet().discard(n,r),y.debug("Error with request handler deregistration: ",r)):(t.onClose(),i.internal.getConversationSet().respondIfPresent(n,o)),e()}))}))}})},respond:function(r){y.debug("Request handler pair.request",e);var i={sessionId:r.request.sessionID,path:r.request.path,properties:r.request.properties};try{var s=(n||o.getChecked(r.request.dataType)).readValue(r.request.content),a={respond:function(e,t){var n=o.getChecked(void 0!==t?t:e);r.callback({responseDataType:n.name(),data:n.writeValueToArray(e)})},reject:function(e){r.fail(g.ErrorReason.REJECTED_REQUEST,e,!1)}};return t.onRequest(s,i,a),!1}catch(e){return y.info("An exception has occurred whilst processing the request:",e),t.onError(e),r.fail(g.ErrorReason.CALLBACK_EXCEPTION,e&&e.message),!1}},close:function(){y.debug("Request handler closed",e),t.onClose()}};u.registerRequestHandler(i.internal,f,h).then(void 0,(function(e){l(e)}))}}))},e.prototype.sendRequestToController=function(e,t,r,n,i,o){var s,a=this.internal.getContext().DataTypes;try{p.requireNonNull(r,"Message path"),p.requireNonNull(n,"Request")}catch(e){return void t(e)}try{s=i?a.getChecked(i):a.getByValue(n)}catch(e){return void t(e)}void 0!==s?(y.debug("Sending request to server",n),this.MESSAGING_SEND.send({path:r,dataType:s.name(),request:s.writeValueToArray(n)},(function(n,i){var s;if(d.responseSuccess(n,i)){y.debug("Request complete",r);try{s=a.getChecked(o||i.responseDataType),e(s.readValue(i.data))}catch(e){t(e)}}else y.debug("Request failed",r),t(n)}))):t(new Error("Could not determine request type"))},e.prototype.sendRequestToSession=function(e,t,r,n,i,o,s){var a,u=this.internal.getContext().DataTypes;try{p.requireNonNull(i,"Session ID"),p.requireNonNull(r,"Message path"),p.requireNonNull(n,"Request")}catch(e){return void t(e)}try{a=o?u.getChecked(o):u.getByValue(n)}catch(e){return void t(e)}void 0!==a?(y.debug("Sending request to session",i,n),this.MESSAGING_RECEIVER_SERVER.send({sessionId:i,path:r,dataType:a.name(),request:a.writeValueToArray(n)},(function(n,i){var o;if(d.responseSuccess(n,i)){y.debug("Request complete",r);try{o=u.getChecked(s||i.responseDataType),e(o.readValue(i.data))}catch(e){t(e)}}else y.debug("Request failed",r),t(n)}))):t(new Error("Could not determine request type"))},e.prototype.sendRequest=function(e,t,r,n,i){var o=this;return new Promise((function(s,a){if(o.internal.checkConnected(a))try{if(r instanceof f.SessionId)o.sendRequestToSession(s,a,e,t,r,n,i);else if("string"==typeof r){var u=function(e){try{return f.SessionId.fromString(e)}catch(e){return!1}}(r);u?o.sendRequestToSession(s,a,e,t,u,n,i):o.sendRequestToController(s,a,e,t,r,n)}else o.sendRequestToController(s,a,e,t,r,n)}catch(e){a(e)}}))},e.prototype.sendRequestToFilter=function(e,t,r,o,s,a){var u=this,c=this.internal.getContext().DataTypes;return new Promise((function(l,f){return n(u,void 0,void 0,(function(){var n,u,h,g,v,E,w=this;return i(this,(function(i){switch(i.label){case 0:if(!this.internal.checkConnected(f))return[3,2];try{p.requireNonNull(t,"Message path"),p.requireNonNull(e,"Session filter"),p.requireNonNull(r,"Request"),p.requireNonNull(o,"Response callback")}catch(e){return f(e),[2]}n=void 0;try{n=s?c.getChecked(s):c.getByValue(r)}catch(e){return f(e),[2]}return void 0===n?(f(new Error("Could not determine request type")),[2]):(u=0,h=-1,g=function(){return u>=h&&-1!==h||0===h},[4,this.internal.getConversationSet().newConversation({onOpen:function(){},onResponse:function(e,t){if(null===t)return!0;if("number"==typeof t)return h=t,g();var r=t.sessionID;if(u++,t.errorReason)o.onResponseError(r,t.errorReason);else{var n=c.getByName(t.response.responseDataType),i=void 0;try{i=c.getChecked(a||t.response.responseDataType)}catch(e){return o.onResponseError(r,e),g()}if(n.canReadAs(i.valueClass)){var s=void 0;try{s=n.readAs(i.valueClass,t.response.data)}catch(e){return o.onResponseError(r,e),g()}try{o.onResponse(r,s)}catch(e){y.error("Exception within messaging filter callback",e)}}else o.onResponseError(r,new Error("The received response was a "+n+", which cannot be read as: "+i))}return g()},onDiscard:function(){}})]);case 1:v=i.sent(),y.debug("Sending filter request to server",r),E=void 0;try{E=n.writeValueToArray(r)}catch(e){return f(e),[2]}this.MESSAGING_FILTER_SEND.send({cid:v,path:t,filter:e,dataType:n,request:E},(function(e,r){d.responseSuccess(e,r)?r.isSuccess?(y.debug("Request complete",t),w.internal.getConversationSet().respondIfPresent(v,r.numberSent),l(r.numberSent)):(y.debug("Request failed",t),w.internal.getConversationSet().respondIfPresent(v,null),f(r.errors)):(y.debug("Request failed",t),w.internal.getConversationSet().respondIfPresent(v,null),f(e))})),i.label=2;case 2:return[2]}}))}))}))},e.prototype.setRequestStream=function(e,t,r,n){var i=this.internal.getContext().DataTypes,o=new v(r?i.getValueClassChecked(r):void 0,n?i.getValueClassChecked(n):void 0,t),s=this.requestStreams[e];return this.requestStreams[e]=o,s?s.stream:void 0},e.prototype.removeRequestStream=function(e){var t=this.requestStreams[e];return delete this.requestStreams[e],t?t.stream:void 0},e}();t.MessagesImpl=w},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0,t.create=function(e){return{onRequest:function(t,r,n){try{e(t,r,n)}catch(e){n.fail(t.getContext().ErrorReason.CALLBACK_EXCEPTION,e.message)}}}}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},u=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.registerTopicHandler=t.registerRequestHandler=t.registerHandler=t.registrationCallback=t.responseHandler=t.ResponseHandlerState=void 0;var c,l=r(9),f=r(17).create("Registration");!function(e){e[e.REGISTERING=0]="REGISTERING",e[e.ACTIVE=1]="ACTIVE",e[e.CLOSED=2]="CLOSED"}(c=t.ResponseHandlerState||(t.ResponseHandlerState={}));var h=function(e){function t(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=e.apply(this,u([],a(r)))||this;return i.cause=t,i}return i(t,e),t}(Error);function p(e,t,r){var n,i=c.REGISTERING;return{onDiscard:function(r,n){try{n instanceof e.getContext().CloseReason?t.close():t.close(n)}catch(n){f.error("REGISTERED_HANDLER_EXCEPTION",n)}i=c.CLOSED},onOpen:function(t){n=function(){return new Promise((function(n,o){i!==c.CLOSED?r(t,(function(r){r?(e.getConversationSet().discard(t,r),o(r)):(e.getConversationSet().respondIfPresent(t,c.CLOSED),n())})):o(new Error("Handler already closed"))}))}},onResponse:function(r,o){if(o===c.CLOSED){try{t.close()}catch(e){f.error("REGISTERED_HANDLER_EXCEPTION",e)}return i=o,!0}try{return o===c.ACTIVE?(t.active(n,r),i=o,!1):t.respond(o)}catch(t){f.error("REGISTERED_HANDLER_EXCEPTION",t),e.getConversationSet().discard(r,new h(t,"An error was thrown by the handler")),n().catch((function(e){f.debug("Failed to deregister with the server",e)}))}return!0}}}function d(e,t,r,n){return function(i){i?(e.discard(t,i),n(i)):(e.respondIfPresent(t,c.ACTIVE),r())}}function g(e,t,r,n,i){return o(this,void 0,void 0,(function(){var o,a,u,c,l;return s(this,(function(s){switch(s.label){case 0:return o=e.getConversationSet(),a=e.getServiceLocator(),u=a.obtain(n),c=a.obtain(i),[4,o.newConversation(p(e,r,(function(e,r){c.send(t,r)})))];case 1:return l=s.sent(),[2,new Promise((function(e,r){u.send({params:t,cid:l},d(o,l,e,r))}))]}}))}))}t.responseHandler=p,t.registrationCallback=d,t.registerHandler=g,t.registerRequestHandler=function(e,t,r){return g(e,t,r,l.MESSAGING_RECEIVER_CONTROL_REGISTRATION,l.MESSAGING_RECEIVER_CONTROL_DEREGISTRATION)},t.registerTopicHandler=function(e,t,r){return g(e,t,r,l.TOPIC_CONTROL_REGISTRATION,l.TOPIC_CONTROL_DEREGISTRATION)}},function(e,t,r){"use strict";(function(e){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <http://feross.org> * @license MIT */ var n=r(28),i=r(29),o=r(30);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView