From c6cb0f6cd5907d9ef8d89dfdab56101fd3103c58 Mon Sep 17 00:00:00 2001 From: Eugene Potapov Date: Mon, 8 Jul 2024 11:50:54 -0500 Subject: [PATCH] revert unnecessary changes, update readme --- sdks/README.md | 4 +++- sdks/js/dist/zcc.session.js | 2 +- sdks/js/src/classes/session.js | 6 ------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sdks/README.md b/sdks/README.md index b81bee3..ab9dd10 100644 --- a/sdks/README.md +++ b/sdks/README.md @@ -177,7 +177,9 @@ session.connect().then(function() { }); ``` -`serverURL` can be one of the [API entry points](https://github.com/zelloptt/zello-channel-api/blob/master/API.md#api-entry-points). +`serverURL` can be one of the [API entry points](https://github.com/zelloptt/zello-channel-api/blob/master/API.md#api-entry-points). +You may want to provide any string as a version of your app as `version` +You can also provide `platformName` string to identify your platform. If the provided value include "gateway" substring, Zello Alarm service will track the online status of this client (if enabled). ### Sending voice messages diff --git a/sdks/js/dist/zcc.session.js b/sdks/js/dist/zcc.session.js index 88e3a4a..c546df5 100644 --- a/sdks/js/dist/zcc.session.js +++ b/sdks/js/dist/zcc.session.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ZCC=t():(e.ZCC=e.ZCC||{},e.ZCC.Session=t())}(self,(()=>{return e={668:e=>{e.exports=function(e){return atob(e)}},2:e=>{e.exports={libraryName:"ZCC"}},712:e=>{e.exports={ERROR_NOT_ENOUGH_PARAMS:"Not enough parameters",ERROR_INVALID_SERVER_PROTOCOL:"Invalid server protocol, use ws:// or wss://",ERROR_UNSUPPORTED:"Your browser does not support all required APIs.\nRead more here https://github.com/zelloptt/zello-channel-api",ERROR_RECORDING_NO_HTTPS:"Recording will work over https:// loaded pages only",ERROR_WIDGET_ELEMENT_NOT_FOUND:"DOM element for widget is not found",ERROR_INVALID_DECODER:"Invalid incoming message decoder. Should implement ZCC.Decoder interface",ERROR_INVALID_PLAYER:"Invalid incoming message player. Should implement ZCC.Player interface",ERROR_INVALID_RECORDER:"Invalid outgoing message recorder. Should implement ZCC.Recorder interface",ERROR_INVALID_ENCODER:"Invalid outgoing message encoder. Should implement ZCC.Encoder interface",ERROR_SESSION_FAIL_CONNECT:"Failed to connect",ERROR_INVALID_IMAGE_WIDTH_OR_HEIGHT:"Invalid image width or height",ERROR_FAILED_TO_SEND_IMAGE:"Failed to send image",ERROR_IMAGE_NOT_READY_TO_BE_SENT:"Image is not ready to be sent",ERROR_NO_CAMERA_AVAILABLE:"No camera available",ERROR_TYPE_UNKNOWN_SERVER_ERROR:"Unknown server error",ERROR_TYPE_CONFIGURATION:"configuration",EVENT_ERROR:"error",EVENT_CONNECT:"connect",EVENT_CLOSE:"close",EVENT_LOGON:"logon",EVENT_STATUS:"status",EVENT_START_STREAM:"start_stream",EVENT_STOP_STREAM:"stop_stream",EVENT_SESSION_START_CONNECT:"session_start_connect",EVENT_SESSION_CONNECT:"session_connect",EVENT_SESSION_FAIL_CONNECT:"session_fail_connect",EVENT_SESSION_CONNECTION_LOST:"session_connection_lost",EVENT_SESSION_DISCONNECT:"session_disconnect",EVENT_INCOMING_VOICE_WILL_START:"incoming_voice_will_start",EVENT_INCOMING_VOICE_DID_START:"incoming_voice_did_start",EVENT_INCOMING_VOICE_DID_STOP:"incoming_voice_did_stop",EVENT_INCOMING_VOICE_FAIL_START:"incoming_voice_fail_start",EVENT_OUTGOING_VOICE_DID_STOP:"outgoing_voice_did_stop",EVENT_INCOMING_VOICE_DATA:"incoming_voice_data",EVENT_INCOMING_VOICE_DATA_DECODED:"incoming_voice_data_decoded",EVENT_INCOMING_IMAGE_DATA:"incoming_image_data",EVENT_DATA:"data",EVENT_DATA_ENCODED:"data_encoded",EVENT_ENCODER_DONE:"encoder_done",EVENT_RECORDER_READY:"recorder_ready",EVENT_WIDGET_OPEN_BUTTON_CLICK:"widget_open_button_click",EVENT_WIDGET_MUTE:"widget_mute",EVENT_WIDGET_UNMUTE:"widget_unmute",EVENT_WIDGET_SPEAKING_USERNAME_CLICK:"speaking_username_click",EVENT_INCOMING_TEXT_MESSAGE:"incoming_text_message",EVENT_INCOMING_LOCATION:"incoming_location",EVENT_INCOMING_IMAGE:"incoming_image",EVENT_IMAGE_DATA:"image_data",EVENT_THUMBNAIL_DATA:"thumbnail_data",EVENT_IMAGE_PREVIEW_DATA:"image_preview_data",EVENT_THUMBNAIL_PREVIEW_DATA:"thumbnail_preview_data",EVENT_DISPATCH_CALL_STATUS:"dispatch_call_status",MAX_OUTGOING_IMAGE_SCALE_PX:1280,OUTGOING_IMAGE_THUMBNAIL_SCALE_PX:90,SN_STATUS_SUCCESS:"success",SN_STATUS_ONLINE:"online",SN_STATUS_OFFLINE:"offline",MESSAGE_TYPE_AUDIO:1,MESSAGE_TYPE_IMAGE:2,MESSAGE_TYPE_JSON:123,IMAGE_TYPE_FULL:1,IMAGE_TYPE_THUMBNAIL:2,TALK_PRIORITY_VALUE_NORMAL:100,TALK_PRIORITY_VALUE_LOW:10}},706:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n1||"string"==typeof e&&-1!==e.indexOf(".")||(arguments[0]=(arguments[0]instanceof Array?arguments[0][0]:arguments[0])+".*",o(l(u.prototype),"emit",this).apply(this,arguments))}}],n&&i(t.prototype,n),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(n(387).EventEmitter2);e.exports=f},492:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;return this.connectOrReconnect(e)}},{key:"clearExistingReconnectTimeout",value:function(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout)}},{key:"connectOrReconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=l.defer();return this.connectAttempts?(this.connectAttempts===this.maxConnectAttempts&&this.emit(f.EVENT_SESSION_START_CONNECT),this.connectAttempts--,this.doConnect().then((function(){return e.doLogon()})).then((function(n){"function"==typeof t&&t.apply(e,[null,n]),e.emit(f.EVENT_SESSION_CONNECT),r.resolve(n)})).catch((function(i){if(e.disconnect(),e.connectAttempts)return e.clearExistingReconnectTimeout(),void(e.reconnectTimeout=setTimeout((function(){e.connectOrReconnect(t,n)}),e.connectRetryTimeoutMs));"function"==typeof t&&t.apply(e,[i]),e.emit(n?f.EVENT_SESSION_DISCONNECT:f.EVENT_SESSION_FAIL_CONNECT,i),r.reject(i)})),r.promise):(this.emit(this.channelConfigurationError?f.EVENT_SESSION_DISCONNECT:f.EVENT_SESSION_FAIL_CONNECT),r.reject("Failed to connect"))}},{key:"doConnect",value:function(){var e=this,t=l.defer();return this.wsConnection=new WebSocket(this.options.serverUrl),this.wsConnection.binaryType="arraybuffer",this.wsConnection.addEventListener("open",(function(){return t.resolve()})),this.wsConnection.addEventListener("message",(function(t){e.wsMessageHandler(t.data)})),this.wsConnection.addEventListener("error",(function(e){return t.reject("WebSocket error: "+e)})),this.wsConnection.addEventListener("close",(function(n){e.selfDisconnect?e.selfDisconnect=!1:"fulfilled"===t.promise.inspect().state&&(e.emit(f.EVENT_SESSION_CONNECTION_LOST,n.reason),e.clearExistingReconnectTimeout(),e.reconnectTimeout=setTimeout((function(){e.connectOrReconnect(null,!0)}),e.connectRetryTimeoutMs))})),t.promise}},{key:"doLogon",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=l.defer(),n={command:"logon",seq:this.getSeq(),channel:this.options.channel};e?n.refresh_token=e:(n.auth_token=this.options.authToken,n.token_version=this.options.tokenVersion),this.options.listenOnly&&(n.listen_only=!0),this.options.username&&(n.username=this.options.username,n.password=this.options.password),n.version=this.version,this.options.platformName&&(n.platform_name=this.options.platformName),this.options.platformType&&(n.platform_type=this.options.platformType);var r=function(e,n){e?t.reject(e):t.resolve(n)};return this.sendCommand(n,r),t.promise}},{key:"disconnect",value:function(){this.selfDisconnect=!0,this.wsConnection.close()}},{key:"wsBinaryDataHandler",value:function(e){var t=p.parseIncomingBinaryMessage(e);switch(t.messageType){case f.MESSAGE_TYPE_AUDIO:this.emit(f.EVENT_INCOMING_VOICE_DATA,t);break;case f.MESSAGE_TYPE_IMAGE:this.emit(f.EVENT_INCOMING_IMAGE_DATA,t)}}},{key:"jsonDataHandler",value:function(e){var t=this;e&&e.seq&&this.handleCallbacks(e),e.refresh_token&&(this.refreshToken=e.refresh_token);var n=p.getLoadedLibrary();switch(e.command){case"on_error":var r=f.ERROR_TYPE_UNKNOWN_SERVER_ERROR;e.error&&(r=e.error),this.emit(f.EVENT_ERROR,r);break;case"on_channel_status":if(!this.wasOnline)switch(e.status){case f.SN_STATUS_ONLINE:this.wasOnline=!0,this.connectAttempts=this.maxConnectAttempts;break;case f.SN_STATUS_OFFLINE:e.error&&e.error_type===f.ERROR_TYPE_CONFIGURATION&&(this.channelConfigurationError=!0)}this.emit(f.EVENT_STATUS,e);break;case"on_stream_start":var i=new n.IncomingMessage(e,this);this.incomingMessages[e.stream_id]=i,i.init().then((function(){t.emit(f.EVENT_INCOMING_VOICE_WILL_START,i)})).catch((function(e){t.emit(f.EVENT_INCOMING_VOICE_FAIL_START,i,e)}));break;case"on_stream_stop":if(!this.incomingMessages[e.stream_id]){this.emit(f.EVENT_OUTGOING_VOICE_DID_STOP,e.stream_id);break}this.emit(f.EVENT_INCOMING_VOICE_DID_STOP,this.incomingMessages[e.stream_id]);break;case"on_text_message":this.emit(f.EVENT_INCOMING_TEXT_MESSAGE,e);break;case"on_location":this.emit(f.EVENT_INCOMING_LOCATION,e);break;case"on_image":var o=new n.IncomingImage(e,this);this.emit(f.EVENT_INCOMING_IMAGE,o);break;case"on_dispatch_call_status":this.emit(f.EVENT_DISPATCH_CALL_STATUS,e)}}},{key:"wsMessageHandler",value:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t?this.jsonDataHandler(t):this.wsBinaryDataHandler(e)}},{key:"handleCallbacks",value:function(e){var t=e.error?e.error:null,n=this.callbacks[e.seq];"function"==typeof n&&(n.apply(this,[t,e]),delete this.callbacks[e.seq])}},{key:"sendCommand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e.seq&&t&&(this.callbacks[e.seq]=t),this.wsConnection.send(JSON.stringify(e))}},{key:"sendBinary",value:function(e){this.wsConnection.send(e)}},{key:"startStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("start_stream",e,t)}},{key:"stopStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("stop_stream",e,t)}},{key:"startVoiceMessage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=p.getLoadedLibrary();return this.activeOutgoingMessage=new r.OutgoingMessage(this,t,n),this.activeOutgoingMessage.on(f.EVENT_DATA_ENCODED,(function(t){e.activeOutgoingMessage.options.autoSendAudio&&e.sendBinary(t)})),this.activeOutgoingMessage}},{key:"onIncomingVoiceDidStart",value:function(e){this.emit(f.EVENT_INCOMING_VOICE_DID_START,e)}},{key:"onIncomingVoiceDecoded",value:function(e,t){this.emit(f.EVENT_INCOMING_VOICE_DATA_DECODED,e,t)}},{key:"sendImage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p.getLoadedLibrary();return this.activeOutgoingImage=new t.OutgoingImage(this,e),this.activeOutgoingImage}},{key:"sendTextMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("send_text_message",e,t)}},{key:"sendLocation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("send_location",e,t)}},{key:"endDispatchCall",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n={call_id:e,channel:this.options.channel};return this.sendCommandWithCallback("end_dispatch_call",n,t)}},{key:"sendCommandWithCallback",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.seq=this.getSeq(),t.command=e;var i=l.defer(),o=function(e,t){if(e)return"function"==typeof r&&r.apply(n,[e]),void i.reject(e);"function"==typeof r&&r.apply(n,[null,t]),i.resolve(t)};return this.sendCommand(t,o),i.promise}}],r=[{key:"validateInitialOptions",value:function(e){if(!e||!e.serverUrl||!e.channel||e.username&&!e.password&&!e.authToken||!e.authToken&&!e.username)throw new Error(f.ERROR_NOT_ENOUGH_PARAMS);if(!e.serverUrl.match(/^wss?:\/\//i))throw new Error(f.ERROR_INVALID_SERVER_PROTOCOL)}}],n&&i(t.prototype,n),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}(u);e.exports=h},338:(e,t,n)=>{function r(e,t){for(var n=0;n=10&&(i=9),t>0&&t<10&&(t="0"+t),n>0&&n<10&&(n="0"+n),r>0&&r<10&&(r="0"+r),t?t+":"+n+":"+r+"."+i:n?n+":"+r+"."+i:r?"00:"+r+"."+i:"00:00."+i}},{key:"buildBinaryPacket",value:function(t,n,r,i){var o=new ArrayBuffer(9),s=new DataView(o);return s.setInt8(0,t),s.setInt32(1,n,!1),s.setInt32(5,r,!1),new Uint8Array(e.arrayBufferConcat(o,i))}},{key:"buildCodecHeader",value:function(e,t,n){var r=new ArrayBuffer(4),i=new DataView(r);return i.setUint16(0,e,!0),i.setUint8(2,t),i.setUint8(3,n),btoa(String.fromCharCode.apply(null,new Uint8Array(r)))}},{key:"arrayBufferConcat",value:function(){var e=0,t=null;for(var n in arguments)e+=(t=arguments[n]).byteLength;var r=new Uint8Array(e),i=0;for(var o in arguments)t=arguments[o],r.set(new Uint8Array(t),i),i+=t.byteLength;return r.buffer}},{key:"parseCodedHeader",value:function(e){var t=new DataView(o("data:text/plain;base64,"+e));return{rate:t.getUint16(0,!0),framesPerPacket:t.getUint8(2),frameSize:t.getUint8(3)}}},{key:"isFunction",value:function(t){return e.instanceOf(t,Function)}},{key:"isArray",value:function(t){return e.instanceOf(t,Array)}},{key:"isObject",value:function(t){return e.instanceOf(t,Object)}},{key:"isPromise",value:function(t){return e.isObject(t)&&e.isFunction(t.then)}},{key:"instanceOf",value:function(e,t){return e instanceof t}},{key:"parseIncomingBinaryMessage",value:function(e){var t=new DataView(e.slice(0,9));return{messageType:t.getUint8(0),messageData:new Uint8Array(e.slice(9)),messageId:t.getUint32(1,!1),packetId:t.getUint32(5,!1)}}}],(n=null)&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.exports=s},387:(e,t,n)=>{var r;!function(i){var o=Object.hasOwnProperty,s=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a="object"==typeof process&&"function"==typeof process.nextTick,c="function"==typeof Symbol,u="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,f=c?u&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function p(){this._events={},this._conf&&h.call(this,this._conf)}function h(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function _(e,t){for(var n={},r=e.length,o=t?value.length:0,s=0;s0;)if(o===e[s])return r;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=d.apply(null,arguments),s={data:r,name:t,original:e};if(n){var a=n.call(i,s);!1!==a&&o.emit.apply(o,[s.name].concat(r))}else o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,c=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=w.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(c,e,t),delete o[e],--this._listenersCount||u()}else{for(r=(n=f(o)).length;r-- >0;)e=n[r],a.call(c,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var T=g(["function"]),b=g(["object","function"]);function O(e,t,n){var r,i,o,s=0,a=new e((function(c,u,l){function f(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var p=function(e){f(),c(e)},h=function(e){f(),u(e)};r?t(p,h,l):(i=[function(e){h(e||Error("canceled"))}],t(p,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),u(e)}),n.timeout))}));return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=m[a])&&(E=N(e,t,n[h],r+1,i))&&(g?g.push.apply(g,E):g=E);return g}if("**"===T){for((v=r+1===i||r+2===i&&"*"===b)&&n._listeners&&(g=N(e,t,n,i,i)),a=(m=f(n)).length;a-- >0;)"_listeners"!==(h=m[a])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(E=N(e,t,n[h],i,i))&&(g?g.push.apply(g,E):g=E),E=N(e,t,n[h],r,i)):E=N(e,t,n[h],h===b?r+2:r,i),E&&(g?g.push.apply(g,E):g=E));return g}n[T]&&(g=N(e,t,n[T],r+1,i))}if((y=n["*"])&&N(e,t,y,r+1,i),d=n["**"])if(r0;)"_listeners"!==(h=m[a])&&(h===b?N(e,t,d[h],r+2,i):h===T?N(e,t,d[h],r+1,i):((_={})[h]=d[h],N(e,t,{"**":_},r+1,i)));else d._listeners?N(e,t,d,i,i):d["*"]&&d["*"]._listeners&&N(e,t,d["*"],i,i);return g}function I(e,t,n){var r,i,o=0,s=0,a=this.delimiter,c=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+c}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+10&&l._listeners.length>this._maxListeners&&(l._listeners.warned=!0,y.call(this,l._listeners.length,u))):l._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,s,a,c=f(e),u=c.length,l=e._listeners;u-- >0;)i=e[o=c[u]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,l&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,s,a);return t}function A(e){for(var t,n,r,i=f(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||A(t)||delete e[n]);return r}function R(e,t,n){this.emitter=e,this.event=t,this.listener=n}function C(e,t,n){if(!0===n)o=!0;else if(!1===n)r=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var r=n.async,o=n.promisify,s=n.nextTick,c=n.objectify}if(r||s||o){var u=t,f=t._origin||t;if(s&&!a)throw Error("process.nextTick is not supported");o===i&&(o="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,n=this.event;return o?s?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=n,u.apply(t,e)})):(s?process.nextTick:l)((function(){t.event=n,u.apply(t,e)}))},t._async=!0,t._origin=f}return[t,c?new R(this,e,t):this]}function S(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,h.call(this,e)}R.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},S.EventEmitter2=S,S.prototype.listenTo=function(e,t,n){if("object"!=typeof e)throw TypeError("target musts be an object");var r=this;function o(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,o=n.reducers,s=w.call(r,e);i=-1===s?new v(r,e,n):r._observers[s];for(var a,c=f(t),u=c.length,l="function"==typeof o,p=0;p0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},S.prototype.delimiter=".",S.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},S.prototype.getMaxListeners=function(){return this._maxListeners},S.prototype.event="",S.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},S.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},S.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},S.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},S.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},S.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},S.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||p.call(this);var e,t,n,r,i,o,s=arguments[0],a=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(a&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,c)for(r=0;r3)for(t=new Array(l-1),i=1;i3)for(n=new Array(f-1),o=1;o0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,y.call(this,this._events[e].length,e))):this._events[e]=t,s)},S.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=N.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var o=0;o0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(n=a[t[o]])?r.push(n):r.push.apply(r,n);return r}if(this.wildcard){if(!(s=this.listenerTree))return[];var c=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return N.call(this,c,u,s,0),c}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},S.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?f(t):[]},S.prototype.listenerCount=function(e){return this.listeners(e).length},S.prototype.hasListeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return N.call(this,t,n,this.listenerTree,0),t.length>0}var r=this._events,o=this._all;return!!(o&&o.length||r&&(e===i?f(r).length:r[e]))},S.prototype.listenersAny=function(){return this._all?this._all:[]},S.prototype.waitFor=function(e,t){var n=this,r=typeof t;return"number"===r?t={timeout:t}:"function"===r&&(t={filter:t}),O((t=m(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:T,Promise:E})).Promise,(function(r,i,o){function s(){var o=t.filter;if(!o||o.apply(n,arguments))if(n.off(e,s),t.handleError){var a=arguments[0];a?i(a):r(d.apply(null,arguments).slice(1))}else r(d.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!1)}),{timeout:t.timeout,overload:t.overload})};var L=S.prototype;Object.defineProperties(S,{defaultMaxListeners:{get:function(){return L._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");L._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return O((n=m(n,{Promise,timeout:0,overload:!1},{Promise:E})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(d.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(L,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(r=function(){return S}.call(t,n,t,e))===i||(e.exports=r)}()},648:function(e,t){!function(n){"use strict";function r(e,t){if(e instanceof Boolean||"boolean"==typeof e)return!1;if(t instanceof Object||(t={}),t.hasOwnProperty("allowBlank")&&!t.allowBlank&&""===e)return!1;var n="(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+/]{3}=)?";return t.mime&&(n="(data:\\w+\\/[a-zA-Z\\+\\-\\.]+;base64,)?"+n),!1===t.paddingRequired&&(n="(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}(==)?|[A-Za-z0-9+\\/]{3}=?)?"),new RegExp("^"+n+"$","gi").test(e)}e.exports&&(t=e.exports=r),t.isBase64=r}()},486:e=>{!function(t){"use strict";"function"==typeof bootstrap?bootstrap("promise",t):e.exports=t()}((function(){"use strict";var e=!1;try{throw new Error}catch(t){e=!!t.stack}var t,n=b(),r=function(){},i=function(){var e={task:void 0,next:null},t=e,n=!1,r=void 0,o=!1,s=[];function a(){for(var t,r;e.next;)t=(e=e.next).task,e.task=void 0,(r=e.domain)&&(e.domain=void 0,r.enter()),c(t,r);for(;s.length;)c(t=s.pop());n=!1}function c(e,t){try{e()}catch(e){if(o)throw t&&t.exit(),setTimeout(a,0),t&&t.enter(),e;setTimeout((function(){throw e}),0)}t&&t.exit()}if(i=function(e){t=t.next={task:e,domain:o&&process.domain,next:null},n||(n=!0,r())},"object"==typeof process&&"[object process]"===process.toString()&&process.nextTick)o=!0,r=function(){process.nextTick(a)};else if("function"==typeof setImmediate)r="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){r=l,u.port1.onmessage=a,a()};var l=function(){u.port2.postMessage(0)};r=function(){setTimeout(a,0),l()}}else r=function(){setTimeout(a,0)};return i.runAfter=function(e){s.push(e),n||(n=!0,r())},i}(),o=Function.call;function s(e){return function(){return o.apply(e,arguments)}}var a,c=s(Array.prototype.slice),u=s(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;ni.stackCounter)&&(h(t,"__minimumStackCounter__",{value:i.stackCounter,configurable:!0}),r.unshift(i.stack));r.unshift(t.stack);var o=function(e){for(var t=e.split("\n"),n=[],r=0;r=n&&o<=z}function b(){if(e)try{throw new Error}catch(e){var n=e.stack.split("\n"),r=g(n[0].indexOf("@")>0?n[1]:n[2]);if(!r)return;return t=r[0],r[1]}}function O(e){return e instanceof A?e:L(e)?function(e){var t=N();return O.nextTick((function(){try{e.then(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}})),t.promise}(e):B(e)}a="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e},O.resolve=O,O.nextTick=i,O.longStackSupport=!1;var w=1;function N(){var t,n=[],r=[],i=p(N.prototype),o=p(A.prototype);if(o.promiseDispatch=function(e,i,o){var s=c(arguments);n?(n.push(s),"when"===i&&o[1]&&r.push(o[1])):O.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=C(t);return S(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},O.longStackSupport&&e)try{throw new Error}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=w++}function s(i){t=i,O.longStackSupport&&e&&(o.source=i),u(n,(function(e,t){O.nextTick((function(){i.promiseDispatch.apply(i,t)}))}),void 0),n=void 0,r=void 0}return i.promise=o,i.resolve=function(e){t||s(O(e))},i.fulfill=function(e){t||s(B(e))},i.reject=function(e){t||s(F(e))},i.notify=function(e){t||u(r,(function(t,n){O.nextTick((function(){n(e)}))}),void 0)},i}function I(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=N();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function k(e){return I((function(t,n){for(var r=0,i=e.length;r2?e.resolve(c(arguments,1)):e.resolve(n)}},O.Promise=I,O.promise=I,I.race=k,I.all=Y,I.reject=F,I.resolve=O,O.passByCopy=function(e){return e},A.prototype.passByCopy=function(){return this},O.join=function(e,t){return O(e).join(t)},A.prototype.join=function(e){return O([this,e]).spread((function(e,t){if(e===t)return e;throw new Error("Q can't join: not the same: "+e+" "+t)}))},O.race=k,A.prototype.race=function(){return this.then(O.race)},O.makePromise=A,A.prototype.toString=function(){return"[object Promise]"},A.prototype.then=function(e,t,n){var r=this,i=N(),o=!1;return O.nextTick((function(){r.promiseDispatch((function(t){o||(o=!0,i.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return F(e)}}(t)))}),"when",[function(e){o||(o=!0,i.resolve(function(e){if("function"==typeof t){m(e,r);try{return t(e)}catch(e){return F(e)}}return F(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,r=!1;try{t=function(e){return"function"==typeof n?n(e):e}(e)}catch(e){if(r=!0,!O.onerror)throw e;O.onerror(e)}r||i.notify(t)}]),i.promise},O.tap=function(e,t){return O(e).tap(t)},A.prototype.tap=function(e){return e=O(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},O.when=R,A.prototype.thenResolve=function(e){return this.then((function(){return e}))},O.thenResolve=function(e,t){return O(e).thenResolve(t)},A.prototype.thenReject=function(e){return this.then((function(){throw e}))},O.thenReject=function(e,t){return O(e).thenReject(t)},O.nearer=C,O.isPromise=S,O.isPromiseAlike=L,O.isPending=function(e){return S(e)&&"pending"===e.inspect().state},A.prototype.isPending=function(){return"pending"===this.inspect().state},O.isFulfilled=function(e){return!S(e)||"fulfilled"===e.inspect().state},A.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},O.isRejected=function(e){return S(e)&&"rejected"===e.inspect().state},A.prototype.isRejected=function(){return"rejected"===this.inspect().state};var j,x,D,P=[],M=[],V=[],U=!0;function G(){P.length=0,M.length=0,U||(U=!0)}function F(e){var t=A({when:function(t){return t&&function(e){if(U){var t=l(M,e);-1!==t&&("object"==typeof process&&"function"==typeof process.emit&&O.nextTick.runAfter((function(){var n=l(V,e);-1!==n&&(process.emit("rejectionHandled",P[t],e),V.splice(n,1))})),M.splice(t,1),P.splice(t,1))}}(this),t?t(e):this}},(function(){return this}),(function(){return{state:"rejected",reason:e}}));return function(e,t){U&&("object"==typeof process&&"function"==typeof process.emit&&O.nextTick.runAfter((function(){-1!==l(M,e)&&(process.emit("unhandledRejection",t,e),V.push(e))})),M.push(e),t&&void 0!==t.stack?P.push(t.stack):P.push("(no stack) "+t))}(t,e),t}function B(e){return A({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return d(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function W(e,t,n){return O(e).spread(t,n)}function H(e,t,n){return O(e).dispatch(t,n)}function Y(e){return R(e,(function(e){var t=0,n=N();return u(e,(function(r,i,o){var s;S(i)&&"fulfilled"===(s=i.inspect()).state?e[o]=s.value:(++t,R(i,(function(r){e[o]=r,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function Z(e){if(0===e.length)return O.resolve();var t=O.defer(),n=0;return u(e,(function(r,i,o){var s=e[o];n++,R(s,(function(e){t.resolve(e)}),(function(e){if(0==--n){var r=e||new Error(""+e);r.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+r.message,t.reject(r)}}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function q(e){return R(e,(function(e){return e=f(e,O),R(Y(f(e,(function(e){return R(e,r,r)}))),(function(){return e}))}))}O.resetUnhandledRejections=G,O.getUnhandledReasons=function(){return P.slice()},O.stopUnhandledRejectionTracking=function(){G(),U=!1},G(),O.reject=F,O.fulfill=B,O.master=function(e){return A({isDef:function(){}},(function(t,n){return H(e,t,n)}),(function(){return O(e).inspect()}))},O.spread=W,A.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},O.async=function(e){return function(){function t(e,t){var o;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return F(e)}return o.done?O(o.value):R(o.value,r,i)}try{o=n[e](t)}catch(e){return v(e)?O(e.value):F(e)}return R(o,r,i)}var n=e.apply(this,arguments),r=t.bind(t,"next"),i=t.bind(t,"throw");return r()}},O.spawn=function(e){O.done(O.async(e)())},O.return=function(e){throw new a(e)},O.promised=function(e){return function(){return W([this,Y(arguments)],(function(t,n){return e.apply(t,n)}))}},O.dispatch=H,A.prototype.dispatch=function(e,t){var n=this,r=N();return O.nextTick((function(){n.promiseDispatch(r.resolve,e,t)})),r.promise},O.get=function(e,t){return O(e).dispatch("get",[t])},A.prototype.get=function(e){return this.dispatch("get",[e])},O.set=function(e,t,n){return O(e).dispatch("set",[t,n])},A.prototype.set=function(e,t){return this.dispatch("set",[e,t])},O.del=O.delete=function(e,t){return O(e).dispatch("delete",[t])},A.prototype.del=A.prototype.delete=function(e){return this.dispatch("delete",[e])},O.mapply=O.post=function(e,t,n){return O(e).dispatch("post",[t,n])},A.prototype.mapply=A.prototype.post=function(e,t){return this.dispatch("post",[e,t])},O.send=O.mcall=O.invoke=function(e,t){return O(e).dispatch("post",[t,c(arguments,2)])},A.prototype.send=A.prototype.mcall=A.prototype.invoke=function(e){return this.dispatch("post",[e,c(arguments,1)])},O.fapply=function(e,t){return O(e).dispatch("apply",[void 0,t])},A.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},O.try=O.fcall=function(e){return O(e).dispatch("apply",[void 0,c(arguments,1)])},A.prototype.fcall=function(){return this.dispatch("apply",[void 0,c(arguments)])},O.fbind=function(e){var t=O(e),n=c(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(c(arguments))])}},A.prototype.fbind=function(){var e=this,t=c(arguments);return function(){return e.dispatch("apply",[this,t.concat(c(arguments))])}},O.keys=function(e){return O(e).dispatch("keys",[])},A.prototype.keys=function(){return this.dispatch("keys",[])},O.all=Y,A.prototype.all=function(){return Y(this)},O.any=Z,A.prototype.any=function(){return Z(this)},O.allResolved=(j=q,x="allResolved",D="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(x+" is deprecated, use "+D+" instead.",new Error("").stack),j.apply(j,arguments)}),A.prototype.allResolved=function(){return q(this)},O.allSettled=function(e){return O(e).allSettled()},A.prototype.allSettled=function(){return this.then((function(e){return Y(f(e,(function(e){function t(){return e.inspect()}return(e=O(e)).then(t,t)})))}))},O.fail=O.catch=function(e,t){return O(e).then(void 0,t)},A.prototype.fail=A.prototype.catch=function(e){return this.then(void 0,e)},O.progress=function(e,t){return O(e).then(void 0,void 0,t)},A.prototype.progress=function(e){return this.then(void 0,void 0,e)},O.fin=O.finally=function(e,t){return O(e).finally(t)},A.prototype.fin=A.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw new Error("Q can't apply finally callback");return e=O(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},O.done=function(e,t,n,r){return O(e).done(t,n,r)},A.prototype.done=function(e,t,n){var r=function(e){O.nextTick((function(){if(m(e,i),!O.onerror)throw e;O.onerror(e)}))},i=e||t||n?this.then(e,t,n):this;"object"==typeof process&&process&&process.domain&&(r=process.domain.bind(r)),i.then(void 0,r)},O.timeout=function(e,t,n){return O(e).timeout(t,n)},A.prototype.timeout=function(e,t){var n=N(),r=setTimeout((function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(r),n.resolve(e)}),(function(e){clearTimeout(r),n.reject(e)}),n.notify),n.promise},O.delay=function(e,t){return void 0===t&&(t=e,e=void 0),O(e).delay(t)},A.prototype.delay=function(e){return this.then((function(t){var n=N();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},O.nfapply=function(e,t){return O(e).nfapply(t)},A.prototype.nfapply=function(e){var t=N(),n=c(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},O.nfcall=function(e){var t=c(arguments,1);return O(e).nfapply(t)},A.prototype.nfcall=function(){var e=c(arguments),t=N();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},O.nfbind=O.denodeify=function(e){if(void 0===e)throw new Error("Q can't wrap an undefined function");var t=c(arguments,1);return function(){var n=t.concat(c(arguments)),r=N();return n.push(r.makeNodeResolver()),O(e).fapply(n).fail(r.reject),r.promise}},A.prototype.nfbind=A.prototype.denodeify=function(){var e=c(arguments);return e.unshift(this),O.denodeify.apply(void 0,e)},O.nbind=function(e,t){var n=c(arguments,2);return function(){var r=n.concat(c(arguments)),i=N();function o(){return e.apply(t,arguments)}return r.push(i.makeNodeResolver()),O(o).fapply(r).fail(i.reject),i.promise}},A.prototype.nbind=function(){var e=c(arguments,0);return e.unshift(this),O.nbind.apply(void 0,e)},O.nmapply=O.npost=function(e,t,n){return O(e).npost(t,n)},A.prototype.nmapply=A.prototype.npost=function(e,t){var n=c(t||[]),r=N();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},O.nsend=O.nmcall=O.ninvoke=function(e,t){var n=c(arguments,2),r=N();return n.push(r.makeNodeResolver()),O(e).dispatch("post",[t,n]).fail(r.reject),r.promise},A.prototype.nsend=A.prototype.nmcall=A.prototype.ninvoke=function(e){var t=c(arguments,1),n=N();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},O.nodeify=function(e,t){return O(e).nodeify(t)},A.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){O.nextTick((function(){e(null,t)}))}),(function(t){O.nextTick((function(){e(t)}))}))},O.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var z=b();return O}))},634:(e,t,n)=>{"use strict";var r=n(668),i=n(648);function o(e){for(var t=new Uint8Array(e.length),n=0;n{return e={668:e=>{e.exports=function(e){return atob(e)}},2:e=>{e.exports={libraryName:"ZCC"}},712:e=>{e.exports={ERROR_NOT_ENOUGH_PARAMS:"Not enough parameters",ERROR_INVALID_SERVER_PROTOCOL:"Invalid server protocol, use ws:// or wss://",ERROR_UNSUPPORTED:"Your browser does not support all required APIs.\nRead more here https://github.com/zelloptt/zello-channel-api",ERROR_RECORDING_NO_HTTPS:"Recording will work over https:// loaded pages only",ERROR_WIDGET_ELEMENT_NOT_FOUND:"DOM element for widget is not found",ERROR_INVALID_DECODER:"Invalid incoming message decoder. Should implement ZCC.Decoder interface",ERROR_INVALID_PLAYER:"Invalid incoming message player. Should implement ZCC.Player interface",ERROR_INVALID_RECORDER:"Invalid outgoing message recorder. Should implement ZCC.Recorder interface",ERROR_INVALID_ENCODER:"Invalid outgoing message encoder. Should implement ZCC.Encoder interface",ERROR_SESSION_FAIL_CONNECT:"Failed to connect",ERROR_INVALID_IMAGE_WIDTH_OR_HEIGHT:"Invalid image width or height",ERROR_FAILED_TO_SEND_IMAGE:"Failed to send image",ERROR_IMAGE_NOT_READY_TO_BE_SENT:"Image is not ready to be sent",ERROR_NO_CAMERA_AVAILABLE:"No camera available",ERROR_TYPE_UNKNOWN_SERVER_ERROR:"Unknown server error",ERROR_TYPE_CONFIGURATION:"configuration",EVENT_ERROR:"error",EVENT_CONNECT:"connect",EVENT_CLOSE:"close",EVENT_LOGON:"logon",EVENT_STATUS:"status",EVENT_START_STREAM:"start_stream",EVENT_STOP_STREAM:"stop_stream",EVENT_SESSION_START_CONNECT:"session_start_connect",EVENT_SESSION_CONNECT:"session_connect",EVENT_SESSION_FAIL_CONNECT:"session_fail_connect",EVENT_SESSION_CONNECTION_LOST:"session_connection_lost",EVENT_SESSION_DISCONNECT:"session_disconnect",EVENT_INCOMING_VOICE_WILL_START:"incoming_voice_will_start",EVENT_INCOMING_VOICE_DID_START:"incoming_voice_did_start",EVENT_INCOMING_VOICE_DID_STOP:"incoming_voice_did_stop",EVENT_INCOMING_VOICE_FAIL_START:"incoming_voice_fail_start",EVENT_OUTGOING_VOICE_DID_STOP:"outgoing_voice_did_stop",EVENT_INCOMING_VOICE_DATA:"incoming_voice_data",EVENT_INCOMING_VOICE_DATA_DECODED:"incoming_voice_data_decoded",EVENT_INCOMING_IMAGE_DATA:"incoming_image_data",EVENT_DATA:"data",EVENT_DATA_ENCODED:"data_encoded",EVENT_ENCODER_DONE:"encoder_done",EVENT_RECORDER_READY:"recorder_ready",EVENT_WIDGET_OPEN_BUTTON_CLICK:"widget_open_button_click",EVENT_WIDGET_MUTE:"widget_mute",EVENT_WIDGET_UNMUTE:"widget_unmute",EVENT_WIDGET_SPEAKING_USERNAME_CLICK:"speaking_username_click",EVENT_INCOMING_TEXT_MESSAGE:"incoming_text_message",EVENT_INCOMING_LOCATION:"incoming_location",EVENT_INCOMING_IMAGE:"incoming_image",EVENT_IMAGE_DATA:"image_data",EVENT_THUMBNAIL_DATA:"thumbnail_data",EVENT_IMAGE_PREVIEW_DATA:"image_preview_data",EVENT_THUMBNAIL_PREVIEW_DATA:"thumbnail_preview_data",EVENT_DISPATCH_CALL_STATUS:"dispatch_call_status",MAX_OUTGOING_IMAGE_SCALE_PX:1280,OUTGOING_IMAGE_THUMBNAIL_SCALE_PX:90,SN_STATUS_SUCCESS:"success",SN_STATUS_ONLINE:"online",SN_STATUS_OFFLINE:"offline",MESSAGE_TYPE_AUDIO:1,MESSAGE_TYPE_IMAGE:2,MESSAGE_TYPE_JSON:123,IMAGE_TYPE_FULL:1,IMAGE_TYPE_THUMBNAIL:2,TALK_PRIORITY_VALUE_NORMAL:100,TALK_PRIORITY_VALUE_LOW:10}},706:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n1||"string"==typeof e&&-1!==e.indexOf(".")||(arguments[0]=(arguments[0]instanceof Array?arguments[0][0]:arguments[0])+".*",o(l(u.prototype),"emit",this).apply(this,arguments))}}],n&&i(t.prototype,n),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(n(387).EventEmitter2);e.exports=f},492:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;return this.connectOrReconnect(e)}},{key:"clearExistingReconnectTimeout",value:function(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout)}},{key:"connectOrReconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=l.defer();return this.connectAttempts?(this.connectAttempts===this.maxConnectAttempts&&this.emit(f.EVENT_SESSION_START_CONNECT),this.connectAttempts--,this.doConnect().then((function(){return e.doLogon()})).then((function(n){"function"==typeof t&&t.apply(e,[null,n]),e.emit(f.EVENT_SESSION_CONNECT),r.resolve(n)})).catch((function(i){if(e.disconnect(),e.connectAttempts)return e.clearExistingReconnectTimeout(),void(e.reconnectTimeout=setTimeout((function(){e.connectOrReconnect(t,n)}),e.connectRetryTimeoutMs));"function"==typeof t&&t.apply(e,[i]),e.emit(n?f.EVENT_SESSION_DISCONNECT:f.EVENT_SESSION_FAIL_CONNECT,i),r.reject(i)})),r.promise):(this.emit(this.channelConfigurationError?f.EVENT_SESSION_DISCONNECT:f.EVENT_SESSION_FAIL_CONNECT),r.reject("Failed to connect"))}},{key:"doConnect",value:function(){var e=this,t=l.defer();return this.wsConnection=new WebSocket(this.options.serverUrl),this.wsConnection.binaryType="arraybuffer",this.wsConnection.addEventListener("open",(function(){return t.resolve()})),this.wsConnection.addEventListener("message",(function(t){e.wsMessageHandler(t.data)})),this.wsConnection.addEventListener("error",(function(e){return t.reject("WebSocket error: "+e)})),this.wsConnection.addEventListener("close",(function(n){e.selfDisconnect?e.selfDisconnect=!1:"fulfilled"===t.promise.inspect().state&&(e.emit(f.EVENT_SESSION_CONNECTION_LOST,n.reason),e.clearExistingReconnectTimeout(),e.reconnectTimeout=setTimeout((function(){e.connectOrReconnect(null,!0)}),e.connectRetryTimeoutMs))})),t.promise}},{key:"doLogon",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=l.defer(),n={command:"logon",seq:this.getSeq(),channel:this.options.channel};e?n.refresh_token=e:(n.auth_token=this.options.authToken,n.token_version=this.options.tokenVersion),this.options.listenOnly&&(n.listen_only=!0),this.options.username&&(n.username=this.options.username,n.password=this.options.password),n.version=this.version,this.options.platformName&&(n.platform_name=this.options.platformName),this.options.platformType&&(n.platform_type=this.options.platformType);var r=function(e,n){e?t.reject(e):t.resolve(n)};return this.sendCommand(n,r),t.promise}},{key:"disconnect",value:function(){this.selfDisconnect=!0,this.wsConnection.close()}},{key:"wsBinaryDataHandler",value:function(e){var t=p.parseIncomingBinaryMessage(e);switch(t.messageType){case f.MESSAGE_TYPE_AUDIO:this.emit(f.EVENT_INCOMING_VOICE_DATA,t);break;case f.MESSAGE_TYPE_IMAGE:this.emit(f.EVENT_INCOMING_IMAGE_DATA,t)}}},{key:"jsonDataHandler",value:function(e){var t=this;e&&e.seq&&this.handleCallbacks(e),e.refresh_token&&(this.refreshToken=e.refresh_token);var n=p.getLoadedLibrary();switch(e.command){case"on_error":var r=f.ERROR_TYPE_UNKNOWN_SERVER_ERROR;e.error&&(r=e.error),this.emit(f.EVENT_ERROR,r);break;case"on_channel_status":if(!this.wasOnline)switch(e.status){case f.SN_STATUS_ONLINE:this.wasOnline=!0,this.connectAttempts=this.maxConnectAttempts;break;case f.SN_STATUS_OFFLINE:e.error&&e.error_type===f.ERROR_TYPE_CONFIGURATION&&(this.channelConfigurationError=!0)}this.emit(f.EVENT_STATUS,e);break;case"on_stream_start":var i=new n.IncomingMessage(e,this);this.incomingMessages[e.stream_id]=i,i.init().then((function(){t.emit(f.EVENT_INCOMING_VOICE_WILL_START,i)})).catch((function(e){t.emit(f.EVENT_INCOMING_VOICE_FAIL_START,i,e)}));break;case"on_stream_stop":if(!this.incomingMessages[e.stream_id]){this.emit(f.EVENT_OUTGOING_VOICE_DID_STOP,e.stream_id);break}this.emit(f.EVENT_INCOMING_VOICE_DID_STOP,this.incomingMessages[e.stream_id]);break;case"on_text_message":this.emit(f.EVENT_INCOMING_TEXT_MESSAGE,e);break;case"on_location":this.emit(f.EVENT_INCOMING_LOCATION,e);break;case"on_image":var o=new n.IncomingImage(e,this);this.emit(f.EVENT_INCOMING_IMAGE,o);break;case"on_dispatch_call_status":this.emit(f.EVENT_DISPATCH_CALL_STATUS,e)}}},{key:"wsMessageHandler",value:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t?this.jsonDataHandler(t):this.wsBinaryDataHandler(e)}},{key:"handleCallbacks",value:function(e){var t=e.error?e.error:null,n=this.callbacks[e.seq];"function"==typeof n&&(n.apply(this,[t,e]),delete this.callbacks[e.seq])}},{key:"sendCommand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e.seq&&t&&(this.callbacks[e.seq]=t),this.wsConnection.send(JSON.stringify(e))}},{key:"sendBinary",value:function(e){this.wsConnection.send(e)}},{key:"startStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("start_stream",e,t)}},{key:"stopStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("stop_stream",e,t)}},{key:"startVoiceMessage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=p.getLoadedLibrary();return this.activeOutgoingMessage=new r.OutgoingMessage(this,t,n),this.activeOutgoingMessage.on(f.EVENT_DATA_ENCODED,(function(t){e.activeOutgoingMessage.options.autoSendAudio&&e.sendBinary(t)})),this.activeOutgoingMessage}},{key:"onIncomingVoiceDidStart",value:function(e){this.emit(f.EVENT_INCOMING_VOICE_DID_START,e)}},{key:"onIncomingVoiceDecoded",value:function(e,t){this.emit(f.EVENT_INCOMING_VOICE_DATA_DECODED,e,t)}},{key:"sendImage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=p.getLoadedLibrary();return this.activeOutgoingImage=new t.OutgoingImage(this,e),this.activeOutgoingImage}},{key:"sendTextMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("send_text_message",e,t)}},{key:"sendLocation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.sendCommandWithCallback("send_location",e,t)}},{key:"endDispatchCall",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n={call_id:e,channel:this.options.channel};return this.sendCommandWithCallback("end_dispatch_call",n,t)}},{key:"sendCommandWithCallback",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.seq=this.getSeq(),t.command=e;var i=l.defer(),o=function(e,t){if(e)return"function"==typeof r&&r.apply(n,[e]),void i.reject(e);"function"==typeof r&&r.apply(n,[null,t]),i.resolve(t)};return this.sendCommand(t,o),i.promise}}],r=[{key:"validateInitialOptions",value:function(e){if(!e||!e.serverUrl||!e.channel||e.username&&!e.password&&!e.authToken||!e.authToken&&!e.username)throw new Error(f.ERROR_NOT_ENOUGH_PARAMS);if(!e.serverUrl.match(/^wss?:\/\//i))throw new Error(f.ERROR_INVALID_SERVER_PROTOCOL)}}],n&&i(t.prototype,n),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}(u);e.exports=h},338:(e,t,n)=>{function r(e,t){for(var n=0;n=10&&(i=9),t>0&&t<10&&(t="0"+t),n>0&&n<10&&(n="0"+n),r>0&&r<10&&(r="0"+r),t?t+":"+n+":"+r+"."+i:n?n+":"+r+"."+i:r?"00:"+r+"."+i:"00:00."+i}},{key:"buildBinaryPacket",value:function(t,n,r,i){var o=new ArrayBuffer(9),s=new DataView(o);return s.setInt8(0,t),s.setInt32(1,n,!1),s.setInt32(5,r,!1),new Uint8Array(e.arrayBufferConcat(o,i))}},{key:"buildCodecHeader",value:function(e,t,n){var r=new ArrayBuffer(4),i=new DataView(r);return i.setUint16(0,e,!0),i.setUint8(2,t),i.setUint8(3,n),btoa(String.fromCharCode.apply(null,new Uint8Array(r)))}},{key:"arrayBufferConcat",value:function(){var e=0,t=null;for(var n in arguments)e+=(t=arguments[n]).byteLength;var r=new Uint8Array(e),i=0;for(var o in arguments)t=arguments[o],r.set(new Uint8Array(t),i),i+=t.byteLength;return r.buffer}},{key:"parseCodedHeader",value:function(e){var t=new DataView(o("data:text/plain;base64,"+e));return{rate:t.getUint16(0,!0),framesPerPacket:t.getUint8(2),frameSize:t.getUint8(3)}}},{key:"isFunction",value:function(t){return e.instanceOf(t,Function)}},{key:"isArray",value:function(t){return e.instanceOf(t,Array)}},{key:"isObject",value:function(t){return e.instanceOf(t,Object)}},{key:"isPromise",value:function(t){return e.isObject(t)&&e.isFunction(t.then)}},{key:"instanceOf",value:function(e,t){return e instanceof t}},{key:"parseIncomingBinaryMessage",value:function(e){var t=new DataView(e.slice(0,9));return{messageType:t.getUint8(0),messageData:new Uint8Array(e.slice(9)),messageId:t.getUint32(1,!1),packetId:t.getUint32(5,!1)}}}],(n=null)&&r(t.prototype,n),s&&r(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.exports=s},387:(e,t,n)=>{var r;!function(i){var o=Object.hasOwnProperty,s=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a="object"==typeof process&&"function"==typeof process.nextTick,c="function"==typeof Symbol,u="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,f=c?u&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function p(){this._events={},this._conf&&h.call(this,this._conf)}function h(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function _(e,t){for(var n={},r=e.length,o=t?value.length:0,s=0;s0;)if(o===e[s])return r;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=d.apply(null,arguments),s={data:r,name:t,original:e};if(n){var a=n.call(i,s);!1!==a&&o.emit.apply(o,[s.name].concat(r))}else o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,c=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=w.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(c,e,t),delete o[e],--this._listenersCount||u()}else{for(r=(n=f(o)).length;r-- >0;)e=n[r],a.call(c,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var T=g(["function"]),b=g(["object","function"]);function O(e,t,n){var r,i,o,s=0,a=new e((function(c,u,l){function f(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var p=function(e){f(),c(e)},h=function(e){f(),u(e)};r?t(p,h,l):(i=[function(e){h(e||Error("canceled"))}],t(p,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),u(e)}),n.timeout))}));return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=m[a])&&(E=N(e,t,n[h],r+1,i))&&(g?g.push.apply(g,E):g=E);return g}if("**"===T){for((v=r+1===i||r+2===i&&"*"===b)&&n._listeners&&(g=N(e,t,n,i,i)),a=(m=f(n)).length;a-- >0;)"_listeners"!==(h=m[a])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(E=N(e,t,n[h],i,i))&&(g?g.push.apply(g,E):g=E),E=N(e,t,n[h],r,i)):E=N(e,t,n[h],h===b?r+2:r,i),E&&(g?g.push.apply(g,E):g=E));return g}n[T]&&(g=N(e,t,n[T],r+1,i))}if((y=n["*"])&&N(e,t,y,r+1,i),d=n["**"])if(r0;)"_listeners"!==(h=m[a])&&(h===b?N(e,t,d[h],r+2,i):h===T?N(e,t,d[h],r+1,i):((_={})[h]=d[h],N(e,t,{"**":_},r+1,i)));else d._listeners?N(e,t,d,i,i):d["*"]&&d["*"]._listeners&&N(e,t,d["*"],i,i);return g}function I(e,t,n){var r,i,o=0,s=0,a=this.delimiter,c=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+c}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+10&&l._listeners.length>this._maxListeners&&(l._listeners.warned=!0,y.call(this,l._listeners.length,u))):l._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,s,a,c=f(e),u=c.length,l=e._listeners;u-- >0;)i=e[o=c[u]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,l&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,s,a);return t}function A(e){for(var t,n,r,i=f(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||A(t)||delete e[n]);return r}function R(e,t,n){this.emitter=e,this.event=t,this.listener=n}function C(e,t,n){if(!0===n)o=!0;else if(!1===n)r=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var r=n.async,o=n.promisify,s=n.nextTick,c=n.objectify}if(r||s||o){var u=t,f=t._origin||t;if(s&&!a)throw Error("process.nextTick is not supported");o===i&&(o="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,n=this.event;return o?s?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=n,u.apply(t,e)})):(s?process.nextTick:l)((function(){t.event=n,u.apply(t,e)}))},t._async=!0,t._origin=f}return[t,c?new R(this,e,t):this]}function S(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,h.call(this,e)}R.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},S.EventEmitter2=S,S.prototype.listenTo=function(e,t,n){if("object"!=typeof e)throw TypeError("target musts be an object");var r=this;function o(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,o=n.reducers,s=w.call(r,e);i=-1===s?new v(r,e,n):r._observers[s];for(var a,c=f(t),u=c.length,l="function"==typeof o,p=0;p0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},S.prototype.delimiter=".",S.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},S.prototype.getMaxListeners=function(){return this._maxListeners},S.prototype.event="",S.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},S.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},S.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},S.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},S.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},S.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},S.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||p.call(this);var e,t,n,r,i,o,s=arguments[0],a=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(a&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,c)for(r=0;r3)for(t=new Array(l-1),i=1;i3)for(n=new Array(f-1),o=1;o0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,y.call(this,this._events[e].length,e))):this._events[e]=t,s)},S.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=N.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var o=0;o0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(n=a[t[o]])?r.push(n):r.push.apply(r,n);return r}if(this.wildcard){if(!(s=this.listenerTree))return[];var c=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return N.call(this,c,u,s,0),c}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},S.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?f(t):[]},S.prototype.listenerCount=function(e){return this.listeners(e).length},S.prototype.hasListeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return N.call(this,t,n,this.listenerTree,0),t.length>0}var r=this._events,o=this._all;return!!(o&&o.length||r&&(e===i?f(r).length:r[e]))},S.prototype.listenersAny=function(){return this._all?this._all:[]},S.prototype.waitFor=function(e,t){var n=this,r=typeof t;return"number"===r?t={timeout:t}:"function"===r&&(t={filter:t}),O((t=m(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:T,Promise:E})).Promise,(function(r,i,o){function s(){var o=t.filter;if(!o||o.apply(n,arguments))if(n.off(e,s),t.handleError){var a=arguments[0];a?i(a):r(d.apply(null,arguments).slice(1))}else r(d.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!1)}),{timeout:t.timeout,overload:t.overload})};var L=S.prototype;Object.defineProperties(S,{defaultMaxListeners:{get:function(){return L._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");L._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return O((n=m(n,{Promise,timeout:0,overload:!1},{Promise:E})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(d.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(L,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(r=function(){return S}.call(t,n,t,e))===i||(e.exports=r)}()},648:function(e,t){!function(n){"use strict";function r(e,t){if(e instanceof Boolean||"boolean"==typeof e)return!1;if(t instanceof Object||(t={}),t.hasOwnProperty("allowBlank")&&!t.allowBlank&&""===e)return!1;var n="(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+/]{3}=)?";return t.mime&&(n="(data:\\w+\\/[a-zA-Z\\+\\-\\.]+;base64,)?"+n),!1===t.paddingRequired&&(n="(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}(==)?|[A-Za-z0-9+\\/]{3}=?)?"),new RegExp("^"+n+"$","gi").test(e)}e.exports&&(t=e.exports=r),t.isBase64=r}()},486:e=>{!function(t){"use strict";"function"==typeof bootstrap?bootstrap("promise",t):e.exports=t()}((function(){"use strict";var e=!1;try{throw new Error}catch(t){e=!!t.stack}var t,n=b(),r=function(){},i=function(){var e={task:void 0,next:null},t=e,n=!1,r=void 0,o=!1,s=[];function a(){for(var t,r;e.next;)t=(e=e.next).task,e.task=void 0,(r=e.domain)&&(e.domain=void 0,r.enter()),c(t,r);for(;s.length;)c(t=s.pop());n=!1}function c(e,t){try{e()}catch(e){if(o)throw t&&t.exit(),setTimeout(a,0),t&&t.enter(),e;setTimeout((function(){throw e}),0)}t&&t.exit()}if(i=function(e){t=t.next={task:e,domain:o&&process.domain,next:null},n||(n=!0,r())},"object"==typeof process&&"[object process]"===process.toString()&&process.nextTick)o=!0,r=function(){process.nextTick(a)};else if("function"==typeof setImmediate)r="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){r=l,u.port1.onmessage=a,a()};var l=function(){u.port2.postMessage(0)};r=function(){setTimeout(a,0),l()}}else r=function(){setTimeout(a,0)};return i.runAfter=function(e){s.push(e),n||(n=!0,r())},i}(),o=Function.call;function s(e){return function(){return o.apply(e,arguments)}}var a,c=s(Array.prototype.slice),u=s(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;ni.stackCounter)&&(h(t,"__minimumStackCounter__",{value:i.stackCounter,configurable:!0}),r.unshift(i.stack));r.unshift(t.stack);var o=function(e){for(var t=e.split("\n"),n=[],r=0;r=n&&o<=z}function b(){if(e)try{throw new Error}catch(e){var n=e.stack.split("\n"),r=g(n[0].indexOf("@")>0?n[1]:n[2]);if(!r)return;return t=r[0],r[1]}}function O(e){return e instanceof A?e:L(e)?function(e){var t=N();return O.nextTick((function(){try{e.then(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}})),t.promise}(e):B(e)}a="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e},O.resolve=O,O.nextTick=i,O.longStackSupport=!1;var w=1;function N(){var t,n=[],r=[],i=p(N.prototype),o=p(A.prototype);if(o.promiseDispatch=function(e,i,o){var s=c(arguments);n?(n.push(s),"when"===i&&o[1]&&r.push(o[1])):O.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=C(t);return S(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},O.longStackSupport&&e)try{throw new Error}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=w++}function s(i){t=i,O.longStackSupport&&e&&(o.source=i),u(n,(function(e,t){O.nextTick((function(){i.promiseDispatch.apply(i,t)}))}),void 0),n=void 0,r=void 0}return i.promise=o,i.resolve=function(e){t||s(O(e))},i.fulfill=function(e){t||s(B(e))},i.reject=function(e){t||s(F(e))},i.notify=function(e){t||u(r,(function(t,n){O.nextTick((function(){n(e)}))}),void 0)},i}function I(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=N();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function k(e){return I((function(t,n){for(var r=0,i=e.length;r2?e.resolve(c(arguments,1)):e.resolve(n)}},O.Promise=I,O.promise=I,I.race=k,I.all=Y,I.reject=F,I.resolve=O,O.passByCopy=function(e){return e},A.prototype.passByCopy=function(){return this},O.join=function(e,t){return O(e).join(t)},A.prototype.join=function(e){return O([this,e]).spread((function(e,t){if(e===t)return e;throw new Error("Q can't join: not the same: "+e+" "+t)}))},O.race=k,A.prototype.race=function(){return this.then(O.race)},O.makePromise=A,A.prototype.toString=function(){return"[object Promise]"},A.prototype.then=function(e,t,n){var r=this,i=N(),o=!1;return O.nextTick((function(){r.promiseDispatch((function(t){o||(o=!0,i.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return F(e)}}(t)))}),"when",[function(e){o||(o=!0,i.resolve(function(e){if("function"==typeof t){m(e,r);try{return t(e)}catch(e){return F(e)}}return F(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,r=!1;try{t=function(e){return"function"==typeof n?n(e):e}(e)}catch(e){if(r=!0,!O.onerror)throw e;O.onerror(e)}r||i.notify(t)}]),i.promise},O.tap=function(e,t){return O(e).tap(t)},A.prototype.tap=function(e){return e=O(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},O.when=R,A.prototype.thenResolve=function(e){return this.then((function(){return e}))},O.thenResolve=function(e,t){return O(e).thenResolve(t)},A.prototype.thenReject=function(e){return this.then((function(){throw e}))},O.thenReject=function(e,t){return O(e).thenReject(t)},O.nearer=C,O.isPromise=S,O.isPromiseAlike=L,O.isPending=function(e){return S(e)&&"pending"===e.inspect().state},A.prototype.isPending=function(){return"pending"===this.inspect().state},O.isFulfilled=function(e){return!S(e)||"fulfilled"===e.inspect().state},A.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},O.isRejected=function(e){return S(e)&&"rejected"===e.inspect().state},A.prototype.isRejected=function(){return"rejected"===this.inspect().state};var j,x,D,M=[],V=[],P=[],U=!0;function G(){M.length=0,V.length=0,U||(U=!0)}function F(e){var t=A({when:function(t){return t&&function(e){if(U){var t=l(V,e);-1!==t&&("object"==typeof process&&"function"==typeof process.emit&&O.nextTick.runAfter((function(){var n=l(P,e);-1!==n&&(process.emit("rejectionHandled",M[t],e),P.splice(n,1))})),V.splice(t,1),M.splice(t,1))}}(this),t?t(e):this}},(function(){return this}),(function(){return{state:"rejected",reason:e}}));return function(e,t){U&&("object"==typeof process&&"function"==typeof process.emit&&O.nextTick.runAfter((function(){-1!==l(V,e)&&(process.emit("unhandledRejection",t,e),P.push(e))})),V.push(e),t&&void 0!==t.stack?M.push(t.stack):M.push("(no stack) "+t))}(t,e),t}function B(e){return A({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return d(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function W(e,t,n){return O(e).spread(t,n)}function H(e,t,n){return O(e).dispatch(t,n)}function Y(e){return R(e,(function(e){var t=0,n=N();return u(e,(function(r,i,o){var s;S(i)&&"fulfilled"===(s=i.inspect()).state?e[o]=s.value:(++t,R(i,(function(r){e[o]=r,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function Z(e){if(0===e.length)return O.resolve();var t=O.defer(),n=0;return u(e,(function(r,i,o){var s=e[o];n++,R(s,(function(e){t.resolve(e)}),(function(e){if(0==--n){var r=e||new Error(""+e);r.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+r.message,t.reject(r)}}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function q(e){return R(e,(function(e){return e=f(e,O),R(Y(f(e,(function(e){return R(e,r,r)}))),(function(){return e}))}))}O.resetUnhandledRejections=G,O.getUnhandledReasons=function(){return M.slice()},O.stopUnhandledRejectionTracking=function(){G(),U=!1},G(),O.reject=F,O.fulfill=B,O.master=function(e){return A({isDef:function(){}},(function(t,n){return H(e,t,n)}),(function(){return O(e).inspect()}))},O.spread=W,A.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},O.async=function(e){return function(){function t(e,t){var o;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return F(e)}return o.done?O(o.value):R(o.value,r,i)}try{o=n[e](t)}catch(e){return v(e)?O(e.value):F(e)}return R(o,r,i)}var n=e.apply(this,arguments),r=t.bind(t,"next"),i=t.bind(t,"throw");return r()}},O.spawn=function(e){O.done(O.async(e)())},O.return=function(e){throw new a(e)},O.promised=function(e){return function(){return W([this,Y(arguments)],(function(t,n){return e.apply(t,n)}))}},O.dispatch=H,A.prototype.dispatch=function(e,t){var n=this,r=N();return O.nextTick((function(){n.promiseDispatch(r.resolve,e,t)})),r.promise},O.get=function(e,t){return O(e).dispatch("get",[t])},A.prototype.get=function(e){return this.dispatch("get",[e])},O.set=function(e,t,n){return O(e).dispatch("set",[t,n])},A.prototype.set=function(e,t){return this.dispatch("set",[e,t])},O.del=O.delete=function(e,t){return O(e).dispatch("delete",[t])},A.prototype.del=A.prototype.delete=function(e){return this.dispatch("delete",[e])},O.mapply=O.post=function(e,t,n){return O(e).dispatch("post",[t,n])},A.prototype.mapply=A.prototype.post=function(e,t){return this.dispatch("post",[e,t])},O.send=O.mcall=O.invoke=function(e,t){return O(e).dispatch("post",[t,c(arguments,2)])},A.prototype.send=A.prototype.mcall=A.prototype.invoke=function(e){return this.dispatch("post",[e,c(arguments,1)])},O.fapply=function(e,t){return O(e).dispatch("apply",[void 0,t])},A.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},O.try=O.fcall=function(e){return O(e).dispatch("apply",[void 0,c(arguments,1)])},A.prototype.fcall=function(){return this.dispatch("apply",[void 0,c(arguments)])},O.fbind=function(e){var t=O(e),n=c(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(c(arguments))])}},A.prototype.fbind=function(){var e=this,t=c(arguments);return function(){return e.dispatch("apply",[this,t.concat(c(arguments))])}},O.keys=function(e){return O(e).dispatch("keys",[])},A.prototype.keys=function(){return this.dispatch("keys",[])},O.all=Y,A.prototype.all=function(){return Y(this)},O.any=Z,A.prototype.any=function(){return Z(this)},O.allResolved=(j=q,x="allResolved",D="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(x+" is deprecated, use "+D+" instead.",new Error("").stack),j.apply(j,arguments)}),A.prototype.allResolved=function(){return q(this)},O.allSettled=function(e){return O(e).allSettled()},A.prototype.allSettled=function(){return this.then((function(e){return Y(f(e,(function(e){function t(){return e.inspect()}return(e=O(e)).then(t,t)})))}))},O.fail=O.catch=function(e,t){return O(e).then(void 0,t)},A.prototype.fail=A.prototype.catch=function(e){return this.then(void 0,e)},O.progress=function(e,t){return O(e).then(void 0,void 0,t)},A.prototype.progress=function(e){return this.then(void 0,void 0,e)},O.fin=O.finally=function(e,t){return O(e).finally(t)},A.prototype.fin=A.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw new Error("Q can't apply finally callback");return e=O(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},O.done=function(e,t,n,r){return O(e).done(t,n,r)},A.prototype.done=function(e,t,n){var r=function(e){O.nextTick((function(){if(m(e,i),!O.onerror)throw e;O.onerror(e)}))},i=e||t||n?this.then(e,t,n):this;"object"==typeof process&&process&&process.domain&&(r=process.domain.bind(r)),i.then(void 0,r)},O.timeout=function(e,t,n){return O(e).timeout(t,n)},A.prototype.timeout=function(e,t){var n=N(),r=setTimeout((function(){t&&"string"!=typeof t||((t=new Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(r),n.resolve(e)}),(function(e){clearTimeout(r),n.reject(e)}),n.notify),n.promise},O.delay=function(e,t){return void 0===t&&(t=e,e=void 0),O(e).delay(t)},A.prototype.delay=function(e){return this.then((function(t){var n=N();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},O.nfapply=function(e,t){return O(e).nfapply(t)},A.prototype.nfapply=function(e){var t=N(),n=c(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},O.nfcall=function(e){var t=c(arguments,1);return O(e).nfapply(t)},A.prototype.nfcall=function(){var e=c(arguments),t=N();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},O.nfbind=O.denodeify=function(e){if(void 0===e)throw new Error("Q can't wrap an undefined function");var t=c(arguments,1);return function(){var n=t.concat(c(arguments)),r=N();return n.push(r.makeNodeResolver()),O(e).fapply(n).fail(r.reject),r.promise}},A.prototype.nfbind=A.prototype.denodeify=function(){var e=c(arguments);return e.unshift(this),O.denodeify.apply(void 0,e)},O.nbind=function(e,t){var n=c(arguments,2);return function(){var r=n.concat(c(arguments)),i=N();function o(){return e.apply(t,arguments)}return r.push(i.makeNodeResolver()),O(o).fapply(r).fail(i.reject),i.promise}},A.prototype.nbind=function(){var e=c(arguments,0);return e.unshift(this),O.nbind.apply(void 0,e)},O.nmapply=O.npost=function(e,t,n){return O(e).npost(t,n)},A.prototype.nmapply=A.prototype.npost=function(e,t){var n=c(t||[]),r=N();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},O.nsend=O.nmcall=O.ninvoke=function(e,t){var n=c(arguments,2),r=N();return n.push(r.makeNodeResolver()),O(e).dispatch("post",[t,n]).fail(r.reject),r.promise},A.prototype.nsend=A.prototype.nmcall=A.prototype.ninvoke=function(e){var t=c(arguments,1),n=N();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},O.nodeify=function(e,t){return O(e).nodeify(t)},A.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){O.nextTick((function(){e(null,t)}))}),(function(t){O.nextTick((function(){e(t)}))}))},O.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var z=b();return O}))},634:(e,t,n)=>{"use strict";var r=n(668),i=n(648);function o(e){for(var t=new Uint8Array(e.length),n=0;n