@botfabrik/engine-webclient 4.107.0 → 4.108.0
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/client/assets/{index-DJ2nppVp.js → index-BFYEgcht.js} +1 -1
- package/dist/client/assets/{index-DJ2nppVp.js.map → index-BFYEgcht.js.map} +1 -1
- package/dist/client/assets/{index-CXSidNoh.css → index-BioayaaF.css} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/getSupportedClientLanguage.d.ts +1 -0
- package/dist/getSupportedClientLanguage.js +15 -0
- package/dist/getSupportedClientLanguage.test.js +18 -0
- package/dist/index.js +3 -3
- package/package.json +5 -5
- package/dist/getSupportedClientLocale.d.ts +0 -2
- package/dist/getSupportedClientLocale.js +0 -16
- package/dist/getSupportedClientLocale.test.js +0 -18
- /package/dist/{getSupportedClientLocale.test.d.ts → getSupportedClientLanguage.test.d.ts} +0 -0
|
@@ -73,4 +73,4 @@ ${ce.current.stack}
|
|
|
73
73
|
|
|
74
74
|
- La cronologia delle chat è memorizzata nell'area UE e può essere visualizzata solo da persone autorizzate.
|
|
75
75
|
- Non inserire dati personali nella finestra di chat (password, data di nascita, ecc.).`,"general-conditions.accept-conditions-note":"Utilizzando la chat si accettano le condizioni d'uso.","block-user-input.title":"Attendere la risposta del chatbot.","conversation-rating.call-to-action.title":"Valuta questa chat","conversation-rating.overlay.title":"Quanto sei soddisfatto di questa chat?","conversation-rating.overlay.guest-feedback.input-placeholder":"Inserisci qui il tuo feedback (opzionale)","conversation-rating.overlay.star.very-bad":"Molto male","conversation-rating.overlay.star.very-good":"Molto buono","conversation-rating.overlay.bot-message.rate-feedback.value-1":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-2":"Oh, non suona bene. Vi prego di darmi un feedback in modo che possa imparare di più.","conversation-rating.overlay.bot-message.rate-feedback.value-3":"La media non è il mio obiettivo, cosa posso ancora migliorare?","conversation-rating.overlay.bot-message.rate-feedback.value-4":"Anche l'assenza è finita. Cosa posso migliorare per ottenere tutte le stelle la prossima volta?","conversation-rating.overlay.bot-message.rate-feedback.value-5":"Perfetto! Allora spero di potervi consigliare ancora una volta bene.","conversation-rating.overlay.bot-message.submit-feedback":"Grazie mille per il feedback. Mi impegno costantemente per migliorare.","conversation-rating.overlay.action.submit":"Invia","conversation-rating.overlay.action.back-to-chat":"Chiudere","conversation-rating.overlay.action.close-chat":"Minimizzare la chat","conversation-rating.overlay.action.restart-chat":"Riavviare la chat","conversation-rating.overlay.action.cancel":"Annulla","start-screen.intro":"","start-screen.start-chat":"Avviare la chat","start-screen.waiting-for-login":"In attesa di login ...","header.close-chat":"Minimizzare la chat","header.menu.title":"Menu","header.menu.restart-chat":"Riavviare la chat","header.menu.expand-chat-window":"Espandere la finestra","header.menu.download-transcript":"Scaricare la trascrizione","header.menu.send-transcript":"Inviare la trascrizione","header.menu.export-transcript":"Esportare la trascrizione","header.menu.rate-conversation":"Valutare la conversazione","source-infos.close":"Chiudere","source-infos.open-source":"Fonte aperta","source-infos.error.title":"Errore","source-infos.error.info":"Ops! Qualcosa è andato storto. Riprovare o contattare l'assistenza se il problema persiste.","source-infos.highlight-loading.title":"Il contenuto rilevante è evidenziato...","source-infos.highlight-loading.description":"Un momento - la fonte è in fase di analisi","commands.show-more.action":"Di più","commands.show-more.tooltip":"Mostra più comandi","commands.show-less.action":"Meno","commands.show-less.tooltip":"Mostra meno comandi"},jx=["de","en","fr","it"],eb={locale:"de",messages:Py},Ux=(n,l)=>{if(jx.includes(n)){const r=Hx(n),s=$y(l);return{...r,...s}}return l},Hx=n=>{switch(n.toString()){case"en":return zx;case"fr":return kx;case"it":return Bx;default:return Py}},qx=(n=Ix,l)=>{switch(l.type){case Wh:return Object.assign({},n,{connectionState:Kr.CONNECTING});case Qh:return Object.assign({},n,{connectionState:Kr.CONNECTED});case Ph:return Object.assign({},n,{connectionState:Kr.DISCONNECTED});case $h:return Object.assign({},n,{connectionState:Kr.RECONNECTED});case em:return Object.assign({},n,{sessionId:l.sessionId});case cu:return Object.assign({},n,{sessionId:l.payload.sessionId,userId:l.payload.userId});case uu:return Object.assign({},n,{sessionId:void 0});default:return n}},Ix={connectionState:Kr.DISCONNECTED,sessionId:void 0,userId:void 0,queryString:window.location.search},Gx=(n=Cv,l)=>{switch(l.type){case gy:return Cv;case cu:return Yr({type:"webclient.chat.started"}),n;case uu:return Yr({type:"webclient.chat.ended"}),n;case Uv:return Object.assign({},n,{isBotTyping:!0});case Hv:return Object.assign({},n,{isBotTyping:!1});case Dh:case qv:return Av(n,l.message);case Iv:{Yr(l);const r=Object.assign({},l.message,{_id:l.meta.actionId}),s=n.messages.filter(c=>c._id===l.meta.actionId).length>0;return Object.assign({},n,{isBotTyping:!1,messages:s?n.messages:n.messages.concat([r]),quickReplies:r.quickReplies?r.quickReplies:[]})}case Bh:{const r=l.messages,s=r.length?r[r.length-1]:void 0;return Object.assign({},n,{isBotTyping:!1,messages:r,quickReplies:s?.quickReplies||[]})}case kh:return Yr(l.message),n;case Gv:return Yr(l.event),n;case KA:return Object.assign({},n,{drawerContentUrl:l.payload.parameters.contentUrl});case FA:return Object.assign({},n,{drawerContentUrl:void 0});case JA:return Object.assign({},n,{locale:l.payload.locale});case Jv:return Yr(l),n;case Zv:return Yr(l),{...n,conversationRating:{...n.conversationRating,opener:void 0}};case Uh:{const r=new tu(l.transcription,new zh),s=Object.assign({},r,{_id:Bc()});return Av(n,s)}case Vv:{const r=n.messages.map(s=>s._id===l.payload.actionId?Object.assign({},s,l.payload.reaction?{reaction:{type:l.payload.reaction,category:l.payload.category,comment:l.payload.comment}}:{reaction:void 0}):s);return Object.assign({},n,{messages:r})}case Hh:{const r={enabled:!0,rating:l.payload.rating};return Object.assign({},n,{conversationRating:r})}case Lh:{const r={...n.conversationRating,rating:l.payload};return Object.assign({},n,{conversationRating:r})}case yy:{const r={...n.conversationRating,opener:l.payload.opener,...l.payload.defaultRating?{rating:{value:l.payload.defaultRating,feedback:n.conversationRating.rating?.feedback||""}}:{}};return Object.assign({},n,{conversationRating:r})}case by:{const r={...n.conversationRating,opener:void 0};return Object.assign({},n,{conversationRating:r})}case Ih:return{...n,sourceInfos:{type:"loading",chunkId:l.payload.chunkId}};case qh:{const{highlighted:r}=l.payload;return n.sourceInfos?.type==="loaded"&&r?{...n,sourceInfos:{...n.sourceInfos,highlighted:!0}}:{...n,sourceInfos:{type:"loading-error"}}}case Fv:{const r=n.sourceInfos?.type,{chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:h,url:m}=l.payload,p=n.sourceInfos?.type==="loading"||n.sourceInfos?.type==="loaded"?n.sourceInfos?.chunkId:void 0;return p&&p!==s?n:r==="loading"||r==="loaded"&&h?{...n,sourceInfos:{type:"loaded",chunkId:s,knowledgeBaseType:c,title:f,content:d,highlighted:h,url:m}}:n}case Gh:return{...n,sourceInfos:void 0};case vy:return{...n,showTranscriptMailOverlay:!n.showTranscriptMailOverlay,conversationRating:{...n.conversationRating,opener:void 0}};default:return n}},Av=(n,l)=>{const r=n.messages[n.messages.length-1],s=r?.text===l.text;return r&&r.sender.type===l.sender.type&&s?n:Object.assign({},n,{messages:n.messages.concat([l]),quickReplies:[]})},Yr=n=>{Vx()?window.top?.postMessage(n,"*"):n.type==="webclient.change.url"&&window.open(n.url)},Vx=()=>typeof window<"u"&&window.self!==window.top,Cv={messages:[],quickReplies:[],isBotTyping:!1,showTranscriptMailOverlay:!1,conversationRating:{enabled:!1}},tb=Jh({name:"intl",initialState:eb,reducers:{updateIntl:(n,l)=>{n.locale=l.payload.language,n.messages=l.payload.messages}}}),{updateIntl:Xx}=tb.actions,Yx=tb.reducer,Kx={version:void 0,requiresUserAuthentication:!1,enableStartScreen:void 0,enableStandaloneView:!1,enableTranscriptExportEmail:!1,enableTranscriptExportPdf:!1,enableGeneralConditions:!1,enableSpeechSupport:!1,commands:[],menuItems:[]},nb=Jh({name:"settings",initialState:Kx,reducers:{setSettings(n,l){n.version&&n.version!==l.payload.version?(console.log("version changed, reloading chat window"),window.location.reload()):(n.version=l.payload.version,n.requiresUserAuthentication=l.payload.requiresUserAuthentication,n.enableStartScreen=l.payload.enableStartScreen,n.enableStandaloneView=l.payload.enableStandaloneView,n.enableTranscriptExportEmail=l.payload.enableTranscriptExportEmail,n.enableTranscriptExportPdf=l.payload.enableTranscriptExportPdf,n.enableGeneralConditions=l.payload.enableGeneralConditions,n.enableSpeechSupport=l.payload.enableSpeechSupport,n.commands=l.payload.commands,n.menuItems=l.payload.menuItems||[])}}}),{setSettings:Fx}=nb.actions,Jx=nb.reducer,Zx=ty({settings:Jx,chat:Gx,startScreen:uS,connection:qx,intl:Yx}),Wx="bubble-chat",ab="state-last-saved-at",lb="state",Qx=n=>{try{if(!e4())return;const l=Sv(n,ab);if($x(l))return;{const r=Sv(n,lb);if(r===null)return;const s=JSON.parse(r),c=s.connection?.queryString;if(c!==void 0&&!t4(c,window.location.search)){console.log("Ignoring persisted state due to different query string");return}else return s}}catch(l){console.error(l);return}},Px=(n,l)=>{try{const r=JSON.stringify(l);Ev(n,lb,r);const s=new Date().toISOString();Ev(n,ab,s)}catch(r){console.error(r)}},$x=n=>{if(n===null)return!1;const l=new Date(n);return l.setHours(l.getHours()+12),new Date>l},e4=()=>typeof localStorage<"u",Sv=(n,l)=>{const r=rb(n,l);return localStorage.getItem(r)},Ev=(n,l,r)=>{const s=rb(n,l);return localStorage.setItem(s,r)},rb=(n,l)=>`${Wx}-${n}-${l}`,t4=(n,l)=>{const r=new URLSearchParams(n),s=new URLSearchParams(l);r.delete("referrer"),s.delete("referrer");const c=Array.from(r.entries()).sort(),f=Array.from(s.entries()).sort();return c.length!==f.length?!1:c.every(([d,h],m)=>{const[p,v]=f[m];return d===p&&h===v})},Qa=Object.create(null);Qa.open="0";Qa.close="1";Qa.ping="2";Qa.pong="3";Qa.message="4";Qa.upgrade="5";Qa.noop="6";const Nc=Object.create(null);Object.keys(Qa).forEach(n=>{Nc[Qa[n]]=n});const Ch={type:"error",data:"parser error"},ib=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",sb=typeof ArrayBuffer=="function",ob=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,cm=({type:n,data:l},r,s)=>ib&&l instanceof Blob?r?s(l):Tv(l,s):sb&&(l instanceof ArrayBuffer||ob(l))?r?s(l):Tv(new Blob([l]),s):s(Qa[n]+(l||"")),Tv=(n,l)=>{const r=new FileReader;return r.onload=function(){const s=r.result.split(",")[1];l("b"+(s||""))},r.readAsDataURL(n)};function xv(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let Qd;function n4(n,l){if(ib&&n.data instanceof Blob)return n.data.arrayBuffer().then(xv).then(l);if(sb&&(n.data instanceof ArrayBuffer||ob(n.data)))return l(xv(n.data));cm(n,!1,r=>{Qd||(Qd=new TextEncoder),l(Qd.encode(r))})}const Ov="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Ov.length;n++)Gs[Ov.charCodeAt(n)]=n;const a4=n=>{let l=n.length*.75,r=n.length,s,c=0,f,d,h,m;n[n.length-1]==="="&&(l--,n[n.length-2]==="="&&l--);const p=new ArrayBuffer(l),v=new Uint8Array(p);for(s=0;s<r;s+=4)f=Gs[n.charCodeAt(s)],d=Gs[n.charCodeAt(s+1)],h=Gs[n.charCodeAt(s+2)],m=Gs[n.charCodeAt(s+3)],v[c++]=f<<2|d>>4,v[c++]=(d&15)<<4|h>>2,v[c++]=(h&3)<<6|m&63;return p},l4=typeof ArrayBuffer=="function",um=(n,l)=>{if(typeof n!="string")return{type:"message",data:cb(n,l)};const r=n.charAt(0);return r==="b"?{type:"message",data:r4(n.substring(1),l)}:Nc[r]?n.length>1?{type:Nc[r],data:n.substring(1)}:{type:Nc[r]}:Ch},r4=(n,l)=>{if(l4){const r=a4(n);return cb(r,l)}else return{base64:!0,data:n}},cb=(n,l)=>l==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,ub="",i4=(n,l)=>{const r=n.length,s=new Array(r);let c=0;n.forEach((f,d)=>{cm(f,!1,h=>{s[d]=h,++c===r&&l(s.join(ub))})})},s4=(n,l)=>{const r=n.split(ub),s=[];for(let c=0;c<r.length;c++){const f=um(r[c],l);if(s.push(f),f.type==="error")break}return s};function o4(){return new TransformStream({transform(n,l){n4(n,r=>{const s=r.length;let c;if(s<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,s);else if(s<65536){c=new Uint8Array(3);const f=new DataView(c.buffer);f.setUint8(0,126),f.setUint16(1,s)}else{c=new Uint8Array(9);const f=new DataView(c.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(c[0]|=128),l.enqueue(c),l.enqueue(r)})}})}let Pd;function Ec(n){return n.reduce((l,r)=>l+r.length,0)}function Tc(n,l){if(n[0].length===l)return n.shift();const r=new Uint8Array(l);let s=0;for(let c=0;c<l;c++)r[c]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),r}function c4(n,l){Pd||(Pd=new TextDecoder);const r=[];let s=0,c=-1,f=!1;return new TransformStream({transform(d,h){for(r.push(d);;){if(s===0){if(Ec(r)<1)break;const m=Tc(r,1);f=(m[0]&128)===128,c=m[0]&127,c<126?s=3:c===126?s=1:s=2}else if(s===1){if(Ec(r)<2)break;const m=Tc(r,2);c=new DataView(m.buffer,m.byteOffset,m.length).getUint16(0),s=3}else if(s===2){if(Ec(r)<8)break;const m=Tc(r,8),p=new DataView(m.buffer,m.byteOffset,m.length),v=p.getUint32(0);if(v>Math.pow(2,21)-1){h.enqueue(Ch);break}c=v*Math.pow(2,32)+p.getUint32(4),s=3}else{if(Ec(r)<c)break;const m=Tc(r,c);h.enqueue(um(f?m:Pd.decode(m),l)),s=0}if(c===0||c>n){h.enqueue(Ch);break}}}})}const fb=4;function sn(n){if(n)return u4(n)}function u4(n){for(var l in sn.prototype)n[l]=sn.prototype[l];return n}sn.prototype.on=sn.prototype.addEventListener=function(n,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(l),this};sn.prototype.once=function(n,l){function r(){this.off(n,r),l.apply(this,arguments)}return r.fn=l,this.on(n,r),this};sn.prototype.off=sn.prototype.removeListener=sn.prototype.removeAllListeners=sn.prototype.removeEventListener=function(n,l){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+n];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,c=0;c<r.length;c++)if(s=r[c],s===l||s.fn===l){r.splice(c,1);break}return r.length===0&&delete this._callbacks["$"+n],this};sn.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var l=new Array(arguments.length-1),r=this._callbacks["$"+n],s=1;s<arguments.length;s++)l[s-1]=arguments[s];if(r){r=r.slice(0);for(var s=0,c=r.length;s<c;++s)r[s].apply(this,l)}return this};sn.prototype.emitReserved=sn.prototype.emit;sn.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};sn.prototype.hasListeners=function(n){return!!this.listeners(n).length};const vu=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,r)=>r(l,0),Sa=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),f4="arraybuffer";function db(n,...l){return l.reduce((r,s)=>(n.hasOwnProperty(s)&&(r[s]=n[s]),r),{})}const d4=Sa.setTimeout,h4=Sa.clearTimeout;function yu(n,l){l.useNativeTimers?(n.setTimeoutFn=d4.bind(Sa),n.clearTimeoutFn=h4.bind(Sa)):(n.setTimeoutFn=Sa.setTimeout.bind(Sa),n.clearTimeoutFn=Sa.clearTimeout.bind(Sa))}const m4=1.33;function p4(n){return typeof n=="string"?g4(n):Math.ceil((n.byteLength||n.size)*m4)}function g4(n){let l=0,r=0;for(let s=0,c=n.length;s<c;s++)l=n.charCodeAt(s),l<128?r+=1:l<2048?r+=2:l<55296||l>=57344?r+=3:(s++,r+=4);return r}function hb(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function v4(n){let l="";for(let r in n)n.hasOwnProperty(r)&&(l.length&&(l+="&"),l+=encodeURIComponent(r)+"="+encodeURIComponent(n[r]));return l}function y4(n){let l={},r=n.split("&");for(let s=0,c=r.length;s<c;s++){let f=r[s].split("=");l[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return l}class b4 extends Error{constructor(l,r,s){super(l),this.description=r,this.context=s,this.type="TransportError"}}class fm extends sn{constructor(l){super(),this.writable=!1,yu(this,l),this.opts=l,this.query=l.query,this.socket=l.socket,this.supportsBinary=!l.forceBase64}onError(l,r,s){return super.emitReserved("error",new b4(l,r,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(l){this.readyState==="open"&&this.write(l)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(l){const r=um(l,this.socket.binaryType);this.onPacket(r)}onPacket(l){super.emitReserved("packet",l)}onClose(l){this.readyState="closed",super.emitReserved("close",l)}pause(l){}createUri(l,r={}){return l+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const l=this.opts.hostname;return l.indexOf(":")===-1?l:"["+l+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(l){const r=v4(l);return r.length?"?"+r:""}}class _4 extends fm{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(l){this.readyState="pausing";const r=()=>{this.readyState="paused",l()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||r()})),this.writable||(s++,this.once("drain",function(){--s||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(l){const r=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};s4(l,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const l=()=>{this.write([{type:"close"}])};this.readyState==="open"?l():this.once("open",l)}write(l){this.writable=!1,i4(l,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const l=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=hb()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(l,r)}}let mb=!1;try{mb=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const A4=mb;function C4(){}class S4 extends _4{constructor(l){if(super(l),typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&l.hostname!==location.hostname||s!==l.port}}doWrite(l,r){const s=this.request({method:"POST",data:l});s.on("success",r),s.on("error",(c,f)=>{this.onError("xhr post error",c,f)})}doPoll(){const l=this.request();l.on("data",this.onData.bind(this)),l.on("error",(r,s)=>{this.onError("xhr poll error",r,s)}),this.pollXhr=l}}class Za extends sn{constructor(l,r,s){super(),this.createRequest=l,yu(this,s),this._opts=s,this._method=s.method||"GET",this._uri=r,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var l;const r=db(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(r);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&s.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(l=this._opts.cookieJar)===null||l===void 0||l.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var c;s.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=Za.requestsCount++,Za.requests[this._index]=this)}_onError(l){this.emitReserved("error",l,this._xhr),this._cleanup(!0)}_cleanup(l){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=C4,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Za.requests[this._index],this._xhr=null}}_onLoad(){const l=this._xhr.responseText;l!==null&&(this.emitReserved("data",l),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Za.requestsCount=0;Za.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rv);else if(typeof addEventListener=="function"){const n="onpagehide"in Sa?"pagehide":"unload";addEventListener(n,Rv,!1)}}function Rv(){for(let n in Za.requests)Za.requests.hasOwnProperty(n)&&Za.requests[n].abort()}const E4=(function(){const n=pb({xdomain:!1});return n&&n.responseType!==null})();class T4 extends S4{constructor(l){super(l);const r=l&&l.forceBase64;this.supportsBinary=E4&&!r}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new Za(pb,this.uri(),l)}}function pb(n){const l=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||A4))return new XMLHttpRequest}catch{}if(!l)try{return new Sa[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const gb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class x4 extends fm{get name(){return"websocket"}doOpen(){const l=this.uri(),r=this.opts.protocols,s=gb?{}:db(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=this.createSocket(l,r,s)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=l=>this.onClose({description:"websocket connection closed",context:l}),this.ws.onmessage=l=>this.onData(l.data),this.ws.onerror=l=>this.onError("websocket error",l)}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;cm(s,this.supportsBinary,f=>{try{this.doWrite(s,f)}catch{}c&&vu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const l=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=hb()),this.supportsBinary||(r.b64=1),this.createUri(l,r)}}const $d=Sa.WebSocket||Sa.MozWebSocket;class O4 extends x4{createSocket(l,r,s){return gb?new $d(l,r,s):r?new $d(l,r):new $d(l)}doWrite(l,r){this.ws.send(r)}}class R4 extends fm{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(l){return this.emitReserved("error",l)}this._transport.closed.then(()=>{this.onClose()}).catch(l=>{this.onError("webtransport error",l)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(l=>{const r=c4(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=l.readable.pipeThrough(r).getReader(),c=o4();c.readable.pipeTo(l.writable),this._writer=c.writable.getWriter();const f=()=>{s.read().then(({done:h,value:m})=>{h||(this.onPacket(m),f())}).catch(h=>{})};f();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let r=0;r<l.length;r++){const s=l[r],c=r===l.length-1;this._writer.write(s).then(()=>{c&&vu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const w4={websocket:O4,webtransport:R4,polling:T4},N4=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,M4=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Sh(n){if(n.length>8e3)throw"URI too long";const l=n,r=n.indexOf("["),s=n.indexOf("]");r!=-1&&s!=-1&&(n=n.substring(0,r)+n.substring(r,s).replace(/:/g,";")+n.substring(s,n.length));let c=N4.exec(n||""),f={},d=14;for(;d--;)f[M4[d]]=c[d]||"";return r!=-1&&s!=-1&&(f.source=l,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=D4(f,f.path),f.queryKey=L4(f,f.query),f}function D4(n,l){const r=/\/{2,9}/g,s=l.replace(r,"/").split("/");return(l.slice(0,1)=="/"||l.length===0)&&s.splice(0,1),l.slice(-1)=="/"&&s.splice(s.length-1,1),s}function L4(n,l){const r={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,c,f){c&&(r[c]=f)}),r}const Eh=typeof addEventListener=="function"&&typeof removeEventListener=="function",Mc=[];Eh&&addEventListener("offline",()=>{Mc.forEach(n=>n())},!1);class ur extends sn{constructor(l,r){if(super(),this.binaryType=f4,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(r=l,l=null),l){const s=Sh(l);r.hostname=s.host,r.secure=s.protocol==="https"||s.protocol==="wss",r.port=s.port,s.query&&(r.query=s.query)}else r.host&&(r.hostname=Sh(r.host).host);yu(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(s=>{const c=s.prototype.name;this.transports.push(c),this._transportsByName[c]=s}),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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=y4(this.opts.query)),Eh&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Mc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const r=Object.assign({},this.opts.query);r.EIO=fb,r.transport=l,this.id&&(r.sid=this.id);const s=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[l]);return new this._transportsByName[l](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const l=this.opts.rememberUpgrade&&ur.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(l);r.open(),this.setTransport(r)}setTransport(l){this.transport&&this.transport.removeAllListeners(),this.transport=l,l.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",ur.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(l){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",l),this.emitReserved("heartbeat"),l.type){case"open":this.onHandshake(JSON.parse(l.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=l.data,this._onError(r);break;case"message":this.emitReserved("data",l.data),this.emitReserved("message",l.data);break}}onHandshake(l){this.emitReserved("handshake",l),this.id=l.sid,this.transport.query.sid=l.sid,this._pingInterval=l.pingInterval,this._pingTimeout=l.pingTimeout,this._maxPayload=l.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const l=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+l,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},l),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const l=this._getWritablePackets();this.transport.send(l),this._prevBufferLen=l.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let s=0;s<this.writeBuffer.length;s++){const c=this.writeBuffer[s].data;if(c&&(r+=p4(c)),s>0&&r>this._maxPayload)return this.writeBuffer.slice(0,s);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const l=Date.now()>this._pingTimeoutTime;return l&&(this._pingTimeoutTime=0,vu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),l}write(l,r,s){return this._sendPacket("message",l,r,s),this}send(l,r,s){return this._sendPacket("message",l,r,s),this}_sendPacket(l,r,s,c){if(typeof r=="function"&&(c=r,r=void 0),typeof s=="function"&&(c=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const f={type:l,data:r,options:s};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),c&&this.once("flush",c),this.flush()}close(){const l=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),l()},s=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():l()}):this.upgrading?s():l()),this}_onError(l){if(ur.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",l),this._onClose("transport error",l)}_onClose(l,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Eh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Mc.indexOf(this._offlineEventListener);s!==-1&&Mc.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,r),this.writeBuffer=[],this._prevBufferLen=0}}}ur.protocol=fb;class z4 extends ur{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let l=0;l<this._upgrades.length;l++)this._probe(this._upgrades[l])}_probe(l){let r=this.createTransport(l),s=!1;ur.priorWebsocketSuccess=!1;const c=()=>{s||(r.send([{type:"ping",data:"probe"}]),r.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;ur.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(v(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const C=new Error("probe error");C.transport=r.name,this.emitReserved("upgradeError",C)}}))};function f(){s||(s=!0,v(),r.close(),r=null)}const d=b=>{const C=new Error("probe error: "+b);C.transport=r.name,f(),this.emitReserved("upgradeError",C)};function h(){d("transport closed")}function m(){d("socket closed")}function p(b){r&&b.name!==r.name&&f()}const v=()=>{r.removeListener("open",c),r.removeListener("error",d),r.removeListener("close",h),this.off("close",m),this.off("upgrading",p)};r.once("open",c),r.once("error",d),r.once("close",h),this.once("close",m),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{s||r.open()},200):r.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const r=[];for(let s=0;s<l.length;s++)~this.transports.indexOf(l[s])&&r.push(l[s]);return r}}let k4=class extends z4{constructor(l,r={}){const s=typeof l=="object"?l:r;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(c=>w4[c]).filter(c=>!!c)),super(l,s)}};function B4(n,l="",r){let s=n;r=r||typeof location<"u"&&location,n==null&&(n=r.protocol+"//"+r.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=r.protocol+n:n=r.host+n),/^(https?|wss?):\/\//.test(n)||(typeof r<"u"?n=r.protocol+"//"+n:n="https://"+n),s=Sh(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const f=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+f+":"+s.port+l,s.href=s.protocol+"://"+f+(r&&r.port===s.port?"":":"+s.port),s}const j4=typeof ArrayBuffer=="function",U4=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,vb=Object.prototype.toString,H4=typeof Blob=="function"||typeof Blob<"u"&&vb.call(Blob)==="[object BlobConstructor]",q4=typeof File=="function"||typeof File<"u"&&vb.call(File)==="[object FileConstructor]";function dm(n){return j4&&(n instanceof ArrayBuffer||U4(n))||H4&&n instanceof Blob||q4&&n instanceof File}function Dc(n,l){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let r=0,s=n.length;r<s;r++)if(Dc(n[r]))return!0;return!1}if(dm(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Dc(n.toJSON(),!0);for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&Dc(n[r]))return!0;return!1}function I4(n){const l=[],r=n.data,s=n;return s.data=Th(r,l),s.attachments=l.length,{packet:s,buffers:l}}function Th(n,l){if(!n)return n;if(dm(n)){const r={_placeholder:!0,num:l.length};return l.push(n),r}else if(Array.isArray(n)){const r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=Th(n[s],l);return r}else if(typeof n=="object"&&!(n instanceof Date)){const r={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=Th(n[s],l));return r}return n}function G4(n,l){return n.data=xh(n.data,l),delete n.attachments,n}function xh(n,l){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<l.length)return l[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r]=xh(n[r],l);else if(typeof n=="object")for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=xh(n[r],l));return n}const V4=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var We;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(We||(We={}));class X4{constructor(l){this.replacer=l}encode(l){return(l.type===We.EVENT||l.type===We.ACK)&&Dc(l)?this.encodeAsBinary({type:l.type===We.EVENT?We.BINARY_EVENT:We.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let r=""+l.type;return(l.type===We.BINARY_EVENT||l.type===We.BINARY_ACK)&&(r+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(r+=l.nsp+","),l.id!=null&&(r+=l.id),l.data!=null&&(r+=JSON.stringify(l.data,this.replacer)),r}encodeAsBinary(l){const r=I4(l),s=this.encodeAsString(r.packet),c=r.buffers;return c.unshift(s),c}}class hm extends sn{constructor(l){super(),this.reviver=l}add(l){let r;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(l);const s=r.type===We.BINARY_EVENT;s||r.type===We.BINARY_ACK?(r.type=s?We.EVENT:We.ACK,this.reconstructor=new Y4(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(dm(l)||l.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(l),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let r=0;const s={type:Number(l.charAt(0))};if(We[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===We.BINARY_EVENT||s.type===We.BINARY_ACK){const f=r+1;for(;l.charAt(++r)!=="-"&&r!=l.length;);const d=l.substring(f,r);if(d!=Number(d)||l.charAt(r)!=="-")throw new Error("Illegal attachments");s.attachments=Number(d)}if(l.charAt(r+1)==="/"){const f=r+1;for(;++r&&!(l.charAt(r)===","||r===l.length););s.nsp=l.substring(f,r)}else s.nsp="/";const c=l.charAt(r+1);if(c!==""&&Number(c)==c){const f=r+1;for(;++r;){const d=l.charAt(r);if(d==null||Number(d)!=d){--r;break}if(r===l.length)break}s.id=Number(l.substring(f,r+1))}if(l.charAt(++r)){const f=this.tryParse(l.substr(r));if(hm.isPayloadValid(s.type,f))s.data=f;else throw new Error("invalid payload")}return s}tryParse(l){try{return JSON.parse(l,this.reviver)}catch{return!1}}static isPayloadValid(l,r){switch(l){case We.CONNECT:return wv(r);case We.DISCONNECT:return r===void 0;case We.CONNECT_ERROR:return typeof r=="string"||wv(r);case We.EVENT:case We.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&V4.indexOf(r[0])===-1);case We.ACK:case We.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Y4{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const r=G4(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function wv(n){return Object.prototype.toString.call(n)==="[object Object]"}const K4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:hm,Encoder:X4,get PacketType(){return We}},Symbol.toStringTag,{value:"Module"}));function Ba(n,l,r){return n.on(l,r),function(){n.off(l,r)}}const F4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class yb extends sn{constructor(l,r,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=l,this.nsp=r,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 l=this.io;this.subs=[Ba(l,"open",this.onopen.bind(this)),Ba(l,"packet",this.onpacket.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...r){var s,c,f;if(F4.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(r.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const d={type:We.EVENT,data:r};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const v=this.ids++,b=r.pop();this._registerAckCallback(v,b),d.id=v}const h=(c=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||c===void 0?void 0:c.writable,m=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!h||(m?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(l,r){var s;const c=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(c===void 0){this.acks[l]=r;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let h=0;h<this.sendBuffer.length;h++)this.sendBuffer[h].id===l&&this.sendBuffer.splice(h,1);r.call(this,new Error("operation has timed out"))},c),d=(...h)=>{this.io.clearTimeoutFn(f),r.apply(this,h)};d.withError=!0,this.acks[l]=d}emitWithAck(l,...r){return new Promise((s,c)=>{const f=(d,h)=>d?c(d):s(h);f.withError=!0,r.push(f),this.emit(l,...r)})}_addToQueue(l){let r;typeof l[l.length-1]=="function"&&(r=l.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((c,...f)=>(this._queue[0],c!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(c)):(this._queue.shift(),r&&r(null,...f)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!l||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type:We.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},l):l})}onerror(l){this.connected||this.emitReserved("connect_error",l)}onclose(l,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",l,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(l=>{if(!this.sendBuffer.some(s=>String(s.id)===l)){const s=this.acks[l];delete this.acks[l],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(l){if(l.nsp===this.nsp)switch(l.type){case We.CONNECT:l.data&&l.data.sid?this.onconnect(l.data.sid,l.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 We.EVENT:case We.BINARY_EVENT:this.onevent(l);break;case We.ACK:case We.BINARY_ACK:this.onack(l);break;case We.DISCONNECT:this.ondisconnect();break;case We.CONNECT_ERROR:this.destroy();const s=new Error(l.data.message);s.data=l.data.data,this.emitReserved("connect_error",s);break}}onevent(l){const r=l.data||[];l.id!=null&&r.push(this.ack(l.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(l){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const s of r)s.apply(this,l)}super.emit.apply(this,l),this._pid&&l.length&&typeof l[l.length-1]=="string"&&(this._lastOffset=l[l.length-1])}ack(l){const r=this;let s=!1;return function(...c){s||(s=!0,r.packet({type:We.ACK,id:l,data:c}))}}onack(l){const r=this.acks[l.id];typeof r=="function"&&(delete this.acks[l.id],r.withError&&l.data.unshift(null),r.apply(this,l.data))}onconnect(l,r){this.id=l,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(l=>this.emitEvent(l)),this.receiveBuffer=[],this.sendBuffer.forEach(l=>{this.notifyOutgoingListeners(l),this.packet(l)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(l=>l()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:We.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(l){return this.flags.compress=l,this}get volatile(){return this.flags.volatile=!0,this}timeout(l){return this.flags.timeout=l,this}onAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(l),this}prependAny(l){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(l),this}offAny(l){if(!this._anyListeners)return this;if(l){const r=this._anyListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(l),this}prependAnyOutgoing(l){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(l),this}offAnyOutgoing(l){if(!this._anyOutgoingListeners)return this;if(l){const r=this._anyOutgoingListeners;for(let s=0;s<r.length;s++)if(l===r[s])return r.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(l){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const s of r)s.apply(this,l.data)}}}function Ui(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}Ui.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var l=Math.random(),r=Math.floor(l*this.jitter*n);n=(Math.floor(l*10)&1)==0?n-r:n+r}return Math.min(n,this.max)|0};Ui.prototype.reset=function(){this.attempts=0};Ui.prototype.setMin=function(n){this.ms=n};Ui.prototype.setMax=function(n){this.max=n};Ui.prototype.setJitter=function(n){this.jitter=n};class Oh extends sn{constructor(l,r){var s;super(),this.nsps={},this.subs=[],l&&typeof l=="object"&&(r=l,l=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,yu(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((s=r.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Ui({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=l;const c=r.parser||K4;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(l){return arguments.length?(this._reconnection=!!l,l||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(l){return l===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=l,this)}reconnectionDelay(l){var r;return l===void 0?this._reconnectionDelay:(this._reconnectionDelay=l,(r=this.backoff)===null||r===void 0||r.setMin(l),this)}randomizationFactor(l){var r;return l===void 0?this._randomizationFactor:(this._randomizationFactor=l,(r=this.backoff)===null||r===void 0||r.setJitter(l),this)}reconnectionDelayMax(l){var r;return l===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=l,(r=this.backoff)===null||r===void 0||r.setMax(l),this)}timeout(l){return arguments.length?(this._timeout=l,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(l){if(~this._readyState.indexOf("open"))return this;this.engine=new k4(this.uri,this.opts);const r=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const c=Ba(r,"open",function(){s.onopen(),l&&l()}),f=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),l?l(h):this.maybeReconnectOnOpen()},d=Ba(r,"error",f);if(this._timeout!==!1){const h=this._timeout,m=this.setTimeoutFn(()=>{c(),f(new Error("timeout")),r.close()},h);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}return this.subs.push(c),this.subs.push(d),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Ba(l,"ping",this.onping.bind(this)),Ba(l,"data",this.ondata.bind(this)),Ba(l,"error",this.onerror.bind(this)),Ba(l,"close",this.onclose.bind(this)),Ba(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(l){try{this.decoder.add(l)}catch(r){this.onclose("parse error",r)}}ondecoded(l){vu(()=>{this.emitReserved("packet",l)},this.setTimeoutFn)}onerror(l){this.emitReserved("error",l)}socket(l,r){let s=this.nsps[l];return s?this._autoConnect&&!s.active&&s.connect():(s=new yb(this,l,r),this.nsps[l]=s),s}_destroy(l){const r=Object.keys(this.nsps);for(const s of r)if(this.nsps[s].active)return;this._close()}_packet(l){const r=this.encoder.encode(l);for(let s=0;s<r.length;s++)this.engine.write(r[s],l.options)}cleanup(){this.subs.forEach(l=>l()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(l,r){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",l,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const l=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{l.skipReconnect||(this.emitReserved("reconnect_attempt",l.backoff.attempts),!l.skipReconnect&&l.open(c=>{c?(l._reconnecting=!1,l.reconnect(),this.emitReserved("reconnect_error",c)):l.onreconnect()}))},r);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const l=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",l)}}const Hs={};function Lc(n,l){typeof n=="object"&&(l=n,n=void 0),l=l||{};const r=B4(n,l.path||"/socket.io"),s=r.source,c=r.id,f=r.path,d=Hs[c]&&f in Hs[c].nsps,h=l.forceNew||l["force new connection"]||l.multiplex===!1||d;let m;return h?m=new Oh(s,l):(Hs[c]||(Hs[c]=new Oh(s,l)),m=Hs[c]),r.query&&!l.query&&(l.query=r.queryKey),m.socket(r.path,l)}Object.assign(Lc,{Manager:Oh,Socket:yb,io:Lc,connect:Lc});const J4=[Iv,Gv,Uv,Hv,XA,...mS,...nC,"@@localize/SET_ACTIVE_LANGUAGE","@@localize/ADD_TRANSLATION_FOR_LANGUAGE"],Z4=({dispatch:n,getState:l})=>r=>{let s=null;return c=>{const f=r(c);if(c.type===Zh){s?.disconnect(),n(vS());const d=`/chat?${new URLSearchParams(c.querystrings).toString()}`;s=Lc(`/${c.clientName}${d}`),s.on("action",n),s.on("connect",()=>n(yS())),s.on("disconnect",()=>n(bS())),s.on("reconnect",()=>n(_S())),s.on("set-translations",(h,m)=>{n(Xx({language:h,messages:Ux(h,m)}))}),s.on("set-settings",h=>{n(Fx(h))}),s.on("enable-conversation-rating",h=>n(sC(h))),s.on("speech-transcription",h=>n(lC(h))),s.on("restore-client-state",h=>{n(gS(h.sessionId)),n(cC(h.messages))}),s.on("expand-window",({devices:h,initial:m=!1})=>{n({type:Jv,devices:h,initial:m})}),s.on("restart-chat",()=>{n(Ws())}),s.on("login-success",h=>{n(iS({loginToken:h.loginToken}))})}else if(c.type==="start-screen/requestLogin")s?.emit("login-requested",c.payload);else if(c.type===cu)s?.emit("start-chat",c.payload);else if(c.type===uu)s?.emit("terminate-session",c.payload);else if(c.type===tC)s?.emit("get-started",JSON.stringify(c));else if(c.type===jh)s?.emit("audio-message",c.buffer);else if(c.type===Lh)s?.emit("conversation-rating",c.payload);else if(c.type===Wv){const{connection:{sessionId:d}}=l();window.location.href=`/transcript-pdf/${d}`}else J4.indexOf(c.type)===-1&&c.meta===void 0&&s&&s.emit("action",JSON.stringify(c));return f}},bb=Vh(),W4={...Qx(bb),intl:eb},Rh=KC({middleware:n=>n().concat(Z4),reducer:Zx,preloadedState:W4});Rh.subscribe(s6(()=>{const n=Rh.getState();Px(bb,{connection:n.connection,startScreen:n.startScreen})},1e3));const Q4=document.getElementById("root"),P4=k2.createRoot(Q4);P4.render(y.jsx(zA,{store:Rh,children:y.jsx(Lx,{})}));
|
|
76
|
-
//# sourceMappingURL=index-
|
|
76
|
+
//# sourceMappingURL=index-BFYEgcht.js.map
|