ue-softphone-sdk 3.0.15 → 3.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/types/index.d.ts +5 -0
- package/dist/lib/ue-soft-phone.min.js +2 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/ue-softphone-sdk.js +2 -2
- package/index.html/index.html +11 -1
- package/package.json +1 -1
- package/sdkdemo/img/wifi1.b7af5ed5.svg +10 -0
- package/sdkdemo/img/wifi2.1648a543.svg +4 -0
- package/sdkdemo/img/wifi3.ec030889.svg +4 -0
- package/sdkdemo/img/wifi4.101d572a.svg +4 -0
- package/sdkdemo/ue-load.min.js +60 -60
- package/sdkdemo/ue.lib.css +1 -1
- package/sdkdemo/ue.min.js +19 -5
- package/sdkdemo/webphone_ez.html +76 -0
- package/src/index.ts +171 -52
package/dist/types/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ interface InitOptions {
|
|
|
22
22
|
pushHangupStatistics?: boolean;
|
|
23
23
|
pushCallinRingStatistics?: boolean;
|
|
24
24
|
isOpenCallQueue?: boolean;
|
|
25
|
+
openNlsTranslation?: boolean;
|
|
25
26
|
}
|
|
26
27
|
interface OnCallEventParams {
|
|
27
28
|
success?: Function;
|
|
@@ -139,6 +140,7 @@ export default class ueSoftphone {
|
|
|
139
140
|
static Socketinstance: any;
|
|
140
141
|
static AudioTask: any;
|
|
141
142
|
static MonitorSocketinstance: any;
|
|
143
|
+
static UserConfig: any;
|
|
142
144
|
static noop(): void;
|
|
143
145
|
static debug: (msg: any) => void;
|
|
144
146
|
static log: (msg: any) => void;
|
|
@@ -149,6 +151,7 @@ export default class ueSoftphone {
|
|
|
149
151
|
static request: (server: string, proto: any) => any;
|
|
150
152
|
private attachEventCallbacks;
|
|
151
153
|
private attachMonitorEventCallbacks;
|
|
154
|
+
private attachNlsTranslationEventCallbacks;
|
|
152
155
|
constructor(options?: InitOptions);
|
|
153
156
|
private init;
|
|
154
157
|
private login;
|
|
@@ -161,7 +164,9 @@ export default class ueSoftphone {
|
|
|
161
164
|
private initAgentQueue;
|
|
162
165
|
private initQueue;
|
|
163
166
|
static createQueueMonitorEventHandle(callbacks?: any): void;
|
|
167
|
+
static createopenNlsTransEventHandle(callbacks?: any): void;
|
|
164
168
|
listenCallQueueEvent: (callbacks: any) => void;
|
|
169
|
+
listenTranslationEvent: (callbacks: any) => void;
|
|
165
170
|
static useDefaultDependencies(deps: any): {
|
|
166
171
|
newWebSocket(server: string, proto: any): any;
|
|
167
172
|
request(url: string, options: any): any;
|
package/dist/ue-softphone-sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ue-webrtc"),require("js-base64"),require("js-md5"),require("jsencrypt")):"function"==typeof define&&define.amd?define(["ue-webrtc","js-base64","js-md5","jsencrypt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ueSoftphone=t(e.ueWebrtc,e.jsBase64,e.md5,e.jsencrypt)}(this,(function(e,t,s,n){"use strict";var o=function(){return o=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e,t,s,n){return new(s||(s=Promise))((function(o,i){function r(e){try{
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ue-webrtc"),require("js-base64"),require("js-md5"),require("jsencrypt")):"function"==typeof define&&define.amd?define(["ue-webrtc","js-base64","js-md5","jsencrypt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ueSoftphone=t(e.ueWebrtc,e.jsBase64,e.md5,e.jsencrypt)}(this,(function(e,t,s,n){"use strict";var o=function(){return o=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e,t,s,n){return new(s||(s=Promise))((function(o,i){function r(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))}function r(e,t){var s,n,o,i,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,n=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],n=0}finally{s=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/*!
|
|
3
3
|
* Socket.IO v4.7.2
|
|
4
4
|
* (c) 2014-2023 Guillermo Rauch
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
const c=Object.create(null);c.open="0",c.close="1",c.ping="2",c.pong="3",c.message="4",c.upgrade="5",c.noop="6";const a=Object.create(null);Object.keys(c).forEach((e=>{a[c[e]]=e}));const u={type:"error",data:"parser error"},l="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),h="function"==typeof ArrayBuffer,p=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,f=({type:e,data:t},s,n)=>l&&t instanceof Blob?s?n(t):d(t,n):h&&(t instanceof ArrayBuffer||p(t))?s?n(t):d(new Blob([t]),n):n(c[e]+(t||"")),d=(e,t)=>{const s=new FileReader;return s.onload=function(){const e=s.result.split(",")[1];t("b"+(e||""))},s.readAsDataURL(e)};function g(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let m;const y="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)y["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;const b="function"==typeof ArrayBuffer,v=(e,t)=>{if("string"!=typeof e)return{type:"message",data:w(e,t)};const s=e.charAt(0);return"b"===s?{type:"message",data:k(e.substring(1),t)}:a[s]?e.length>1?{type:a[s],data:e.substring(1)}:{type:a[s]}:u},k=(e,t)=>{if(b){const s=(e=>{let t,s,n,o,i,r=.75*e.length,c=e.length,a=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const u=new ArrayBuffer(r),l=new Uint8Array(u);for(t=0;t<c;t+=4)s=y[e.charCodeAt(t)],n=y[e.charCodeAt(t+1)],o=y[e.charCodeAt(t+2)],i=y[e.charCodeAt(t+3)],l[a++]=s<<2|n>>4,l[a++]=(15&n)<<4|o>>2,l[a++]=(3&o)<<6|63&i;return u})(e);return w(s,t)}return{base64:!0,data:e}},w=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,T=String.fromCharCode(30);function I(){return new TransformStream({transform(e,t){!function(e,t){l&&e.data instanceof Blob?e.data.arrayBuffer().then(g).then(t):h&&(e.data instanceof ArrayBuffer||p(e.data))?t(g(e.data)):f(e,!1,(e=>{m||(m=new TextEncoder),t(m.encode(e))}))}(e,(s=>{const n=s.length;let o;if(n<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,n);else if(n<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,n)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(s)}))}})}let A;function O(e){return e.reduce(((e,t)=>e+t.length),0)}function _(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let n=0;for(let o=0;o<t;o++)s[o]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),s}function E(e){if(e)return function(e){for(var t in E.prototype)e[t]=E.prototype[t];return e}(e)}E.prototype.on=E.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},E.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this},E.prototype.off=E.prototype.removeListener=E.prototype.removeAllListeners=E.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((s=n[o])===t||s.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},E.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(s){n=0;for(var o=(s=s.slice(0)).length;n<o;++n)s[n].apply(this,t)}return this},E.prototype.emitReserved=E.prototype.emit,E.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},E.prototype.hasListeners=function(e){return!!this.listeners(e).length};const C="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function S(e,...t){return t.reduce(((t,s)=>(e.hasOwnProperty(s)&&(t[s]=e[s]),t)),{})}const N=C.setTimeout,R=C.clearTimeout;function P(e,t){t.useNativeTimers?(e.setTimeoutFn=N.bind(C),e.clearTimeoutFn=R.bind(C)):(e.setTimeoutFn=C.setTimeout.bind(C),e.clearTimeoutFn=C.clearTimeout.bind(C))}class q extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class B extends E{constructor(e){super(),this.writable=!1,P(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,s){return super.emitReserved("error",new q(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=v(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}(e);return t.length?"?"+t:""}}const x="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),L=64,U={};let M,j=0,D=0;function F(e){let t="";do{t=x[e%L]+t,e=Math.floor(e/L)}while(e>0);return t}function z(){const e=F(+new Date);return e!==M?(j=0,M=e):e+"."+F(j++)}for(;D<L;D++)U[x[D]]=D;let W=!1;try{W="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(c){}const H=W;function V(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||H))return new XMLHttpRequest}catch(e){}if(!t)try{return new(C[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function K(){}const G=null!=new V({xdomain:!1}).responseType;class J extends E{constructor(e,t){super(),P(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=S(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const s=this.xhr=new V(t);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&s.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{s.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var e;3===s.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(s)),4===s.readyState&&(200===s.status||1223===s.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof s.status?s.status:0)}),0))},s.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=J.requestsCount++,J.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=K,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete J.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function Q(){for(let e in J.requests)J.requests.hasOwnProperty(e)&&J.requests[e].abort()}J.requestsCount=0,J.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Q):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",Q,!1));const Y="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),$=C.WebSocket||C.MozWebSocket,X="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),Z={websocket:class extends B{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,s=X?{}:S(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=X?new $(e,t,s):t?new $(e,t):new $(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;f(s,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}n&&Y((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!$}},webtransport:class extends B{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){A||(A=new TextDecoder);const s=[];let n=0,o=-1,i=!1;return new TransformStream({transform(r,c){for(s.push(r);;){if(0===n){if(O(s)<1)break;const e=_(s,1);i=128==(128&e[0]),o=127&e[0],n=o<126?3:126===o?1:2}else if(1===n){if(O(s)<2)break;const e=_(s,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(O(s)<8)break;const e=_(s,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){c.enqueue(u);break}o=i*Math.pow(2,32)+t.getUint32(4),n=3}else{if(O(s)<o)break;const e=_(s,o);c.enqueue(v(i?e:A.decode(e),t)),n=0}if(0===o||o>e){c.enqueue(u);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),n=I();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();const o=()=>{s.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this.writer.write(i).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;this.writer.write(s).then((()=>{n&&Y((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends B{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let s=location.port;s||(s=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||s!==e.port}const t=e&&e.forceBase64;this.supportsBinary=G&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const s=e.split(T),n=[];for(let e=0;e<s.length;e++){const o=v(s[e],t);if(n.push(o),"error"===o.type)break}return n})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const s=e.length,n=new Array(s);let o=0;e.forEach(((e,i)=>{f(e,!1,(e=>{n[i]=e,++o===s&&t(n.join(T))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new J(this.uri(),e)}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},ee=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,te=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function se(e){const t=e,s=e.indexOf("["),n=e.indexOf("]");-1!=s&&-1!=n&&(e=e.substring(0,s)+e.substring(s,n).replace(/:/g,";")+e.substring(n,e.length));let o=ee.exec(e||""),i={},r=14;for(;r--;)i[te[r]]=o[r]||"";return-1!=s&&-1!=n&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const s=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1),"/"==t.slice(-1)&&s.splice(s.length-1,1),s}(0,i.path),i.queryKey=function(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(s[t]=n)})),s}(0,i.query),i}class ne extends E{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=se(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=se(t.host).host),P(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},s=e.split("&");for(let e=0,n=s.length;e<n;e++){let n=s[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Z[e](s)}open(){let e;if(this.opts.rememberUpgrade&&ne.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),s=!1;ne.priorWebsocketSuccess=!1;const n=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!s)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ne.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{s||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){s||(s=!0,u(),t.close(),t=null)}const i=e=>{const s=new Error("probe error: "+e);s.transport=t.name,o(),this.emitReserved("upgradeError",s)};function r(){i("transport closed")}function c(){i("socket closed")}function a(e){t&&e.name!==t.name&&o()}const u=()=>{t.removeListener("open",n),t.removeListener("error",i),t.removeListener("close",r),this.off("close",c),this.off("upgrading",a)};t.once("open",n),t.once("error",i),t.once("close",r),this.once("close",c),this.once("upgrading",a),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{s||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",ne.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let s=0;s<this.writeBuffer.length;s++){const n=this.writeBuffer[s].data;if(n&&(e+="string"==typeof(t=n)?function(e){let t=0,s=0;for(let n=0,o=e.length;n<o;n++)t=e.charCodeAt(n),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(n++,s+=4);return s}(t):Math.ceil(1.33*(t.byteLength||t.size))),s>0&&e>this.maxPayload)return this.writeBuffer.slice(0,s);e+=2}var t;return this.writeBuffer}write(e,t,s){return this.sendPacket("message",e,t,s),this}send(e,t,s){return this.sendPacket("message",e,t,s),this}sendPacket(e,t,s,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof s&&(n=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;const o={type:e,data:t,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?s():e()})):this.upgrading?s():e()),this}onError(e){ne.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let s=0;const n=e.length;for(;s<n;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}ne.protocol=4;const oe="function"==typeof ArrayBuffer,ie=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,re=Object.prototype.toString,ce="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===re.call(Blob),ae="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===re.call(File);function ue(e){return oe&&(e instanceof ArrayBuffer||ie(e))||ce&&e instanceof Blob||ae&&e instanceof File}function le(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,s=e.length;t<s;t++)if(le(e[t]))return!0;return!1}if(ue(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return le(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&le(e[t]))return!0;return!1}function he(e){const t=[],s=e.data,n=e;return n.data=pe(s,t),n.attachments=t.length,{packet:n,buffers:t}}function pe(e,t){if(!e)return e;if(ue(e)){const s={_placeholder:!0,num:t.length};return t.push(e),s}if(Array.isArray(e)){const s=new Array(e.length);for(let n=0;n<e.length;n++)s[n]=pe(e[n],t);return s}if("object"==typeof e&&!(e instanceof Date)){const s={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=pe(e[n],t));return s}return e}function fe(e,t){return e.data=de(e.data,t),delete e.attachments,e}function de(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=de(e[s],t);else if("object"==typeof e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(e[s]=de(e[s],t));return e}const ge=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var me;function ye(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(me||(me={}));class be extends E{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===me.BINARY_EVENT;s||t.type===me.BINARY_ACK?(t.type=s?me.EVENT:me.ACK,this.reconstructor=new ve(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!ue(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(void 0===me[s.type])throw new Error("unknown packet type "+s.type);if(s.type===me.BINARY_EVENT||s.type===me.BINARY_ACK){const n=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(n,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");s.attachments=Number(o)}if("/"===e.charAt(t+1)){const n=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);s.nsp=e.substring(n,t)}else s.nsp="/";const n=e.charAt(t+1);if(""!==n&&Number(n)==n){const n=t+1;for(;++t;){const s=e.charAt(t);if(null==s||Number(s)!=s){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(!be.isPayloadValid(s.type,n))throw new Error("invalid payload");s.data=n}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case me.CONNECT:return ye(t);case me.DISCONNECT:return void 0===t;case me.CONNECT_ERROR:return"string"==typeof t||ye(t);case me.EVENT:case me.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ge.indexOf(t[0]));case me.ACK:case me.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ve{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=fe(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var ke=Object.freeze({__proto__:null,protocol:5,get PacketType(){return me},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==me.EVENT&&e.type!==me.ACK||!le(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===me.EVENT?me.BINARY_EVENT:me.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==me.BINARY_EVENT&&e.type!==me.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=he(e),s=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(s),n}},Decoder:be});function we(e,t,s){return e.on(t,s),function(){e.off(t,s)}}const Te=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ie extends E{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[we(e,"open",this.onopen.bind(this)),we(e,"packet",this.onpacket.bind(this)),we(e,"error",this.onerror.bind(this)),we(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Te.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:me.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var s;const n=null!==(s=this.flags.timeout)&&void 0!==s?s:this._opts.ackTimeout;if(void 0===n)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),n);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...e])}}emitWithAck(e,...t){const s=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((n,o)=>{t.push(((e,t)=>s?e?o(e):n(t):n(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(s===this._queue[0])return null!==e?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue()})),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:me.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case me.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case me.EVENT:case me.BINARY_EVENT:this.onevent(e);break;case me.ACK:case me.BINARY_ACK:this.onack(e);break;case me.DISCONNECT:this.ondisconnect();break;case me.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...n){s||(s=!0,t.packet({type:me.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:me.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function Ae(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ae.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-s:e+s}return 0|Math.min(e,this.max)},Ae.prototype.reset=function(){this.attempts=0},Ae.prototype.setMin=function(e){this.ms=e},Ae.prototype.setMax=function(e){this.max=e},Ae.prototype.setJitter=function(e){this.jitter=e};class Oe extends E{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,P(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(s=t.randomizationFactor)&&void 0!==s?s:.5),this.backoff=new Ae({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||ke;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ne(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const n=we(t,"open",(function(){s.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=we(t,"error",o);if(!1!==this._timeout){const e=this._timeout,s=this.setTimeoutFn((()=>{n(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&s.unref(),this.subs.push((()=>{this.clearTimeoutFn(s)}))}return this.subs.push(n),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(we(e,"ping",this.onping.bind(this)),we(e,"data",this.ondata.bind(this)),we(e,"error",this.onerror.bind(this)),we(e,"close",this.onclose.bind(this)),we(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Y((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Ie(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&s.unref(),this.subs.push((()=>{this.clearTimeoutFn(s)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const _e={};function Ee(e,t){"object"==typeof e&&(t=e,e=void 0);const s=function(e,t="",s){let n=e;s=s||"undefined"!=typeof location&&location,null==e&&(e=s.protocol+"//"+s.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?s.protocol+e:s.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==s?s.protocol+"//"+e:"https://"+e),n=se(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+t,n.href=n.protocol+"://"+o+(s&&s.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=s.source,o=s.id,i=s.path,r=_e[o]&&i in _e[o].nsps;let c;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?c=new Oe(n,t):(_e[o]||(_e[o]=new Oe(n,t)),c=_e[o]),s.query&&!t.query&&(t.query=s.queryKey),c.socket(s.path,t)}Object.assign(Ee,{Manager:Oe,Socket:Ie,io:Ee,connect:Ee});var Ce={notOpenAudioMsg:"麦克风没有开启",notOpenAudioCode:403,notOpenAudioMsgEn:"Permission dismissed"},Se={forbiddenAudioMsg:"请先检查您的麦克风是否开启",forbiddenAudioCode:0,forbiddenAudioMsgEn:"Permission denied"},Ne={requestState:!1,delay:0},Re=function(){function c(e){void 0===e&&(e={});var t=this;this.getWebrtcInfo=function(e,t){a.request(e+"/call/api/sip/webrtc/config/query",{verb:"GET",loginToken:a.loginToken,sessionId:a.agentInfo._id,success:function(e){e.success&&e.data?(a.agentextras=e.data,a.initWebrtcEvent(e.data)):t.error(o({},e))},error:function(e){t.error({error:e})}})},this.initAttachEvent=function(e,s,n,o,i){t.attachEventCallbacks&&a.request(e+"/platform/action/refreshWsToken",{verb:"GET",loginToken:a.loginToken,sessionId:a.agentInfo._id,success:function(e){if(e&&e.data){var r="";n.forEach((function(e){"KF"===e.id&&(r=e.url)})),t.attachEventCallbacks.serve=r,t.attachEventCallbacks.SocketOptions={query:{accountId:o.accountId,agentNumber:o.agentNumber,agentId:o._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:s,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:1,pushHangupStatistics:a.initOptions.pushHangupStatistics||!1,pushCallinRingStatistics:a.initOptions.pushCallinRingStatistics||!1},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},t.attachEventCallbacks.suc=i,a.createEventHandle(t.attachEventCallbacks)}},error:function(e){n.error({error:e})}})},this.attachNetworkCallbacks={message:a.noop,error:a.noop,success:a.noop},this.initnNetworkMonitoring=function(e,s){var n="";e.forEach((function(e){if("MONITOR"===e.id){var t=document.location.protocol;"file:"===t&&(t="https:"),n=t+"//"+e.url}})),t.attachNetworkCallbacks.success(),t.attachNetworkCallbacks.message({delay:100}),setInterval((function(){var e=(new Date).getTime();Ne.requestState=!0,a.request(n+"/ready",{method:"GET",success:function(s){if(s.success){var n=(new Date).getTime();Ne.delay=(n-e)/2,t.attachNetworkCallbacks.message({delay:Ne.delay})}else t.attachNetworkCallbacks.error(),Ne.delay=500,Ne.requestState=!1},error:function(e){t.attachNetworkCallbacks.error(),Ne.delay=500,Ne.requestState=!1}})}),1e4)},this.listenCallNetork=function(e){e&&(t.attachNetworkCallbacks.message=e.message&&"function"==typeof e.message?e.message:a.noop,t.attachNetworkCallbacks.success=e.success&&"function"==typeof e.success?e.success:a.noop,t.attachNetworkCallbacks.error=e.error&&"function"==typeof e.error?e.error:a.noop)},this.initAgentQueue=function(e,s,n,o,i){t.attachMonitorEventCallbacks&&a.request(e+"/platform/action/refreshWsToken",{verb:"GET",loginToken:a.loginToken,sessionId:a.agentInfo._id,success:function(e){if(e&&e.data){var r="";n.forEach((function(e){"MONITOR"===e.id&&(r=e.url)})),t.attachMonitorEventCallbacks.serve=r,t.attachMonitorEventCallbacks.SocketOptions={query:{accountId:o.accountId,agentNumber:o.agentNumber,agentId:o._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:s,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:3},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},t.attachMonitorEventCallbacks.suc=i,a.createQueueMonitorEventHandle(t.attachMonitorEventCallbacks)}},error:function(e){console.log("失败",e),n.error({error:e})}})},this.initQueue=function(e){a.request(e+"/call/monitor/agent/queue/query",{verb:"POST",body:{accountId:a.agentInfo.accountId,agentId:a.agentInfo._id},success:function(e){e&&e.data?t.attachMonitorEventCallbacks.message(e):t.attachMonitorEventCallbacks.error(e)},error:function(e){t.attachMonitorEventCallbacks.error(e)}})},this.listenCallQueueEvent=function(e){t.attachMonitorEventCallbacks=e},this.openMediaAudio=function(e,t){var s=navigator,n=s.mediaDevices,o=s.getUserMedia,i=s.webkitGetUserMedia,r=s.mozGetUserMedia,c=s.msGetUserMedia,a=(o||i||r||c).bind(navigator);return n?navigator.mediaDevices.getUserMedia({audio:!0}).catch((function(s){var n=s.message.includes("denied");return t?(n&&alert(Se.forbiddenAudioMsg),e&&!n&&alert(e),n?Se:Ce):n?Se:Ce})):new Promise((function(s,n){a?a({audio:!0},(function(e){s(!0)}),(function(s){t&&e&&alert(e),n(Ce)})):n(Ce)}))},this.listenCallEvent=function(e){t.attachEventCallbacks=e},this._callApi=function(){var e,s,n=t;return{callout:function(t){return i(this,void 0,void 0,(function(){var i,c,u,l,h,p;return r(this,(function(r){switch(r.label){case 0:if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null===a.loginToken||void 0===a.loginToken)return t.fail({success:!1,message:"initialization not complete!"}),[2];if(null===a.agentInfo||void 0===a.agentInfo)return t.fail({success:!1,message:"initialization not complete!"}),[2];if(null===t.customerNumber||void 0===t.customerNumber)return t.fail({success:!1,message:"Parameter customerNumber is required!"}),[2];if("WEBRTC"!==a.initOptions.loginType)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return r.sent(),[3,4];case 3:return r.sent(),t.fail({success:!1,message:"无麦克风权限!"}),[2];case 4:if(i=a.initOptions.server||a.callApiUrl,c={customerNumber:t.customerNumber,agentNumber:a.agentInfo.agentNumber,accountId:a.agentInfo.accountId,agentId:a.agentInfo._id,loginType:t.loginType||a.agentInfo.loginType||a.initOptions.loginType},t.agentTimeout&&(c.agentTimeout=t.agentTimeout),t.customerTimeout&&(c.customerTimeout=t.customerTimeout),t.agentDisNumber&&(c.agentDisNumber=t.agentDisNumber),t.customerDisNumber&&(c.customerDisNumber=t.customerDisNumber),t.extras&&(c.extras=t.extras),t.numberGroupId&&(c.numberGroupId=t.numberGroupId),t.numberGroupName&&(c.numberGroupName=t.numberGroupName),u=a.initOptions,l=!0,"WEBRTC"!==u.loginType)return[3,8];r.label=5;case 5:return r.trys.push([5,7,,8]),[4,n.openMediaAudio("请打开麦克风权限!",l)];case 6:return h=r.sent()||{},[3,8];case 7:return p=r.sent(),console.log(p),[3,8];case 8:return a.request(i+"/call/api/call/call/out",{verb:"POST",body:c,loginToken:a.loginToken,sessionId:a.agentInfo._id,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success(o(o({success:!0,message:"callout success"},h),e.data)):t.fail(o({success:!1,message:e.message,code:e.code},h))}}),[2]}}))}))},hangup:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/hangup",{verb:"POST",body:{},loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"hangup success",data:e}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},holdOrUnHold:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.type&&void 0!==t.type){var n=a.initOptions.server||a.callApiUrl,o={type:t.type};a.request(n+"/call/api/call/hold",{verb:"POST",body:o,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"holdOrUnHold success"}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},muteOrUnMute:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.type&&void 0!==t.type){var n=a.initOptions.server||a.callApiUrl,o={type:t.type,direction:t.direction||"all"};a.request(n+"/call/api/call/mute",{verb:"POST",body:o,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"muteOrUnMute success"}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},transfer:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.type&&void 0!==t.type)if(null!==t.number&&void 0!==t.number){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/transfer",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"transfer success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},consult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.mode&&void 0!==t.mode)if(null!==t.number&&void 0!==t.number){t.agentNumber=a.agentInfo.agentNumber;var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/consult",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"consult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"Parameter mode is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},cancelconsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/consult/cancel",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"cancelconsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},endConsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/consult/stop",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"endConsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},callbackConsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/consult/resume",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"resumeConsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},consultTransfer:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/consult/transfer",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"consultTransfer success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},threeWayCall:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/threeway",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"threeWayCall success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},evaluate:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.type&&void 0!==t.type){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/evaluate",{verb:"POST",body:t,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"evaluate success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},meeting:function(t){if(t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null!==a.loginToken&&void 0!==a.loginToken)if(null!==a.agentInfo&&void 0!==a.agentInfo)if(null!==t.number&&void 0!==t.number){var n=a.initOptions.server||a.callApiUrl;a.request(n+"/call/api/call/meeting",{verb:"POST",body:{meetingType:"phone",number:t.number},loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"meeting success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})}}},this._agentApi=function(){var e=t;return{switchLoginType:function(t){return i(this,void 0,void 0,(function(){var s,n,c,u,l,h,p=this;return r(this,(function(f){switch(f.label){case 0:if(s=null,t.success=t&&"function"==typeof t.success?t.success:a.noop,t.fail=t&&"function"==typeof t.fail?t.fail:a.noop,null===t.loginType||void 0===t.loginType)return t.fail({success:!1,message:"Parameter loginType is required!"}),[2];if(null===a.agentInfo||void 0===a.agentInfo)return t.fail({success:!1,message:"initialization not complete!"}),[2];if(null!==t.loginNumber&&void 0!==t.loginNumber&&(s=t.loginNumber),"PSTN"===t.loginType&&!(s=s||a.agentInfo.mobile))return alert("请给座席绑定手机号,或者传入号码参数!"),t.fail({success:!1,message:"Please bind your mobile number"}),[2];if("SIP"===t.loginType&&(s=s||a.agentInfo.sipNumber),"WEBRTC"===t.loginType&&(s=a.agentInfo.webrtcSipNumber),n=a.initOptions.server||a.callApiUrl,c={loginType:t.loginType,loginNumber:s},a.initOptions,l=!0,"WEBRTC"!==t.loginType)return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.openMediaAudio("请打开麦克风权限!",l)];case 2:return u=f.sent()||{},[3,4];case 3:return h=f.sent(),console.log(h),[3,4];case 4:return a.request(n+"/call/api/agent/v1/login-type/change",{verb:"POST",body:c,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,success:function(s){return i(p,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return s.success?(t.success(o({success:!0,message:"updateLoginType success"},u)),a.agentInfo.loginType=t.loginType,a.initOptions.loginType=t.loginType,"WEBRTC"!==t.loginType?[3,1]:(e._webPhoneApi().connect(),[3,4])):[3,5];case 1:return"PSTN"!==t.loginType?[3,3]:[4,a.request(n+"/platform/action/updateCallConfig",{verb:"POST",body:{agentCallConfig:{},mobile:t.loginNumber},loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId})];case 2:return i.sent(),e._webPhoneApi().disconnect(),[3,4];case 3:e._webPhoneApi().disconnect(),i.label=4;case 4:return[3,6];case 5:t.fail(o({success:!1,message:s.message,code:s.code},u)),i.label=6;case 6:return[2]}}))}))}}),[2]}}))}))},findPhoneBarList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:a.noop,e.fail=e&&"function"==typeof e.fail?e.fail:a.noop,null!==a.agentInfo&&void 0!==a.agentInfo){var t=a.initOptions.server||a.callApiUrl;a.request(t+"/call/api/phone/bar/all",{verb:"GET",loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,success:function(t){if(t.success){var s=[];t.data.forEach((function(e){var t={name:e.name,number:e.number};s.push(t)})),e.success({success:!0,data:s})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},switchPhoneBar:function(e){if(e.success=e&&"function"==typeof e.success?e.success:a.noop,e.fail=e&&"function"==typeof e.fail?e.fail:a.noop,null!==e.stateNumber&&void 0!==e.stateNumber)if(null!==a.agentInfo&&void 0!==a.agentInfo){var t=a.initOptions.server||a.callApiUrl,s={stateNumber:e.stateNumber,accountId:a.agentInfo.accountId,agentNumber:a.agentInfo.agentNumber};a.request(t+"/call/api/agent/status/switch",{verb:"POST",body:s,loginToken:a.loginToken,sessionId:a.agentInfo._id,success:function(t){t.success?e.success({success:!0}):e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"});else e.fail({success:!1,message:"Parameter stateNumber is required!"})},logout:function(e){if(e.success=e&&"function"==typeof e.success?e.success:a.noop,e.fail=e&&"function"==typeof e.fail?e.fail:a.noop,null!==a.agentInfo&&void 0!==a.agentInfo){null!==e.toAnswerOffline&&void 0!==e.toAnswerOffline||(e.toAnswerOffline="1");var t=a.initOptions.server||a.callApiUrl,s={toAnswerOffline:e.toAnswerOffline};a.request(t+"/call/api/sdk/agent/logout",{verb:"POST",body:s,loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,success:function(t){t.success?e&&(a.Socketinstance.disconnect(),"WEBRTC"===a.agentInfo.loginType&&a.webPhone.disconnect(),e.success({success:!0})):e&&e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},findIdleAgentsForQueue:function(e){if(e.success=e&&"function"==typeof e.success?e.success:a.noop,e.fail=e&&"function"==typeof e.fail?e.fail:a.noop,null!==a.agentInfo&&void 0!==a.agentInfo){var t=a.initOptions.server||a.callApiUrl;a.request(t+"/call/api/queue/acountFreeAgent/find",{verb:"POST",body:{},loginToken:a.loginToken,sessionId:a.agentInfo._id,accountId:a.agentInfo.accountId,success:function(t){t.success?e&&e.success({success:!0,dataList:t.data||[]}):e&&e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},getAvailableSipNumberList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:a.noop,e.fail=e&&"function"==typeof e.fail?e.fail:a.noop,null!==a.agentInfo&&void 0!==a.agentInfo){var t=a.initOptions.server||a.callApiUrl;a.request(t+"/call/api/sip/avaliable/query",{verb:"POST",body:{},loginToken:a.loginToken,sessionId:a.agentInfo._id,success:function(t){if(t.success&&t.data){var s=[];t.data.forEach((function(e){var t={number:e.id,numberName:e.number};s.push(t)})),e.success({success:!0,data:s})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})}}},this._webPhoneApi=function(){return{accept:function(){a.webPhone.accept()},connect:function(){a.webPhone&&this.isConnected()||a.initWebrtcEvent(a.agentextras)},disconnect:function(){a.webPhone&&this.isConnected()&&a.webPhone.disconnect()},isConnected:function(){return a.webPhone.isConnected()},sendDTMF:function(e){a.webPhone.sendDTMF(e)}}},e.error="function"==typeof e.error?e.error:a.noop,e.success="function"==typeof e.success?e.success:a.noop,null!==e.agentNumber&&void 0!==e.agentNumber?(null!==e.loginType&&void 0!==e.loginType||(e.loginType="PSTN"),null!==e.pushHangupStatistics&&void 0!==e.pushHangupStatistics||(e.pushHangupStatistics=!1),null!==e.pushCallinRingStatistics&&void 0!==e.pushCallinRingStatistics||(e.pushCallinRingStatistics=!1),this.init(e)):e.error({message:"Invalid agentNumber"})}var a;return c.noop=function(){},c.prototype.init=function(e){if(void 0===e&&(e={}),a.trace=a.noop,a.debug=a.noop,a.log=a.noop,a.warn=a.noop,a.error=a.noop,!0===e.debug||"all"===e.debug)a.trace=console.trace.bind(console),a.debug=console.debug.bind(console),a.log=console.log.bind(console),a.warn=console.warn.bind(console),a.error=console.error.bind(console);else if(Array.isArray(e.debug))for(var t in e.debug){var s=e.debug[t];switch(s){case"trace":a.trace=console.trace.bind(console);break;case"debug":a.debug=console.debug.bind(console);break;case"log":a.log=console.log.bind(console);break;case"warn":a.warn=console.warn.bind(console);break;case"error":a.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+s+"' (supported: 'trace', 'debug', 'log', warn', 'error')")}}a.log("Initializing library");var n=a.useDefaultDependencies({WebSocket:Pe});a.newWebSocket=n.newWebSocket,a.request=n.request,this.login(e)},c.prototype.login=function(e){return i(this,void 0,void 0,(function(){var i,c,u,l,h,p,f,d,g,m=this;return r(this,(function(r){switch(r.label){case 0:if(console.log(e,"options"),i=e.server||a.callApiUrl,c=e.agentNumber+"@"+e.accountId,u=e.loginType,l=e.isOpenNetwork||!1,h=e.isOpenCallQueue||!1,p={loginName:c,loginType:u,loginChannel:"SDK",password:""},f=!0,"WEBRTC"!==u)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.openMediaAudio("请打开麦克风权限!",f)];case 2:return d=r.sent()||{},[3,4];case 3:return g=r.sent(),console.log(g),console.log("授权失败================================"),[3,4];case 4:return e.password&&(p.password=e.password),a.request(i+"/platform/public/loginPre",{verb:"GET",success:function(r){if(r&&r.success&&r.data){var c=decodeURIComponent(t.Base64.decode(r.data.pk)),f=new n.JSEncrypt;f.setPublicKey(c);var g=s(p.password),y=f.encrypt(g);p.password=y,a.request(i+"/platform/public/login",{verb:"POST",body:p,success:function(t){t.success?a.request(i+"/platform/action/loginInfo",{verb:"GET",loginToken:t.data.loginToken,sessionId:t.data.sessionId,success:function(t){t.success?(t.data.agent&&(a.agentInfo=t.data.agent,a.loginToken=t.data.loginToken,a.initOptions=o(o({},e),{audioInfo:d})),m.initAttachEvent(i,u,t.data.pushServer,t.data.agent,e.success),l&&m.initnNetworkMonitoring(t.data.pushServer,""),h&&(m.initAgentQueue(i,u,t.data.pushServer,t.data.agent,e.success),m.initQueue(i)),"WEBRTC"===u&&m.getWebrtcInfo(i,e)):e.error(o(o({},t),d))},error:function(t){e.error(o({error:t},d))}}):e.error(o(o({},t),d))},error:function(t){e.error(o({error:t},d))}})}else e.error(o(o({},r),d))},error:function(t){e.error(o({error:t},d))}}),[2]}}))}))},c.createEventHandle=function(e){var t=this;void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:a.noop,e.error="function"==typeof e.error?e.error:a.noop,e.message="function"==typeof e.message?e.message:a.noop,e.event="function"==typeof e.event?e.event:a.noop,e.server=null===e.serve||void 0===e.serve?"ws://152.136.72.209:3201/phoneBarGateway":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},a.error({message:"login response error!"})),this.Socketinstance=a.newWebSocket(e.server,e.SocketOptions),this.Socketinstance.on("connect",(function(){e.success("connect event serve success!"),e.suc()})),this.Socketinstance.on("error",(function(t,s){e.error({type:"socketError",error:t}),s&&"function"==typeof s&&s("error")})),this.Socketinstance.on("message",(function(t,s){e.message({subtype:t.subType,data:t.data}),"WEBRTC"===a.initOptions.loginType&&(t.data&&t.data.callType&&"callin"===t.data.callType&&t.data.eventType&&"ring"===t.data.eventType?(a.AudioTask||(a.AudioTask=new qe("https://softphone.useasy.cn/ring.wav")),a.AudioTask.ringAudioPlay()):a.AudioTask&&a.AudioTask.ringAudioPause()),s&&"function"==typeof s&&s("success")})),this.Socketinstance.on("event",(function(s){if("KICK_OFF"===s.subType&&!0===s.data.kickoff){t.Socketinstance.disconnect();try{a.webPhone.disconnect(),console.log(s,"互踢")}catch(e){}e.event({message:"坐席账户在其他地方登录",data:s})}}))},c.createQueueMonitorEventHandle=function(e){void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:a.noop,e.error="function"==typeof e.error?e.error:a.noop,e.message="function"==typeof e.message?e.message:a.noop,e.server=null===e.serve||void 0===e.serve?"ue-dev1.useasy.cn":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},a.error({message:"login response error!"})),this.MonitorSocketinstance=a.newWebSocket(e.server,e.SocketOptions),this.MonitorSocketinstance.on("connect",(function(){e.success("connect event serve success!"),e.suc(),a.log("监控connect========")})),this.MonitorSocketinstance.on("error",(function(t,s){e.error({type:"socketError",error:t}),s&&"function"==typeof s&&s("error")})),this.MonitorSocketinstance.on("message",(function(t,s){e.message({subtype:t.subType,data:t.data})})),this.MonitorSocketinstance.on("event",(function(t,s){e.message(t)}))},c.useDefaultDependencies=function(e){var t=e&&e.fetch||fetch,s=e&&e.Promise||Promise,n=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,t){return new n(e,t)},request:function(e,n){var o={method:n.verb,cache:"no-cache",headers:{"Content-Type":"application/json",loginToken:n.loginToken||"",sessionId:n.sessionId||"",clienttype:0}};n.encryptionFields&&(o.headers["ue-encryption-algorithm"]=n.encryptionAlgorithm||"aes",o.headers["ue-encryption-fields"]=n.encryptionFields),void 0!==n.withCredentials&&(o.credentials=!0===n.withCredentials?"include":n.withCredentials?n.withCredentials:"omit"),void 0!==n.body&&(o.body=JSON.stringify(n.body));var i=t(e,o).catch((function(e){return s.reject({message:"Probably a network error, is the gateway down?",error:e})}));if(void 0!==n.timeout){var r=new s((function(e,t){var s=window.setTimeout((function(){return clearTimeout(s),n.error({message:"Request timed out",timeout:n.timeout}),t({message:"Request timed out",timeout:n.timeout})}),n.timeout)}));i=s.race([i,r])}return i.then((function(e){return e.ok?typeof n.success==typeof a.noop?e.json().then((function(e){n.success(e)})).catch((function(t){return n.error({message:"Failed to parse response body",error:t,response:e}),s.reject({message:"Failed to parse response body",error:t,response:e})})):void 0:(n.error({message:"API call failed",response:e}),s.reject({message:"API call failed",response:e}))})).catch((function(e){typeof n.error==typeof a.noop&&n.error(e.message||"<< internal error >>",e)})),i}}},Object.defineProperty(c.prototype,"agent",{get:function(){return this._agentApi()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"webrtc",{get:function(){return this._webPhoneApi()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"call",{get:function(){return this._callApi()},enumerable:!1,configurable:!0}),a=c,c.callApiUrl="https://app.useasy.cn/api",c.Socketinstance=null,c.AudioTask=null,c.MonitorSocketinstance=null,c.initWebrtcEvent=function(t){return i(void 0,void 0,void 0,(function(){return r(a,(function(s){switch(s.label){case 0:return a.webPhone=new e.UeWebrtc({server:t.wssUrl,sip:t.sip,secret:t.password}),[4,this.webPhone.connect()];case 1:return s.sent(),this.webPhone.register(),[2]}}))}))},c}(),Pe=function(){function e(e,t){delete t.path,delete t.hostname,delete t.port,this.ws=Ee.connect("wss://".concat(e),t)}return e.prototype.on=function(e,t){"connect"===e&&this.ws.on(e,t),"error"===e&&(this.ws.on("connect_error",t),this.ws.on("error",t),this.ws.on("disconnect",t),this.ws.on("reconnect_failed",t)),"message"===e&&this.ws.on("call",t),"event"===e&&this.ws.on("event",t)},e.prototype.emit=function(e,t,s){this.ws.emit(e,t,s)},e.prototype.disconnect=function(){this.ws.disconnect()},e}(),qe=function(){function e(e){this.ringAudio=new Audio(e),this.ringAudio.loop=!0,this.ringAudioRunning=!1}return e.prototype.ringAudioPlay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return this.ringAudioRunning?[2]:[3,1];case 1:return[4,this.ringAudio.play()];case 2:e.sent(),this.ringAudioRunning=!0,e.label=3;case 3:return[2]}}))}))},e.prototype.ringAudioPause=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return this.ringAudio.paused?[3,2]:[4,this.ringAudio.pause()];case 1:e.sent(),this.ringAudioRunning=!1,e.label=2;case 2:return[2]}}))}))},e}();return Re}));
|
|
7
|
+
const a=Object.create(null);a.open="0",a.close="1",a.ping="2",a.pong="3",a.message="4",a.upgrade="5",a.noop="6";const c=Object.create(null);Object.keys(a).forEach((e=>{c[a[e]]=e}));const u={type:"error",data:"parser error"},l="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),h="function"==typeof ArrayBuffer,p=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,f=({type:e,data:t},s,n)=>l&&t instanceof Blob?s?n(t):d(t,n):h&&(t instanceof ArrayBuffer||p(t))?s?n(t):d(new Blob([t]),n):n(a[e]+(t||"")),d=(e,t)=>{const s=new FileReader;return s.onload=function(){const e=s.result.split(",")[1];t("b"+(e||""))},s.readAsDataURL(e)};function g(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let m;const y="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)y["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;const b="function"==typeof ArrayBuffer,v=(e,t)=>{if("string"!=typeof e)return{type:"message",data:T(e,t)};const s=e.charAt(0);return"b"===s?{type:"message",data:k(e.substring(1),t)}:c[s]?e.length>1?{type:c[s],data:e.substring(1)}:{type:c[s]}:u},k=(e,t)=>{if(b){const s=(e=>{let t,s,n,o,i,r=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const u=new ArrayBuffer(r),l=new Uint8Array(u);for(t=0;t<a;t+=4)s=y[e.charCodeAt(t)],n=y[e.charCodeAt(t+1)],o=y[e.charCodeAt(t+2)],i=y[e.charCodeAt(t+3)],l[c++]=s<<2|n>>4,l[c++]=(15&n)<<4|o>>2,l[c++]=(3&o)<<6|63&i;return u})(e);return T(s,t)}return{base64:!0,data:e}},T=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,w=String.fromCharCode(30);function I(){return new TransformStream({transform(e,t){!function(e,t){l&&e.data instanceof Blob?e.data.arrayBuffer().then(g).then(t):h&&(e.data instanceof ArrayBuffer||p(e.data))?t(g(e.data)):f(e,!1,(e=>{m||(m=new TextEncoder),t(m.encode(e))}))}(e,(s=>{const n=s.length;let o;if(n<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,n);else if(n<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,n)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(s)}))}})}let O;function A(e){return e.reduce(((e,t)=>e+t.length),0)}function _(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let n=0;for(let o=0;o<t;o++)s[o]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),s}function E(e){if(e)return function(e){for(var t in E.prototype)e[t]=E.prototype[t];return e}(e)}E.prototype.on=E.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},E.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this},E.prototype.off=E.prototype.removeListener=E.prototype.removeAllListeners=E.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((s=n[o])===t||s.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},E.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),s=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(s){n=0;for(var o=(s=s.slice(0)).length;n<o;++n)s[n].apply(this,t)}return this},E.prototype.emitReserved=E.prototype.emit,E.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},E.prototype.hasListeners=function(e){return!!this.listeners(e).length};const C="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function S(e,...t){return t.reduce(((t,s)=>(e.hasOwnProperty(s)&&(t[s]=e[s]),t)),{})}const N=C.setTimeout,R=C.clearTimeout;function P(e,t){t.useNativeTimers?(e.setTimeoutFn=N.bind(C),e.clearTimeoutFn=R.bind(C)):(e.setTimeoutFn=C.setTimeout.bind(C),e.clearTimeoutFn=C.clearTimeout.bind(C))}class q extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class B extends E{constructor(e){super(),this.writable=!1,P(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,s){return super.emitReserved("error",new q(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=v(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}(e);return t.length?"?"+t:""}}const x="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),L=64,U={};let M,F=0,j=0;function D(e){let t="";do{t=x[e%L]+t,e=Math.floor(e/L)}while(e>0);return t}function z(){const e=D(+new Date);return e!==M?(F=0,M=e):e+"."+D(F++)}for(;j<L;j++)U[x[j]]=j;let W=!1;try{W="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(a){}const K=W;function H(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||K))return new XMLHttpRequest}catch(e){}if(!t)try{return new(C[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function V(){}const G=null!=new H({xdomain:!1}).responseType;class Q extends E{constructor(e,t){super(),P(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=S(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const s=this.xhr=new H(t);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&s.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{s.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var e;3===s.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(s)),4===s.readyState&&(200===s.status||1223===s.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof s.status?s.status:0)}),0))},s.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=V,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Q.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function J(){for(let e in Q.requests)Q.requests.hasOwnProperty(e)&&Q.requests[e].abort()}Q.requestsCount=0,Q.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",J):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",J,!1));const Y="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),$=C.WebSocket||C.MozWebSocket,X="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),Z={websocket:class extends B{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,s=X?{}:S(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=X?new $(e,t,s):t?new $(e,t):new $(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;f(s,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}n&&Y((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!$}},webtransport:class extends B{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){O||(O=new TextDecoder);const s=[];let n=0,o=-1,i=!1;return new TransformStream({transform(r,a){for(s.push(r);;){if(0===n){if(A(s)<1)break;const e=_(s,1);i=128==(128&e[0]),o=127&e[0],n=o<126?3:126===o?1:2}else if(1===n){if(A(s)<2)break;const e=_(s,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(A(s)<8)break;const e=_(s,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(u);break}o=i*Math.pow(2,32)+t.getUint32(4),n=3}else{if(A(s)<o)break;const e=_(s,o);a.enqueue(v(i?e:O.decode(e),t)),n=0}if(0===o||o>e){a.enqueue(u);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),n=I();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();const o=()=>{s.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this.writer.write(i).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;this.writer.write(s).then((()=>{n&&Y((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends B{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let s=location.port;s||(s=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||s!==e.port}const t=e&&e.forceBase64;this.supportsBinary=G&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const s=e.split(w),n=[];for(let e=0;e<s.length;e++){const o=v(s[e],t);if(n.push(o),"error"===o.type)break}return n})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const s=e.length,n=new Array(s);let o=0;e.forEach(((e,i)=>{f(e,!1,(e=>{n[i]=e,++o===s&&t(n.join(w))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Q(this.uri(),e)}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},ee=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,te=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function se(e){const t=e,s=e.indexOf("["),n=e.indexOf("]");-1!=s&&-1!=n&&(e=e.substring(0,s)+e.substring(s,n).replace(/:/g,";")+e.substring(n,e.length));let o=ee.exec(e||""),i={},r=14;for(;r--;)i[te[r]]=o[r]||"";return-1!=s&&-1!=n&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const s=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1),"/"==t.slice(-1)&&s.splice(s.length-1,1),s}(0,i.path),i.queryKey=function(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(s[t]=n)})),s}(0,i.query),i}class ne extends E{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=se(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=se(t.host).host),P(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},s=e.split("&");for(let e=0,n=s.length;e<n;e++){let n=s[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Z[e](s)}open(){let e;if(this.opts.rememberUpgrade&&ne.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),s=!1;ne.priorWebsocketSuccess=!1;const n=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!s)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ne.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{s||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){s||(s=!0,u(),t.close(),t=null)}const i=e=>{const s=new Error("probe error: "+e);s.transport=t.name,o(),this.emitReserved("upgradeError",s)};function r(){i("transport closed")}function a(){i("socket closed")}function c(e){t&&e.name!==t.name&&o()}const u=()=>{t.removeListener("open",n),t.removeListener("error",i),t.removeListener("close",r),this.off("close",a),this.off("upgrading",c)};t.once("open",n),t.once("error",i),t.once("close",r),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{s||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",ne.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let s=0;s<this.writeBuffer.length;s++){const n=this.writeBuffer[s].data;if(n&&(e+="string"==typeof(t=n)?function(e){let t=0,s=0;for(let n=0,o=e.length;n<o;n++)t=e.charCodeAt(n),t<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(n++,s+=4);return s}(t):Math.ceil(1.33*(t.byteLength||t.size))),s>0&&e>this.maxPayload)return this.writeBuffer.slice(0,s);e+=2}var t;return this.writeBuffer}write(e,t,s){return this.sendPacket("message",e,t,s),this}send(e,t,s){return this.sendPacket("message",e,t,s),this}sendPacket(e,t,s,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof s&&(n=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;const o={type:e,data:t,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?s():e()})):this.upgrading?s():e()),this}onError(e){ne.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let s=0;const n=e.length;for(;s<n;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}ne.protocol=4;const oe="function"==typeof ArrayBuffer,ie=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,re=Object.prototype.toString,ae="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===re.call(Blob),ce="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===re.call(File);function ue(e){return oe&&(e instanceof ArrayBuffer||ie(e))||ae&&e instanceof Blob||ce&&e instanceof File}function le(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,s=e.length;t<s;t++)if(le(e[t]))return!0;return!1}if(ue(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return le(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&le(e[t]))return!0;return!1}function he(e){const t=[],s=e.data,n=e;return n.data=pe(s,t),n.attachments=t.length,{packet:n,buffers:t}}function pe(e,t){if(!e)return e;if(ue(e)){const s={_placeholder:!0,num:t.length};return t.push(e),s}if(Array.isArray(e)){const s=new Array(e.length);for(let n=0;n<e.length;n++)s[n]=pe(e[n],t);return s}if("object"==typeof e&&!(e instanceof Date)){const s={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=pe(e[n],t));return s}return e}function fe(e,t){return e.data=de(e.data,t),delete e.attachments,e}function de(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let s=0;s<e.length;s++)e[s]=de(e[s],t);else if("object"==typeof e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(e[s]=de(e[s],t));return e}const ge=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var me;function ye(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(me||(me={}));class be extends E{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===me.BINARY_EVENT;s||t.type===me.BINARY_ACK?(t.type=s?me.EVENT:me.ACK,this.reconstructor=new ve(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!ue(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(void 0===me[s.type])throw new Error("unknown packet type "+s.type);if(s.type===me.BINARY_EVENT||s.type===me.BINARY_ACK){const n=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(n,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");s.attachments=Number(o)}if("/"===e.charAt(t+1)){const n=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);s.nsp=e.substring(n,t)}else s.nsp="/";const n=e.charAt(t+1);if(""!==n&&Number(n)==n){const n=t+1;for(;++t;){const s=e.charAt(t);if(null==s||Number(s)!=s){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(!be.isPayloadValid(s.type,n))throw new Error("invalid payload");s.data=n}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case me.CONNECT:return ye(t);case me.DISCONNECT:return void 0===t;case me.CONNECT_ERROR:return"string"==typeof t||ye(t);case me.EVENT:case me.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ge.indexOf(t[0]));case me.ACK:case me.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ve{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=fe(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var ke=Object.freeze({__proto__:null,protocol:5,get PacketType(){return me},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==me.EVENT&&e.type!==me.ACK||!le(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===me.EVENT?me.BINARY_EVENT:me.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==me.BINARY_EVENT&&e.type!==me.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=he(e),s=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(s),n}},Decoder:be});function Te(e,t,s){return e.on(t,s),function(){e.off(t,s)}}const we=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ie extends E{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Te(e,"open",this.onopen.bind(this)),Te(e,"packet",this.onpacket.bind(this)),Te(e,"error",this.onerror.bind(this)),Te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(we.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:me.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var s;const n=null!==(s=this.flags.timeout)&&void 0!==s?s:this._opts.ackTimeout;if(void 0===n)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),n);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...e])}}emitWithAck(e,...t){const s=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((n,o)=>{t.push(((e,t)=>s?e?o(e):n(t):n(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(s===this._queue[0])return null!==e?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue()})),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:me.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case me.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case me.EVENT:case me.BINARY_EVENT:this.onevent(e);break;case me.ACK:case me.BINARY_ACK:this.onack(e);break;case me.DISCONNECT:this.ondisconnect();break;case me.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...n){s||(s=!0,t.packet({type:me.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:me.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function Oe(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Oe.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-s:e+s}return 0|Math.min(e,this.max)},Oe.prototype.reset=function(){this.attempts=0},Oe.prototype.setMin=function(e){this.ms=e},Oe.prototype.setMax=function(e){this.max=e},Oe.prototype.setJitter=function(e){this.jitter=e};class Ae extends E{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,P(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(s=t.randomizationFactor)&&void 0!==s?s:.5),this.backoff=new Oe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||ke;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ne(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const n=Te(t,"open",(function(){s.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Te(t,"error",o);if(!1!==this._timeout){const e=this._timeout,s=this.setTimeoutFn((()=>{n(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&s.unref(),this.subs.push((()=>{this.clearTimeoutFn(s)}))}return this.subs.push(n),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Te(e,"ping",this.onping.bind(this)),Te(e,"data",this.ondata.bind(this)),Te(e,"error",this.onerror.bind(this)),Te(e,"close",this.onclose.bind(this)),Te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Y((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Ie(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&s.unref(),this.subs.push((()=>{this.clearTimeoutFn(s)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const _e={};function Ee(e,t){"object"==typeof e&&(t=e,e=void 0);const s=function(e,t="",s){let n=e;s=s||"undefined"!=typeof location&&location,null==e&&(e=s.protocol+"//"+s.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?s.protocol+e:s.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==s?s.protocol+"//"+e:"https://"+e),n=se(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+t,n.href=n.protocol+"://"+o+(s&&s.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=s.source,o=s.id,i=s.path,r=_e[o]&&i in _e[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?a=new Ae(n,t):(_e[o]||(_e[o]=new Ae(n,t)),a=_e[o]),s.query&&!t.query&&(t.query=s.queryKey),a.socket(s.path,t)}Object.assign(Ee,{Manager:Ae,Socket:Ie,io:Ee,connect:Ee});var Ce={notOpenAudioMsg:"麦克风没有开启",notOpenAudioCode:403,notOpenAudioMsgEn:"Permission dismissed"},Se={forbiddenAudioMsg:"请先检查您的麦克风是否开启",forbiddenAudioCode:0,forbiddenAudioMsgEn:"Permission denied"},Ne={requestState:!1,delay:0},Re=function(){function a(e){void 0===e&&(e={});var t=this;this.getWebrtcInfo=function(e,t){c.request(e+"/call/api/sip/webrtc/config/query",{verb:"GET",loginToken:c.loginToken,sessionId:c.agentInfo._id,success:function(e){e.success&&e.data?(c.agentextras=e.data,c.initWebrtcEvent(e.data)):t.error(o({},e))},error:function(e){t.error({error:e})}})},this.initAttachEvent=function(e,s,n,o,i){t.attachEventCallbacks&&c.request(e+"/platform/action/refreshWsToken",{verb:"GET",loginToken:c.loginToken,sessionId:c.agentInfo._id,success:function(e){if(e&&e.data){var r="";n.forEach((function(e){"KF"===e.id&&(r=e.url)})),t.attachEventCallbacks.serve=r,t.attachEventCallbacks.SocketOptions={query:{accountId:o.accountId,agentNumber:o.agentNumber,agentId:o._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:s,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:1,pushHangupStatistics:c.initOptions.pushHangupStatistics||!1,pushCallinRingStatistics:c.initOptions.pushCallinRingStatistics||!1},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},t.attachEventCallbacks.suc=i,c.createEventHandle(t.attachEventCallbacks)}},error:function(e){n.error({error:e})}})},this.attachNetworkCallbacks={message:c.noop,error:c.noop,success:c.noop},this.initnNetworkMonitoring=function(e,s){var n="";e.forEach((function(e){if("MONITOR"===e.id){var t=document.location.protocol;"file:"===t&&(t="https:"),n=t+"//"+e.url}})),t.attachNetworkCallbacks.success(),t.attachNetworkCallbacks.message({delay:100}),setInterval((function(){var e=(new Date).getTime();Ne.requestState=!0,c.request(n+"/ready",{method:"GET",success:function(s){if(s.success){var n=(new Date).getTime();Ne.delay=(n-e)/2,t.attachNetworkCallbacks.message({delay:Ne.delay})}else t.attachNetworkCallbacks.error(),Ne.delay=500,Ne.requestState=!1},error:function(e){t.attachNetworkCallbacks.error(),Ne.delay=500,Ne.requestState=!1}})}),1e4)},this.listenCallNetork=function(e){e&&(t.attachNetworkCallbacks.message=e.message&&"function"==typeof e.message?e.message:c.noop,t.attachNetworkCallbacks.success=e.success&&"function"==typeof e.success?e.success:c.noop,t.attachNetworkCallbacks.error=e.error&&"function"==typeof e.error?e.error:c.noop)},this.initAgentQueue=function(e,s,n,o,i){(t.attachMonitorEventCallbacks||t.attachNlsTranslationEventCallbacks)&&c.request(e+"/platform/action/refreshWsToken",{verb:"GET",loginToken:c.loginToken,sessionId:c.agentInfo._id,success:function(e){if(e&&e.data){var r="";n.forEach((function(e){"MONITOR"===e.id&&(r=e.url)})),t.attachMonitorEventCallbacks&&c.UserConfig.isOpenCallQueue&&(t.attachMonitorEventCallbacks.serve=r,t.attachMonitorEventCallbacks.SocketOptions={query:{accountId:o.accountId,agentNumber:o.agentNumber,agentId:o._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:s,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:3},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},t.attachMonitorEventCallbacks.suc=i,c.createQueueMonitorEventHandle(t.attachMonitorEventCallbacks)),t.attachNlsTranslationEventCallbacks&&c.UserConfig.openNlsTranslation&&(t.attachNlsTranslationEventCallbacks.serve=r,t.attachNlsTranslationEventCallbacks.SocketOptions={query:{accountId:o.accountId,agentNumber:o.agentNumber,agentId:o._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:s,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:3},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},t.attachNlsTranslationEventCallbacks.suc=i,c.createopenNlsTransEventHandle(t.attachNlsTranslationEventCallbacks))}},error:function(e){console.log("失败",e),n.error({error:e})}})},this.initQueue=function(e){c.request(e+"/call/monitor/agent/queue/query",{verb:"POST",body:{accountId:c.agentInfo.accountId,agentId:c.agentInfo._id},success:function(e){e&&e.data?t.attachMonitorEventCallbacks.message(e):t.attachMonitorEventCallbacks.error(e)},error:function(e){t.attachMonitorEventCallbacks.error(e)}})},this.listenCallQueueEvent=function(e){t.attachMonitorEventCallbacks=e},this.listenTranslationEvent=function(e){t.attachNlsTranslationEventCallbacks=e},this.openMediaAudio=function(e,t){var s=navigator,n=s.mediaDevices,o=s.getUserMedia,i=s.webkitGetUserMedia,r=s.mozGetUserMedia,a=s.msGetUserMedia,c=(o||i||r||a).bind(navigator);return n?navigator.mediaDevices.getUserMedia({audio:!0}).catch((function(s){var n=s.message.includes("denied");return t?(n&&alert(Se.forbiddenAudioMsg),e&&!n&&alert(e),n?Se:Ce):n?Se:Ce})):new Promise((function(s,n){c?c({audio:!0},(function(e){s(!0)}),(function(s){t&&e&&alert(e),n(Ce)})):n(Ce)}))},this.listenCallEvent=function(e){t.attachEventCallbacks=e},this._callApi=function(){var e,s,n=t;return{callout:function(t){return i(this,void 0,void 0,(function(){var i,a,u,l,h,p;return r(this,(function(r){switch(r.label){case 0:if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null===c.loginToken||void 0===c.loginToken)return t.fail({success:!1,message:"initialization not complete!"}),[2];if("KICK_OFF"===c.loginToken)return t.fail({success:!1,message:"您的座席账号正在别处登录,当前页面电话条已退出。"}),[2];if(null===c.agentInfo||void 0===c.agentInfo)return t.fail({success:!1,message:"initialization not complete!"}),[2];if(null===t.customerNumber||void 0===t.customerNumber)return t.fail({success:!1,message:"Parameter customerNumber is required!"}),[2];if("WEBRTC"!==c.initOptions.loginType)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return r.sent(),[3,4];case 3:return r.sent(),t.fail({success:!1,message:"无麦克风权限!"}),[2];case 4:if(i=c.initOptions.server||c.callApiUrl,a={customerNumber:t.customerNumber,agentNumber:c.agentInfo.agentNumber,accountId:c.agentInfo.accountId,agentId:c.agentInfo._id,loginType:t.loginType||c.agentInfo.loginType||c.initOptions.loginType},t.agentTimeout&&(a.agentTimeout=t.agentTimeout),t.customerTimeout&&(a.customerTimeout=t.customerTimeout),t.agentDisNumber&&(a.agentDisNumber=t.agentDisNumber),t.customerDisNumber&&(a.customerDisNumber=t.customerDisNumber),t.extras&&(a.extras=t.extras),t.numberGroupId&&(a.numberGroupId=t.numberGroupId),t.numberGroupName&&(a.numberGroupName=t.numberGroupName),u=c.initOptions,l=!0,"WEBRTC"!==u.loginType)return[3,8];r.label=5;case 5:return r.trys.push([5,7,,8]),[4,n.openMediaAudio("请打开麦克风权限!",l)];case 6:return h=r.sent()||{},[3,8];case 7:return p=r.sent(),console.log(p),[3,8];case 8:return c.request(i+"/call/api/call/call/out",{verb:"POST",body:a,loginToken:c.loginToken,sessionId:c.agentInfo._id,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success(o(o({success:!0,message:"callout success"},h),e.data)):t.fail(o({success:!1,message:e.message,code:e.code},h))}}),[2]}}))}))},hangup:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/hangup",{verb:"POST",body:{},loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"hangup success",data:e}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},holdOrUnHold:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.type&&void 0!==t.type){var n=c.initOptions.server||c.callApiUrl,o={type:t.type};c.request(n+"/call/api/call/hold",{verb:"POST",body:o,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"holdOrUnHold success"}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},muteOrUnMute:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.type&&void 0!==t.type){var n=c.initOptions.server||c.callApiUrl,o={type:t.type,direction:t.direction||"all"};c.request(n+"/call/api/call/mute",{verb:"POST",body:o,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"muteOrUnMute success"}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},transfer:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.type&&void 0!==t.type)if(null!==t.number&&void 0!==t.number){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/transfer",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"transfer success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},consult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.mode&&void 0!==t.mode)if(null!==t.number&&void 0!==t.number){t.agentNumber=c.agentInfo.agentNumber;var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/consult",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"consult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"Parameter mode is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},cancelconsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/consult/cancel",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"cancelconsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},endConsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/consult/stop",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"endConsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},callbackConsult:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/consult/resume",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"resumeConsult success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},consultTransfer:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/consult/transfer",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"consultTransfer success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},threeWayCall:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/threeway",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"threeWayCall success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},evaluate:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.type&&void 0!==t.type){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/evaluate",{verb:"POST",body:t,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"evaluate success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter type is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})},meeting:function(t){if(t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null!==c.loginToken&&void 0!==c.loginToken)if(null!==c.agentInfo&&void 0!==c.agentInfo)if(null!==t.number&&void 0!==t.number){var n=c.initOptions.server||c.callApiUrl;c.request(n+"/call/api/call/meeting",{verb:"POST",body:{meetingType:"phone",number:t.number},loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:s,success:function(e){e.success?t.success({success:!0,message:"meeting success",data:e.data.response.data}):t.fail({success:!1,message:e.message,code:e.code})}})}else t.fail({success:!1,message:"Parameter number is required!"});else t.fail({success:!1,message:"initialization not complete!"});else t.fail({success:!1,message:"initialization not complete!"})}}},this._agentApi=function(){var e=t;return{switchLoginType:function(t){return i(this,void 0,void 0,(function(){var s,n,a,u,l,h,p=this;return r(this,(function(f){switch(f.label){case 0:if(s=null,t.success=t&&"function"==typeof t.success?t.success:c.noop,t.fail=t&&"function"==typeof t.fail?t.fail:c.noop,null===t.loginType||void 0===t.loginType)return t.fail({success:!1,message:"Parameter loginType is required!"}),[2];if(null===c.agentInfo||void 0===c.agentInfo)return t.fail({success:!1,message:"initialization not complete!"}),[2];if(null!==t.loginNumber&&void 0!==t.loginNumber&&(s=t.loginNumber),"PSTN"===t.loginType&&!(s=s||c.agentInfo.mobile))return alert("请给座席绑定手机号,或者传入号码参数!"),t.fail({success:!1,message:"Please bind your mobile number"}),[2];if("SIP"===t.loginType&&(s=s||c.agentInfo.sipNumber),"WEBRTC"===t.loginType&&(s=c.agentInfo.webrtcSipNumber),n=c.initOptions.server||c.callApiUrl,a={loginType:t.loginType,loginNumber:s},c.initOptions,l=!0,"WEBRTC"!==t.loginType)return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.openMediaAudio("请打开麦克风权限!",l)];case 2:return u=f.sent()||{},[3,4];case 3:return h=f.sent(),console.log(h),[3,4];case 4:return c.request(n+"/call/api/agent/v1/login-type/change",{verb:"POST",body:a,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,success:function(s){return i(p,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return s.success?(t.success(o({success:!0,message:"updateLoginType success"},u)),c.agentInfo.loginType=t.loginType,c.initOptions.loginType=t.loginType,"WEBRTC"!==t.loginType?[3,1]:(e._webPhoneApi().connect(),[3,4])):[3,5];case 1:return"PSTN"!==t.loginType?[3,3]:[4,c.request(n+"/platform/action/updateCallConfig",{verb:"POST",body:{agentCallConfig:{},mobile:t.loginNumber},loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId})];case 2:return i.sent(),e._webPhoneApi().disconnect(),[3,4];case 3:e._webPhoneApi().disconnect(),i.label=4;case 4:return[3,6];case 5:t.fail(o({success:!1,message:s.message,code:s.code},u)),i.label=6;case 6:return[2]}}))}))}}),[2]}}))}))},findPhoneBarList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:c.noop,e.fail=e&&"function"==typeof e.fail?e.fail:c.noop,null!==c.agentInfo&&void 0!==c.agentInfo){var t=c.initOptions.server||c.callApiUrl;c.request(t+"/call/api/phone/bar/all",{verb:"GET",loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,success:function(t){if(t.success){var s=[];t.data.forEach((function(e){var t={name:e.name,number:e.number};s.push(t)})),e.success({success:!0,data:s})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},switchPhoneBar:function(e){if(e.success=e&&"function"==typeof e.success?e.success:c.noop,e.fail=e&&"function"==typeof e.fail?e.fail:c.noop,null!==e.stateNumber&&void 0!==e.stateNumber)if(null!==c.agentInfo&&void 0!==c.agentInfo){var t=c.initOptions.server||c.callApiUrl,s={stateNumber:e.stateNumber,accountId:c.agentInfo.accountId,agentNumber:c.agentInfo.agentNumber};c.request(t+"/call/api/agent/status/switch",{verb:"POST",body:s,loginToken:c.loginToken,sessionId:c.agentInfo._id,success:function(t){t.success?e.success({success:!0}):e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"});else e.fail({success:!1,message:"Parameter stateNumber is required!"})},logout:function(e){if(e.success=e&&"function"==typeof e.success?e.success:c.noop,e.fail=e&&"function"==typeof e.fail?e.fail:c.noop,null!==c.agentInfo&&void 0!==c.agentInfo){null!==e.toAnswerOffline&&void 0!==e.toAnswerOffline||(e.toAnswerOffline="1");var t=c.initOptions.server||c.callApiUrl,s={toAnswerOffline:e.toAnswerOffline};c.request(t+"/call/api/sdk/agent/logout",{verb:"POST",body:s,loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,success:function(t){t.success?e&&(c.Socketinstance.disconnect(),"WEBRTC"===c.agentInfo.loginType&&c.webPhone.disconnect(),e.success({success:!0})):e&&e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},findIdleAgentsForQueue:function(e){if(e.success=e&&"function"==typeof e.success?e.success:c.noop,e.fail=e&&"function"==typeof e.fail?e.fail:c.noop,null!==c.agentInfo&&void 0!==c.agentInfo){var t=c.initOptions.server||c.callApiUrl;c.request(t+"/call/api/queue/acountFreeAgent/find",{verb:"POST",body:{},loginToken:c.loginToken,sessionId:c.agentInfo._id,accountId:c.agentInfo.accountId,success:function(t){t.success?e&&e.success({success:!0,dataList:t.data||[]}):e&&e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},getAvailableSipNumberList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:c.noop,e.fail=e&&"function"==typeof e.fail?e.fail:c.noop,null!==c.agentInfo&&void 0!==c.agentInfo){var t=c.initOptions.server||c.callApiUrl;c.request(t+"/call/api/sip/avaliable/query",{verb:"POST",body:{},loginToken:c.loginToken,sessionId:c.agentInfo._id,success:function(t){if(t.success&&t.data){var s=[];t.data.forEach((function(e){var t={number:e.id,numberName:e.number};s.push(t)})),e.success({success:!0,data:s})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})}}},this._webPhoneApi=function(){return{accept:function(){c.webPhone.accept()},connect:function(){c.webPhone&&this.isConnected()||c.initWebrtcEvent(c.agentextras)},disconnect:function(){c.webPhone&&this.isConnected()&&c.webPhone.disconnect()},isConnected:function(){return c.webPhone.isConnected()},sendDTMF:function(e){c.webPhone.sendDTMF(e)}}},e.error="function"==typeof e.error?e.error:c.noop,e.success="function"==typeof e.success?e.success:c.noop,null!==e.agentNumber&&void 0!==e.agentNumber?(null!==e.loginType&&void 0!==e.loginType||(e.loginType="PSTN"),null!==e.pushHangupStatistics&&void 0!==e.pushHangupStatistics||(e.pushHangupStatistics=!1),null!==e.pushCallinRingStatistics&&void 0!==e.pushCallinRingStatistics||(e.pushCallinRingStatistics=!1),this.init(e)):e.error({message:"Invalid agentNumber"})}var c;return a.noop=function(){},a.prototype.init=function(e){if(void 0===e&&(e={}),c.trace=c.noop,c.debug=c.noop,c.log=c.noop,c.warn=c.noop,c.error=c.noop,!0===e.debug||"all"===e.debug)c.trace=console.trace.bind(console),c.debug=console.debug.bind(console),c.log=console.log.bind(console),c.warn=console.warn.bind(console),c.error=console.error.bind(console);else if(Array.isArray(e.debug))for(var t in e.debug){var s=e.debug[t];switch(s){case"trace":c.trace=console.trace.bind(console);break;case"debug":c.debug=console.debug.bind(console);break;case"log":c.log=console.log.bind(console);break;case"warn":c.warn=console.warn.bind(console);break;case"error":c.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+s+"' (supported: 'trace', 'debug', 'log', warn', 'error')")}}c.log("Initializing library");var n=c.useDefaultDependencies({WebSocket:Pe});c.newWebSocket=n.newWebSocket,c.request=n.request,this.login(e)},a.prototype.login=function(e){return i(this,void 0,void 0,(function(){var i,a,u,l,h,p,f,d,g,m,y=this;return r(this,(function(r){switch(r.label){case 0:if(console.log(e,"options"),c.UserConfig=e,i=e.server||c.callApiUrl,a=e.agentNumber+"@"+e.accountId,u=e.loginType,l=e.isOpenNetwork||!1,h=e.isOpenCallQueue||!1,p=e.openNlsTranslation||!1,f={loginName:a,loginType:u,loginChannel:"SDK",password:""},d=!0,"WEBRTC"!==u)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.openMediaAudio("请打开麦克风权限!",d)];case 2:return g=r.sent()||{},[3,4];case 3:return m=r.sent(),console.log(m),console.log("授权失败================================"),[3,4];case 4:return e.password&&(f.password=e.password),c.request(i+"/platform/public/loginPre",{verb:"GET",success:function(r){if(r&&r.success&&r.data){var a=decodeURIComponent(t.Base64.decode(r.data.pk)),d=new n.JSEncrypt;d.setPublicKey(a);var m=s(f.password),b=d.encrypt(m);f.password=b,c.request(i+"/platform/public/login",{verb:"POST",body:f,success:function(t){t.success?c.request(i+"/platform/action/loginInfo",{verb:"GET",loginToken:t.data.loginToken,sessionId:t.data.sessionId,success:function(t){t.success?(t.data.agent&&(c.agentInfo=t.data.agent,c.loginToken=t.data.loginToken,c.initOptions=o(o({},e),{audioInfo:g})),y.initAttachEvent(i,u,t.data.pushServer,t.data.agent,e.success),l&&y.initnNetworkMonitoring(t.data.pushServer,""),(h||p)&&y.initAgentQueue(i,u,t.data.pushServer,t.data.agent,e.success),h&&y.initQueue(i),"WEBRTC"===u&&y.getWebrtcInfo(i,e)):e.error(o(o({},t),g))},error:function(t){e.error(o({error:t},g))}}):e.error(o(o({},t),g))},error:function(t){e.error(o({error:t},g))}})}else e.error(o(o({},r),g))},error:function(t){e.error(o({error:t},g))}}),[2]}}))}))},a.createEventHandle=function(e){var t=this;void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:c.noop,e.error="function"==typeof e.error?e.error:c.noop,e.message="function"==typeof e.message?e.message:c.noop,e.event="function"==typeof e.event?e.event:c.noop,e.server=null===e.serve||void 0===e.serve?"ws://152.136.72.209:3201/phoneBarGateway":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},c.error({message:"login response error!"})),this.Socketinstance=c.newWebSocket(e.server,e.SocketOptions),this.Socketinstance.on("connect",(function(){e.success("connect event serve success!"),e.suc()})),this.Socketinstance.on("error",(function(t,s){e.error({type:"socketError",error:t}),s&&"function"==typeof s&&s("error")})),this.Socketinstance.on("message",(function(t,s){e.message({subtype:t.subType,data:t.data}),"WEBRTC"===c.initOptions.loginType&&(t.data&&t.data.callType&&"callin"===t.data.callType&&t.data.eventType&&"ring"===t.data.eventType?(c.AudioTask||(c.AudioTask=new qe("https://softphone.useasy.cn/ring.wav")),c.AudioTask.ringAudioPlay()):c.AudioTask&&c.AudioTask.ringAudioPause()),s&&"function"==typeof s&&s("success")})),this.Socketinstance.on("event",(function(s){if("KICK_OFF"===s.subType&&!0===s.data.kickoff){t.Socketinstance.disconnect(),c.loginToken="KICK_OFF";try{c.webPhone.disconnect(),console.log(s,"互踢")}catch(e){}e.event({message:"坐席账户在其他地方登录",data:s})}}))},a.createQueueMonitorEventHandle=function(e){var t=this;void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:c.noop,e.error="function"==typeof e.error?e.error:c.noop,e.message="function"==typeof e.message?e.message:c.noop,e.server=null===e.serve||void 0===e.serve?"ue-dev1.useasy.cn":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},c.error({message:"login response error!"})),null===this.MonitorSocketinstance&&(this.MonitorSocketinstance=c.newWebSocket(e.server,e.SocketOptions)),this.MonitorSocketinstance.on("connect",(function(){e.success("connect event serve success!"),e.suc(),c.log("监控connect========")})),this.MonitorSocketinstance.on("error",(function(t,s){e.error({type:"socketError",error:t}),s&&"function"==typeof s&&s("error")})),this.MonitorSocketinstance.on("event",(function(s,n){if("KICK_OFF"===s.subType&&!0===s.data.kickoff){t.MonitorSocketinstance.disconnect();try{c.webPhone.disconnect()}catch(e){}e.message({message:"坐席账户在其他地方登录",data:s})}e.message(s)})),this.MonitorSocketinstance.on("call",(function(t,s){"queue"==t.subType&&c.UserConfig.isOpenCallQueue&&e.message({subtype:t.subType,data:t.data})}))},a.createopenNlsTransEventHandle=function(e){var t=this;void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:c.noop,e.error="function"==typeof e.error?e.error:c.noop,e.message="function"==typeof e.message?e.message:c.noop,e.server=null===e.serve||void 0===e.serve?"ue-dev1.useasy.cn":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},c.error({message:"login response error!"})),null===this.MonitorSocketinstance&&(this.MonitorSocketinstance=c.newWebSocket(e.server,e.SocketOptions)),this.MonitorSocketinstance.on("connect",(function(){e.success("转译connect event serve success!"),e.suc(),c.log("转译监控connect========")})),this.MonitorSocketinstance.on("error",(function(t,s){e.error({type:"socketError",error:t}),s&&"function"==typeof s&&s("error")})),this.MonitorSocketinstance.on("event",(function(s,n){if("KICK_OFF"===s.subType&&!0===s.data.kickoff){t.MonitorSocketinstance.disconnect();try{c.webPhone.disconnect()}catch(e){}e.message({message:"坐席账户在其他地方登录",data:s})}e.message(s)})),this.MonitorSocketinstance.on("call",(function(t,s){"translation"==t.subType&&c.UserConfig.openNlsTranslation&&e.message({subtype:t.subType,data:t.data})}))},a.useDefaultDependencies=function(e){var t=e&&e.fetch||fetch,s=e&&e.Promise||Promise,n=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,t){return new n(e,t)},request:function(e,n){var o={method:n.verb,cache:"no-cache",headers:{"Content-Type":"application/json",loginToken:n.loginToken||"",sessionId:n.sessionId||"",clienttype:0}};n.encryptionFields&&(o.headers["ue-encryption-algorithm"]=n.encryptionAlgorithm||"aes",o.headers["ue-encryption-fields"]=n.encryptionFields),void 0!==n.withCredentials&&(o.credentials=!0===n.withCredentials?"include":n.withCredentials?n.withCredentials:"omit"),void 0!==n.body&&(o.body=JSON.stringify(n.body));var i=t(e,o).catch((function(e){return s.reject({message:"Probably a network error, is the gateway down?",error:e})}));if(void 0!==n.timeout){var r=new s((function(e,t){var s=window.setTimeout((function(){return clearTimeout(s),n.error({message:"Request timed out",timeout:n.timeout}),t({message:"Request timed out",timeout:n.timeout})}),n.timeout)}));i=s.race([i,r])}return i.then((function(e){return e.ok?typeof n.success==typeof c.noop?e.json().then((function(e){n.success(e)})).catch((function(t){return n.error({message:"Failed to parse response body",error:t,response:e}),s.reject({message:"Failed to parse response body",error:t,response:e})})):void 0:(n.error({message:"API call failed",response:e}),s.reject({message:"API call failed",response:e}))})).catch((function(e){typeof n.error==typeof c.noop&&n.error(e.message||"<< internal error >>",e)})),i}}},Object.defineProperty(a.prototype,"agent",{get:function(){return this._agentApi()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"webrtc",{get:function(){return this._webPhoneApi()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"call",{get:function(){return this._callApi()},enumerable:!1,configurable:!0}),c=a,a.callApiUrl="https://dev1.useasy.cn/api",a.Socketinstance=null,a.AudioTask=null,a.MonitorSocketinstance=null,a.UserConfig=null,a.initWebrtcEvent=function(t){return i(void 0,void 0,void 0,(function(){return r(c,(function(s){switch(s.label){case 0:return c.webPhone=new e.UeWebrtc({server:t.wssUrl,sip:t.sip,secret:t.password}),[4,this.webPhone.connect()];case 1:return s.sent(),this.webPhone.register(),[2]}}))}))},a}(),Pe=function(){function e(e,t){delete t.path,delete t.hostname,delete t.port,this.ws=Ee.connect("wss://".concat(e),t)}return e.prototype.on=function(e,t){"connect"===e&&this.ws.on(e,t),"error"===e&&(this.ws.on("connect_error",t),this.ws.on("error",t),this.ws.on("disconnect",t),this.ws.on("reconnect_failed",t)),"message"===e&&this.ws.on("call",t),"event"===e&&this.ws.on("event",t),"call"===e&&this.ws.on("call",t)},e.prototype.emit=function(e,t,s){this.ws.emit(e,t,s)},e.prototype.disconnect=function(){this.ws.disconnect()},e}(),qe=function(){function e(e){this.ringAudio=new Audio(e),this.ringAudio.loop=!0,this.ringAudioRunning=!1}return e.prototype.ringAudioPlay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return this.ringAudioRunning?[2]:[3,1];case 1:return[4,this.ringAudio.play()];case 2:e.sent(),this.ringAudioRunning=!0,e.label=3;case 3:return[2]}}))}))},e.prototype.ringAudioPause=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return this.ringAudio.paused?[3,2]:[4,this.ringAudio.pause()];case 1:e.sent(),this.ringAudioRunning=!1,e.label=2;case 2:return[2]}}))}))},e}();return Re}));
|
package/index.html/index.html
CHANGED
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
// isOpenNetwork: true,
|
|
28
28
|
pushCallinRingStatistics: true,
|
|
29
29
|
pushHangupStatistics: true,
|
|
30
|
-
isOpenCallQueue:
|
|
30
|
+
isOpenCallQueue: false, // 是否开启呼叫队列的socket
|
|
31
|
+
openNlsTranslation: false, // 是否开启转译
|
|
31
32
|
// success(res) {
|
|
32
33
|
// console.log(787877,res);
|
|
33
34
|
// },
|
|
@@ -64,6 +65,15 @@
|
|
|
64
65
|
console.log(res, '获取呼叫队列数据成功')
|
|
65
66
|
}
|
|
66
67
|
})
|
|
68
|
+
// 监听实时转译socket
|
|
69
|
+
ue.listenTranslationEvent({
|
|
70
|
+
success (res) {
|
|
71
|
+
console.log('监听实时转译socket成功', res);
|
|
72
|
+
},
|
|
73
|
+
message (res) {
|
|
74
|
+
console.log(res, '获取实时转译数据成功')
|
|
75
|
+
}
|
|
76
|
+
})
|
|
67
77
|
document.getElementById('call').addEventListener('click', function(){
|
|
68
78
|
console.log('ssss')
|
|
69
79
|
window.ue.call.callout({
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_8143_50466)">
|
|
3
|
+
<path d="M14.7107 12.4247C13.4562 11.3331 11.8178 10.6724 10.0232 10.6724C8.22856 10.6724 6.59017 11.3331 5.33347 12.4269C5.29877 12.4582 5.27752 12.5017 5.27419 12.5483C5.27086 12.5949 5.28571 12.641 5.31561 12.6769L6.11918 13.6345C6.18392 13.7104 6.29776 13.7193 6.37365 13.6546C7.34686 12.7974 8.62365 12.2796 10.0232 12.2796C11.4228 12.2796 12.6995 12.7974 13.6728 13.6523C13.7486 13.7171 13.8625 13.7081 13.9272 13.6323L14.7308 12.6747C14.7933 12.601 14.7844 12.4894 14.7107 12.4247ZM17.3312 9.29743C15.3513 7.64788 12.8045 6.65458 10.0232 6.65458C7.24195 6.65458 4.69508 7.64788 2.71293 9.29743C2.67667 9.32802 2.65398 9.3717 2.6498 9.41895C2.64561 9.4662 2.66029 9.51319 2.69061 9.54967L3.49418 10.5073C3.55668 10.5831 3.67052 10.5921 3.74418 10.5296C5.44731 9.1144 7.63704 8.26172 10.0232 8.26172C12.4094 8.26172 14.5991 9.1144 16.3 10.5296C16.3759 10.5921 16.4875 10.5831 16.55 10.5073L17.3536 9.54967C17.4161 9.47377 17.4071 9.35993 17.3312 9.29743ZM19.9361 6.19475C17.2263 3.97154 13.7576 2.63672 9.97856 2.63672C6.2241 2.63672 2.77767 3.95368 0.0745416 6.15011C0.0559703 6.16503 0.040572 6.18352 0.0292538 6.20448C0.0179355 6.22544 0.0109261 6.24846 0.00863805 6.27217C0.00635001 6.29588 0.0088297 6.31981 0.0159311 6.34255C0.0230325 6.36529 0.034612 6.38638 0.0499878 6.40458L0.853559 7.36217C0.916059 7.43583 1.02767 7.44699 1.10133 7.38672C3.52767 5.4202 6.61472 4.24386 9.97856 4.24386C13.367 4.24386 16.4741 5.43806 18.9071 7.42913C18.983 7.49163 19.0946 7.48047 19.1571 7.40458L19.9607 6.44699C20.0254 6.37109 20.0143 6.25725 19.9361 6.19475ZM8.57231 15.9403C8.57231 16.3192 8.72282 16.6825 8.99073 16.9504C9.25864 17.2184 9.622 17.3689 10.0009 17.3689C10.3798 17.3689 10.7431 17.2184 11.011 16.9504C11.2789 16.6825 11.4295 16.3192 11.4295 15.9403C11.4295 15.5614 11.2789 15.198 11.011 14.9301C10.7431 14.6622 10.3798 14.5117 10.0009 14.5117C9.622 14.5117 9.25864 14.6622 8.99073 14.9301C8.72282 15.198 8.57231 15.5614 8.57231 15.9403Z" fill="#1C92E9"/>
|
|
4
|
+
</g>
|
|
5
|
+
<defs>
|
|
6
|
+
<clipPath id="clip0_8143_50466">
|
|
7
|
+
<rect width="20" height="20" fill="white"/>
|
|
8
|
+
</clipPath>
|
|
9
|
+
</defs>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14.7107 12.4247C13.4562 11.3331 11.8178 10.6724 10.0232 10.6724C8.22856 10.6724 6.59017 11.3331 5.33347 12.4269C5.29877 12.4582 5.27752 12.5017 5.27419 12.5483C5.27086 12.5949 5.28571 12.641 5.31561 12.6769L6.11918 13.6345C6.18392 13.7104 6.29776 13.7193 6.37365 13.6546C7.34686 12.7974 8.62365 12.2796 10.0232 12.2796C11.4228 12.2796 12.6995 12.7974 13.6728 13.6523C13.7486 13.7171 13.8625 13.7081 13.9272 13.6323L14.7308 12.6747C14.7933 12.601 14.7844 12.4894 14.7107 12.4247ZM17.3312 9.29743C15.3513 7.64788 12.8045 6.65458 10.0232 6.65458C7.24195 6.65458 4.69508 7.64788 2.71293 9.29743C2.67667 9.32802 2.65398 9.3717 2.6498 9.41895C2.64561 9.4662 2.66029 9.51319 2.69061 9.54967L3.49418 10.5073C3.55668 10.5831 3.67052 10.5921 3.74418 10.5296C5.44731 9.1144 7.63704 8.26172 10.0232 8.26172C12.4094 8.26172 14.5991 9.1144 16.3 10.5296C16.3759 10.5921 16.4875 10.5831 16.55 10.5073L17.3536 9.54967C17.4161 9.47377 17.4071 9.35993 17.3312 9.29743ZM19.9361 6.19475C17.2263 3.97154 13.7576 2.63672 9.97856 2.63672C6.2241 2.63672 2.77767 3.95368 0.0745416 6.15011C0.0559703 6.16503 0.040572 6.18352 0.0292538 6.20448C0.0179355 6.22544 0.0109261 6.24846 0.00863805 6.27217C0.00635001 6.29588 0.0088297 6.31981 0.0159311 6.34255C0.0230325 6.36529 0.034612 6.38638 0.0499878 6.40458L0.853559 7.36217C0.916059 7.43583 1.02767 7.44699 1.10133 7.38672C3.52767 5.4202 6.61472 4.24386 9.97856 4.24386C13.367 4.24386 16.4741 5.43806 18.9071 7.42913C18.983 7.49163 19.0946 7.48047 19.1571 7.40458L19.9607 6.44699C20.0254 6.37109 20.0143 6.25725 19.9361 6.19475ZM8.57231 15.9403C8.57231 16.3192 8.72282 16.6825 8.99073 16.9504C9.25864 17.2184 9.622 17.3689 10.0009 17.3689C10.3798 17.3689 10.7431 17.2184 11.011 16.9504C11.2789 16.6825 11.4295 16.3192 11.4295 15.9403C11.4295 15.5614 11.2789 15.198 11.011 14.9301C10.7431 14.6622 10.3798 14.5117 10.0009 14.5117C9.622 14.5117 9.25864 14.6622 8.99073 14.9301C8.72282 15.198 8.57231 15.5614 8.57231 15.9403Z" fill="#D9D9D9"/>
|
|
3
|
+
<path d="M14.71 12.4263C13.4556 11.3348 11.8172 10.6741 10.0225 10.6741C8.2279 10.6741 6.58951 11.3348 5.33281 12.4286C5.29811 12.4599 5.27686 12.5034 5.27354 12.55C5.27021 12.5966 5.28505 12.6427 5.31496 12.6786L6.11853 13.6362C6.18326 13.7121 6.2971 13.721 6.37299 13.6562C7.3462 12.7991 8.62299 12.2813 10.0225 12.2813C11.4221 12.2813 12.6989 12.7991 13.6721 13.654C13.748 13.7188 13.8618 13.7098 13.9266 13.6339L14.7301 12.6763C14.7926 12.6027 14.7837 12.4911 14.71 12.4263ZM17.3306 9.29911C15.3507 7.64955 12.8038 6.65625 10.0225 6.65625C7.24129 6.65625 4.69442 7.64955 2.71228 9.29911C2.67602 9.32969 2.65332 9.37337 2.64914 9.42062C2.64496 9.46788 2.65963 9.51486 2.68995 9.55134L3.49353 10.5089C3.55603 10.5848 3.66987 10.5937 3.74353 10.5312C5.44665 9.11607 7.63638 8.26339 10.0225 8.26339C12.4087 8.26339 14.5984 9.11607 16.2993 10.5312C16.3752 10.5937 16.4868 10.5848 16.5493 10.5089L17.3529 9.55134C17.4154 9.47545 17.4065 9.36161 17.3306 9.29911ZM8.57165 15.942C8.57165 16.3208 8.72216 16.6842 8.99007 16.9521C9.25798 17.22 9.62134 17.3705 10.0002 17.3705C10.3791 17.3705 10.7425 17.22 11.0104 16.9521C11.2783 16.6842 11.4288 16.3208 11.4288 15.942C11.4288 15.5631 11.2783 15.1997 11.0104 14.9318C10.7425 14.6639 10.3791 14.5134 10.0002 14.5134C9.62134 14.5134 9.25798 14.6639 8.99007 14.9318C8.72216 15.1997 8.57165 15.5631 8.57165 15.942Z" fill="#FAAD14"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14.7107 12.4247C13.4562 11.3331 11.8178 10.6724 10.0232 10.6724C8.22856 10.6724 6.59017 11.3331 5.33347 12.4269C5.29877 12.4582 5.27752 12.5017 5.27419 12.5483C5.27086 12.5949 5.28571 12.641 5.31561 12.6769L6.11918 13.6345C6.18392 13.7104 6.29776 13.7193 6.37365 13.6546C7.34686 12.7974 8.62365 12.2796 10.0232 12.2796C11.4228 12.2796 12.6995 12.7974 13.6728 13.6523C13.7486 13.7171 13.8625 13.7081 13.9272 13.6323L14.7308 12.6747C14.7933 12.601 14.7844 12.4894 14.7107 12.4247ZM17.3312 9.29743C15.3513 7.64788 12.8045 6.65458 10.0232 6.65458C7.24195 6.65458 4.69508 7.64788 2.71293 9.29743C2.67667 9.32802 2.65398 9.3717 2.6498 9.41895C2.64561 9.4662 2.66029 9.51319 2.69061 9.54967L3.49418 10.5073C3.55668 10.5831 3.67052 10.5921 3.74418 10.5296C5.44731 9.1144 7.63704 8.26172 10.0232 8.26172C12.4094 8.26172 14.5991 9.1144 16.3 10.5296C16.3759 10.5921 16.4875 10.5831 16.55 10.5073L17.3536 9.54967C17.4161 9.47377 17.4071 9.35993 17.3312 9.29743ZM19.9361 6.19475C17.2263 3.97154 13.7576 2.63672 9.97856 2.63672C6.2241 2.63672 2.77767 3.95368 0.0745416 6.15011C0.0559703 6.16503 0.040572 6.18352 0.0292538 6.20448C0.0179355 6.22544 0.0109261 6.24846 0.00863805 6.27217C0.00635001 6.29588 0.0088297 6.31981 0.0159311 6.34255C0.0230325 6.36529 0.034612 6.38638 0.0499878 6.40458L0.853559 7.36217C0.916059 7.43583 1.02767 7.44699 1.10133 7.38672C3.52767 5.4202 6.61472 4.24386 9.97856 4.24386C13.367 4.24386 16.4741 5.43806 18.9071 7.42913C18.983 7.49163 19.0946 7.48047 19.1571 7.40458L19.9607 6.44699C20.0254 6.37109 20.0143 6.25725 19.9361 6.19475ZM8.57231 15.9403C8.57231 16.3192 8.72282 16.6825 8.99073 16.9504C9.25864 17.2184 9.622 17.3689 10.0009 17.3689C10.3798 17.3689 10.7431 17.2184 11.011 16.9504C11.2789 16.6825 11.4295 16.3192 11.4295 15.9403C11.4295 15.5614 11.2789 15.198 11.011 14.9301C10.7431 14.6622 10.3798 14.5117 10.0009 14.5117C9.622 14.5117 9.25864 14.6622 8.99073 14.9301C8.72282 15.198 8.57231 15.5614 8.57231 15.9403Z" fill="#D9D9D9"/>
|
|
3
|
+
<path d="M14.7104 12.4241C13.4559 11.3326 11.8175 10.6719 10.0229 10.6719C8.22826 10.6719 6.58987 11.3326 5.33317 12.4263C5.29847 12.4576 5.27723 12.5011 5.2739 12.5477C5.27057 12.5943 5.28541 12.6404 5.31532 12.6763L6.11889 13.6339C6.18362 13.7098 6.29746 13.7187 6.37335 13.654C7.34657 12.7969 8.62335 12.279 10.0229 12.279C11.4225 12.279 12.6992 12.7969 13.6725 13.6518C13.7484 13.7165 13.8622 13.7076 13.9269 13.6317L14.7305 12.6741C14.793 12.6004 14.7841 12.4888 14.7104 12.4241ZM8.57201 15.9397C8.57201 16.3186 8.72252 16.682 8.99043 16.9499C9.25834 17.2178 9.6217 17.3683 10.0006 17.3683C10.3795 17.3683 10.7428 17.2178 11.0107 16.9499C11.2786 16.682 11.4292 16.3186 11.4292 15.9397C11.4292 15.5609 11.2786 15.1975 11.0107 14.9296C10.7428 14.6617 10.3795 14.5112 10.0006 14.5112C9.6217 14.5112 9.25834 14.6617 8.99043 14.9296C8.72252 15.1975 8.57201 15.5609 8.57201 15.9397Z" fill="#F5222D"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14.7107 12.4247C13.4562 11.3331 11.8178 10.6724 10.0232 10.6724C8.22856 10.6724 6.59017 11.3331 5.33347 12.4269C5.29877 12.4582 5.27752 12.5017 5.27419 12.5483C5.27086 12.5949 5.28571 12.641 5.31561 12.6769L6.11918 13.6345C6.18392 13.7104 6.29776 13.7193 6.37365 13.6546C7.34686 12.7974 8.62365 12.2796 10.0232 12.2796C11.4228 12.2796 12.6995 12.7974 13.6728 13.6523C13.7486 13.7171 13.8625 13.7081 13.9272 13.6323L14.7308 12.6747C14.7933 12.601 14.7844 12.4894 14.7107 12.4247ZM17.3312 9.29743C15.3513 7.64788 12.8045 6.65458 10.0232 6.65458C7.24195 6.65458 4.69508 7.64788 2.71293 9.29743C2.67667 9.32802 2.65398 9.3717 2.6498 9.41895C2.64561 9.4662 2.66029 9.51319 2.69061 9.54967L3.49418 10.5073C3.55668 10.5831 3.67052 10.5921 3.74418 10.5296C5.44731 9.1144 7.63704 8.26172 10.0232 8.26172C12.4094 8.26172 14.5991 9.1144 16.3 10.5296C16.3759 10.5921 16.4875 10.5831 16.55 10.5073L17.3536 9.54967C17.4161 9.47377 17.4071 9.35993 17.3312 9.29743ZM19.9361 6.19475C17.2263 3.97154 13.7576 2.63672 9.97856 2.63672C6.2241 2.63672 2.77767 3.95368 0.0745416 6.15011C0.0559703 6.16503 0.040572 6.18352 0.0292538 6.20448C0.0179355 6.22544 0.0109261 6.24846 0.00863805 6.27217C0.00635001 6.29588 0.0088297 6.31981 0.0159311 6.34255C0.0230325 6.36529 0.034612 6.38638 0.0499878 6.40458L0.853559 7.36217C0.916059 7.43583 1.02767 7.44699 1.10133 7.38672C3.52767 5.4202 6.61472 4.24386 9.97856 4.24386C13.367 4.24386 16.4741 5.43806 18.9071 7.42913C18.983 7.49163 19.0946 7.48047 19.1571 7.40458L19.9607 6.44699C20.0254 6.37109 20.0143 6.25725 19.9361 6.19475ZM8.57231 15.9403C8.57231 16.3192 8.72282 16.6825 8.99073 16.9504C9.25864 17.2184 9.622 17.3689 10.0009 17.3689C10.3798 17.3689 10.7431 17.2184 11.011 16.9504C11.2789 16.6825 11.4295 16.3192 11.4295 15.9403C11.4295 15.5614 11.2789 15.198 11.011 14.9301C10.7431 14.6622 10.3798 14.5117 10.0009 14.5117C9.622 14.5117 9.25864 14.6622 8.99073 14.9301C8.72282 15.198 8.57231 15.5614 8.57231 15.9403Z" fill="#D9D9D9"/>
|
|
3
|
+
<path d="M8.57227 15.9403C8.57227 16.3192 8.72278 16.6825 8.99068 16.9504C9.25859 17.2184 9.62196 17.3689 10.0008 17.3689C10.3797 17.3689 10.7431 17.2184 11.011 16.9504C11.2789 16.6825 11.4294 16.3192 11.4294 15.9403C11.4294 15.5614 11.2789 15.198 11.011 14.9301C10.7431 14.6622 10.3797 14.5117 10.0008 14.5117C9.62196 14.5117 9.25859 14.6622 8.99068 14.9301C8.72278 15.198 8.57227 15.5614 8.57227 15.9403Z" fill="#A8071A"/>
|
|
4
|
+
</svg>
|