-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecho-8LOtPuFk
8 lines (8 loc) · 76.9 KB
/
echo-8LOtPuFk
1
2
3
4
5
6
7
8
function fe(f){"@babel/helpers - typeof";return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},fe(f)}function j(f,l){if(!(f instanceof l))throw new TypeError("Cannot call a class as a function")}function ct(f,l){for(var a=0;a<l.length;a++){var o=l[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(f,o.key,o)}}function N(f,l,a){return l&&ct(f.prototype,l),a&&ct(f,a),Object.defineProperty(f,"prototype",{writable:!1}),f}function oe(){return oe=Object.assign||function(f){for(var l=1;l<arguments.length;l++){var a=arguments[l];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(f[o]=a[o])}return f},oe.apply(this,arguments)}function z(f,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");f.prototype=Object.create(l&&l.prototype,{constructor:{value:f,writable:!0,configurable:!0}}),Object.defineProperty(f,"prototype",{writable:!1}),l&&Ee(f,l)}function pe(f){return pe=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},pe(f)}function Ee(f,l){return Ee=Object.setPrototypeOf||function(o,s){return o.__proto__=s,o},Ee(f,l)}function Tr(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pr(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function xr(f,l){if(l&&(typeof l=="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pr(f)}function M(f){var l=Tr();return function(){var o=pe(f),s;if(l){var u=pe(this).constructor;s=Reflect.construct(o,arguments,u)}else s=o.apply(this,arguments);return xr(this,s)}}var Ae=function(){function f(){j(this,f)}return N(f,[{key:"listenForWhisper",value:function(a,o){return this.listen(".client-"+a,o)}},{key:"notification",value:function(a){return this.listen(".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated",a)}},{key:"stopListeningForWhisper",value:function(a,o){return this.stopListening(".client-"+a,o)}}]),f}(),lt=function(){function f(l){j(this,f),this.namespace=l}return N(f,[{key:"format",value:function(a){return[".","\\"].includes(a.charAt(0))?a.substring(1):(this.namespace&&(a=this.namespace+"."+a),a.replace(/\./g,"\\"))}},{key:"setNamespace",value:function(a){this.namespace=a}}]),f}(),ge=function(f){z(a,f);var l=M(a);function a(o,s,u){var h;return j(this,a),h=l.call(this),h.name=s,h.pusher=o,h.options=u,h.eventFormatter=new lt(h.options.namespace),h.subscribe(),h}return N(a,[{key:"subscribe",value:function(){this.subscription=this.pusher.subscribe(this.name)}},{key:"unsubscribe",value:function(){this.pusher.unsubscribe(this.name)}},{key:"listen",value:function(s,u){return this.on(this.eventFormatter.format(s),u),this}},{key:"listenToAll",value:function(s){var u=this;return this.subscription.bind_global(function(h,L){if(!h.startsWith("pusher:")){var w=u.options.namespace.replace(/\./g,"\\"),B=h.startsWith(w)?h.substring(w.length+1):"."+h;s(B,L)}}),this}},{key:"stopListening",value:function(s,u){return u?this.subscription.unbind(this.eventFormatter.format(s),u):this.subscription.unbind(this.eventFormatter.format(s)),this}},{key:"stopListeningToAll",value:function(s){return s?this.subscription.unbind_global(s):this.subscription.unbind_global(),this}},{key:"subscribed",value:function(s){return this.on("pusher:subscription_succeeded",function(){s()}),this}},{key:"error",value:function(s){return this.on("pusher:subscription_error",function(u){s(u)}),this}},{key:"on",value:function(s,u){return this.subscription.bind(s,u),this}}]),a}(Ae),Or=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"whisper",value:function(s,u){return this.pusher.channels.channels[this.name].trigger("client-".concat(s),u),this}}]),a}(ge),Lr=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"whisper",value:function(s,u){return this.pusher.channels.channels[this.name].trigger("client-".concat(s),u),this}}]),a}(ge),Er=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"here",value:function(s){return this.on("pusher:subscription_succeeded",function(u){s(Object.keys(u.members).map(function(h){return u.members[h]}))}),this}},{key:"joining",value:function(s){return this.on("pusher:member_added",function(u){s(u.info)}),this}},{key:"whisper",value:function(s,u){return this.pusher.channels.channels[this.name].trigger("client-".concat(s),u),this}},{key:"leaving",value:function(s){return this.on("pusher:member_removed",function(u){s(u.info)}),this}}]),a}(ge),dt=function(f){z(a,f);var l=M(a);function a(o,s,u){var h;return j(this,a),h=l.call(this),h.events={},h.listeners={},h.name=s,h.socket=o,h.options=u,h.eventFormatter=new lt(h.options.namespace),h.subscribe(),h}return N(a,[{key:"subscribe",value:function(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}},{key:"unsubscribe",value:function(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}},{key:"listen",value:function(s,u){return this.on(this.eventFormatter.format(s),u),this}},{key:"stopListening",value:function(s,u){return this.unbindEvent(this.eventFormatter.format(s),u),this}},{key:"subscribed",value:function(s){return this.on("connect",function(u){s(u)}),this}},{key:"error",value:function(s){return this}},{key:"on",value:function(s,u){var h=this;return this.listeners[s]=this.listeners[s]||[],this.events[s]||(this.events[s]=function(L,w){h.name===L&&h.listeners[s]&&h.listeners[s].forEach(function(B){return B(w)})},this.socket.on(s,this.events[s])),this.listeners[s].push(u),this}},{key:"unbind",value:function(){var s=this;Object.keys(this.events).forEach(function(u){s.unbindEvent(u)})}},{key:"unbindEvent",value:function(s,u){this.listeners[s]=this.listeners[s]||[],u&&(this.listeners[s]=this.listeners[s].filter(function(h){return h!==u})),(!u||this.listeners[s].length===0)&&(this.events[s]&&(this.socket.removeListener(s,this.events[s]),delete this.events[s]),delete this.listeners[s])}}]),a}(Ae),ft=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"whisper",value:function(s,u){return this.socket.emit("client event",{channel:this.name,event:"client-".concat(s),data:u}),this}}]),a}(dt),Ar=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"here",value:function(s){return this.on("presence:subscribed",function(u){s(u.map(function(h){return h.user_info}))}),this}},{key:"joining",value:function(s){return this.on("presence:joining",function(u){return s(u.user_info)}),this}},{key:"whisper",value:function(s,u){return this.socket.emit("client event",{channel:this.name,event:"client-".concat(s),data:u}),this}},{key:"leaving",value:function(s){return this.on("presence:leaving",function(u){return s(u.user_info)}),this}}]),a}(ft),ve=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"subscribe",value:function(){}},{key:"unsubscribe",value:function(){}},{key:"listen",value:function(s,u){return this}},{key:"listenToAll",value:function(s){return this}},{key:"stopListening",value:function(s,u){return this}},{key:"subscribed",value:function(s){return this}},{key:"error",value:function(s){return this}},{key:"on",value:function(s,u){return this}}]),a}(Ae),ut=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"whisper",value:function(s,u){return this}}]),a}(ve),Rr=function(f){z(a,f);var l=M(a);function a(){return j(this,a),l.apply(this,arguments)}return N(a,[{key:"here",value:function(s){return this}},{key:"joining",value:function(s){return this}},{key:"whisper",value:function(s,u){return this}},{key:"leaving",value:function(s){return this}}]),a}(ve),Re=function(){function f(l){j(this,f),this._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},broadcaster:"pusher",csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"},this.setOptions(l),this.connect()}return N(f,[{key:"setOptions",value:function(a){this.options=oe(this._defaultOptions,a);var o=this.csrfToken();return o&&(this.options.auth.headers["X-CSRF-TOKEN"]=o,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=o),o=this.options.bearerToken,o&&(this.options.auth.headers.Authorization="Bearer "+o,this.options.userAuthentication.headers.Authorization="Bearer "+o),a}},{key:"csrfToken",value:function(){var a;return typeof window<"u"&&window.Laravel&&window.Laravel.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&typeof document.querySelector=="function"&&(a=document.querySelector('meta[name="csrf-token"]'))?a.getAttribute("content"):null}}]),f}(),ht=function(f){z(a,f);var l=M(a);function a(){var o;return j(this,a),o=l.apply(this,arguments),o.channels={},o}return N(a,[{key:"connect",value:function(){typeof this.options.client<"u"?this.pusher=this.options.client:this.options.Pusher?this.pusher=new this.options.Pusher(this.options.key,this.options):this.pusher=new Pusher(this.options.key,this.options)}},{key:"signin",value:function(){this.pusher.signin()}},{key:"listen",value:function(s,u,h){return this.channel(s).listen(u,h)}},{key:"channel",value:function(s){return this.channels[s]||(this.channels[s]=new ge(this.pusher,s,this.options)),this.channels[s]}},{key:"privateChannel",value:function(s){return this.channels["private-"+s]||(this.channels["private-"+s]=new Or(this.pusher,"private-"+s,this.options)),this.channels["private-"+s]}},{key:"encryptedPrivateChannel",value:function(s){return this.channels["private-encrypted-"+s]||(this.channels["private-encrypted-"+s]=new Lr(this.pusher,"private-encrypted-"+s,this.options)),this.channels["private-encrypted-"+s]}},{key:"presenceChannel",value:function(s){return this.channels["presence-"+s]||(this.channels["presence-"+s]=new Er(this.pusher,"presence-"+s,this.options)),this.channels["presence-"+s]}},{key:"leave",value:function(s){var u=this,h=[s,"private-"+s,"private-encrypted-"+s,"presence-"+s];h.forEach(function(L,w){u.leaveChannel(L)})}},{key:"leaveChannel",value:function(s){this.channels[s]&&(this.channels[s].unsubscribe(),delete this.channels[s])}},{key:"socketId",value:function(){return this.pusher.connection.socket_id}},{key:"disconnect",value:function(){this.pusher.disconnect()}}]),a}(Re),Ir=function(f){z(a,f);var l=M(a);function a(){var o;return j(this,a),o=l.apply(this,arguments),o.channels={},o}return N(a,[{key:"connect",value:function(){var s=this,u=this.getSocketIO();return this.socket=u(this.options.host,this.options),this.socket.on("reconnect",function(){Object.values(s.channels).forEach(function(h){h.subscribe()})}),this.socket}},{key:"getSocketIO",value:function(){if(typeof this.options.client<"u")return this.options.client;if(typeof io<"u")return io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}},{key:"listen",value:function(s,u,h){return this.channel(s).listen(u,h)}},{key:"channel",value:function(s){return this.channels[s]||(this.channels[s]=new dt(this.socket,s,this.options)),this.channels[s]}},{key:"privateChannel",value:function(s){return this.channels["private-"+s]||(this.channels["private-"+s]=new ft(this.socket,"private-"+s,this.options)),this.channels["private-"+s]}},{key:"presenceChannel",value:function(s){return this.channels["presence-"+s]||(this.channels["presence-"+s]=new Ar(this.socket,"presence-"+s,this.options)),this.channels["presence-"+s]}},{key:"leave",value:function(s){var u=this,h=[s,"private-"+s,"presence-"+s];h.forEach(function(L){u.leaveChannel(L)})}},{key:"leaveChannel",value:function(s){this.channels[s]&&(this.channels[s].unsubscribe(),delete this.channels[s])}},{key:"socketId",value:function(){return this.socket.id}},{key:"disconnect",value:function(){this.socket.disconnect()}}]),a}(Re),jr=function(f){z(a,f);var l=M(a);function a(){var o;return j(this,a),o=l.apply(this,arguments),o.channels={},o}return N(a,[{key:"connect",value:function(){}},{key:"listen",value:function(s,u,h){return new ve}},{key:"channel",value:function(s){return new ve}},{key:"privateChannel",value:function(s){return new ut}},{key:"encryptedPrivateChannel",value:function(s){return new ut}},{key:"presenceChannel",value:function(s){return new Rr}},{key:"leave",value:function(s){}},{key:"leaveChannel",value:function(s){}},{key:"socketId",value:function(){return"fake-socket-id"}},{key:"disconnect",value:function(){}}]),a}(Re),Nr=function(){function f(l){j(this,f),this.options=l,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}return N(f,[{key:"channel",value:function(a){return this.connector.channel(a)}},{key:"connect",value:function(){if(this.options.broadcaster=="reverb")this.connector=new ht(oe(oe({},this.options),{cluster:""}));else if(this.options.broadcaster=="pusher")this.connector=new ht(this.options);else if(this.options.broadcaster=="socket.io")this.connector=new Ir(this.options);else if(this.options.broadcaster=="null")this.connector=new jr(this.options);else if(typeof this.options.broadcaster=="function")this.connector=new this.options.broadcaster(this.options);else throw new Error("Broadcaster ".concat(fe(this.options.broadcaster)," ").concat(this.options.broadcaster," is not supported."))}},{key:"disconnect",value:function(){this.connector.disconnect()}},{key:"join",value:function(a){return this.connector.presenceChannel(a)}},{key:"leave",value:function(a){this.connector.leave(a)}},{key:"leaveChannel",value:function(a){this.connector.leaveChannel(a)}},{key:"leaveAllChannels",value:function(){for(var a in this.connector.channels)this.leaveChannel(a)}},{key:"listen",value:function(a,o,s){return this.connector.listen(a,o,s)}},{key:"private",value:function(a){return this.connector.privateChannel(a)}},{key:"encryptedPrivate",value:function(a){return this.connector.encryptedPrivateChannel(a)}},{key:"socketId",value:function(){return this.connector.socketId()}},{key:"registerInterceptors",value:function(){typeof Vue=="function"&&Vue.http&&this.registerVueRequestInterceptor(),typeof axios=="function"&&this.registerAxiosRequestInterceptor(),typeof jQuery=="function"&&this.registerjQueryAjaxSetup(),(typeof Turbo>"u"?"undefined":fe(Turbo))==="object"&&this.registerTurboRequestInterceptor()}},{key:"registerVueRequestInterceptor",value:function(){var a=this;Vue.http.interceptors.push(function(o,s){a.socketId()&&o.headers.set("X-Socket-ID",a.socketId()),s()})}},{key:"registerAxiosRequestInterceptor",value:function(){var a=this;axios.interceptors.request.use(function(o){return a.socketId()&&(o.headers["X-Socket-Id"]=a.socketId()),o})}},{key:"registerjQueryAjaxSetup",value:function(){var a=this;typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter(function(o,s,u){a.socketId()&&u.setRequestHeader("X-Socket-Id",a.socketId())})}},{key:"registerTurboRequestInterceptor",value:function(){var a=this;document.addEventListener("turbo:before-fetch-request",function(o){o.detail.fetchOptions.headers["X-Socket-Id"]=a.socketId()})}}]),f}();function Ur(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var pt={exports:{}};/*!
* Pusher JavaScript Library v8.4.0-rc2
* https://pusher.com/
*
* Copyright 2020, Pusher
* Released under the MIT licence.
*/(function(f,l){(function(o,s){f.exports=s()})(window,function(){return function(a){var o={};function s(u){if(o[u])return o[u].exports;var h=o[u]={i:u,l:!1,exports:{}};return a[u].call(h.exports,h,h.exports,s),h.l=!0,h.exports}return s.m=a,s.c=o,s.d=function(u,h,L){s.o(u,h)||Object.defineProperty(u,h,{enumerable:!0,get:L})},s.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},s.t=function(u,h){if(h&1&&(u=s(u)),h&8||h&4&&typeof u=="object"&&u&&u.__esModule)return u;var L=Object.create(null);if(s.r(L),Object.defineProperty(L,"default",{enumerable:!0,value:u}),h&2&&typeof u!="string")for(var w in u)s.d(L,w,(function(B){return u[B]}).bind(null,w));return L},s.n=function(u){var h=u&&u.__esModule?function(){return u.default}:function(){return u};return s.d(h,"a",h),h},s.o=function(u,h){return Object.prototype.hasOwnProperty.call(u,h)},s.p="",s(s.s=2)}([function(a,o,s){var u=this&&this.__extends||function(){var b=function(p,v){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,E){_.__proto__=E}||function(_,E){for(var U in E)E.hasOwnProperty(U)&&(_[U]=E[U])},b(p,v)};return function(p,v){b(p,v);function _(){this.constructor=p}p.prototype=v===null?Object.create(v):(_.prototype=v.prototype,new _)}}();Object.defineProperty(o,"__esModule",{value:!0});var h=256,L=function(){function b(p){p===void 0&&(p="="),this._paddingCharacter=p}return b.prototype.encodedLength=function(p){return this._paddingCharacter?(p+2)/3*4|0:(p*8+5)/6|0},b.prototype.encode=function(p){for(var v="",_=0;_<p.length-2;_+=3){var E=p[_]<<16|p[_+1]<<8|p[_+2];v+=this._encodeByte(E>>>3*6&63),v+=this._encodeByte(E>>>2*6&63),v+=this._encodeByte(E>>>1*6&63),v+=this._encodeByte(E>>>0*6&63)}var U=p.length-_;if(U>0){var E=p[_]<<16|(U===2?p[_+1]<<8:0);v+=this._encodeByte(E>>>3*6&63),v+=this._encodeByte(E>>>2*6&63),U===2?v+=this._encodeByte(E>>>1*6&63):v+=this._paddingCharacter||"",v+=this._paddingCharacter||""}return v},b.prototype.maxDecodedLength=function(p){return this._paddingCharacter?p/4*3|0:(p*6+7)/8|0},b.prototype.decodedLength=function(p){return this.maxDecodedLength(p.length-this._getPaddingLength(p))},b.prototype.decode=function(p){if(p.length===0)return new Uint8Array(0);for(var v=this._getPaddingLength(p),_=p.length-v,E=new Uint8Array(this.maxDecodedLength(_)),U=0,D=0,X=0,$=0,F=0,J=0,Q=0;D<_-4;D+=4)$=this._decodeChar(p.charCodeAt(D+0)),F=this._decodeChar(p.charCodeAt(D+1)),J=this._decodeChar(p.charCodeAt(D+2)),Q=this._decodeChar(p.charCodeAt(D+3)),E[U++]=$<<2|F>>>4,E[U++]=F<<4|J>>>2,E[U++]=J<<6|Q,X|=$&h,X|=F&h,X|=J&h,X|=Q&h;if(D<_-1&&($=this._decodeChar(p.charCodeAt(D)),F=this._decodeChar(p.charCodeAt(D+1)),E[U++]=$<<2|F>>>4,X|=$&h,X|=F&h),D<_-2&&(J=this._decodeChar(p.charCodeAt(D+2)),E[U++]=F<<4|J>>>2,X|=J&h),D<_-3&&(Q=this._decodeChar(p.charCodeAt(D+3)),E[U++]=J<<6|Q,X|=Q&h),X!==0)throw new Error("Base64Coder: incorrect characters for decoding");return E},b.prototype._encodeByte=function(p){var v=p;return v+=65,v+=25-p>>>8&6,v+=51-p>>>8&-75,v+=61-p>>>8&-15,v+=62-p>>>8&3,String.fromCharCode(v)},b.prototype._decodeChar=function(p){var v=h;return v+=(42-p&p-44)>>>8&-h+p-43+62,v+=(46-p&p-48)>>>8&-h+p-47+63,v+=(47-p&p-58)>>>8&-h+p-48+52,v+=(64-p&p-91)>>>8&-h+p-65+0,v+=(96-p&p-123)>>>8&-h+p-97+26,v},b.prototype._getPaddingLength=function(p){var v=0;if(this._paddingCharacter){for(var _=p.length-1;_>=0&&p[_]===this._paddingCharacter;_--)v++;if(p.length<4||v>2)throw new Error("Base64Coder: incorrect padding")}return v},b}();o.Coder=L;var w=new L;function B(b){return w.encode(b)}o.encode=B;function O(b){return w.decode(b)}o.decode=O;var x=function(b){u(p,b);function p(){return b!==null&&b.apply(this,arguments)||this}return p.prototype._encodeByte=function(v){var _=v;return _+=65,_+=25-v>>>8&6,_+=51-v>>>8&-75,_+=61-v>>>8&-13,_+=62-v>>>8&49,String.fromCharCode(_)},p.prototype._decodeChar=function(v){var _=h;return _+=(44-v&v-46)>>>8&-h+v-45+62,_+=(94-v&v-96)>>>8&-h+v-95+63,_+=(47-v&v-58)>>>8&-h+v-48+52,_+=(64-v&v-91)>>>8&-h+v-65+0,_+=(96-v&v-123)>>>8&-h+v-97+26,_},p}(L);o.URLSafeCoder=x;var k=new x;function S(b){return k.encode(b)}o.encodeURLSafe=S;function T(b){return k.decode(b)}o.decodeURLSafe=T,o.encodedLength=function(b){return w.encodedLength(b)},o.maxDecodedLength=function(b){return w.maxDecodedLength(b)},o.decodedLength=function(b){return w.decodedLength(b)}},function(a,o,s){Object.defineProperty(o,"__esModule",{value:!0});var u="utf8: invalid string",h="utf8: invalid source encoding";function L(O){for(var x=new Uint8Array(w(O)),k=0,S=0;S<O.length;S++){var T=O.charCodeAt(S);T<128?x[k++]=T:T<2048?(x[k++]=192|T>>6,x[k++]=128|T&63):T<55296?(x[k++]=224|T>>12,x[k++]=128|T>>6&63,x[k++]=128|T&63):(S++,T=(T&1023)<<10,T|=O.charCodeAt(S)&1023,T+=65536,x[k++]=240|T>>18,x[k++]=128|T>>12&63,x[k++]=128|T>>6&63,x[k++]=128|T&63)}return x}o.encode=L;function w(O){for(var x=0,k=0;k<O.length;k++){var S=O.charCodeAt(k);if(S<128)x+=1;else if(S<2048)x+=2;else if(S<55296)x+=3;else if(S<=57343){if(k>=O.length-1)throw new Error(u);k++,x+=4}else throw new Error(u)}return x}o.encodedLength=w;function B(O){for(var x=[],k=0;k<O.length;k++){var S=O[k];if(S&128){var T=void 0;if(S<224){if(k>=O.length)throw new Error(h);var b=O[++k];if((b&192)!==128)throw new Error(h);S=(S&31)<<6|b&63,T=128}else if(S<240){if(k>=O.length-1)throw new Error(h);var b=O[++k],p=O[++k];if((b&192)!==128||(p&192)!==128)throw new Error(h);S=(S&15)<<12|(b&63)<<6|p&63,T=2048}else if(S<248){if(k>=O.length-2)throw new Error(h);var b=O[++k],p=O[++k],v=O[++k];if((b&192)!==128||(p&192)!==128||(v&192)!==128)throw new Error(h);S=(S&15)<<18|(b&63)<<12|(p&63)<<6|v&63,T=65536}else throw new Error(h);if(S<T||S>=55296&&S<=57343)throw new Error(h);if(S>=65536){if(S>1114111)throw new Error(h);S-=65536,x.push(String.fromCharCode(55296|S>>10)),S=56320|S&1023}}x.push(String.fromCharCode(S))}return x.join("")}o.decode=B},function(a,o,s){a.exports=s(3).default},function(a,o,s){s.r(o);class u{constructor(e,t){this.lastId=0,this.prefix=e,this.name=t}create(e){this.lastId++;var t=this.lastId,r=this.prefix+t,i=this.name+"["+t+"]",c=!1,d=function(){c||(e.apply(null,arguments),c=!0)};return this[t]=d,{number:t,id:r,name:i,callback:d}}remove(e){delete this[e.number]}}var h=new u("_pusher_script_","Pusher.ScriptReceivers"),L={VERSION:"8.4.0-rc2",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},w=L;class B{constructor(e){this.options=e,this.receivers=e.receivers||h,this.loading={}}load(e,t,r){var i=this;if(i.loading[e]&&i.loading[e].length>0)i.loading[e].push(r);else{i.loading[e]=[r];var c=m.createScriptRequest(i.getPath(e,t)),d=i.receivers.create(function(g){if(i.receivers.remove(d),i.loading[e]){var y=i.loading[e];delete i.loading[e];for(var C=function(R){R||c.cleanup()},P=0;P<y.length;P++)y[P](g,C)}});c.send(d)}}getRoot(e){var t,r=m.getDocument().location.protocol;return e&&e.useTLS||r==="https:"?t=this.options.cdn_https:t=this.options.cdn_http,t.replace(/\/*$/,"")+"/"+this.options.version}getPath(e,t){return this.getRoot(t)+"/"+e+this.options.suffix+".js"}}var O=new u("_pusher_dependencies","Pusher.DependenciesReceivers"),x=new B({cdn_http:w.cdn_http,cdn_https:w.cdn_https,version:w.VERSION,suffix:w.dependency_suffix,receivers:O});const k={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var T={buildLogSuffix:function(n){const e="See:",t=k.urls[n];if(!t)return"";let r;return t.fullUrl?r=t.fullUrl:t.path&&(r=k.baseUrl+t.path),r?`${e} ${r}`:""}},b;(function(n){n.UserAuthentication="user-authentication",n.ChannelAuthorization="channel-authorization"})(b||(b={}));class p extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class v extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class X extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class $ extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class F extends Error{constructor(e,t){super(t),this.status=e,Object.setPrototypeOf(this,new.target.prototype)}}var Q=function(n,e,t,r,i){const c=m.createXHR();c.open("POST",t.endpoint,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var d in t.headers)c.setRequestHeader(d,t.headers[d]);if(t.headersProvider!=null){let g=t.headersProvider();for(var d in g)c.setRequestHeader(d,g[d])}return c.onreadystatechange=function(){if(c.readyState===4)if(c.status===200){let g,y=!1;try{g=JSON.parse(c.responseText),y=!0}catch{i(new F(200,`JSON returned from ${r.toString()} endpoint was invalid, yet status code was 200. Data was: ${c.responseText}`),null)}y&&i(null,g)}else{let g="";switch(r){case b.UserAuthentication:g=T.buildLogSuffix("authenticationEndpoint");break;case b.ChannelAuthorization:g=`Clients must be authorized to join private or presence channels. ${T.buildLogSuffix("authorizationEndpoint")}`;break}i(new F(c.status,`Unable to retrieve auth string from ${r.toString()} endpoint - received status: ${c.status} from ${t.endpoint}. ${g}`),null)}},c.send(e),c};function vt(n){return mt(bt(n))}var ne=String.fromCharCode,ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gt=function(n){var e=n.charCodeAt(0);return e<128?n:e<2048?ne(192|e>>>6)+ne(128|e&63):ne(224|e>>>12&15)+ne(128|e>>>6&63)+ne(128|e&63)},bt=function(n){return n.replace(/[^\x00-\x7F]/g,gt)},yt=function(n){var e=[0,2,1][n.length%3],t=n.charCodeAt(0)<<16|(n.length>1?n.charCodeAt(1):0)<<8|(n.length>2?n.charCodeAt(2):0),r=[ae.charAt(t>>>18),ae.charAt(t>>>12&63),e>=2?"=":ae.charAt(t>>>6&63),e>=1?"=":ae.charAt(t&63)];return r.join("")},mt=window.btoa||function(n){return n.replace(/[\s\S]{1,3}/g,yt)};class _t{constructor(e,t,r,i){this.clear=t,this.timer=e(()=>{this.timer&&(this.timer=i(this.timer))},r)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var Ie=_t;function wt(n){window.clearTimeout(n)}function kt(n){window.clearInterval(n)}class K extends Ie{constructor(e,t){super(setTimeout,wt,e,function(r){return t(),null})}}class St extends Ie{constructor(e,t){super(setInterval,kt,e,function(r){return t(),r})}}var Ct={now(){return Date.now?Date.now():new Date().valueOf()},defer(n){return new K(0,n)},method(n,...e){var t=Array.prototype.slice.call(arguments,1);return function(r){return r[n].apply(r,t.concat(arguments))}}},q=Ct;function H(n,...e){for(var t=0;t<e.length;t++){var r=e[t];for(var i in r)r[i]&&r[i].constructor&&r[i].constructor===Object?n[i]=H(n[i]||{},r[i]):n[i]=r[i]}return n}function Tt(){for(var n=["Pusher"],e=0;e<arguments.length;e++)typeof arguments[e]=="string"?n.push(arguments[e]):n.push(ce(arguments[e]));return n.join(" : ")}function je(n,e){var t=Array.prototype.indexOf;if(n===null)return-1;if(t&&n.indexOf===t)return n.indexOf(e);for(var r=0,i=n.length;r<i;r++)if(n[r]===e)return r;return-1}function W(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}function Ne(n){var e=[];return W(n,function(t,r){e.push(r)}),e}function Pt(n){var e=[];return W(n,function(t){e.push(t)}),e}function re(n,e,t){for(var r=0;r<n.length;r++)e.call(t||window,n[r],r,n)}function Ue(n,e){for(var t=[],r=0;r<n.length;r++)t.push(e(n[r],r,n,t));return t}function xt(n,e){var t={};return W(n,function(r,i){t[i]=e(r)}),t}function De(n,e){e=e||function(i){return!!i};for(var t=[],r=0;r<n.length;r++)e(n[r],r,n,t)&&t.push(n[r]);return t}function qe(n,e){var t={};return W(n,function(r,i){(e&&e(r,i,n,t)||r)&&(t[i]=r)}),t}function Ot(n){var e=[];return W(n,function(t,r){e.push([r,t])}),e}function He(n,e){for(var t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1}function Lt(n,e){for(var t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0}function Et(n){return xt(n,function(e){return typeof e=="object"&&(e=ce(e)),encodeURIComponent(vt(e.toString()))})}function At(n){var e=qe(n,function(r){return r!==void 0}),t=Ue(Ot(Et(e)),q.method("join","=")).join("&");return t}function Rt(n){var e=[],t=[];return function r(i,c){var d,g,y;switch(typeof i){case"object":if(!i)return null;for(d=0;d<e.length;d+=1)if(e[d]===i)return{$ref:t[d]};if(e.push(i),t.push(c),Object.prototype.toString.apply(i)==="[object Array]")for(y=[],d=0;d<i.length;d+=1)y[d]=r(i[d],c+"["+d+"]");else{y={};for(g in i)Object.prototype.hasOwnProperty.call(i,g)&&(y[g]=r(i[g],c+"["+JSON.stringify(g)+"]"))}return y;case"number":case"string":case"boolean":return i}}(n,"$")}function ce(n){try{return JSON.stringify(n)}catch{return JSON.stringify(Rt(n))}}class It{constructor(){this.globalLog=e=>{window.console&&window.console.log&&window.console.log(e)}}debug(...e){this.log(this.globalLog,e)}warn(...e){this.log(this.globalLogWarn,e)}error(...e){this.log(this.globalLogError,e)}globalLogWarn(e){window.console&&window.console.warn?window.console.warn(e):this.globalLog(e)}globalLogError(e){window.console&&window.console.error?window.console.error(e):this.globalLogWarn(e)}log(e,...t){var r=Tt.apply(this,arguments);xe.log?xe.log(r):xe.logToConsole&&e.bind(this)(r)}}var A=new It,jt=function(n,e,t,r,i){(t.headers!==void 0||t.headersProvider!=null)&&A.warn(`To send headers with the ${r.toString()} request, you must use AJAX, rather than JSONP.`);var c=n.nextAuthCallbackID.toString();n.nextAuthCallbackID++;var d=n.getDocument(),g=d.createElement("script");n.auth_callbacks[c]=function(P){i(null,P)};var y="Pusher.auth_callbacks['"+c+"']";g.src=t.endpoint+"?callback="+encodeURIComponent(y)+"&"+e;var C=d.getElementsByTagName("head")[0]||d.documentElement;C.insertBefore(g,C.firstChild)},Nt=jt;class Ut{constructor(e){this.src=e}send(e){var t=this,r="Error loading "+t.src;t.script=document.createElement("script"),t.script.id=e.id,t.script.src=t.src,t.script.type="text/javascript",t.script.charset="UTF-8",t.script.addEventListener?(t.script.onerror=function(){e.callback(r)},t.script.onload=function(){e.callback(null)}):t.script.onreadystatechange=function(){(t.script.readyState==="loaded"||t.script.readyState==="complete")&&e.callback(null)},t.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(t.errorScript=document.createElement("script"),t.errorScript.id=e.id+"_error",t.errorScript.text=e.name+"('"+r+"');",t.script.async=t.errorScript.async=!1):t.script.async=!0;var i=document.getElementsByTagName("head")[0];i.insertBefore(t.script,i.firstChild),t.errorScript&&i.insertBefore(t.errorScript,t.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Dt{constructor(e,t){this.url=e,this.data=t}send(e){if(!this.request){var t=At(this.data),r=this.url+"/"+e.number+"?"+t;this.request=m.createScriptRequest(r),this.request.send(e)}}cleanup(){this.request&&this.request.cleanup()}}var qt=function(n,e){return function(t,r){var i="http"+(e?"s":"")+"://",c=i+(n.host||n.options.host)+n.options.path,d=m.createJSONPRequest(c,t),g=m.ScriptReceivers.create(function(y,C){h.remove(g),d.cleanup(),C&&C.host&&(n.host=C.host),r&&r(y,C)});d.send(g)}},Ht={name:"jsonp",getAgent:qt},zt=Ht;function be(n,e,t){var r=n+(e.useTLS?"s":""),i=e.useTLS?e.hostTLS:e.hostNonTLS;return r+"://"+i+t}function ye(n,e){var t="/app/"+n,r="?protocol="+w.PROTOCOL+"&client=js&version="+w.VERSION+(e?"&"+e:"");return t+r}var Mt={getInitial:function(n,e){var t=(e.httpPath||"")+ye(n,"flash=false");return be("ws",e,t)}},Ft={getInitial:function(n,e){var t=(e.httpPath||"/pusher")+ye(n);return be("http",e,t)}},Bt={getInitial:function(n,e){return be("http",e,e.httpPath||"/pusher")},getPath:function(n,e){return ye(n)}};class Xt{constructor(){this._callbacks={}}get(e){return this._callbacks[me(e)]}add(e,t,r){var i=me(e);this._callbacks[i]=this._callbacks[i]||[],this._callbacks[i].push({fn:t,context:r})}remove(e,t,r){if(!e&&!t&&!r){this._callbacks={};return}var i=e?[me(e)]:Ne(this._callbacks);t||r?this.removeCallback(i,t,r):this.removeAllCallbacks(i)}removeCallback(e,t,r){re(e,function(i){this._callbacks[i]=De(this._callbacks[i]||[],function(c){return t&&t!==c.fn||r&&r!==c.context}),this._callbacks[i].length===0&&delete this._callbacks[i]},this)}removeAllCallbacks(e){re(e,function(t){delete this._callbacks[t]},this)}}function me(n){return"_"+n}class V{constructor(e){this.callbacks=new Xt,this.global_callbacks=[],this.failThrough=e}bind(e,t,r){return this.callbacks.add(e,t,r),this}bind_global(e){return this.global_callbacks.push(e),this}unbind(e,t,r){return this.callbacks.remove(e,t,r),this}unbind_global(e){return e?(this.global_callbacks=De(this.global_callbacks||[],t=>t!==e),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(e,t,r){for(var i=0;i<this.global_callbacks.length;i++)this.global_callbacks[i](e,t);var c=this.callbacks.get(e),d=[];if(r?d.push(t,r):t&&d.push(t),c&&c.length>0)for(var i=0;i<c.length;i++)c[i].fn.apply(c[i].context||window,d);else this.failThrough&&this.failThrough(e,t);return this}}class $t extends V{constructor(e,t,r,i,c){super(),this.initialize=m.transportConnectionInitializer,this.hooks=e,this.name=t,this.priority=r,this.key=i,this.options=c,this.state="new",this.timeline=c.timeline,this.activityTimeout=c.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var e=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(e,this.options)}catch(t){return q.defer(()=>{this.onError(t),this.changeState("closed")}),!1}return this.bindListeners(),A.debug("Connecting",{transport:this.name,url:e}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(e){return this.state==="open"?(q.defer(()=>{this.socket&&this.socket.send(e)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(e){this.emit("error",{type:"WebSocketError",error:e}),this.timeline.error(this.buildTimelineMessage({error:e.toString()}))}onClose(e){e?this.changeState("closed",{code:e.code,reason:e.reason,wasClean:e.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(e){this.emit("message",e)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=e=>{this.onError(e)},this.socket.onclose=e=>{this.onClose(e)},this.socket.onmessage=e=>{this.onMessage(e)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(e,t){this.state=e,this.timeline.info(this.buildTimelineMessage({state:e,params:t})),this.emit(e,t)}buildTimelineMessage(e){return H({cid:this.id},e)}}class te{constructor(e){this.hooks=e}isSupported(e){return this.hooks.isSupported(e)}createConnection(e,t,r,i){return new $t(this.hooks,e,t,r,i)}}var Jt=new te({urls:Mt,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!m.getWebSocketAPI()},isSupported:function(){return!!m.getWebSocketAPI()},getSocket:function(n){return m.createWebSocket(n)}}),ze={urls:Ft,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Me=H({getSocket:function(n){return m.HTTPFactory.createStreamingSocket(n)}},ze),Fe=H({getSocket:function(n){return m.HTTPFactory.createPollingSocket(n)}},ze),Be={isSupported:function(){return m.isXHRSupported()}},Wt=new te(H({},Me,Be)),Vt=new te(H({},Fe,Be)),Gt={ws:Jt,xhr_streaming:Wt,xhr_polling:Vt},ue=Gt,Qt=new te({file:"sockjs",urls:Bt,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(n,e){return new window.SockJS(n,null,{js_path:x.getPath("sockjs",{useTLS:e.useTLS}),ignore_null_origin:e.ignoreNullOrigin})},beforeOpen:function(n,e){n.send(JSON.stringify({path:e}))}}),Xe={isSupported:function(n){var e=m.isXDRSupported(n.useTLS);return e}},Kt=new te(H({},Me,Xe)),Yt=new te(H({},Fe,Xe));ue.xdr_streaming=Kt,ue.xdr_polling=Yt,ue.sockjs=Qt;var Zt=ue;class en extends V{constructor(){super();var e=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){e.emit("online")},!1),window.addEventListener("offline",function(){e.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var tn=new en;class nn{constructor(e,t,r){this.manager=e,this.transport=t,this.minPingDelay=r.minPingDelay,this.maxPingDelay=r.maxPingDelay,this.pingDelay=void 0}createConnection(e,t,r,i){i=H({},i,{activityTimeout:this.pingDelay});var c=this.transport.createConnection(e,t,r,i),d=null,g=function(){c.unbind("open",g),c.bind("closed",y),d=q.now()},y=C=>{if(c.unbind("closed",y),C.code===1002||C.code===1003)this.manager.reportDeath();else if(!C.wasClean&&d){var P=q.now()-d;P<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(P/2,this.minPingDelay))}};return c.bind("open",g),c}isSupported(e){return this.manager.isAlive()&&this.transport.isSupported(e)}}const $e={decodeMessage:function(n){try{var e=JSON.parse(n.data),t=e.data;if(typeof t=="string")try{t=JSON.parse(e.data)}catch{}var r={event:e.event,channel:e.channel,data:t};return e.user_id&&(r.user_id=e.user_id),r}catch(i){throw{type:"MessageParseError",error:i,data:n.data}}},encodeMessage:function(n){return JSON.stringify(n)},processHandshake:function(n){var e=$e.decodeMessage(n);if(e.event==="pusher:connection_established"){if(!e.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:e.data.socket_id,activityTimeout:e.data.activity_timeout*1e3}}else{if(e.event==="pusher:error")return{action:this.getCloseAction(e.data),error:this.getCloseError(e.data)};throw"Invalid handshake"}},getCloseAction:function(n){return n.code<4e3?n.code>=1002&&n.code<=1004?"backoff":null:n.code===4e3?"tls_only":n.code<4100?"refused":n.code<4200?"backoff":n.code<4300?"retry":"refused"},getCloseError:function(n){return n.code!==1e3&&n.code!==1001?{type:"PusherError",data:{code:n.code,message:n.reason||n.message}}:null}};var Y=$e;class rn extends V{constructor(e,t){super(),this.id=e,this.transport=t,this.activityTimeout=t.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(e){return this.transport.send(e)}send_event(e,t,r){var i={event:e,data:t};return r&&(i.channel=r),A.debug("Event sent",i),this.send(Y.encodeMessage(i))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var e={message:r=>{var i;try{i=Y.decodeMessage(r)}catch(c){this.emit("error",{type:"MessageParseError",error:c,data:r.data})}if(i!==void 0){switch(A.debug("Event recd",i),i.event){case"pusher:error":this.emit("error",{type:"PusherError",data:i.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",i)}},activity:()=>{this.emit("activity")},error:r=>{this.emit("error",r)},closed:r=>{t(),r&&r.code&&this.handleCloseEvent(r),this.transport=null,this.emit("closed")}},t=()=>{W(e,(r,i)=>{this.transport.unbind(i,r)})};W(e,(r,i)=>{this.transport.bind(i,r)})}handleCloseEvent(e){var t=Y.getCloseAction(e),r=Y.getCloseError(e);r&&this.emit("error",r),t&&this.emit(t,{action:t,error:r})}}class sn{constructor(e,t){this.transport=e,this.callback=t,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=e=>{this.unbindListeners();var t;try{t=Y.processHandshake(e)}catch(r){this.finish("error",{error:r}),this.transport.close();return}t.action==="connected"?this.finish("connected",{connection:new rn(t.id,this.transport),activityTimeout:t.activityTimeout}):(this.finish(t.action,{error:t.error}),this.transport.close())},this.onClosed=e=>{this.unbindListeners();var t=Y.getCloseAction(e)||"backoff",r=Y.getCloseError(e);this.finish(t,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(e,t){this.callback(H({transport:this.transport,action:e},t))}}class on{constructor(e,t){this.timeline=e,this.options=t||{}}send(e,t){this.timeline.isEmpty()||this.timeline.send(m.TimelineTransport.getAgent(this,e),t)}}class _e extends V{constructor(e,t){super(function(r,i){A.debug("No callbacks on "+e+" for "+r)}),this.name=e,this.pusher=t,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(e,t){return t(null,{auth:""})}trigger(e,t){if(e.indexOf("client-")!==0)throw new p("Event '"+e+"' does not start with 'client-'");if(!this.subscribed){var r=T.buildLogSuffix("triggeringClientEvents");A.warn(`Client event triggered before channel 'subscription_succeeded' event . ${r}`)}return this.pusher.send_event(e,t,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(e){var t=e.event,r=e.data;if(t==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(e);else if(t==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(e);else if(t.indexOf("pusher_internal:")!==0){var i={};this.emit(t,r,i)}}handleSubscriptionSucceededEvent(e){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",e.data)}handleSubscriptionCountEvent(e){e.data.subscription_count&&(this.subscriptionCount=e.data.subscription_count),this.emit("pusher:subscription_count",e.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(e,t)=>{e?(this.subscriptionPending=!1,A.error(e.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:e.message},e instanceof F?{status:e.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:t.auth,channel_data:t.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class we extends _e{authorize(e,t){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:e},t)}}class an{constructor(){this.reset()}get(e){return Object.prototype.hasOwnProperty.call(this.members,e)?{id:e,info:this.members[e]}:null}each(e){W(this.members,(t,r)=>{e(this.get(r))})}setMyID(e){this.myID=e}onSubscription(e){this.members=e.presence.hash,this.count=e.presence.count,this.me=this.get(this.myID)}addMember(e){return this.get(e.user_id)===null&&this.count++,this.members[e.user_id]=e.user_info,this.get(e.user_id)}removeMember(e){var t=this.get(e.user_id);return t&&(delete this.members[e.user_id],this.count--),t}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var cn=function(n,e,t,r){function i(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function g(P){try{C(r.next(P))}catch(R){d(R)}}function y(P){try{C(r.throw(P))}catch(R){d(R)}}function C(P){P.done?c(P.value):i(P.value).then(g,y)}C((r=r.apply(n,e||[])).next())})};class un extends we{constructor(e,t){super(e,t),this.members=new an}authorize(e,t){super.authorize(e,(r,i)=>cn(this,void 0,void 0,function*(){if(!r)if(i=i,i.channel_data!=null){var c=JSON.parse(i.channel_data);this.members.setMyID(c.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let d=T.buildLogSuffix("authorizationEndpoint");A.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${d}, or the user should be signed in.`),t("Invalid auth response");return}t(r,i)}))}handleEvent(e){var t=e.event;if(t.indexOf("pusher_internal:")===0)this.handleInternalEvent(e);else{var r=e.data,i={};e.user_id&&(i.user_id=e.user_id),this.emit(t,r,i)}}handleInternalEvent(e){var t=e.event,r=e.data;switch(t){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(e);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(e);break;case"pusher_internal:member_added":var i=this.members.addMember(r);this.emit("pusher:member_added",i);break;case"pusher_internal:member_removed":var c=this.members.removeMember(r);c&&this.emit("pusher:member_removed",c);break}}handleSubscriptionSucceededEvent(e){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(e.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var hn=s(1),ke=s(0);class ln extends we{constructor(e,t,r){super(e,t),this.key=null,this.nacl=r}authorize(e,t){super.authorize(e,(r,i)=>{if(r){t(r,i);return}let c=i.shared_secret;if(!c){t(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(ke.decode)(c),delete i.shared_secret,t(null,i)})}trigger(e,t){throw new D("Client events are not currently supported for encrypted channels")}handleEvent(e){var t=e.event,r=e.data;if(t.indexOf("pusher_internal:")===0||t.indexOf("pusher:")===0){super.handleEvent(e);return}this.handleEncryptedEvent(t,r)}handleEncryptedEvent(e,t){if(!this.key){A.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!t.ciphertext||!t.nonce){A.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+t);return}let r=Object(ke.decode)(t.ciphertext);if(r.length<this.nacl.secretbox.overheadLength){A.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${r.length}`);return}let i=Object(ke.decode)(t.nonce);if(i.length<this.nacl.secretbox.nonceLength){A.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${i.length}`);return}let c=this.nacl.secretbox.open(r,i,this.key);if(c===null){A.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(d,g)=>{if(d){A.error(`Failed to make a request to the authEndpoint: ${g}. Unable to fetch new key, so dropping encrypted event`);return}if(c=this.nacl.secretbox.open(r,i,this.key),c===null){A.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(e,this.getDataToEmit(c))});return}this.emit(e,this.getDataToEmit(c))}getDataToEmit(e){let t=Object(hn.decode)(e);try{return JSON.parse(t)}catch{return t}}}class dn extends V{constructor(e,t){super(),this.state="initialized",this.connection=null,this.key=e,this.options=t,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var r=m.getNetwork();r.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),r.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(e){this.key=e,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(e){return this.connection?this.connection.send(e):!1}send_event(e,t,r){return this.connection?this.connection.send_event(e,t,r):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var e=(t,r)=>{t?this.runner=this.strategy.connect(0,e):r.action==="error"?(this.emit("error",{type:"HandshakeError",error:r.error}),this.timeline.error({handshakeError:r.error})):(this.abortConnecting(),this.handshakeCallbacks[r.action](r))};this.runner=this.strategy.connect(0,e)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var e=this.abandonConnection();e.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(e){this.timeline.info({action:"retry",delay:e}),e>0&&this.emit("connecting_in",Math.round(e/1e3)),this.retryTimer=new K(e||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new K(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new K(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new K(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(e){return H({},e,{message:t=>{this.resetActivityCheck(),this.emit("message",t)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:t=>{this.emit("error",t)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(e){return H({},e,{connected:t=>{this.activityTimeout=Math.min(this.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(t.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let e=t=>r=>{r.error&&this.emit("error",{type:"WebSocketError",error:r.error}),t(r)};return{tls_only:e(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:e(()=>{this.disconnect()}),backoff:e(()=>{this.retryIn(1e3)}),retry:e(()=>{this.retryIn(0)})}}setConnection(e){this.connection=e;for(var t in this.connectionCallbacks)this.connection.bind(t,this.connectionCallbacks[t]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var e in this.connectionCallbacks)this.connection.unbind(e,this.connectionCallbacks[e]);var t=this.connection;return this.connection=null,t}}updateState(e,t){var r=this.state;if(this.state=e,r!==e){var i=e;i==="connected"&&(i+=" with new socket ID "+t.socket_id),A.debug("State changed",r+" -> "+i),this.timeline.info({state:e,params:t}),this.emit("state_change",{previous:r,current:e}),this.emit(e,t)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class fn{constructor(){this.channels={}}add(e,t){return this.channels[e]||(this.channels[e]=pn(e,t)),this.channels[e]}all(){return Pt(this.channels)}find(e){return this.channels[e]}remove(e){var t=this.channels[e];return delete this.channels[e],t}disconnect(){W(this.channels,function(e){e.disconnect()})}}function pn(n,e){if(n.indexOf("private-encrypted-")===0){if(e.config.nacl)return G.createEncryptedChannel(n,e,e.config.nacl);let t="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",r=T.buildLogSuffix("encryptedChannelSupport");throw new D(`${t}. ${r}`)}else{if(n.indexOf("private-")===0)return G.createPrivateChannel(n,e);if(n.indexOf("presence-")===0)return G.createPresenceChannel(n,e);if(n.indexOf("#")===0)throw new v('Cannot create a channel with name "'+n+'".');return G.createChannel(n,e)}}var vn={createChannels(){return new fn},createConnectionManager(n,e){return new dn(n,e)},createChannel(n,e){return new _e(n,e)},createPrivateChannel(n,e){return new we(n,e)},createPresenceChannel(n,e){return new un(n,e)},createEncryptedChannel(n,e,t){return new ln(n,e,t)},createTimelineSender(n,e){return new on(n,e)},createHandshake(n,e){return new sn(n,e)},createAssistantToTheTransportManager(n,e,t){return new nn(n,e,t)}},G=vn;class Je{constructor(e){this.options=e||{},this.livesLeft=this.options.lives||1/0}getAssistant(e){return G.createAssistantToTheTransportManager(this,e,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Z{constructor(e,t){this.strategies=e,this.loop=!!t.loop,this.failFast=!!t.failFast,this.timeout=t.timeout,this.timeoutLimit=t.timeoutLimit}isSupported(){return He(this.strategies,q.method("isSupported"))}connect(e,t){var r=this.strategies,i=0,c=this.timeout,d=null,g=(y,C)=>{C?t(null,C):(i=i+1,this.loop&&(i=i%r.length),i<r.length?(c&&(c=c*2,this.timeoutLimit&&(c=Math.min(c,this.timeoutLimit))),d=this.tryStrategy(r[i],e,{timeout:c,failFast:this.failFast},g)):t(!0))};return d=this.tryStrategy(r[i],e,{timeout:c,failFast:this.failFast},g),{abort:function(){d.abort()},forceMinPriority:function(y){e=y,d&&d.forceMinPriority(y)}}}tryStrategy(e,t,r,i){var c=null,d=null;return r.timeout>0&&(c=new K(r.timeout,function(){d.abort(),i(!0)})),d=e.connect(t,function(g,y){g&&c&&c.isRunning()&&!r.failFast||(c&&c.ensureAborted(),i(g,y))}),{abort:function(){c&&c.ensureAborted(),d.abort()},forceMinPriority:function(g){d.forceMinPriority(g)}}}}class Se{constructor(e){this.strategies=e}isSupported(){return He(this.strategies,q.method("isSupported"))}connect(e,t){return gn(this.strategies,e,function(r,i){return function(c,d){if(i[r].error=c,c){bn(i)&&t(!0);return}re(i,function(g){g.forceMinPriority(d.transport.priority)}),t(null,d)}})}}function gn(n,e,t){var r=Ue(n,function(i,c,d,g){return i.connect(e,t(c,g))});return{abort:function(){re(r,yn)},forceMinPriority:function(i){re(r,function(c){c.forceMinPriority(i)})}}}function bn(n){return Lt(n,function(e){return!!e.error})}function yn(n){!n.error&&!n.aborted&&(n.abort(),n.aborted=!0)}class mn{constructor(e,t,r){this.strategy=e,this.transports=t,this.ttl=r.ttl||1800*1e3,this.usingTLS=r.useTLS,this.timeline=r.timeline}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.usingTLS,i=_n(r),c=i&&i.cacheSkipCount?i.cacheSkipCount:0,d=[this.strategy];if(i&&i.timestamp+this.ttl>=q.now()){var g=this.transports[i.transport];g&&(["ws","wss"].includes(i.transport)||c>3?(this.timeline.info({cached:!0,transport:i.transport,latency:i.latency}),d.push(new Z([g],{timeout:i.latency*2+1e3,failFast:!0}))):c++)}var y=q.now(),C=d.pop().connect(e,function P(R,de){R?(We(r),d.length>0?(y=q.now(),C=d.pop().connect(e,P)):t(R)):(wn(r,de.transport.name,q.now()-y,c),t(null,de))});return{abort:function(){C.abort()},forceMinPriority:function(P){e=P,C&&C.forceMinPriority(P)}}}}function Ce(n){return"pusherTransport"+(n?"TLS":"NonTLS")}function _n(n){var e=m.getLocalStorage();if(e)try{var t=e[Ce(n)];if(t)return JSON.parse(t)}catch{We(n)}return null}function wn(n,e,t,r){var i=m.getLocalStorage();if(i)try{i[Ce(n)]=ce({timestamp:q.now(),transport:e,latency:t,cacheSkipCount:r})}catch{}}function We(n){var e=m.getLocalStorage();if(e)try{delete e[Ce(n)]}catch{}}class he{constructor(e,{delay:t}){this.strategy=e,this.options={delay:t}}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.strategy,i,c=new K(this.options.delay,function(){i=r.connect(e,t)});return{abort:function(){c.ensureAborted(),i&&i.abort()},forceMinPriority:function(d){e=d,i&&i.forceMinPriority(d)}}}}class ie{constructor(e,t,r){this.test=e,this.trueBranch=t,this.falseBranch=r}isSupported(){var e=this.test()?this.trueBranch:this.falseBranch;return e.isSupported()}connect(e,t){var r=this.test()?this.trueBranch:this.falseBranch;return r.connect(e,t)}}class kn{constructor(e){this.strategy=e}isSupported(){return this.strategy.isSupported()}connect(e,t){var r=this.strategy.connect(e,function(i,c){c&&r.abort(),t(i,c)});return r}}function se(n){return function(){return n.isSupported()}}var Sn=function(n,e,t){var r={};function i(ot,wr,kr,Sr,Cr){var at=t(n,ot,wr,kr,Sr,Cr);return r[ot]=at,at}var c=Object.assign({},e,{hostNonTLS:n.wsHost+":"+n.wsPort,hostTLS:n.wsHost+":"+n.wssPort,httpPath:n.wsPath}),d=Object.assign({},c,{useTLS:!0}),g=Object.assign({},e,{hostNonTLS:n.httpHost+":"+n.httpPort,hostTLS:n.httpHost+":"+n.httpsPort,httpPath:n.httpPath}),y={loop:!0,timeout:15e3,timeoutLimit:6e4},C=new Je({minPingDelay:1e4,maxPingDelay:n.activityTimeout}),P=new Je({lives:2,minPingDelay:1e4,maxPingDelay:n.activityTimeout}),R=i("ws","ws",3,c,C),de=i("wss","ws",3,d,C),gr=i("sockjs","sockjs",1,g),et=i("xhr_streaming","xhr_streaming",1,g,P),br=i("xdr_streaming","xdr_streaming",1,g,P),tt=i("xhr_polling","xhr_polling",1,g),yr=i("xdr_polling","xdr_polling",1,g),nt=new Z([R],y),mr=new Z([de],y),_r=new Z([gr],y),rt=new Z([new ie(se(et),et,br)],y),it=new Z([new ie(se(tt),tt,yr)],y),st=new Z([new ie(se(rt),new Se([rt,new he(it,{delay:4e3})]),it)],y),Oe=new ie(se(st),st,_r),Le;return e.useTLS?Le=new Se([nt,new he(Oe,{delay:2e3})]):Le=new Se([nt,new he(mr,{delay:2e3}),new he(Oe,{delay:5e3})]),new mn(new kn(new ie(se(R),Le,Oe)),r,{ttl:18e5,timeline:e.timeline,useTLS:e.useTLS})},Cn=Sn,Tn=function(){var n=this;n.timeline.info(n.buildTimelineMessage({transport:n.name+(n.options.useTLS?"s":"")})),n.hooks.isInitialized()?n.changeState("initialized"):n.hooks.file?(n.changeState("initializing"),x.load(n.hooks.file,{useTLS:n.options.useTLS},function(e,t){n.hooks.isInitialized()?(n.changeState("initialized"),t(!0)):(e&&n.onError(e),n.onClose(),t(!1))})):n.onClose()},Pn={getRequest:function(n){var e=new window.XDomainRequest;return e.ontimeout=function(){n.emit("error",new _),n.close()},e.onerror=function(t){n.emit("error",t),n.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&n.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&n.onChunk(200,e.responseText),n.emit("finished",200),n.close()},e},abortRequest:function(n){n.ontimeout=n.onerror=n.onprogress=n.onload=null,n.abort()}},xn=Pn;const On=256*1024;class Ln extends V{constructor(e,t,r){super(),this.hooks=e,this.method=t,this.url=r}start(e){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},m.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(e)}close(){this.unloader&&(m.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(e,t){for(;;){var r=this.advanceBuffer(t);if(r)this.emit("chunk",{status:e,data:r});else break}this.isBufferTooLong(t)&&this.emit("buffer_too_long")}advanceBuffer(e){var t=e.slice(this.position),r=t.indexOf(`
`);return r!==-1?(this.position+=r+1,t.slice(0,r)):null}isBufferTooLong(e){return this.position===e.length&&e.length>On}}var Te;(function(n){n[n.CONNECTING=0]="CONNECTING",n[n.OPEN=1]="OPEN",n[n.CLOSED=3]="CLOSED"})(Te||(Te={}));var ee=Te,En=1;class An{constructor(e,t){this.hooks=e,this.session=Ge(1e3)+"/"+Nn(8),this.location=Rn(t),this.readyState=ee.CONNECTING,this.openStream()}send(e){return this.sendRaw(JSON.stringify([e]))}ping(){this.hooks.sendHeartbeat(this)}close(e,t){this.onClose(e,t,!0)}sendRaw(e){if(this.readyState===ee.OPEN)try{return m.createSocketRequest("POST",Ve(In(this.location,this.session))).start(e),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(e,t,r){this.closeStream(),this.readyState=ee.CLOSED,this.onclose&&this.onclose({code:e,reason:t,wasClean:r})}onChunk(e){if(e.status===200){this.readyState===ee.OPEN&&this.onActivity();var t,r=e.data.slice(0,1);switch(r){case"o":t=JSON.parse(e.data.slice(1)||"{}"),this.onOpen(t);break;case"a":t=JSON.parse(e.data.slice(1)||"[]");for(var i=0;i<t.length;i++)this.onEvent(t[i]);break;case"m":t=JSON.parse(e.data.slice(1)||"null"),this.onEvent(t);break;case"h":this.hooks.onHeartbeat(this);break;case"c":t=JSON.parse(e.data.slice(1)||"[]"),this.onClose(t[0],t[1],!0);break}}}onOpen(e){this.readyState===ee.CONNECTING?(e&&e.hostname&&(this.location.base=jn(this.location.base,e.hostname)),this.readyState=ee.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(e){this.readyState===ee.OPEN&&this.onmessage&&this.onmessage({data:e})}onActivity(){this.onactivity&&this.onactivity()}onError(e){this.onerror&&this.onerror(e)}openStream(){this.stream=m.createSocketRequest("POST",Ve(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",e=>{this.onChunk(e)}),this.stream.bind("finished",e=>{this.hooks.onFinished(this,e)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(e){q.defer(()=>{this.onError(e),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Rn(n){var e=/([^\?]*)\/*(\??.*)/.exec(n);return{base:e[1],queryString:e[2]}}function In(n,e){return n.base+"/"+e+"/xhr_send"}function Ve(n){var e=n.indexOf("?")===-1?"?":"&";return n+e+"t="+ +new Date+"&n="+En++}function jn(n,e){var t=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(n);return t[1]+e+t[3]}function Ge(n){return m.randomInt(n)}function Nn(n){for(var e=[],t=0;t<n;t++)e.push(Ge(32).toString(32));return e.join("")}var Un=An,Dn={getReceiveURL:function(n,e){return n.base+"/"+e+"/xhr_streaming"+n.queryString},onHeartbeat:function(n){n.sendRaw("[]")},sendHeartbeat:function(n){n.sendRaw("[]")},onFinished:function(n,e){n.onClose(1006,"Connection interrupted ("+e+")",!1)}},qn=Dn,Hn={getReceiveURL:function(n,e){return n.base+"/"+e+"/xhr"+n.queryString},onHeartbeat:function(){},sendHeartbeat:function(n){n.sendRaw("[]")},onFinished:function(n,e){e===200?n.reconnect():n.onClose(1006,"Connection interrupted ("+e+")",!1)}},zn=Hn,Mn={getRequest:function(n){var e=m.getXHRAPI(),t=new e;return t.onreadystatechange=t.onprogress=function(){switch(t.readyState){case 3:t.responseText&&t.responseText.length>0&&n.onChunk(t.status,t.responseText);break;case 4:t.responseText&&t.responseText.length>0&&n.onChunk(t.status,t.responseText),n.emit("finished",t.status),n.close();break}},t},abortRequest:function(n){n.onreadystatechange=null,n.abort()}},Fn=Mn,Bn={createStreamingSocket(n){return this.createSocket(qn,n)},createPollingSocket(n){return this.createSocket(zn,n)},createSocket(n,e){return new Un(n,e)},createXHR(n,e){return this.createRequest(Fn,n,e)},createRequest(n,e,t){return new Ln(n,e,t)}},Qe=Bn;Qe.createXDR=function(n,e){return this.createRequest(xn,n,e)};var Xn=Qe,$n={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:O,getDefaultStrategy:Cn,Transports:Zt,transportConnectionInitializer:Tn,HTTPFactory:Xn,TimelineTransport:zt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(n){window.Pusher=n;var e=()=>{this.onDocumentBody(n.ready)};window.JSON?e():x.load("json2",{},e)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Q,jsonp:Nt}},onDocumentBody(n){document.body?n():setTimeout(()=>{this.onDocumentBody(n)},0)},createJSONPRequest(n,e){return new Dt(n,e)},createScriptRequest(n){return new Ut(n)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var n=this.getXHRAPI();return new n},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return tn},createWebSocket(n){var e=this.getWebSocketAPI();return new e(n)},createSocketRequest(n,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(n,e);if(this.isXDRSupported(e.indexOf("https:")===0))return this.HTTPFactory.createXDR(n,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var n=this.getXHRAPI();return!!n&&new n().withCredentials!==void 0},isXDRSupported(n){var e=n?"https:":"http:",t=this.getProtocol();return!!window.XDomainRequest&&t===e},addUnloadListener(n){window.addEventListener!==void 0?window.addEventListener("unload",n,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",n)},removeUnloadListener(n){window.addEventListener!==void 0?window.removeEventListener("unload",n,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",n)},randomInt(n){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*n)}},m=$n,Pe;(function(n){n[n.ERROR=3]="ERROR",n[n.INFO=6]="INFO",n[n.DEBUG=7]="DEBUG"})(Pe||(Pe={}));var le=Pe;class Jn{constructor(e,t,r){this.key=e,this.session=t,this.events=[],this.options=r||{},this.sent=0,this.uniqueID=0}log(e,t){e<=this.options.level&&(this.events.push(H({},t,{timestamp:q.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(e){this.log(le.ERROR,e)}info(e){this.log(le.INFO,e)}debug(e){this.log(le.DEBUG,e)}isEmpty(){return this.events.length===0}send(e,t){var r=H({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],e(r,(i,c)=>{i||this.sent++,t&&t(i,c)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Wn{constructor(e,t,r,i){this.name=e,this.priority=t,this.transport=r,this.options=i||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(e,t){if(this.isSupported()){if(this.priority<e)return Ke(new E,t)}else return Ke(new $,t);var r=!1,i=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),c=null,d=function(){i.unbind("initialized",d),i.connect()},g=function(){c=G.createHandshake(i,function(R){r=!0,P(),t(null,R)})},y=function(R){P(),t(R)},C=function(){P();var R;R=ce(i),t(new U(R))},P=function(){i.unbind("initialized",d),i.unbind("open",g),i.unbind("error",y),i.unbind("closed",C)};return i.bind("initialized",d),i.bind("open",g),i.bind("error",y),i.bind("closed",C),i.initialize(),{abort:()=>{r||(P(),c?c.close():i.close())},forceMinPriority:R=>{r||this.priority<R&&(c?c.close():i.close())}}}}function Ke(n,e){return q.defer(function(){e(n)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Vn}=m;var Gn=function(n,e,t,r,i,c){var d=Vn[t];if(!d)throw new X(t);var g=(!n.enabledTransports||je(n.enabledTransports,e)!==-1)&&(!n.disabledTransports||je(n.disabledTransports,e)===-1),y;return g?(i=Object.assign({ignoreNullOrigin:n.ignoreNullOrigin},i),y=new Wn(e,r,c?c.getAssistant(d):d,i)):y=Qn,y},Qn={isSupported:function(){return!1},connect:function(n,e){var t=q.defer(function(){e(new $)});return{abort:function(){t.ensureAborted()},forceMinPriority:function(){}}}};function Kn(n){if(n==null)throw"You must pass an options object";if(n.cluster==null)throw"Options object must provide a cluster";"disableStats"in n&&A.warn("The disableStats option is deprecated in favor of enableStats")}const Yn=(n,e)=>{var t="socket_id="+encodeURIComponent(n.socketId);for(var r in e.params)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(e.params[r]);if(e.paramsProvider!=null){let i=e.paramsProvider();for(var r in i)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(i[r])}return t};var Zn=n=>{if(typeof m.getAuthorizers()[n.transport]>"u")throw`'${n.transport}' is not a recognized auth transport`;return(e,t)=>{const r=Yn(e,n);m.getAuthorizers()[n.transport](m,r,n,b.UserAuthentication,t)}};const er=(n,e)=>{var t="socket_id="+encodeURIComponent(n.socketId);t+="&channel_name="+encodeURIComponent(n.channelName);for(var r in e.params)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(e.params[r]);if(e.paramsProvider!=null){let i=e.paramsProvider();for(var r in i)t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(i[r])}return t};var tr=n=>{if(typeof m.getAuthorizers()[n.transport]>"u")throw`'${n.transport}' is not a recognized auth transport`;return(e,t)=>{const r=er(e,n);m.getAuthorizers()[n.transport](m,r,n,b.ChannelAuthorization,t)}};const nr=(n,e,t)=>{const r={authTransport:e.transport,authEndpoint:e.endpoint,auth:{params:e.params,headers:e.headers}};return(i,c)=>{const d=n.channel(i.channelName);t(d,r).authorize(i.socketId,c)}};function Ye(n,e){let t={activityTimeout:n.activityTimeout||w.activityTimeout,cluster:n.cluster,httpPath:n.httpPath||w.httpPath,httpPort:n.httpPort||w.httpPort,httpsPort:n.httpsPort||w.httpsPort,pongTimeout:n.pongTimeout||w.pongTimeout,statsHost:n.statsHost||w.stats_host,unavailableTimeout:n.unavailableTimeout||w.unavailableTimeout,wsPath:n.wsPath||w.wsPath,wsPort:n.wsPort||w.wsPort,wssPort:n.wssPort||w.wssPort,enableStats:ar(n),httpHost:rr(n),useTLS:or(n),wsHost:ir(n),userAuthenticator:cr(n),channelAuthorizer:hr(n,e)};return"disabledTransports"in n&&(t.disabledTransports=n.disabledTransports),"enabledTransports"in n&&(t.enabledTransports=n.enabledTransports),"ignoreNullOrigin"in n&&(t.ignoreNullOrigin=n.ignoreNullOrigin),"timelineParams"in n&&(t.timelineParams=n.timelineParams),"nacl"in n&&(t.nacl=n.nacl),t}function rr(n){return n.httpHost?n.httpHost:n.cluster?`sockjs-${n.cluster}.pusher.com`:w.httpHost}function ir(n){return n.wsHost?n.wsHost:sr(n.cluster)}function sr(n){return`ws-${n}.pusher.com`}function or(n){return m.getProtocol()==="https:"?!0:n.forceTLS!==!1}function ar(n){return"enableStats"in n?n.enableStats:"disableStats"in n?!n.disableStats:!1}const Ze=n=>"customHandler"in n&&n.customHandler!=null;function cr(n){const e=Object.assign(Object.assign({},w.userAuthentication),n.userAuthentication);return Ze(e)?e.customHandler:Zn(e)}function ur(n,e){let t;if("channelAuthorization"in n)t=Object.assign(Object.assign({},w.channelAuthorization),n.channelAuthorization);else if(t={transport:n.authTransport||w.authTransport,endpoint:n.authEndpoint||w.authEndpoint},"auth"in n&&("params"in n.auth&&(t.params=n.auth.params),"headers"in n.auth&&(t.headers=n.auth.headers)),"authorizer"in n)return{customHandler:nr(e,t,n.authorizer)};return t}function hr(n,e){const t=ur(n,e);return Ze(t)?t.customHandler:tr(t)}class lr extends V{constructor(e){super(function(t,r){A.debug(`No callbacks on watchlist events for ${t}`)}),this.pusher=e,this.bindWatchlistInternalEvent()}handleEvent(e){e.data.events.forEach(t=>{this.emit(t.name,t)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",e=>{var t=e.event;t==="pusher_internal:watchlist_events"&&this.handleEvent(e)})}}function dr(){let n,e;return{promise:new Promise((r,i)=>{n=r,e=i}),resolve:n,reject:e}}var fr=dr;class pr extends V{constructor(e){super(function(t,r){A.debug("No callbacks on user for "+t)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(t,r)=>{if(t){A.warn(`Error during signin: ${t}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:r.auth,user_data:r.user_data})},this.pusher=e,this.pusher.connection.bind("state_change",({previous:t,current:r})=>{t!=="connected"&&r==="connected"&&this._signin(),t==="connected"&&r!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new lr(e),this.pusher.connection.bind("message",t=>{var r=t.event;r==="pusher:signin_success"&&this._onSigninSuccess(t.data),this.serverToUserChannel&&this.serverToUserChannel.name===t.channel&&this.serverToUserChannel.handleEvent(t)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(e){try{this.user_data=JSON.parse(e.user_data)}catch{A.error(`Failed parsing user data after signin: ${e.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){A.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const e=t=>{t.subscriptionPending&&t.subscriptionCancelled?t.reinstateSubscription():!t.subscriptionPending&&this.pusher.connection.state==="connected"&&t.subscribe()};this.serverToUserChannel=new _e(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((t,r)=>{t.indexOf("pusher_internal:")===0||t.indexOf("pusher:")===0||this.emit(t,r)}),e(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:e,resolve:t,reject:r}=fr();e.done=!1;const i=()=>{e.done=!0};e.then(i).catch(i),this.signinDonePromise=e,this._signinDoneResolve=t}}class I{static ready(){I.isReady=!0;for(var e=0,t=I.instances.length;e<t;e++)I.instances[e].connect()}static getClientFeatures(){return Ne(qe({ws:m.Transports.ws},function(e){return e.isSupported({})}))}constructor(e,t){vr(e),Kn(t),this.key=e,this.options=t,this.config=Ye(this.options,this),this.channels=G.createChannels(),this.global_emitter=new V,this.sessionID=m.randomInt(1e9),this.timeline=new Jn(this.key,this.sessionID,{cluster:this.config.cluster,features:I.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:le.INFO,version:w.VERSION}),this.config.enableStats&&(this.timelineSender=G.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+m.TimelineTransport.name}));var r=i=>m.getDefaultStrategy(this.config,i,Gn);this.connection=G.createConnectionManager(this.key,{getStrategy:r,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",i=>{var c=i.event,d=c.indexOf("pusher_internal:")===0;if(i.channel){var g=this.channel(i.channel);g&&g.handleEvent(i)}d||this.global_emitter.emit(i.event,i.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",i=>{A.warn(i)}),I.instances.push(this),this.timeline.info({instances:I.instances.length}),this.user=new pr(this),I.isReady&&this.connect()}switchCluster(e){const{appKey:t,cluster:r}=e;this.key=t,this.options=Object.assign(Object.assign({},this.options),{cluster:r}),this.config=Ye(this.options,this),this.connection.switchCluster(this.key)}channel(e){return this.channels.find(e)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var e=this.connection.isUsingTLS(),t=this.timelineSender;this.timelineSenderTimer=new St(6e4,function(){t.send(e)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(e,t,r){return this.global_emitter.bind(e,t,r),this}unbind(e,t,r){return this.global_emitter.unbind(e,t,r),this}bind_global(e){return this.global_emitter.bind_global(e),this}unbind_global(e){return this.global_emitter.unbind_global(e),this}unbind_all(e){return this.global_emitter.unbind_all(),this}subscribeAll(){var e;for(e in this.channels.channels)this.channels.channels.hasOwnProperty(e)&&this.subscribe(e)}subscribe(e){var t=this.channels.add(e,this);return t.subscriptionPending&&t.subscriptionCancelled?t.reinstateSubscription():!t.subscriptionPending&&this.connection.state==="connected"&&t.subscribe(),t}unsubscribe(e){var t=this.channels.find(e);t&&t.subscriptionPending?t.cancelSubscription():(t=this.channels.remove(e),t&&t.subscribed&&t.unsubscribe())}send_event(e,t,r){return this.connection.send_event(e,t,r)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}I.instances=[],I.isReady=!1,I.logToConsole=!1,I.Runtime=m,I.ScriptReceivers=m.ScriptReceivers,I.DependenciesReceivers=m.DependenciesReceivers,I.auth_callbacks=m.auth_callbacks;var xe=o.default=I;function vr(n){if(n==null)throw"You must pass your app key when you instantiate Pusher."}m.setup(I)}])})})(pt);var Dr=pt.exports;const qr=Ur(Dr);window.Pusher=qr;window.Echo=new Nr({broadcaster:"reverb",key:"qpbbma37j1jc72wwxo5i",wsHost:"ps99.devloft.co.uk",wsPort:"443",wssPort:"443",forceTLS:!0,enabledTransports:["ws","wss"]});