bitmax-crm-widget 1.1.0 → 1.2.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/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import e,{useState as t,useRef as n,useEffect as r}from"react";function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t,n,r,s,o,i){try{var a=e[o](i),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var i=e.apply(t,n);function a(e){o(i,r,s,a,c,"next",e)}function c(e){o(i,r,s,a,c,"throw",e)}a(void 0)})}}function a(){
1
+ import e,{useState as t,useEffect as r,useRef as n}from"react";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,o,s,i){try{var a=e[s](i),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,c,"next",e)}function c(e){s(i,n,o,a,c,"throw",e)}a(void 0)})}}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach(function(t){a(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function o(n,r,s,o){var a=r&&r.prototype instanceof l?r:l,u=Object.create(a.prototype);return c(u,"_invoke",function(n,r,s){var o,a,c,l=0,u=s||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,a=0,c=e,d.n=n,i}};function p(n,r){for(a=n,c=r,t=0;!h&&l&&!s&&t<u.length;t++){var s,o=u[t],p=d.p,f=o[2];n>3?(s=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=p&&((s=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(s=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(s||n>1)return i;throw h=!0,r}return function(s,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(t=a<2?e:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(s="next"),t=o[s]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+s+"' method"),a=1);o=e}else if((t=(h=d.n<0)?c:n.call(r,d))!==i)break}catch(t){o=e,a=1,c=t}finally{l=1}}return{value:t,done:h}}}(n,s,o),!0),u}var i={};function l(){}function u(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=h.prototype=l.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=h,c(p,"constructor",h),c(h,"constructor",u),u.displayName="GeneratorFunction",c(h,s,"GeneratorFunction"),c(p),c(p,s,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:f}})()}function c(e,t,n,r){var s=Object.defineProperty;try{s({},"",{})}catch(e){s=0}c=function(e,t,n,r){function o(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?s?s(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,o,i,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw s}}return a}}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}const d=Object.create(null);d.open="0",d.close="1",d.ping="2",d.pong="3",d.message="4",d.upgrade="5",d.noop="6";const p=Object.create(null);Object.keys(d).forEach(e=>{p[d[e]]=e});const f={type:"error",data:"parser error"},m="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),g="function"==typeof ArrayBuffer,y=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,b=({type:e,data:t},n,r)=>m&&t instanceof Blob?n?r(t):w(t,r):g&&(t instanceof ArrayBuffer||y(t))?n?r(t):w(new Blob([t]),r):r(d[e]+(t||"")),w=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function v(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let E;const _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)k[_.charCodeAt(e)]=e;const x="function"==typeof ArrayBuffer,O=(e,t)=>{if("string"!=typeof e)return{type:"message",data:R(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:S(e.substring(1),t)};return p[n]?e.length>1?{type:p[n],data:e.substring(1)}:{type:p[n]}:f},S=(e,t)=>{if(x){const n=(e=>{let t,n,r,s,o,i=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const l=new ArrayBuffer(i),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=k[e.charCodeAt(t)],r=k[e.charCodeAt(t+1)],s=k[e.charCodeAt(t+2)],o=k[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|s>>2,u[c++]=(3&s)<<6|63&o;return l})(e);return R(n,t)}return{base64:!0,data:e}},R=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,A=String.fromCharCode(30);function T(){return new TransformStream({transform(e,t){!function(e,t){m&&e.data instanceof Blob?e.data.arrayBuffer().then(v).then(t):g&&(e.data instanceof ArrayBuffer||y(e.data))?t(v(e.data)):b(e,!1,e=>{E||(E=new TextEncoder),t(E.encode(e))})}(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const e=new DataView(s.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{s=new Uint8Array(9);const e=new DataView(s.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let C;function N(e){return e.reduce((e,t)=>e+t.length,0)}function B(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function j(e){if(e)return function(e){for(var t in j.prototype)e[t]=j.prototype[t];return e}(e)}j.prototype.on=j.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},j.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},j.prototype.off=j.prototype.removeListener=j.prototype.removeAllListeners=j.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},j.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},j.prototype.emitReserved=j.prototype.emit,j.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},j.prototype.hasListeners=function(e){return!!this.listeners(e).length};const L="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),P="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function U(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const I=P.setTimeout,q=P.clearTimeout;function F(e,t){t.useNativeTimers?(e.setTimeoutFn=I.bind(P),e.clearTimeoutFn=q.bind(P)):(e.setTimeoutFn=P.setTimeout.bind(P),e.clearTimeoutFn=P.clearTimeout.bind(P))}function D(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function M(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class z extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class H extends j{constructor(e){super(),this.writable=!1,F(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new z(e,t,n)),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=O(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 n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class W extends H{constructor(){super(...arguments),this._polling=!1}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 n=e.split(A),r=[];for(let e=0;e<n.length;e++){const s=O(n[e],t);if(r.push(s),"error"===s.type)break}return r})(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 n=e.length,r=new Array(n);let s=0;e.forEach((e,o)=>{b(e,!1,e=>{r[o]=e,++s===n&&t(r.join(A))})})})(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]=M()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let V=!1;try{V="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const K=V;function J(){}class $ extends W{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.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}}class G extends j{constructor(e,t,n){super(),this.createRequest=e,F(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=U(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=G.requestsCount++,G.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=J,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete G.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()}}if(G.requestsCount=0,G.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Y);else if("function"==typeof addEventListener){addEventListener("onpagehide"in P?"pagehide":"unload",Y,!1)}function Y(){for(let e in G.requests)G.requests.hasOwnProperty(e)&&G.requests[e].abort()}const Q=function(){const e=X({xdomain:!1});return e&&null!==e.responseType}();function X(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||K))return new XMLHttpRequest}catch(e){}if(!t)try{return new(P[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Z="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ee extends H{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Z?{}:U(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}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 n=e[t],r=t===e.length-1;b(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&L(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},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]=M()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const te=P.WebSocket||P.MozWebSocket;const ne={websocket:class extends ee{createSocket(e,t,n){return Z?new te(e,t,n):t?new te(e,t):new te(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends H{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}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){C||(C=new TextDecoder);const n=[];let r=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(n.push(i);;){if(0===r){if(N(n)<1)break;const e=B(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(N(n)<2)break;const e=B(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(N(n)<8)break;const e=B(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(f);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(N(n)<s)break;const e=B(n,s);a.enqueue(O(o?e:C.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(f);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=T();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const s=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),s())}).catch(e=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&L(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ${constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Q&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new G(X,this.uri(),e)}}},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,se=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function oe(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=re.exec(e||""),o={},i=14;for(;i--;)o[se[i]]=s[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const ie="function"==typeof addEventListener&&"function"==typeof removeEventListener,ae=[];ie&&addEventListener("offline",()=>{ae.forEach(e=>e())},!1);class ce extends j{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=oe(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=oe(t.host).host);F(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=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),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={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),ie&&(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"})},ae.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&ce.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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))}onOpen(){this.readyState="open",ce.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();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._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=D(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,L(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{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?n():e()}):this.upgrading?n():e()),this}_onError(e){if(ce.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ie&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ae.indexOf(this._offlineEventListener);-1!==e&&ae.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ce.protocol=4;class le extends ce{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;ce.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ce.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),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 s(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,s(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&s()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let ue=class extends le{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>ne[e]).filter(e=>!!e)),super(e,n)}};const he="function"==typeof ArrayBuffer,de=Object.prototype.toString,pe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===de.call(Blob),fe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===de.call(File);function me(e){return he&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||pe&&e instanceof Blob||fe&&e instanceof File}function ge(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ge(e[t]))return!0;return!1}if(me(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return ge(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ge(e[t]))return!0;return!1}function ye(e){const t=[],n=e.data,r=e;return r.data=be(n,t),r.attachments=t.length,{packet:r,buffers:t}}function be(e,t){if(!e)return e;if(me(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=be(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=be(e[r],t));return n}return e}function we(e,t){return e.data=ve(e.data,t),delete e.attachments,e}function ve(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 n=0;n<e.length;n++)e[n]=ve(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ve(e[n],t));return e}const Ee=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var _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"}(_e||(_e={}));function ke(e){return"[object Object]"===Object.prototype.toString.call(e)}class xe extends j{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 n=t.type===_e.BINARY_EVENT;n||t.type===_e.BINARY_ACK?(t.type=n?_e.EVENT:_e.ACK,this.reconstructor=new Oe(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!me(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 n={type:Number(e.charAt(0))};if(void 0===_e[n.type])throw new Error("unknown packet type "+n.type);if(n.type===_e.BINARY_EVENT||n.type===_e.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const s=e.substring(r,t);if(s!=Number(s)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(s)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!xe.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case _e.CONNECT:return ke(t);case _e.DISCONNECT:return void 0===t;case _e.CONNECT_ERROR:return"string"==typeof t||ke(t);case _e.EVENT:case _e.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Ee.indexOf(t[0]));case _e.ACK:case _e.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Oe{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=we(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Se=Object.freeze({__proto__:null,Decoder:xe,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==_e.EVENT&&e.type!==_e.ACK||!ge(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===_e.EVENT?_e.BINARY_EVENT:_e.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==_e.BINARY_EVENT&&e.type!==_e.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=ye(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return _e},protocol:5});function Re(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ae=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Te extends j{constructor(e,t,n){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,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Re(e,"open",this.onopen.bind(this)),Re(e,"packet",this.onpacket.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(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){var n,r,s;if(Ae.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 o={type:_e.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(s=this.io.engine)||void 0===s?void 0:s._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const s=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"))},r),o=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const s=(e,t)=>e?r(e):n(t);s.withError=!0,t.push(s),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),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:_e.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),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case _e.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 _e.EVENT:case _e.BINARY_EVENT:this.onevent(e);break;case _e.ACK:case _e.BINARY_ACK:this.onack(e);break;case _e.DISCONNECT:this.ondisconnect();break;case _e.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 n of t)n.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 n=!1;return function(...r){n||(n=!0,t.packet({type:_e.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}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:_e.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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n of t)n.apply(this,e.data)}}}function Ce(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}Ce.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Ce.prototype.reset=function(){this.attempts=0},Ce.prototype.setMin=function(e){this.ms=e},Ce.prototype.setMax=function(e){this.max=e},Ce.prototype.setJitter=function(e){this.jitter=e};class Ne extends j{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,F(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!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Ce({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Se;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),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 ue(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Re(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Re(t,"error",s);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),s(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Re(e,"ping",this.onping.bind(this)),Re(e,"data",this.ondata.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(e,"close",this.onclose.bind(this)),Re(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){L(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Te(this,e,t),this.nsps[e]=n),n}_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 n=0;n<t.length;n++)this.engine.write(t[n],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")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),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 n=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&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Be={};function je(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=oe(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,s=n.id,o=n.path,i=Be[s]&&o in Be[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ne(r,t):(Be[s]||(Be[s]=new Ne(r,t)),a=Be[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Le(e,t){return function(){return e.apply(t,arguments)}}Object.assign(je,{Manager:Ne,Socket:Te,io:je,connect:je});const{toString:Pe}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:Ie,toStringTag:qe}=Symbol,Fe=(e=>t=>{const n=Pe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),De=e=>(e=e.toLowerCase(),t=>Fe(t)===e),Me=e=>t=>typeof t===e,{isArray:ze}=Array,He=Me("undefined");function We(e){return null!==e&&!He(e)&&null!==e.constructor&&!He(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ve=De("ArrayBuffer");const Ke=Me("string"),Je=Me("function"),$e=Me("number"),Ge=e=>null!==e&&"object"==typeof e,Ye=e=>{if("object"!==Fe(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||qe in e||Ie in e)},Qe=De("Date"),Xe=De("File"),Ze=De("Blob"),et=De("FileList"),tt=De("URLSearchParams"),[nt,rt,st,ot]=["ReadableStream","Request","Response","Headers"].map(De);function it(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),ze(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(We(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function at(e,t){if(We(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,lt=e=>!He(e)&&e!==ct;const ut=(ht="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>ht&&e instanceof ht);var ht;const dt=De("HTMLFormElement"),pt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ft=De("RegExp"),mt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};it(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const gt=De("AsyncFunction"),yt=(bt="function"==typeof setImmediate,wt=Je(ct.postMessage),bt?setImmediate:wt?(vt=`axios@${Math.random()}`,Et=[],ct.addEventListener("message",({source:e,data:t})=>{e===ct&&t===vt&&Et.length&&Et.shift()()},!1),e=>{Et.push(e),ct.postMessage(vt,"*")}):e=>setTimeout(e));var bt,wt,vt,Et;const _t="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ct):"undefined"!=typeof process&&process.nextTick||yt;var kt={isArray:ze,isArrayBuffer:Ve,isBuffer:We,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Je(e.append)&&("formdata"===(t=Fe(e))||"object"===t&&Je(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ve(e.buffer),t},isString:Ke,isNumber:$e,isBoolean:e=>!0===e||!1===e,isObject:Ge,isPlainObject:Ye,isEmptyObject:e=>{if(!Ge(e)||We(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:nt,isRequest:rt,isResponse:st,isHeaders:ot,isUndefined:He,isDate:Qe,isFile:Xe,isBlob:Ze,isRegExp:ft,isFunction:Je,isStream:e=>Ge(e)&&Je(e.pipe),isURLSearchParams:tt,isTypedArray:ut,isFileList:et,forEach:it,merge:function e(){const{caseless:t,skipUndefined:n}=lt(this)&&this||{},r={},s=(s,o)=>{const i=t&&at(r,o)||o;Ye(r[i])&&Ye(s)?r[i]=e(r[i],s):Ye(s)?r[i]=e({},s):ze(s)?r[i]=s.slice():n&&He(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&it(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(it(t,(t,r)=>{n&&Je(t)?e[r]=Le(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&Ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Fe,kindOfTest:De,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(ze(e))return e;let t=e.length;if(!$e(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ie]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:dt,hasOwnProperty:pt,hasOwnProp:pt,reduceDescriptors:mt,freezeMethods:e=>{mt(e,(t,n)=>{if(Je(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Je(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return ze(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:at,global:ct,isContextDefined:lt,isSpecCompliantForm:function(e){return!!(e&&Je(e.append)&&"FormData"===e[qe]&&e[Ie])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Ge(e)){if(t.indexOf(e)>=0)return;if(We(e))return e;if(!("toJSON"in e)){t[r]=e;const s=ze(e)?[]:{};return it(e,(e,t)=>{const o=n(e,r+1);!He(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:gt,isThenable:e=>e&&(Ge(e)||Je(e))&&Je(e.then)&&Je(e.catch),setImmediate:yt,asap:_t,isIterable:e=>null!=e&&Je(e[Ie])};function xt(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}kt.inherits(xt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:kt.toJSONObject(this.config),code:this.code,status:this.status}}});const Ot=xt.prototype,St={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{St[e]={value:e}}),Object.defineProperties(xt,St),Object.defineProperty(Ot,"isAxiosError",{value:!0}),xt.from=(e,t,n,r,s,o)=>{const i=Object.create(Ot);kt.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return xt.call(i,a,c,n,r,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function Rt(e){return kt.isPlainObject(e)||kt.isArray(e)}function At(e){return kt.endsWith(e,"[]")?e.slice(0,-2):e}function Tt(e,t,n){return e?e.concat(t).map(function(e,t){return e=At(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ct=kt.toFlatObject(kt,{},null,function(e){return/^is[A-Z]/.test(e)});function Nt(e,t,n){if(!kt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=kt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!kt.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&kt.isSpecCompliantForm(t);if(!kt.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(kt.isDate(e))return e.toISOString();if(kt.isBoolean(e))return e.toString();if(!a&&kt.isBlob(e))throw new xt("Blob is not supported. Use a Buffer instead.");return kt.isArrayBuffer(e)||kt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(kt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(kt.isArray(e)&&function(e){return kt.isArray(e)&&!e.some(Rt)}(e)||(kt.isFileList(e)||kt.endsWith(n,"[]"))&&(a=kt.toArray(e)))return n=At(n),a.forEach(function(e,r){!kt.isUndefined(e)&&null!==e&&t.append(!0===i?Tt([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!Rt(e)||(t.append(Tt(s,n,o),c(e)),!1)}const u=[],h=Object.assign(Ct,{defaultVisitor:l,convertValue:c,isVisitable:Rt});if(!kt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!kt.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),kt.forEach(n,function(n,o){!0===(!(kt.isUndefined(n)||null===n)&&s.call(t,n,kt.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Bt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function jt(e,t){this._pairs=[],e&&Nt(e,this,t)}const Lt=jt.prototype;function Pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ut(e,t,n){if(!t)return e;const r=n&&n.encode||Pt;kt.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):kt.isURLSearchParams(t)?t.toString():new jt(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Lt.append=function(e,t){this._pairs.push([e,t])},Lt.toString=function(e){const t=e?function(t){return e.call(this,t,Bt)}:Bt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class It{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){kt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var qt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ft={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:jt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Dt="undefined"!=typeof window&&"undefined"!=typeof document,Mt="object"==typeof navigator&&navigator||void 0,zt=Dt&&(!Mt||["ReactNative","NativeScript","NS"].indexOf(Mt.product)<0),Ht="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Wt=Dt&&window.location.href||"http://localhost";var Vt={...Object.freeze({__proto__:null,hasBrowserEnv:Dt,hasStandardBrowserEnv:zt,hasStandardBrowserWebWorkerEnv:Ht,navigator:Mt,origin:Wt}),...Ft};function Kt(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&kt.isArray(r)?r.length:o,a)return kt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&kt.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&kt.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(kt.isFormData(e)&&kt.isFunction(e.entries)){const n={};return kt.forEachEntry(e,(e,r)=>{t(function(e){return kt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Jt={transitional:qt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=kt.isObject(e);s&&kt.isHTMLForm(e)&&(e=new FormData(e));if(kt.isFormData(e))return r?JSON.stringify(Kt(e)):e;if(kt.isArrayBuffer(e)||kt.isBuffer(e)||kt.isStream(e)||kt.isFile(e)||kt.isBlob(e)||kt.isReadableStream(e))return e;if(kt.isArrayBufferView(e))return e.buffer;if(kt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Nt(e,new Vt.classes.URLSearchParams,{visitor:function(e,t,n,r){return Vt.isNode&&kt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=kt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Nt(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(kt.isString(e))try{return(t||JSON.parse)(e),kt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Jt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(kt.isResponse(e)||kt.isReadableStream(e))return e;if(e&&kt.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw xt.from(e,xt.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vt.classes.FormData,Blob:Vt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};kt.forEach(["delete","get","head","post","put","patch"],e=>{Jt.headers[e]={}});const $t=kt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Gt=Symbol("internals");function Yt(e){return e&&String(e).trim().toLowerCase()}function Qt(e){return!1===e||null==e?e:kt.isArray(e)?e.map(Qt):String(e)}function Xt(e,t,n,r,s){return kt.isFunction(r)?r.call(this,t,n):(s&&(t=n),kt.isString(t)?kt.isString(r)?-1!==t.indexOf(r):kt.isRegExp(r)?r.test(t):void 0:void 0)}let Zt=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Yt(t);if(!s)throw new Error("header name must be a non-empty string");const o=kt.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Qt(e))}const o=(e,t)=>kt.forEach(e,(e,n)=>s(e,n,t));if(kt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(kt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&$t[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(kt.isObject(e)&&kt.isIterable(e)){let n,r,s={};for(const t of e){if(!kt.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?kt.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=Yt(e)){const n=kt.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(kt.isFunction(t))return t.call(this,e,n);if(kt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Yt(e)){const n=kt.findKey(this,e);return!(!n||void 0===this[n]||t&&!Xt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Yt(e)){const s=kt.findKey(n,e);!s||t&&!Xt(0,n[s],s,t)||(delete n[s],r=!0)}}return kt.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Xt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return kt.forEach(this,(r,s)=>{const o=kt.findKey(n,s);if(o)return t[o]=Qt(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=Qt(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return kt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&kt.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Gt]=this[Gt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Yt(e);t[r]||(!function(e,t){const n=kt.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return kt.isArray(e)?e.forEach(r):r(e),this}};function en(e,t){const n=this||Jt,r=t||n,s=Zt.from(r.headers);let o=r.data;return kt.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function tn(e){return!(!e||!e.__CANCEL__)}function nn(e,t,n){xt.call(this,null==e?"canceled":e,xt.ERR_CANCELED,t,n),this.name="CanceledError"}function rn(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new xt("Request failed with status code "+n.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),kt.reduceDescriptors(Zt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),kt.freezeMethods(Zt),kt.inherits(nn,xt,{__CANCEL__:!0});const sn=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,h=0;for(;u!==o;)h+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},on=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},an=e=>(...t)=>kt.asap(()=>e(...t));var cn=Vt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Vt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Vt.origin),Vt.navigator&&/(msie|trident)/i.test(Vt.navigator.userAgent)):()=>!0,ln=Vt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];kt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),kt.isString(r)&&a.push(`path=${r}`),kt.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),kt.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function un(e,t,n){let r=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const hn=e=>e instanceof Zt?{...e}:e;function dn(e,t){t=t||{};const n={};function r(e,t,n,r){return kt.isPlainObject(e)&&kt.isPlainObject(t)?kt.merge.call({caseless:r},e,t):kt.isPlainObject(t)?kt.merge({},t):kt.isArray(t)?t.slice():t}function s(e,t,n,s){return kt.isUndefined(t)?kt.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!kt.isUndefined(t))return r(void 0,t)}function i(e,t){return kt.isUndefined(t)?kt.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(hn(e),hn(t),0,!0)};return kt.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);kt.isUndefined(i)&&o!==a||(n[r]=i)}),n}var pn=e=>{const t=dn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Zt.from(i),t.url=Ut(un(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),kt.isFormData(n))if(Vt.hasStandardBrowserEnv||Vt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(kt.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(Vt.hasStandardBrowserEnv&&(r&&kt.isFunction(r)&&(r=r(t)),r||!1!==r&&cn(t.url))){const e=s&&o&&ln.read(o);e&&i.set(s,e)}return t};var fn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=pn(e);let s=r.data;const o=Zt.from(r.headers).normalize();let i,a,c,l,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Zt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());rn(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new xt("Request aborted",xt.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new xt(t&&t.message?t.message:"Network Error",xt.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||qt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new xt(t,s.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&kt.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),kt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([c,u]=sn(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=sn(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new nn(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===Vt.protocols.indexOf(y)?n(new xt("Unsupported protocol "+y+":",xt.ERR_BAD_REQUEST,e)):m.send(s||null)})};const mn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof xt?t:new nn(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new xt(`timeout ${t} of ms exceeded`,xt.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>kt.asap(i),a}},gn=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},yn=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},bn=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of yn(e))yield*gn(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:wn}=kt,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(kt.global),{ReadableStream:En,TextEncoder:_n}=kt.global,kn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xn=e=>{e=kt.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:n,Response:r}=e,s=t?wn(t):"function"==typeof fetch,o=wn(n),i=wn(r);if(!s)return!1;const a=s&&wn(En),c=s&&("function"==typeof _n?(l=new _n,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&kn(()=>{let e=!1;const t=new n(Vt.origin,{body:new En,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=i&&a&&kn(()=>kt.isReadableStream(new r("").body)),d={stream:h&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new xt(`Response type '${e}' is not supported`,xt.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=kt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(kt.isBlob(e))return e.size;if(kt.isSpecCompliantForm(e)){const t=new n(Vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return kt.isArrayBufferView(e)||kt.isArrayBuffer(e)?e.byteLength:(kt.isURLSearchParams(e)&&(e+=""),kt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:v}=pn(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let _=mn([c,l&&l.toAbortSignal()],f),k=null;const x=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let O;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(O=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(kt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=on(O,sn(an(g)));a=bn(t.body,65536,e,n)}}kt.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...v,signal:_,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};k=o&&new n(s,c);let l=await(o?E(k,v):E(s,c));const f=h&&("stream"===y||"response"===y);if(h&&(m||f&&x)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=kt.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&on(t,sn(an(m),!0))||[];l=new r(bn(l.body,65536,n,()=>{s&&s(),x&&x()}),e)}y=y||"text";let S=await d[kt.findKey(d,y)||"text"](l,e);return!f&&x&&x(),await new Promise((t,n)=>{rn(t,n,{data:S,headers:Zt.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(x&&x(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new xt("Network Error",xt.ERR_NETWORK,e,k),{cause:t.cause||t});throw xt.from(t,t&&t.code,e,k)}}},On=new Map,Sn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=On;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:xn(t)),l=a;return a};Sn();const Rn={http:null,xhr:fn,fetch:{get:Sn}};kt.forEach(Rn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const An=e=>`- ${e}`,Tn=e=>kt.isFunction(e)||null===e||!1===e;var Cn={getAdapter:function(e,t){e=kt.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!Tn(r)&&(s=Rn[(n=String(r)).toLowerCase()],void 0===s))throw new xt(`Unknown adapter '${n}'`);if(s&&(kt.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new xt("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(An).join("\n"):" "+An(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:Rn};function Nn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nn(null,e)}function Bn(e){Nn(e),e.headers=Zt.from(e.headers),e.data=en.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Cn.getAdapter(e.adapter||Jt.adapter,e)(e).then(function(t){return Nn(e),t.data=en.call(e,e.transformResponse,t),t.headers=Zt.from(t.headers),t},function(t){return tn(t)||(Nn(e),t&&t.response&&(t.response.data=en.call(e,e.transformResponse,t.response),t.response.headers=Zt.from(t.response.headers))),Promise.reject(t)})}const jn="1.13.2",Ln={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ln[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Pn={};Ln.transitional=function(e,t,n){function r(e,t){return"[Axios v"+jn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new xt(r(s," has been removed"+(t?" in "+t:"")),xt.ERR_DEPRECATED);return t&&!Pn[s]&&(Pn[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},Ln.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var Un={assertOptions:function(e,t,n){if("object"!=typeof e)throw new xt("options must be an object",xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new xt("option "+o+" must be "+n,xt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new xt("Unknown option "+o,xt.ERR_BAD_OPTION)}},validators:Ln};const In=Un.validators;let qn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new It,response:new It}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=dn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&Un.assertOptions(n,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),null!=r&&(kt.isFunction(r)?t.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:In.function,serialize:In.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Un.assertOptions(t,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&kt.merge(s.common,s[t.method]);s&&kt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Zt.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,h=0;if(!a){const e=[Bn.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);h<u;)l=l.then(e[h++],e[h++]);return l}u=i.length;let d=t;for(;h<u;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Bn.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(e){return Ut(un((e=dn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};kt.forEach(["delete","get","head","options"],function(e){qn.prototype[e]=function(t,n){return this.request(dn(n||{},{method:e,url:t,data:(n||{}).data}))}}),kt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(dn(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}qn.prototype[e]=t(),qn.prototype[e+"Form"]=t(!0)});const Fn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Fn).forEach(([e,t])=>{Fn[t]=e});const Dn=function e(t){const n=new qn(t),r=Le(qn.prototype.request,n);return kt.extend(r,qn.prototype,n,{allOwnKeys:!0}),kt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(dn(t,n))},r}(Jt);Dn.Axios=qn,Dn.CanceledError=nn,Dn.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new nn(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Dn.isCancel=tn,Dn.VERSION=jn,Dn.toFormData=Nt,Dn.AxiosError=xt,Dn.Cancel=Dn.CanceledError,Dn.all=function(e){return Promise.all(e)},Dn.spread=function(e){return function(t){return e.apply(null,t)}},Dn.isAxiosError=function(e){return kt.isObject(e)&&!0===e.isAxiosError},Dn.mergeConfig=dn,Dn.AxiosHeaders=Zt,Dn.formToJSON=e=>Kt(kt.isHTMLForm(e)?new FormData(e):e),Dn.getAdapter=Cn.getAdapter,Dn.HttpStatusCode=Fn,Dn.default=Dn;const{Axios:Mn,AxiosError:zn,CanceledError:Hn,isCancel:Wn,CancelToken:Vn,VERSION:Kn,all:Jn,Cancel:$n,isAxiosError:Gn,spread:Yn,toFormData:Qn,AxiosHeaders:Xn,HttpStatusCode:Zn,formToJSON:er,getAdapter:tr,mergeConfig:nr}=Dn;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".crm-widget-container{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.crm-chat-button{align-items:center;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(0,0,0,.2);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .2s;width:64px}.crm-chat-button:hover{transform:scale(1.1)}.crm-icon{height:32px;width:32px}.crm-icon-sm{height:24px;width:24px}.crm-spin{animation:crm-spin 1s linear infinite}@keyframes crm-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.crm-badge{align-items:center;background-color:#ef4444;border-radius:50%;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;position:absolute;right:-4px;top:-4px;width:20px}.crm-bottom-6{bottom:24px}.crm-right-6{right:24px}.crm-left-6{left:24px}.crm-top-6{top:24px}.crm-chat-window{background:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:0 20px 50px rgba(0,0,0,.3);display:flex;flex-direction:column;height:600px;max-width:448px;overflow:hidden;position:fixed;width:100%}.crm-chat-window.crm-dark{background:#1f2937;border-color:#374151}.crm-chat-window.crm-bottom-6{bottom:100px}.crm-chat-window.crm-right-6{right:24px}.crm-chat-window.crm-left-6{left:24px}.crm-chat-window.crm-top-6{top:100px}@media (max-width:640px){.crm-chat-window{border-radius:0;bottom:0!important;height:100vh;left:0!important;max-width:100%;right:0!important;top:0!important}}.crm-header{align-items:center;color:#fff;display:flex;justify-content:space-between;padding:16px 24px}.crm-header-content{align-items:center;display:flex;gap:12px}.crm-avatar{align-items:center;background:#fff;border-radius:50%;display:flex;font-size:20px;height:40px;justify-content:center;width:40px}.crm-title{font-size:18px;font-weight:600;margin:0}.crm-status{align-items:center;display:flex;font-size:14px;gap:8px;opacity:.9}.crm-status-dot{border-radius:50%;height:8px;width:8px}.crm-status-dot.crm-online{background-color:#10b981}.crm-status-dot.crm-offline{background-color:#ef4444}.crm-close-btn{background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;padding:8px;transition:background .2s}.crm-close-btn:hover{background:hsla(0,0%,100%,.3)}.crm-new-query-btn{align-items:center;background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;justify-content:center;padding:8px;transition:all .2s}.crm-new-query-btn:hover{background:hsla(0,0%,100%,.3);transform:scale(1.05)}.crm-messages{background:#f9fafb;display:flex;flex:1;flex-direction:column;gap:16px;overflow-y:auto;padding:16px}.crm-dark .crm-messages{background:#111827}.crm-welcome-message{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);padding:16px}.crm-dark .crm-welcome-message{background:#1f2937;border-color:#374151;color:#d1d5db}.crm-welcome-message p{color:#374151;font-size:14px;margin:0}.crm-dark .crm-welcome-message p{color:#d1d5db}.crm-message{display:flex}.crm-message-guest{justify-content:flex-end}.crm-message-agent{justify-content:flex-start}.crm-message-system{justify-content:center}.crm-message-bubble{border-radius:16px;box-shadow:0 1px 2px rgba(0,0,0,.1);max-width:75%;padding:10px 16px}.crm-message-guest .crm-message-bubble{border-bottom-right-radius:4px;color:#fff}.crm-message-agent .crm-message-bubble{background:#fff;border:1px solid #e5e7eb;border-bottom-left-radius:4px;color:#1f2937}.crm-dark .crm-message-agent .crm-message-bubble{background:#1f2937;border-color:#374151;color:#f3f4f6}.crm-agent-name{font-size:12px;font-weight:500;margin:0 0 4px;opacity:.7}.crm-message-text{font-size:14px;line-height:1.5;margin:0;white-space:pre-wrap;word-break:break-word}.crm-message-time{font-size:11px;margin:4px 0 0;opacity:.7}.crm-typing-indicator{display:flex;gap:4px;padding:4px 0}.crm-typing-dot{animation:typing 1.4s infinite;background:#9ca3af;border-radius:50%;height:8px;width:8px}.crm-typing-dot:nth-child(2){animation-delay:.2s}.crm-typing-dot:nth-child(3){animation-delay:.4s}@keyframes typing{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-10px)}}.crm-input-container{background:#fff;border-top:1px solid #e5e7eb;padding:16px}.crm-dark .crm-input-container{background:#1f2937;border-color:#374151}.crm-input-wrapper{align-items:flex-end;display:flex;gap:8px}.crm-input{background:#f9fafb;border:1px solid #d1d5db;border-radius:12px;color:#1f2937;flex:1;font-family:inherit;font-size:14px;max-height:120px;min-height:48px;padding:12px 16px;resize:none}.crm-input:focus{border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.1);outline:none}.crm-input:disabled{cursor:not-allowed;opacity:.5}.crm-dark .crm-input{background:#111827;border-color:#4b5563;color:#f3f4f6}.crm-dark .crm-input::placeholder{color:#6b7280}.crm-send-btn{align-items:center;border:none;border-radius:12px;color:#fff;cursor:pointer;display:flex;flex-shrink:0;justify-content:center;padding:12px;transition:all .2s}.crm-send-btn:hover:not(:disabled){box-shadow:0 4px 12px rgba(0,0,0,.2)}.crm-send-btn:disabled{cursor:not-allowed;opacity:.5}.crm-input-hint{color:#9ca3af;font-size:11px;margin:8px 0 0;text-align:center}.crm-dark .crm-input-hint{color:#6b7280}.crm-messages::-webkit-scrollbar{width:6px}.crm-messages::-webkit-scrollbar-track{background:transparent}.crm-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.crm-dark .crm-messages::-webkit-scrollbar-thumb{background:#4b5563}.crm-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}");var rr=function(s){var o=s.apiKey,c=s.apiUrl,h=void 0===c?"https://chat-crm-backend-7mzo.onrender.com":c,d=s.primaryColor,p=void 0===d?"#4F46E5":d,f=s.position,m=void 0===f?"bottom-right":f,g=s.userData,y=void 0===g?null:g,b=s.welcomeMessage,w=void 0===b?"👋 Welcome! How can we help you today?":b,v=s.companyName,E=void 0===v?"Support":v,_=s.autoOpen,k=void 0!==_&&_,x=s.showNotifications,O=void 0===x||x,S=s.playSound,R=void 0!==S&&S,A=s.theme,T=void 0===A?"light":A,C=s.zIndex,N=void 0===C?9999:C,B=l(t(k),2),j=B[0],L=B[1],P=l(t([]),2),U=P[0],I=P[1],q=l(t(""),2),F=q[0],D=q[1],M=l(t(null),2),z=M[0],H=M[1],W=l(t(null),2);W[0];var V=W[1],K=l(t(null),2),J=K[0],$=K[1],G=l(t(!1),2),Y=G[0],Q=G[1],X=l(t(!1),2),Z=X[0],ee=X[1],te=l(t(!1),2),ne=te[0],re=te[1],se=l(t(!1),2),oe=se[0],ie=se[1],ae=l(t("Support Agent"),2),ce=ae[0],le=ae[1],ue=l(t(0),2),he=ue[0],de=ue[1],pe=l(t(!1),2),fe=pe[0],me=pe[1],ge=l(t("active"),2),ye=ge[0],be=ge[1],we=l(t(null),2),ve=we[0],Ee=we[1],_e=l(t(!1),2),ke=_e[0],xe=_e[1],Oe=n(!1),Se=n(null),Re=n(null),Ae=n(null);r(function(){var e=function(e){if(j){var t=Re.current,n=Ae.current;t&&!t.contains(e.target)&&n&&!n.contains(e.target)&&L(!1)}};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[j]);r(function(){var e;null===(e=Se.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[U]),r(function(){return function(){z&&z.disconnect()}},[z]);var Te=function(){return y?{name:y.name||"Guest User",email:y.email||null,phone:y.phone||null,userId:y.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},Ce=function(){var e=i(a().m(function e(){var t,n,r,s,i,c,l;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=Te(),ee(!0),e.p=1,console.log("🚀 Creating new conversation for first message..."),e.n=2,Dn.post("".concat(h,"/api/v1/webhook/guest-conversation"),{apiKey:o,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(n=e.v).data.success){e.n=3;break}return r=n.data,s=r.conversationId,i=r.petitionId,c=r.queryId,V(c),$(s),me(!0),localStorage.setItem("chatGuestId",c),localStorage.setItem("chatConversationId",s),localStorage.setItem("chatPetitionId",i),console.log("✅ Conversation created:",{petitionId:i,queryId:c}),e.a(2,{newConvId:s,petitionId:i});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,l=e.v,console.error("❌ Create conversation error:",l),l;case 5:return e.p=5,ee(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),Ne=function(){var e=i(a().m(function e(t){var n,r;return a().w(function(e){for(;;)if(0===e.n)return n=t.convId,r=t.petitionId,re(!0),e.a(2,new Promise(function(e,t){try{var s=je("".concat(h,"/widget"),{query:{conversationId:n,petitionId:r,apiKey:o},transports:["websocket","polling"]});s.on("connect",function(){Q(!0),re(!1),console.log("✅ Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){re(!1),console.error("❌ Socket connect_error:",(null==e?void 0:e.message)||e)}),s.on("error",function(e){console.error("❌ Socket error:",e)}),s.on("disconnect",function(){Q(!1),console.log("❌ Disconnected from Chat CRM")}),s.on("new-message",function(e){console.log("📨 Received new-message:",e);var t={message:e.message||e.text||"",sender:e.sender||"agent",senderName:e.senderName||"Agent",timestamp:e.timestamp||new Date,read:!1};I(function(e){return[].concat(u(e),[t])}),le(e.senderName||"Support Agent"),ie(!1),!j&&O&&(de(function(e){return e+1}),R&&Le())}),s.on("query-accepted",function(e){console.log("✅ Query accepted by agent:",e),le(e.agentName||"Support Agent"),be("active"),I(function(t){return[].concat(u(t),[{message:e.message||"".concat(e.agentName," has accepted your query"),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-transferred",function(e){console.log("🔄 Query transferred:",e),le(e.toAgentName||"Support Agent"),I(function(t){return[].concat(u(t),[{message:e.message||"Your query has been transferred to ".concat(e.toAgentName),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-resolved",function(e){console.log("✅ Query resolved:",e),be("resolved"),Oe.current?console.log("🔁 Skipping duplicate resolved system message"):(Oe.current=!0,I(function(e){return[].concat(u(e),[{message:'✅ This query has been resolved by the agent. Click "New Query" to start a new conversation.',sender:"system",timestamp:new Date,read:!0}])}))}),s.on("request-camera-snapshot",function(e){try{var t,n=localStorage.getItem("chatPetitionId");if(null!=e&&e.petitionId&&n&&e.petitionId===n)Ee({requesterName:e.requesterName||(null===(t=e.requester)||void 0===t?void 0:t.name)||"Agent",at:Date.now()})}catch(e){}}),s.on("query-reopened",function(e){console.log("🔄 Query reopened:",e),be("active"),Oe.current=!1}),s.on("agent-typing",function(e){ie(!0),le(e.agentName||"Support Agent"),setTimeout(function(){return ie(!1)},3e3)}),H(s)}catch(e){re(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),Be=function(){var e=i(a().m(function e(){var t,n,r,s,o,i,c,l,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(F.trim()&&"resolved"!==ye){e.n=1;break}return e.a(2);case 1:if(t=Te(),n=F.trim(),r=Date.now(),I(function(e){return[].concat(u(e),[{message:n,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:r}])}),D(""),e.p=2,s=localStorage.getItem("chatPetitionId"),o=J||localStorage.getItem("chatConversationId"),s&&o){e.n=4;break}return e.n=3,Ce();case 3:i=e.v,o=i.newConvId,s=i.petitionId;case 4:if((c=z)&&Y){e.n=6;break}try{z&&z.disconnect()}catch(e){}return e.n=5,Ne({convId:o,petitionId:s});case 5:c=e.v;case 6:l={conversationId:o,petitionId:s,message:n,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("📤 Sending message:",l),c.emit("widget-message",l),e.n=8;break;case 7:e.p=7,h=e.v,console.error("❌ Send message error:",h),I(function(e){return e.filter(function(e){return e.tempId!==r})}),alert("Failed to send message. Please try again.");case 8:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),Le=function(){var e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.value=800,t.type="sine",n.gain.value=.1,t.start(),setTimeout(function(){return t.stop()},200)},Pe=function(){var e=i(a().m(function e(){var t,n,r,s,i,c,l,d,p,f,m,g,y,b;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(ve){e.n=1;break}return e.a(2);case 1:return xe(!0),e.p=2,e.n=3,navigator.mediaDevices.getUserMedia({video:!0});case 3:return n=e.v,(r=document.createElement("video")).srcObject=n,e.n=4,new Promise(function(e){r.onloadedmetadata=e,r.play().then(e).catch(e)});case 4:return s=document.createElement("canvas"),i=r.videoWidth||640,c=r.videoHeight||480,s.width=i,s.height=c,s.getContext("2d").drawImage(r,0,0,i,c),n.getTracks().forEach(function(e){return e.stop()}),e.n=5,new Promise(function(e){return s.toBlob(e,"image/png")});case 5:if(l=e.v){e.n=6;break}throw new Error("Failed to capture");case 6:return d=localStorage.getItem("chatPetitionId"),J||localStorage.getItem("chatConversationId"),p=new FormData,f="snapshot-".concat(d,"-").concat(Date.now(),".png"),p.append("screenshot",l,f),p.append("petitionId",d),p.append("apiKey",o),p.append("metadata",JSON.stringify({source:"widget",requesterName:null==ve?void 0:ve.requesterName})),e.n=7,Dn.post("".concat(h,"/api/v1/webhook/upload-snapshot"),p,{headers:{"Content-Type":"multipart/form-data"}});case 7:if(m=e.v,!(g=null==m||null===(t=m.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.imageUrl)){e.n=8;break}return y=new Date,I(function(e){return[].concat(u(e),[{message:"📸 Screenshot: ".concat(g),sender:"guest",senderName:"You",timestamp:y,read:!0}])}),e.n=8,Dn.post("".concat(h,"/api/v1/webhook/send-message"),{apiKey:o,petitionId:d,message:"📸 Screenshot: ".concat(g),senderName:"Guest User"});case 8:e.n=10;break;case 9:e.p=9,b=e.v,console.error("Widget capture error:",b),alert("Camera permission denied or capture failed.");case 10:return e.p=10,xe(!1),Ee(null),e.f(10);case 11:return e.a(2)}},e,null,[[2,9,10,11]])}));return function(){return e.apply(this,arguments)}}(),Ue=function(){var e={"bottom-right":"crm-bottom-6 crm-right-6","bottom-left":"crm-bottom-6 crm-left-6","top-right":"crm-top-6 crm-right-6","top-left":"crm-top-6 crm-left-6"};return e[m]||e["bottom-right"]},Ie="dark"===T||"auto"===T&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:N}},e.createElement("button",{ref:Ae,onClick:function(){L(function(e){var t=!e;return t&&de(0),t})},className:"crm-chat-button ".concat(Ue()),style:{backgroundColor:p},"aria-label":j?"Close chat":"Open chat"},j?e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})):e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})),!j&&he>0&&e.createElement("span",{className:"crm-badge"},he)),j&&e.createElement("div",{ref:Re,className:"crm-chat-window ".concat(Ue()," ").concat(Ie?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:p}},e.createElement("div",{className:"crm-header-content"},e.createElement("div",{className:"crm-avatar"},"💬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},E),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(Y?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===ye?e.createElement("span",{style:{color:"#10B981"}},"✓ Resolved"):"Support Agent"!==ce?e.createElement("span",null,"💬 ",ce):Y?"Online":ne?"Connecting…":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),z&&z.disconnect(),H(null),V(null),$(null),Q(!1),me(!1),be("active"),Oe.current=!1,I([]),D(""),console.log("🆕 Starting new query...")},className:"crm-new-query-btn",title:"Start New Query"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"}))),e.createElement("button",{onClick:function(){return L(!1)},className:"crm-close-btn"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),e.createElement("div",{className:"crm-messages"},!fe&&0===U.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,w),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"👋 Start typing to begin your conversation")),U.map(function(t,n){return e.createElement("div",{key:n,className:"crm-message ".concat("guest"===t.sender?"crm-message-guest":"system"===t.sender?"crm-message-system":"crm-message-agent")},e.createElement("div",{className:"crm-message-bubble",style:"guest"===t.sender?{backgroundColor:p}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||ce),function(){var n=String(t.message||""),r=n.match(/https?:[^\s]+\.(?:png|jpg|jpeg|gif|webp)/i);if(r){var s=r[0],o=n.replace(s,"").trim();return e.createElement("div",null,o&&e.createElement("p",{className:"crm-message-text",style:{opacity:.85}},o),e.createElement("img",{src:s,alt:"snapshot",style:{maxWidth:"240px",maxHeight:"180px",borderRadius:"8px",border:"1px solid #E5E7EB",display:"block"}}))}return e.createElement("p",{className:"crm-message-text"},n)}(),e.createElement("p",{className:"crm-message-time"},(r=t.timestamp,new Date(r).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})))));var r}),oe&&e.createElement("div",{className:"crm-message crm-message-agent"},e.createElement("div",{className:"crm-message-bubble"},e.createElement("div",{className:"crm-typing-indicator"},e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"})))),e.createElement("div",{ref:Se})),ve&&e.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4}},e.createElement("div",{style:{background:Ie?"#1F2937":"#fff",color:Ie?"#E5E7EB":"#111827",border:Ie?"1px solid #374151":"1px solid #E5E7EB",borderRadius:12,width:360,maxWidth:"100%"}},e.createElement("div",{style:{padding:16}},e.createElement("h3",{style:{margin:0,fontSize:18,fontWeight:600}},"Camera access requested"),e.createElement("p",{style:{marginTop:8,fontSize:14,opacity:.9}},(null==ve?void 0:ve.requesterName)||"Agent"," is requesting a photo from your camera. Do you allow?")),e.createElement("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",borderTop:Ie?"1px solid #374151":"1px solid #E5E7EB",padding:12}},e.createElement("button",{onClick:function(){return Ee(null)},className:"crm-close-btn"},"Cancel"),e.createElement("button",{onClick:Pe,className:"crm-send-btn",style:{backgroundColor:p},disabled:ke},ke?"Capturing…":"Allow & Capture")))),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:F,onChange:function(e){return D(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Be())},placeholder:"resolved"===ye?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===ye}),e.createElement("button",{onClick:Be,disabled:!F.trim()||Z||"resolved"===ye,className:"crm-send-btn",style:{backgroundColor:p}},Z?e.createElement("svg",{className:"crm-icon-sm crm-spin",fill:"none",viewBox:"0 0 24 24"},e.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})):e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})))),e.createElement("p",{className:"crm-input-hint"},fe?"Press Enter to send • Shift+Enter for new line":"Send your first message to start conversation"))))};export{rr as ChatCRMWidget};
3
+ var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function s(r,n,o,s){var c=n&&n.prototype instanceof a?n:a,l=Object.create(c.prototype);return d(l,"_invoke",function(r,n,o){var s,a,c,l=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,r){return s=t,a=0,c=e,p.n=r,i}};function h(r,n){for(a=r,c=n,t=0;!d&&l&&!o&&t<u.length;t++){var o,s=u[t],h=p.p,f=s[2];r>3?(o=f===n)&&(c=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=e):s[0]<=h&&((o=r<2&&h<s[1])?(a=0,p.v=n,p.n=s[1]):h<f&&(o=r<3||s[0]>n||n>f)&&(s[4]=r,s[5]=n,p.n=f,a=0))}if(o||r>1)return i;throw d=!0,n}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&h(u,f),a=u,c=f;(t=a<2?e:c)||!d;){s||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(l=2,s){if(a||(o="next"),t=s[o]){if(!(t=t.call(s,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=s.return)&&t.call(s),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);s=e}else if((t=(d=p.n<0)?c:r.call(n,p))!==i)break}catch(t){s=e,a=1,c=t}finally{l=1}}return{value:t,done:d}}}(r,o,s),!0),l}var i={};function a(){}function c(){}function l(){}t=Object.getPrototypeOf;var p=[][n]?t(t([][n]())):(d(t={},n,function(){return this}),t),h=l.prototype=a.prototype=Object.create(p);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,d(e,o,"GeneratorFunction")),e.prototype=Object.create(h),e}return c.prototype=l,d(h,"constructor",l),d(l,"constructor",c),c.displayName="GeneratorFunction",d(l,o,"GeneratorFunction"),d(h),d(h,o,"Generator"),d(h,n,function(){return this}),d(h,"toString",function(){return"[object Generator]"}),(u=function(){return{w:s,m:f}})()}function d(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}d=function(e,t,r,n){function s(t,r){d(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(s("next",0),s("throw",1),s("return",2))},d(e,t,r,n)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,s,i,a=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,0===t);else for(;!(c=(n=s.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return a}}(e,t)||f(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}const m=Object.create(null);m.open="0",m.close="1",m.ping="2",m.pong="3",m.message="4",m.upgrade="5",m.noop="6";const g=Object.create(null);Object.keys(m).forEach(e=>{g[m[e]]=e});const y={type:"error",data:"parser error"},b="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),v="function"==typeof ArrayBuffer,w=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,x=({type:e,data:t},r,n)=>b&&t instanceof Blob?r?n(t):E(t,n):v&&(t instanceof ArrayBuffer||w(t))?r?n(t):E(new Blob([t]),n):n(m[e]+(t||"")),E=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function k(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let _;const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)C[S.charCodeAt(e)]=e;const A="function"==typeof ArrayBuffer,O=(e,t)=>{if("string"!=typeof e)return{type:"message",data:T(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:R(e.substring(1),t)};return g[r]?e.length>1?{type:g[r],data:e.substring(1)}:{type:g[r]}:y},R=(e,t)=>{if(A){const r=(e=>{let t,r,n,o,s,i=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const l=new ArrayBuffer(i),u=new Uint8Array(l);for(t=0;t<a;t+=4)r=C[e.charCodeAt(t)],n=C[e.charCodeAt(t+1)],o=C[e.charCodeAt(t+2)],s=C[e.charCodeAt(t+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|o>>2,u[c++]=(3&o)<<6|63&s;return l})(e);return T(r,t)}return{base64:!0,data:e}},T=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,N=String.fromCharCode(30);function B(){return new TransformStream({transform(e,t){!function(e,t){b&&e.data instanceof Blob?e.data.arrayBuffer().then(k).then(t):v&&(e.data instanceof ArrayBuffer||w(e.data))?t(k(e.data)):x(e,!1,e=>{_||(_=new TextEncoder),t(_.encode(e))})}(e,r=>{const n=r.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(r)})}})}let F;function j(e){return e.reduce((e,t)=>e+t.length,0)}function L(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let o=0;o<t;o++)r[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)),r}function P(e){if(e)return function(e){for(var t in P.prototype)e[t]=P.prototype[t];return e}(e)}P.prototype.on=P.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},P.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},P.prototype.off=P.prototype.removeListener=P.prototype.removeAllListeners=P.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,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((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},P.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},P.prototype.emitReserved=P.prototype.emit,P.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},P.prototype.hasListeners=function(e){return!!this.listeners(e).length};const I="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),D="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function U(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})}const q=D.setTimeout,M=D.clearTimeout;function z(e,t){t.useNativeTimers?(e.setTimeoutFn=q.bind(D),e.clearTimeoutFn=M.bind(D)):(e.setTimeoutFn=D.setTimeout.bind(D),e.clearTimeoutFn=D.clearTimeout.bind(D))}function W(e){return"string"==typeof e?function(e){let t=0,r=0;for(let n=0,o=e.length;n<o;n++)t=e.charCodeAt(n),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(n++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class V extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class K extends P{constructor(e){super(),this.writable=!1,z(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new V(e,t,r)),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=O(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 r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}class J extends K{constructor(){super(...arguments),this._polling=!1}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 r=e.split(N),n=[];for(let e=0;e<r.length;e++){const o=O(r[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 r=e.length,n=new Array(r);let o=0;e.forEach((e,s)=>{x(e,!1,e=>{n[s]=e,++o===r&&t(n.join(N))})})})(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]=H()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let $=!1;try{$="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const G=$;function Y(){}class Q extends J{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.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}}class X extends P{constructor(e,t,r){super(),this.createRequest=e,z(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;const t=U(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(t);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=X.requestsCount++,X.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=Y,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete X.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()}}if(X.requestsCount=0,X.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Z);else if("function"==typeof addEventListener){addEventListener("onpagehide"in D?"pagehide":"unload",Z,!1)}function Z(){for(let e in X.requests)X.requests.hasOwnProperty(e)&&X.requests[e].abort()}const ee=function(){const e=te({xdomain:!1});return e&&null!==e.responseType}();function te(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||G))return new XMLHttpRequest}catch(e){}if(!t)try{return new(D[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const re="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ne extends K{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=re?{}:U(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}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 r=e[t],n=t===e.length-1;x(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}n&&I(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},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]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const oe=D.WebSocket||D.MozWebSocket;const se={websocket:class extends ne{createSocket(e,t,r){return re?new oe(e,t,r):t?new oe(e,t):new oe(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends K{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}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){F||(F=new TextDecoder);const r=[];let n=0,o=-1,s=!1;return new TransformStream({transform(i,a){for(r.push(i);;){if(0===n){if(j(r)<1)break;const e=L(r,1);s=!(128&~e[0]),o=127&e[0],n=o<126?3:126===o?1:2}else if(1===n){if(j(r)<2)break;const e=L(r,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(j(r)<8)break;const e=L(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(y);break}o=s*Math.pow(2,32)+t.getUint32(4),n=3}else{if(j(r)<o)break;const e=L(r,o);a.enqueue(O(s?e:F.decode(e),t)),n=0}if(0===o||o>e){a.enqueue(y);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=B();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();const o=()=>{r.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],n=t===e.length-1;this._writer.write(r).then(()=>{n&&I(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Q{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ee&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new X(te,this.uri(),e)}}},ie=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ae=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ce(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");-1!=r&&-1!=n&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let o=ie.exec(e||""),s={},i=14;for(;i--;)s[ae[i]]=o[i]||"";return-1!=r&&-1!=n&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const r=/\/{2,9}/g,n=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1);"/"==t.slice(-1)&&n.splice(n.length-1,1);return n}(0,s.path),s.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,n){t&&(r[t]=n)}),r}(0,s.query),s}const le="function"==typeof addEventListener&&"function"==typeof removeEventListener,ue=[];le&&addEventListener("offline",()=>{ue.forEach(e=>e())},!1);class de extends P{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const r=ce(e);t.hostname=r.host,t.secure="https"===r.protocol||"wss"===r.protocol,t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=ce(t.host).host);z(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=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),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={},r=e.split("&");for(let e=0,n=r.length;e<n;e++){let n=r[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}(this.opts.query)),le&&(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"})},ue.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&de.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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))}onOpen(){this.readyState="open",de.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();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._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 t=0;t<this.writeBuffer.length;t++){const r=this.writeBuffer[t].data;if(r&&(e+=W(r)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,I(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const o={type:e,data:t,options:r};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()},r=()=>{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?r():e()}):this.upgrading?r():e()),this}_onError(e){if(de.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),le&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ue.indexOf(this._offlineEventListener);-1!==e&&ue.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}de.protocol=4;class pe extends de{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;de.priorWebsocketSuccess=!1;const n=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;de.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(l(),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(){r||(r=!0,l(),t.close(),t=null)}const s=e=>{const r=new Error("probe error: "+e);r.transport=t.name,o(),this.emitReserved("upgradeError",r)};function i(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&o()}const l=()=>{t.removeListener("open",n),t.removeListener("error",s),t.removeListener("close",i),this.off("close",a),this.off("upgrading",c)};t.once("open",n),t.once("error",s),t.once("close",i),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}let he=class extends pe{constructor(e,t={}){const r="object"==typeof e?e:t;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>se[e]).filter(e=>!!e)),super(e,r)}};const fe="function"==typeof ArrayBuffer,me=Object.prototype.toString,ge="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===me.call(Blob),ye="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===me.call(File);function be(e){return fe&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||ge&&e instanceof Blob||ye&&e instanceof File}function ve(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t<r;t++)if(ve(e[t]))return!0;return!1}if(be(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return ve(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ve(e[t]))return!0;return!1}function we(e){const t=[],r=e.data,n=e;return n.data=xe(r,t),n.attachments=t.length,{packet:n,buffers:t}}function xe(e,t){if(!e)return e;if(be(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}if(Array.isArray(e)){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=xe(e[n],t);return r}if("object"==typeof e&&!(e instanceof Date)){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=xe(e[n],t));return r}return e}function Ee(e,t){return e.data=ke(e.data,t),delete e.attachments,e}function ke(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 r=0;r<e.length;r++)e[r]=ke(e[r],t);else if("object"==typeof e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=ke(e[r],t));return e}const _e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Se;!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"}(Se||(Se={}));function Ce(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ae extends P{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 r=t.type===Se.BINARY_EVENT;r||t.type===Se.BINARY_ACK?(t.type=r?Se.EVENT:Se.ACK,this.reconstructor=new Oe(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!be(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 r={type:Number(e.charAt(0))};if(void 0===Se[r.type])throw new Error("unknown packet type "+r.type);if(r.type===Se.BINARY_EVENT||r.type===Se.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");r.attachments=Number(o)}if("/"===e.charAt(t+1)){const n=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}r.nsp=e.substring(n,t)}else r.nsp="/";const n=e.charAt(t+1);if(""!==n&&Number(n)==n){const n=t+1;for(;++t;){const r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(!Ae.isPayloadValid(r.type,n))throw new Error("invalid payload");r.data=n}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Se.CONNECT:return Ce(t);case Se.DISCONNECT:return void 0===t;case Se.CONNECT_ERROR:return"string"==typeof t||Ce(t);case Se.EVENT:case Se.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===_e.indexOf(t[0]));case Se.ACK:case Se.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Oe{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=Ee(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Re=Object.freeze({__proto__:null,Decoder:Ae,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Se.EVENT&&e.type!==Se.ACK||!ve(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Se.EVENT?Se.BINARY_EVENT:Se.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Se.BINARY_EVENT&&e.type!==Se.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=we(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}},get PacketType(){return Se},protocol:5});function Te(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const Ne=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Be extends P{constructor(e,t,r){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,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),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){var r,n,o;if(Ne.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:Se.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),s.id=e}const i=null===(n=null===(r=this.io.engine)||void 0===r?void 0:r.transport)||void 0===n?void 0:n.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var r;const n=null!==(r=this.flags.timeout)&&void 0!==r?r: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),s=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((r,n)=>{const o=(e,t)=>e?n(e):r(t);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...n)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue()}),this._queue.push(r),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:Se.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),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Se.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 Se.EVENT:case Se.BINARY_EVENT:this.onevent(e);break;case Se.ACK:case Se.BINARY_ACK:this.onack(e);break;case Se.DISCONNECT:this.ondisconnect();break;case Se.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 r of t)r.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 r=!1;return function(...n){r||(r=!0,t.packet({type:Se.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}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:Se.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 r=0;r<t.length;r++)if(e===t[r])return t.splice(r,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 r=0;r<t.length;r++)if(e===t[r])return t.splice(r,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 r of t)r.apply(this,e.data)}}}function Fe(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}Fe.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},Fe.prototype.reset=function(){this.attempts=0},Fe.prototype.setMin=function(e){this.ms=e},Fe.prototype.setMax=function(e){this.max=e},Fe.prototype.setJitter=function(e){this.jitter=e};class je extends P{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,z(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!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new Fe({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||Re;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,e||(this.skipReconnect=!0),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 he(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=Te(t,"open",function(){r.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=Te(t,"error",o);if(!1!==this._timeout){const e=this._timeout,r=this.setTimeoutFn(()=>{n(),o(new Error("timeout")),t.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(n),this.subs.push(s),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){I(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Be(this,e,t),this.nsps[e]=r),r}_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 r=0;r<t.length;r++)this.engine.write(t[r],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")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),null===(r=this.engine)||void 0===r||r.close(),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 r=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&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Le={};function Pe(e,t){"object"==typeof e&&(t=e,e=void 0);const r=function(e,t="",r){let n=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),n=ce(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+(r&&r.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=r.source,o=r.id,s=r.path,i=Le[o]&&s in Le[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new je(n,t):(Le[o]||(Le[o]=new je(n,t)),a=Le[o]),r.query&&!t.query&&(t.query=r.queryKey),a.socket(r.path,t)}function Ie(e,t){return function(){return e.apply(t,arguments)}}Object.assign(Pe,{Manager:je,Socket:Be,io:Pe,connect:Pe});const{toString:De}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:qe,toStringTag:Me}=Symbol,ze=(e=>t=>{const r=De.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),We=e=>(e=e.toLowerCase(),t=>ze(t)===e),He=e=>t=>typeof t===e,{isArray:Ve}=Array,Ke=He("undefined");function Je(e){return null!==e&&!Ke(e)&&null!==e.constructor&&!Ke(e.constructor)&&Ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=We("ArrayBuffer");const Ge=He("string"),Ye=He("function"),Qe=He("number"),Xe=e=>null!==e&&"object"==typeof e,Ze=e=>{if("object"!==ze(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Me in e||qe in e)},et=We("Date"),tt=We("File"),rt=We("Blob"),nt=We("FileList"),ot=We("URLSearchParams"),[st,it,at,ct]=["ReadableStream","Request","Response","Headers"].map(We);function lt(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),Ve(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(Je(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function ut(e,t){if(Je(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,pt=e=>!Ke(e)&&e!==dt;const ht=(ft="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>ft&&e instanceof ft);var ft;const mt=We("HTMLFormElement"),gt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),yt=We("RegExp"),bt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};lt(r,(r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)}),Object.defineProperties(e,n)};const vt=We("AsyncFunction"),wt=(xt="function"==typeof setImmediate,Et=Ye(dt.postMessage),xt?setImmediate:Et?(kt=`axios@${Math.random()}`,_t=[],dt.addEventListener("message",({source:e,data:t})=>{e===dt&&t===kt&&_t.length&&_t.shift()()},!1),e=>{_t.push(e),dt.postMessage(kt,"*")}):e=>setTimeout(e));var xt,Et,kt,_t;const St="undefined"!=typeof queueMicrotask?queueMicrotask.bind(dt):"undefined"!=typeof process&&process.nextTick||wt;var Ct={isArray:Ve,isArrayBuffer:$e,isBuffer:Je,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ye(e.append)&&("formdata"===(t=ze(e))||"object"===t&&Ye(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&$e(e.buffer),t},isString:Ge,isNumber:Qe,isBoolean:e=>!0===e||!1===e,isObject:Xe,isPlainObject:Ze,isEmptyObject:e=>{if(!Xe(e)||Je(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:st,isRequest:it,isResponse:at,isHeaders:ct,isUndefined:Ke,isDate:et,isFile:tt,isBlob:rt,isRegExp:yt,isFunction:Ye,isStream:e=>Xe(e)&&Ye(e.pipe),isURLSearchParams:ot,isTypedArray:ht,isFileList:nt,forEach:lt,merge:function e(){const{caseless:t,skipUndefined:r}=pt(this)&&this||{},n={},o=(o,s)=>{const i=t&&ut(n,s)||s;Ze(n[i])&&Ze(o)?n[i]=e(n[i],o):Ze(o)?n[i]=e({},o):Ve(o)?n[i]=o.slice():r&&Ke(o)||(n[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&lt(arguments[e],o);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(lt(t,(t,n)=>{r&&Ye(t)?e[n]=Ie(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&Ue(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:ze,kindOfTest:We,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Ve(e))return e;let t=e.length;if(!Qe(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[qe]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:mt,hasOwnProperty:gt,hasOwnProp:gt,reduceDescriptors:bt,freezeMethods:e=>{bt(e,(t,r)=>{if(Ye(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Ye(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return Ve(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ut,global:dt,isContextDefined:pt,isSpecCompliantForm:function(e){return!!(e&&Ye(e.append)&&"FormData"===e[Me]&&e[qe])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Xe(e)){if(t.indexOf(e)>=0)return;if(Je(e))return e;if(!("toJSON"in e)){t[n]=e;const o=Ve(e)?[]:{};return lt(e,(e,t)=>{const s=r(e,n+1);!Ke(s)&&(o[t]=s)}),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:vt,isThenable:e=>e&&(Xe(e)||Ye(e))&&Ye(e.then)&&Ye(e.catch),setImmediate:wt,asap:St,isIterable:e=>null!=e&&Ye(e[qe])};function At(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}Ct.inherits(At,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ct.toJSONObject(this.config),code:this.code,status:this.status}}});const Ot=At.prototype,Rt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Rt[e]={value:e}}),Object.defineProperties(At,Rt),Object.defineProperty(Ot,"isAxiosError",{value:!0}),At.from=(e,t,r,n,o,s)=>{const i=Object.create(Ot);Ct.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return At.call(i,a,c,r,n,o),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",s&&Object.assign(i,s),i};function Tt(e){return Ct.isPlainObject(e)||Ct.isArray(e)}function Nt(e){return Ct.endsWith(e,"[]")?e.slice(0,-2):e}function Bt(e,t,r){return e?e.concat(t).map(function(e,t){return e=Nt(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Ft=Ct.toFlatObject(Ct,{},null,function(e){return/^is[A-Z]/.test(e)});function jt(e,t,r){if(!Ct.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Ct.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ct.isUndefined(t[e])})).metaTokens,o=r.visitor||l,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ct.isSpecCompliantForm(t);if(!Ct.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Ct.isDate(e))return e.toISOString();if(Ct.isBoolean(e))return e.toString();if(!a&&Ct.isBlob(e))throw new At("Blob is not supported. Use a Buffer instead.");return Ct.isArrayBuffer(e)||Ct.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(Ct.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Ct.isArray(e)&&function(e){return Ct.isArray(e)&&!e.some(Tt)}(e)||(Ct.isFileList(e)||Ct.endsWith(r,"[]"))&&(a=Ct.toArray(e)))return r=Nt(r),a.forEach(function(e,n){!Ct.isUndefined(e)&&null!==e&&t.append(!0===i?Bt([r],n,s):null===i?r:r+"[]",c(e))}),!1;return!!Tt(e)||(t.append(Bt(o,r,s),c(e)),!1)}const u=[],d=Object.assign(Ft,{defaultVisitor:l,convertValue:c,isVisitable:Tt});if(!Ct.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Ct.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),Ct.forEach(r,function(r,s){!0===(!(Ct.isUndefined(r)||null===r)&&o.call(t,r,Ct.isString(s)?s.trim():s,n,d))&&e(r,n?n.concat(s):[s])}),u.pop()}}(e),t}function Lt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Pt(e,t){this._pairs=[],e&&jt(e,this,t)}const It=Pt.prototype;function Dt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ut(e,t,r){if(!t)return e;const n=r&&r.encode||Dt;Ct.isFunction(r)&&(r={serialize:r});const o=r&&r.serialize;let s;if(s=o?o(t,r):Ct.isURLSearchParams(t)?t.toString():new Pt(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}It.append=function(e,t){this._pairs.push([e,t])},It.toString=function(e){const t=e?function(t){return e.call(this,t,Lt)}:Lt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qt{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ct.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Mt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Pt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Wt="undefined"!=typeof window&&"undefined"!=typeof document,Ht="object"==typeof navigator&&navigator||void 0,Vt=Wt&&(!Ht||["ReactNative","NativeScript","NS"].indexOf(Ht.product)<0),Kt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Jt=Wt&&window.location.href||"http://localhost";var $t={...Object.freeze({__proto__:null,hasBrowserEnv:Wt,hasStandardBrowserEnv:Vt,hasStandardBrowserWebWorkerEnv:Kt,navigator:Ht,origin:Jt}),...zt};function Gt(e){function t(e,r,n,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&Ct.isArray(n)?n.length:s,a)return Ct.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&Ct.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&Ct.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(Ct.isFormData(e)&&Ct.isFunction(e.entries)){const r={};return Ct.forEachEntry(e,(e,n)=>{t(function(e){return Ct.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Yt={transitional:Mt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=Ct.isObject(e);o&&Ct.isHTMLForm(e)&&(e=new FormData(e));if(Ct.isFormData(e))return n?JSON.stringify(Gt(e)):e;if(Ct.isArrayBuffer(e)||Ct.isBuffer(e)||Ct.isStream(e)||Ct.isFile(e)||Ct.isBlob(e)||Ct.isReadableStream(e))return e;if(Ct.isArrayBufferView(e))return e.buffer;if(Ct.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return jt(e,new $t.classes.URLSearchParams,{visitor:function(e,t,r,n){return $t.isNode&&Ct.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=Ct.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return jt(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(Ct.isString(e))try{return(t||JSON.parse)(e),Ct.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Yt.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Ct.isResponse(e)||Ct.isReadableStream(e))return e;if(e&&Ct.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw At.from(e,At.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$t.classes.FormData,Blob:$t.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ct.forEach(["delete","get","head","post","put","patch"],e=>{Yt.headers[e]={}});const Qt=Ct.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Xt=Symbol("internals");function Zt(e){return e&&String(e).trim().toLowerCase()}function er(e){return!1===e||null==e?e:Ct.isArray(e)?e.map(er):String(e)}function tr(e,t,r,n,o){return Ct.isFunction(n)?n.call(this,t,r):(o&&(t=r),Ct.isString(t)?Ct.isString(n)?-1!==t.indexOf(n):Ct.isRegExp(n)?n.test(t):void 0:void 0)}let rr=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=Zt(t);if(!o)throw new Error("header name must be a non-empty string");const s=Ct.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=er(e))}const s=(e,t)=>Ct.forEach(e,(e,r)=>o(e,r,t));if(Ct.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(Ct.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&Qt[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(Ct.isObject(e)&&Ct.isIterable(e)){let r,n,o={};for(const t of e){if(!Ct.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[n=t[0]]=(r=o[n])?Ct.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,r);return this}get(e,t){if(e=Zt(e)){const r=Ct.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Ct.isFunction(t))return t.call(this,e,r);if(Ct.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Zt(e)){const r=Ct.findKey(this,e);return!(!r||void 0===this[r]||t&&!tr(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=Zt(e)){const o=Ct.findKey(r,e);!o||t&&!tr(0,r[o],o,t)||(delete r[o],n=!0)}}return Ct.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!tr(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return Ct.forEach(this,(n,o)=>{const s=Ct.findKey(r,o);if(s)return t[s]=er(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(o):String(o).trim();i!==o&&delete t[o],t[i]=er(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ct.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Ct.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Xt]=this[Xt]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Zt(e);t[n]||(!function(e,t){const r=Ct.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})})}(r,e),t[n]=!0)}return Ct.isArray(e)?e.forEach(n):n(e),this}};function nr(e,t){const r=this||Yt,n=t||r,o=rr.from(n.headers);let s=n.data;return Ct.forEach(e,function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function or(e){return!(!e||!e.__CANCEL__)}function sr(e,t,r){At.call(this,null==e?"canceled":e,At.ERR_CANCELED,t,r),this.name="CanceledError"}function ir(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new At("Request failed with status code "+r.status,[At.ERR_BAD_REQUEST,At.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}rr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ct.reduceDescriptors(rr.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Ct.freezeMethods(rr),Ct.inherits(sr,At,{__CANCEL__:!0});const ar=(e,t,r=3)=>{let n=0;const o=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=n[i];o||(o=c),r[s]=a,n[s]=c;let u=i,d=0;for(;u!==s;)d+=r[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let r,n,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},s-a)))},()=>r&&i(r)]}(r=>{const s=r.loaded,i=r.lengthComputable?r.total:void 0,a=s-n,c=o(a);n=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},cr=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},lr=e=>(...t)=>Ct.asap(()=>e(...t));var ur=$t.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,$t.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,dr=$t.hasStandardBrowserEnv?{write(e,t,r,n,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Ct.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),Ct.isString(n)&&a.push(`path=${n}`),Ct.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),Ct.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function pr(e,t,r){let n=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const hr=e=>e instanceof rr?{...e}:e;function fr(e,t){t=t||{};const r={};function n(e,t,r,n){return Ct.isPlainObject(e)&&Ct.isPlainObject(t)?Ct.merge.call({caseless:n},e,t):Ct.isPlainObject(t)?Ct.merge({},t):Ct.isArray(t)?t.slice():t}function o(e,t,r,o){return Ct.isUndefined(t)?Ct.isUndefined(e)?void 0:n(void 0,e,0,o):n(e,t,0,o)}function s(e,t){if(!Ct.isUndefined(t))return n(void 0,t)}function i(e,t){return Ct.isUndefined(t)?Ct.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,r)=>o(hr(e),hr(t),0,!0)};return Ct.forEach(Object.keys({...e,...t}),function(n){const s=c[n]||o,i=s(e[n],t[n],n);Ct.isUndefined(i)&&s!==a||(r[n]=i)}),r}var mr=e=>{const t=fr({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=rr.from(i),t.url=Ut(pr(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Ct.isFormData(r))if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Ct.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if($t.hasStandardBrowserEnv&&(n&&Ct.isFunction(n)&&(n=n(t)),n||!1!==n&&ur(t.url))){const e=o&&s&&dr.read(s);e&&i.set(o,e)}return t};var gr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=mr(e);let o=n.data;const s=rr.from(n.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:h}=n;function f(){l&&l(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const n=rr.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ir(function(e){t(e),f()},function(e){r(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new At("Request aborted",At.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const n=new At(t&&t.message?t.message:"Network Error",At.ERR_NETWORK,e,m);n.event=t||null,r(n),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const o=n.transitional||Mt;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new At(t,o.clarifyTimeoutError?At.ETIMEDOUT:At.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&Ct.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Ct.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),d&&"json"!==d&&(m.responseType=n.responseType),h&&([c,u]=ar(h,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=ar(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{m&&(r(!t||t.type?new sr(null,e,m):t),m.abort(),m=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);y&&-1===$t.protocols.indexOf(y)?r(new At("Unsupported protocol "+y+":",At.ERR_BAD_REQUEST,e)):m.send(o||null)})};const yr=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const o=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof At?t:new sr(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new At(`timeout ${t} of ms exceeded`,At.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=n;return a.unsubscribe=()=>Ct.asap(i),a}},br=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,o=0;for(;o<r;)n=o+t,yield e.slice(o,n),o=n},vr=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},wr=(e,t,r,n)=>{const o=async function*(e,t){for await(const r of vr(e))yield*br(r,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return a(),void e.close();let s=n.byteLength;if(r){let e=i+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:xr}=Ct,Er=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ct.global),{ReadableStream:kr,TextEncoder:_r}=Ct.global,Sr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Cr=e=>{e=Ct.merge.call({skipUndefined:!0},Er,e);const{fetch:t,Request:r,Response:n}=e,o=t?xr(t):"function"==typeof fetch,s=xr(r),i=xr(n);if(!o)return!1;const a=o&&xr(kr),c=o&&("function"==typeof _r?(l=new _r,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const u=s&&a&&Sr(()=>{let e=!1;const t=new r($t.origin,{body:new kr,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&Sr(()=>Ct.isReadableStream(new n("").body)),p={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new At(`Response type '${e}' is not supported`,At.ERR_NOT_SUPPORT,r)})});const h=async(e,t)=>{const n=Ct.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Ct.isBlob(e))return e.size;if(Ct.isSpecCompliantForm(e)){const t=new r($t.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ct.isArrayBufferView(e)||Ct.isArrayBuffer(e)?e.byteLength:(Ct.isURLSearchParams(e)&&(e+=""),Ct.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:o,method:i,data:a,signal:c,cancelToken:l,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=mr(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let E=yr([c,l&&l.toAbortSignal()],f),k=null;const _=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let S;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(S=await h(b,a))){let e,t=new r(o,{method:"POST",body:a,duplex:"half"});if(Ct.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=cr(S,ar(lr(g)));a=wr(t.body,65536,e,r)}}Ct.isString(v)||(v=v?"include":"omit");const t=s&&"credentials"in r.prototype,c={...w,signal:E,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};k=s&&new r(o,c);let l=await(s?x(k,w):x(o,c));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&_)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Ct.toFiniteNumber(l.headers.get("content-length")),[r,o]=m&&cr(t,ar(lr(m),!0))||[];l=new n(wr(l.body,65536,r,()=>{o&&o(),_&&_()}),e)}y=y||"text";let C=await p[Ct.findKey(p,y)||"text"](l,e);return!f&&_&&_(),await new Promise((t,r)=>{ir(t,r,{data:C,headers:rr.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(_&&_(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new At("Network Error",At.ERR_NETWORK,e,k),{cause:t.cause||t});throw At.from(t,t&&t.code,e,k)}}},Ar=new Map,Or=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:o}=t,s=[n,o,r];let i,a,c=s.length,l=Ar;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:Cr(t)),l=a;return a};Or();const Rr={http:null,xhr:gr,fetch:{get:Or}};Ct.forEach(Rr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Tr=e=>`- ${e}`,Nr=e=>Ct.isFunction(e)||null===e||!1===e;var Br={getAdapter:function(e,t){e=Ct.isArray(e)?e:[e];const{length:r}=e;let n,o;const s={};for(let i=0;i<r;i++){let r;if(n=e[i],o=n,!Nr(n)&&(o=Rr[(r=String(n)).toLowerCase()],void 0===o))throw new At(`Unknown adapter '${r}'`);if(o&&(Ct.isFunction(o)||(o=o.get(t))))break;s[r||"#"+i]=o}if(!o){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new At("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Tr).join("\n"):" "+Tr(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o},adapters:Rr};function Fr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new sr(null,e)}function jr(e){Fr(e),e.headers=rr.from(e.headers),e.data=nr.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Br.getAdapter(e.adapter||Yt.adapter,e)(e).then(function(t){return Fr(e),t.data=nr.call(e,e.transformResponse,t),t.headers=rr.from(t.headers),t},function(t){return or(t)||(Fr(e),t&&t.response&&(t.response.data=nr.call(e,e.transformResponse,t.response),t.response.headers=rr.from(t.response.headers))),Promise.reject(t)})}const Lr="1.13.2",Pr={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Pr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ir={};Pr.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Lr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new At(n(o," has been removed"+(t?" in "+t:"")),At.ERR_DEPRECATED);return t&&!Ir[o]&&(Ir[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}},Pr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Dr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new At("options must be an object",At.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new At("option "+s+" must be "+r,At.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new At("Unknown option "+s,At.ERR_BAD_OPTION)}},validators:Pr};const Ur=Dr.validators;let qr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new qt,response:new qt}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=fr(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:o}=t;void 0!==r&&Dr.assertOptions(r,{silentJSONParsing:Ur.transitional(Ur.boolean),forcedJSONParsing:Ur.transitional(Ur.boolean),clarifyTimeoutError:Ur.transitional(Ur.boolean)},!1),null!=n&&(Ct.isFunction(n)?t.paramsSerializer={serialize:n}:Dr.assertOptions(n,{encode:Ur.function,serialize:Ur.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Dr.assertOptions(t,{baseUrl:Ur.spelling("baseURL"),withXsrfToken:Ur.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&Ct.merge(o.common,o[t.method]);o&&Ct.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=rr.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[jr.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let p=t;for(;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=jr.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Ut(pr((e=fr(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Ct.forEach(["delete","get","head","options"],function(e){qr.prototype[e]=function(t,r){return this.request(fr(r||{},{method:e,url:t,data:(r||{}).data}))}}),Ct.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,o){return this.request(fr(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}qr.prototype[e]=t(),qr.prototype[e+"Form"]=t(!0)});const Mr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mr).forEach(([e,t])=>{Mr[t]=e});const zr=function e(t){const r=new qr(t),n=Ie(qr.prototype.request,r);return Ct.extend(n,qr.prototype,r,{allOwnKeys:!0}),Ct.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(fr(t,r))},n}(Yt);zr.Axios=qr,zr.CanceledError=sr,zr.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,o){r.reason||(r.reason=new sr(e,n,o),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},zr.isCancel=or,zr.VERSION=Lr,zr.toFormData=jt,zr.AxiosError=At,zr.Cancel=zr.CanceledError,zr.all=function(e){return Promise.all(e)},zr.spread=function(e){return function(t){return e.apply(null,t)}},zr.isAxiosError=function(e){return Ct.isObject(e)&&!0===e.isAxiosError},zr.mergeConfig=fr,zr.AxiosHeaders=rr,zr.formToJSON=e=>Gt(Ct.isHTMLForm(e)?new FormData(e):e),zr.getAdapter=Br.getAdapter,zr.HttpStatusCode=Mr,zr.default=zr;const{Axios:Wr,AxiosError:Hr,CanceledError:Vr,isCancel:Kr,CancelToken:Jr,VERSION:$r,all:Gr,Cancel:Yr,isAxiosError:Qr,spread:Xr,toFormData:Zr,AxiosHeaders:en,HttpStatusCode:tn,formToJSON:rn,getAdapter:nn,mergeConfig:on}=zr;var sn=function(n){var o=n.apiKey,s=n.apiUrl,c=n.primaryColor,d=void 0===c?"#4F46E5":c,h=n.userData,f=void 0===h?null:h,m=n.theme,g=void 0===m?"light":m,y=n.onClose,b=p(t("create"),2),v=b[0],w=b[1],x=p(t([]),2),E=x[0],k=x[1],_=p(t(null),2);_[0],_[1];var S=p(t(!1),2),C=S[0],A=S[1],O=p(t({subject:"",description:"",priority:"medium",category:"general"}),2),R=O[0],T=O[1],N="dark"===g||"auto"===g&&window.matchMedia("(prefers-color-scheme: dark)").matches;r(function(){"create"!==v&&B()},[v]);var B=function(){var e=i(u().m(function e(){var t,r,n;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:return A(!0),e.p=1,t=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")},e.n=2,zr.get("".concat(s,"/api/v1/email-ticketing/tickets"),{headers:{"x-api-key":o},params:{status:"myTickets"===v?"open,pending":"all",customerEmail:t.email}});case 2:(r=e.v).data.success&&k(r.data.data.tickets||[]),e.n=4;break;case 3:e.p=3,n=e.v,console.error("Error fetching tickets:",n);case 4:return e.p=4,A(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),F=function(){var e=i(u().m(function e(t){var r,n;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:return t.preventDefault(),A(!0),e.p=1,r=f||{email:localStorage.getItem("chatGuestEmail")||"guest@example.com",name:localStorage.getItem("chatGuestName")||"Guest User"},e.n=2,zr.post("".concat(s,"/api/v1/email-ticketing/tickets"),{subject:R.subject,message:R.description,priority:R.priority,category:R.category,customerEmail:r.email,customerName:r.name},{headers:{"x-api-key":o}});case 2:e.v.data.success&&(alert("✅ Ticket created successfully!"),T({subject:"",description:"",priority:"medium",category:"general"}),w("myTickets")),e.n=4;break;case 3:e.p=3,n=e.v,console.error("Error creating ticket:",n),alert("❌ Failed to create ticket. Please try again.");case 4:return e.p=4,A(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),j=function(e){var t=e.target,r=t.name,n=t.value;T(function(e){return l(l({},e),{},a({},r,n))})},L=function(e){switch(e){case"open":return"#10B981";case"pending":return"#F59E0B";default:return"#6B7280"}},P=function(e){switch(e){case"high":return"#EF4444";case"medium":return"#F59E0B";case"low":return"#10B981";default:return"#6B7280"}};return e.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:N?"#111827":"#F9FAFB",zIndex:999999,display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{backgroundColor:N?"#1F2937":"#fff",borderBottom:N?"1px solid #374151":"1px solid #E5E7EB",padding:"16px 24px",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"8px",backgroundColor:d,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{style:{width:"20px",height:"20px",color:"#fff"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"}))),e.createElement("div",null,e.createElement("h1",{style:{margin:0,fontSize:"20px",fontWeight:600,color:N?"#F9FAFB":"#111827"}},"Support Tickets"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"13px",color:N?"#9CA3AF":"#6B7280"}},"Manage your support requests"))),e.createElement("button",{onClick:y,style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",color:N?"#9CA3AF":"#6B7280",transition:"all 0.2s"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor=N?"#374151":"#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},e.createElement("svg",{style:{width:"24px",height:"24px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))),e.createElement("div",{style:{backgroundColor:N?"#1F2937":"#fff",borderBottom:N?"1px solid #374151":"1px solid #E5E7EB",display:"flex",gap:"4px",padding:"0 24px"}},e.createElement("button",{onClick:function(){return w("create")},style:{padding:"12px 16px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"create"===v?d:N?"#9CA3AF":"#6B7280",borderBottom:"create"===v?"2px solid ".concat(d):"2px solid transparent",transition:"all 0.2s"}},"Create Ticket"),e.createElement("button",{onClick:function(){return w("myTickets")},style:{padding:"12px 16px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"myTickets"===v?d:N?"#9CA3AF":"#6B7280",borderBottom:"myTickets"===v?"2px solid ".concat(d):"2px solid transparent",transition:"all 0.2s"}},"My Tickets"),e.createElement("button",{onClick:function(){return w("history")},style:{padding:"12px 16px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"history"===v?d:N?"#9CA3AF":"#6B7280",borderBottom:"history"===v?"2px solid ".concat(d):"2px solid transparent",transition:"all 0.2s"}},"History")),e.createElement("div",{style:{flex:1,overflow:"auto",padding:"24px"}},"create"===v&&e.createElement("div",{style:{maxWidth:"800px",margin:"0 auto"}},e.createElement("div",{style:{backgroundColor:N?"#1F2937":"#fff",borderRadius:"12px",padding:"24px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:N?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h2",{style:{margin:"0 0 16px 0",fontSize:"18px",fontWeight:600,color:N?"#F9FAFB":"#111827"}},"Create New Support Ticket"),e.createElement("form",{onSubmit:F},e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:N?"#F9FAFB":"#111827"}},"Subject *"),e.createElement("input",{type:"text",name:"subject",value:R.subject,onChange:j,required:!0,placeholder:"Brief description of your issue",style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:N?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:N?"#111827":"#fff",color:N?"#F9FAFB":"#111827",outline:"none"}})),e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:N?"#F9FAFB":"#111827"}},"Description *"),e.createElement("textarea",{name:"description",value:R.description,onChange:j,required:!0,placeholder:"Provide detailed information about your issue...",rows:6,style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:N?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:N?"#111827":"#fff",color:N?"#F9FAFB":"#111827",outline:"none",resize:"vertical"}})),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",marginBottom:"20px"}},e.createElement("div",null,e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:N?"#F9FAFB":"#111827"}},"Priority"),e.createElement("select",{name:"priority",value:R.priority,onChange:j,style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:N?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:N?"#111827":"#fff",color:N?"#F9FAFB":"#111827",outline:"none"}},e.createElement("option",{value:"low"},"Low"),e.createElement("option",{value:"medium"},"Medium"),e.createElement("option",{value:"high"},"High"))),e.createElement("div",null,e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:N?"#F9FAFB":"#111827"}},"Category"),e.createElement("select",{name:"category",value:R.category,onChange:j,style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:N?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:N?"#111827":"#fff",color:N?"#F9FAFB":"#111827",outline:"none"}},e.createElement("option",{value:"general"},"General"),e.createElement("option",{value:"technical"},"Technical Issue"),e.createElement("option",{value:"billing"},"Billing"),e.createElement("option",{value:"feature"},"Feature Request"),e.createElement("option",{value:"bug"},"Bug Report")))),e.createElement("button",{type:"submit",disabled:C,style:{width:"100%",padding:"12px 24px",fontSize:"14px",fontWeight:600,color:"#fff",backgroundColor:d,border:"none",borderRadius:"8px",cursor:C?"not-allowed":"pointer",opacity:C?.7:1,transition:"all 0.2s"}},C?"Creating Ticket...":"Submit Ticket")))),("myTickets"===v||"history"===v)&&e.createElement("div",{style:{maxWidth:"1200px",margin:"0 auto"}},C?e.createElement("div",{style:{textAlign:"center",padding:"40px",color:N?"#9CA3AF":"#6B7280"}},"Loading tickets..."):0===E.length?e.createElement("div",{style:{textAlign:"center",padding:"40px"}},e.createElement("div",{style:{width:"80px",height:"80px",margin:"0 auto 16px",borderRadius:"50%",backgroundColor:N?"#374151":"#F3F4F6",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{style:{width:"40px",height:"40px",color:N?"#9CA3AF":"#6B7280"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"}))),e.createElement("p",{style:{margin:0,fontSize:"16px",fontWeight:500,color:N?"#F9FAFB":"#111827"}},"No tickets found"),e.createElement("p",{style:{margin:"8px 0 0 0",fontSize:"14px",color:N?"#9CA3AF":"#6B7280"}},"myTickets"===v?"You have no open tickets":"No ticket history available")):e.createElement("div",{style:{display:"grid",gap:"12px"}},E.map(function(t){return e.createElement("div",{key:t._id,style:{backgroundColor:N?"#1F2937":"#fff",borderRadius:"12px",padding:"16px 20px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:N?"1px solid #374151":"1px solid #E5E7EB",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:function(e){return e.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:function(e){return e.currentTarget.style.transform="translateY(0)"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start",marginBottom:"8px"}},e.createElement("div",{style:{flex:1}},e.createElement("h3",{style:{margin:"0 0 4px 0",fontSize:"16px",fontWeight:600,color:N?"#F9FAFB":"#111827"}},t.subject),e.createElement("p",{style:{margin:0,fontSize:"13px",color:N?"#9CA3AF":"#6B7280"}},t.ticketId," • ",(r=t.createdAt,new Date(r).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("span",{style:{padding:"4px 10px",fontSize:"12px",fontWeight:500,borderRadius:"6px",backgroundColor:"".concat(P(t.priority),"20"),color:P(t.priority)}},t.priority),e.createElement("span",{style:{padding:"4px 10px",fontSize:"12px",fontWeight:500,borderRadius:"6px",backgroundColor:"".concat(L(t.status),"20"),color:L(t.status)}},t.status))),t.assignedTo&&e.createElement("p",{style:{margin:"8px 0 0 0",fontSize:"13px",color:N?"#9CA3AF":"#6B7280"}},"Assigned to: ",t.assignedTo.name));var r})))))};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".crm-widget-container{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.crm-chat-button{align-items:center;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(0,0,0,.2);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .2s;width:64px}.crm-chat-button:hover{transform:scale(1.1)}.crm-icon{height:32px;width:32px}.crm-icon-sm{height:24px;width:24px}.crm-spin{animation:crm-spin 1s linear infinite}@keyframes crm-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.crm-badge{align-items:center;background-color:#ef4444;border-radius:50%;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;position:absolute;right:-4px;top:-4px;width:20px}.crm-bottom-6{bottom:24px}.crm-right-6{right:24px}.crm-left-6{left:24px}.crm-top-6{top:24px}.crm-chat-window{background:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:0 20px 50px rgba(0,0,0,.3);display:flex;flex-direction:column;height:600px;max-width:448px;overflow:hidden;position:fixed;width:100%}.crm-chat-window.crm-dark{background:#1f2937;border-color:#374151}.crm-chat-window.crm-bottom-6{bottom:100px}.crm-chat-window.crm-right-6{right:24px}.crm-chat-window.crm-left-6{left:24px}.crm-chat-window.crm-top-6{top:100px}@media (max-width:640px){.crm-chat-window{border-radius:0;bottom:0!important;height:100vh;left:0!important;max-width:100%;right:0!important;top:0!important}}.crm-header{align-items:center;color:#fff;display:flex;justify-content:space-between;padding:16px 24px}.crm-header-content{align-items:center;display:flex;gap:12px}.crm-avatar{align-items:center;background:#fff;border-radius:50%;display:flex;font-size:20px;height:40px;justify-content:center;width:40px}.crm-title{font-size:18px;font-weight:600;margin:0}.crm-status{align-items:center;display:flex;font-size:14px;gap:8px;opacity:.9}.crm-status-dot{border-radius:50%;height:8px;width:8px}.crm-status-dot.crm-online{background-color:#10b981}.crm-status-dot.crm-offline{background-color:#ef4444}.crm-close-btn{background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;padding:8px;transition:background .2s}.crm-close-btn:hover{background:hsla(0,0%,100%,.3)}.crm-new-query-btn{align-items:center;background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;justify-content:center;padding:8px;transition:all .2s}.crm-new-query-btn:hover{background:hsla(0,0%,100%,.3);transform:scale(1.05)}.crm-messages{background:#f9fafb;display:flex;flex:1;flex-direction:column;gap:16px;overflow-y:auto;padding:16px}.crm-dark .crm-messages{background:#111827}.crm-welcome-message{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);padding:16px}.crm-dark .crm-welcome-message{background:#1f2937;border-color:#374151;color:#d1d5db}.crm-welcome-message p{color:#374151;font-size:14px;margin:0}.crm-dark .crm-welcome-message p{color:#d1d5db}.crm-message{display:flex}.crm-message-guest{justify-content:flex-end}.crm-message-agent{justify-content:flex-start}.crm-message-system{justify-content:center}.crm-message-bubble{border-radius:16px;box-shadow:0 1px 2px rgba(0,0,0,.1);max-width:75%;padding:10px 16px}.crm-message-guest .crm-message-bubble{border-bottom-right-radius:4px;color:#fff}.crm-message-agent .crm-message-bubble{background:#fff;border:1px solid #e5e7eb;border-bottom-left-radius:4px;color:#1f2937}.crm-dark .crm-message-agent .crm-message-bubble{background:#1f2937;border-color:#374151;color:#f3f4f6}.crm-agent-name{font-size:12px;font-weight:500;margin:0 0 4px;opacity:.7}.crm-message-text{font-size:14px;line-height:1.5;margin:0;white-space:pre-wrap;word-break:break-word}.crm-message-time{font-size:11px;margin:4px 0 0;opacity:.7}.crm-typing-indicator{display:flex;gap:4px;padding:4px 0}.crm-typing-dot{animation:typing 1.4s infinite;background:#9ca3af;border-radius:50%;height:8px;width:8px}.crm-typing-dot:nth-child(2){animation-delay:.2s}.crm-typing-dot:nth-child(3){animation-delay:.4s}@keyframes typing{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-10px)}}.crm-input-container{background:#fff;border-top:1px solid #e5e7eb;padding:16px}.crm-dark .crm-input-container{background:#1f2937;border-color:#374151}.crm-input-wrapper{align-items:flex-end;display:flex;gap:8px}.crm-input{background:#f9fafb;border:1px solid #d1d5db;border-radius:12px;color:#1f2937;flex:1;font-family:inherit;font-size:14px;max-height:120px;min-height:48px;padding:12px 16px;resize:none}.crm-input:focus{border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.1);outline:none}.crm-input:disabled{cursor:not-allowed;opacity:.5}.crm-dark .crm-input{background:#111827;border-color:#4b5563;color:#f3f4f6}.crm-dark .crm-input::placeholder{color:#6b7280}.crm-send-btn{align-items:center;border:none;border-radius:12px;color:#fff;cursor:pointer;display:flex;flex-shrink:0;justify-content:center;padding:12px;transition:all .2s}.crm-send-btn:hover:not(:disabled){box-shadow:0 4px 12px rgba(0,0,0,.2)}.crm-send-btn:disabled{cursor:not-allowed;opacity:.5}.crm-input-hint{color:#9ca3af;font-size:11px;margin:8px 0 0;text-align:center}.crm-dark .crm-input-hint{color:#6b7280}.crm-messages::-webkit-scrollbar{width:6px}.crm-messages::-webkit-scrollbar-track{background:transparent}.crm-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.crm-dark .crm-messages::-webkit-scrollbar-thumb{background:#4b5563}.crm-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}");var an=function(o){var s=o.apiKey,a=o.apiUrl,c=void 0===a?"https://chat-crm-backend-7mzo.onrender.com":a,l=o.primaryColor,d=void 0===l?"#4F46E5":l,f=o.position,m=void 0===f?"bottom-right":f,g=o.userData,y=void 0===g?null:g,b=o.welcomeMessage,v=void 0===b?"👋 Welcome! How can we help you today?":b,w=o.companyName,x=void 0===w?"Support":w,E=o.autoOpen,k=void 0!==E&&E,_=o.showNotifications,S=void 0===_||_,C=o.playSound,A=void 0!==C&&C,O=o.theme,R=void 0===O?"light":O,T=o.zIndex,N=void 0===T?9999:T,B=p(t(k),2),F=B[0],j=B[1],L=p(t([]),2),P=L[0],I=L[1],D=p(t(""),2),U=D[0],q=D[1],M=p(t(null),2),z=M[0],W=M[1],H=p(t(null),2);H[0];var V=H[1],K=p(t(null),2),J=K[0],$=K[1],G=p(t(!1),2),Y=G[0],Q=G[1],X=p(t(!1),2),Z=X[0],ee=X[1],te=p(t(!1),2),re=te[0],ne=te[1],oe=p(t(!1),2),se=oe[0],ie=oe[1],ae=p(t("Support Agent"),2),ce=ae[0],le=ae[1],ue=p(t(0),2),de=ue[0],pe=ue[1],he=p(t(!1),2),fe=he[0],me=he[1],ge=p(t("active"),2),ye=ge[0],be=ge[1],ve=p(t(null),2),we=ve[0],xe=ve[1],Ee=p(t(!1),2),ke=Ee[0],_e=Ee[1],Se=p(t(!1),2),Ce=Se[0],Ae=Se[1],Oe=p(t(null),2),Re=Oe[0],Te=Oe[1],Ne=n(!1),Be=n(null),Fe=n(null),je=n(null),Le=n(null);r(function(){var e=function(e){if(F){var t=Fe.current,r=je.current,n=Le.current;!t||t.contains(e.target)||!r||r.contains(e.target)||n&&n.contains(e.target)||(j(!1),Ae(!1))}};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[F]);r(function(){var e;null===(e=Be.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[P]),r(function(){return function(){z&&z.disconnect()}},[z]);var Ie=function(){return y?{name:y.name||"Guest User",email:y.email||null,phone:y.phone||null,userId:y.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},De=function(){var e=i(u().m(function e(){var t,r,n,o,i,a,l;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=Ie(),ee(!0),e.p=1,console.log("🚀 Creating new conversation for first message..."),e.n=2,zr.post("".concat(c,"/api/v1/webhook/guest-conversation"),{apiKey:s,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(r=e.v).data.success){e.n=3;break}return n=r.data,o=n.conversationId,i=n.petitionId,a=n.queryId,V(a),$(o),me(!0),localStorage.setItem("chatGuestId",a),localStorage.setItem("chatConversationId",o),localStorage.setItem("chatPetitionId",i),console.log("✅ Conversation created:",{petitionId:i,queryId:a}),e.a(2,{newConvId:o,petitionId:i});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,l=e.v,console.error("❌ Create conversation error:",l),l;case 5:return e.p=5,ee(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),Ue=function(){var e=i(u().m(function e(t){var r,n;return u().w(function(e){for(;;)if(0===e.n)return r=t.convId,n=t.petitionId,ne(!0),e.a(2,new Promise(function(e,t){try{var o=Pe("".concat(c,"/widget"),{query:{conversationId:r,petitionId:n,apiKey:s},transports:["websocket","polling"]});o.on("connect",function(){Q(!0),ne(!1),console.log("✅ Connected to Chat CRM Widget Namespace"),e(o)}),o.on("connect_error",function(e){ne(!1),console.error("❌ Socket connect_error:",(null==e?void 0:e.message)||e)}),o.on("error",function(e){console.error("❌ Socket error:",e)}),o.on("disconnect",function(){Q(!1),console.log("❌ Disconnected from Chat CRM")}),o.on("new-message",function(e){console.log("📨 Received new-message:",e);var t={message:e.message||e.text||"",sender:e.sender||"agent",senderName:e.senderName||"Agent",timestamp:e.timestamp||new Date,read:!1};I(function(e){return[].concat(h(e),[t])}),le(e.senderName||"Support Agent"),ie(!1),!F&&S&&(pe(function(e){return e+1}),A&&ze())}),o.on("query-accepted",function(e){console.log("✅ Query accepted by agent:",e),le(e.agentName||"Support Agent"),be("active"),I(function(t){return[].concat(h(t),[{message:e.message||"".concat(e.agentName," has accepted your query"),sender:"system",timestamp:new Date,read:!0}])})}),o.on("query-transferred",function(e){console.log("🔄 Query transferred:",e),le(e.toAgentName||"Support Agent"),I(function(t){return[].concat(h(t),[{message:e.message||"Your query has been transferred to ".concat(e.toAgentName),sender:"system",timestamp:new Date,read:!0}])})}),o.on("query-resolved",function(e){console.log("✅ Query resolved:",e),be("resolved"),Ne.current?console.log("🔁 Skipping duplicate resolved system message"):(Ne.current=!0,I(function(e){return[].concat(h(e),[{message:'✅ This query has been resolved by the agent. Click "New Query" to start a new conversation.',sender:"system",timestamp:new Date,read:!0}])}))}),o.on("request-camera-snapshot",function(e){try{var t,r=localStorage.getItem("chatPetitionId");if(null!=e&&e.petitionId&&r&&e.petitionId===r)xe({requesterName:e.requesterName||(null===(t=e.requester)||void 0===t?void 0:t.name)||"Agent",at:Date.now()})}catch(e){}}),o.on("query-reopened",function(e){console.log("🔄 Query reopened:",e),be("active"),Ne.current=!1}),o.on("agent-typing",function(e){ie(!0),le(e.agentName||"Support Agent"),setTimeout(function(){return ie(!1)},3e3)}),W(o)}catch(e){ne(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),qe=function(){var e=i(u().m(function e(){var t,r,n,o,s,i,a,c,l;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:if(U.trim()&&"resolved"!==ye){e.n=1;break}return e.a(2);case 1:if(t=Ie(),r=U.trim(),n=Date.now(),I(function(e){return[].concat(h(e),[{message:r,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:n}])}),q(""),e.p=2,o=localStorage.getItem("chatPetitionId"),s=J||localStorage.getItem("chatConversationId"),o&&s){e.n=4;break}return e.n=3,De();case 3:i=e.v,s=i.newConvId,o=i.petitionId;case 4:if((a=z)&&Y){e.n=6;break}try{z&&z.disconnect()}catch(e){}return e.n=5,Ue({convId:s,petitionId:o});case 5:a=e.v;case 6:c={conversationId:s,petitionId:o,message:r,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("📤 Sending message:",c),a.emit("widget-message",c),e.n=8;break;case 7:e.p=7,l=e.v,console.error("❌ Send message error:",l),I(function(e){return e.filter(function(e){return e.tempId!==n})}),alert("Failed to send message. Please try again.");case 8:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),Me=function(e){Te(e),Ae(!1)},ze=function(){var e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),r=e.createGain();t.connect(r),r.connect(e.destination),t.frequency.value=800,t.type="sine",r.gain.value=.1,t.start(),setTimeout(function(){return t.stop()},200)},We=function(){var e=i(u().m(function e(){var t,r,n,o,i,a,l,d,p,f,m,g,y,b;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:if(we){e.n=1;break}return e.a(2);case 1:return _e(!0),e.p=2,e.n=3,navigator.mediaDevices.getUserMedia({video:!0});case 3:return r=e.v,(n=document.createElement("video")).srcObject=r,e.n=4,new Promise(function(e){n.onloadedmetadata=e,n.play().then(e).catch(e)});case 4:return o=document.createElement("canvas"),i=n.videoWidth||640,a=n.videoHeight||480,o.width=i,o.height=a,o.getContext("2d").drawImage(n,0,0,i,a),r.getTracks().forEach(function(e){return e.stop()}),e.n=5,new Promise(function(e){return o.toBlob(e,"image/png")});case 5:if(l=e.v){e.n=6;break}throw new Error("Failed to capture");case 6:return d=localStorage.getItem("chatPetitionId"),J||localStorage.getItem("chatConversationId"),p=new FormData,f="snapshot-".concat(d,"-").concat(Date.now(),".png"),p.append("screenshot",l,f),p.append("petitionId",d),p.append("apiKey",s),p.append("metadata",JSON.stringify({source:"widget",requesterName:null==we?void 0:we.requesterName})),e.n=7,zr.post("".concat(c,"/api/v1/webhook/upload-snapshot"),p,{headers:{"Content-Type":"multipart/form-data"}});case 7:if(m=e.v,!(g=null==m||null===(t=m.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.imageUrl)){e.n=8;break}return y=new Date,I(function(e){return[].concat(h(e),[{message:"📸 Screenshot: ".concat(g),sender:"guest",senderName:"You",timestamp:y,read:!0}])}),e.n=8,zr.post("".concat(c,"/api/v1/webhook/send-message"),{apiKey:s,petitionId:d,message:"📸 Screenshot: ".concat(g),senderName:"Guest User"});case 8:e.n=10;break;case 9:e.p=9,b=e.v,console.error("Widget capture error:",b),alert("Camera permission denied or capture failed.");case 10:return e.p=10,_e(!1),xe(null),e.f(10);case 11:return e.a(2)}},e,null,[[2,9,10,11]])}));return function(){return e.apply(this,arguments)}}(),He=function(){var e={"bottom-right":"crm-bottom-6 crm-right-6","bottom-left":"crm-bottom-6 crm-left-6","top-right":"crm-top-6 crm-right-6","top-left":"crm-top-6 crm-left-6"};return e[m]||e["bottom-right"]},Ve="dark"===R||"auto"===R&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:N}},e.createElement("button",{ref:je,onClick:function(){j(function(e){var t=!e;return t?(pe(0),Ae(!0),Te(null)):(Ae(!1),Te(null)),t})},className:"crm-chat-button ".concat(He()),style:{backgroundColor:d},"aria-label":F?"Close help":"Help & Support",title:"Help & Support"},F&&!Ce?e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})):e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z"})),!F&&de>0&&e.createElement("span",{className:"crm-badge"},de)),F&&Ce&&e.createElement("div",{ref:Le,className:"crm-menu-popup ".concat(He()," ").concat(Ve?"crm-dark":""),style:{position:"fixed",bottom:m.includes("bottom")?"90px":"auto",top:m.includes("top")?"90px":"auto",right:m.includes("right")?"24px":"auto",left:m.includes("left")?"24px":"auto",width:"280px",backgroundColor:Ve?"#1F2937":"#fff",borderRadius:"12px",boxShadow:"0 10px 40px rgba(0,0,0,0.15)",border:Ve?"1px solid #374151":"1px solid #E5E7EB",overflow:"hidden",zIndex:N+1}},e.createElement("div",{style:{padding:"16px",borderBottom:Ve?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,color:Ve?"#F9FAFB":"#111827"}},"Help & Support"),e.createElement("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:Ve?"#9CA3AF":"#6B7280"}},"How can we assist you today?")),e.createElement("div",{style:{padding:"8px"}},e.createElement("button",{onClick:function(){return Me("query")},className:"crm-menu-option",style:{width:"100%",padding:"12px",display:"flex",alignItems:"center",gap:"12px",border:"none",borderRadius:"8px",backgroundColor:"transparent",cursor:"pointer",transition:"all 0.2s",textAlign:"left"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor=Ve?"#374151":"#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"8px",backgroundColor:d,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement("svg",{style:{width:"20px",height:"20px",color:"#fff"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"}))),e.createElement("div",{style:{flex:1}},e.createElement("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:Ve?"#F9FAFB":"#111827"}},"Start Query"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:Ve?"#9CA3AF":"#6B7280"}},"Chat with our support team")),e.createElement("svg",{style:{width:"16px",height:"16px",color:Ve?"#9CA3AF":"#6B7280"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),e.createElement("button",{onClick:function(){return Me("ticket")},className:"crm-menu-option",style:{width:"100%",padding:"12px",display:"flex",alignItems:"center",gap:"12px",border:"none",borderRadius:"8px",backgroundColor:"transparent",cursor:"pointer",transition:"all 0.2s",textAlign:"left",marginTop:"4px"},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor=Ve?"#374151":"#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"8px",backgroundColor:"#10B981",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement("svg",{style:{width:"20px",height:"20px",color:"#fff"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"}))),e.createElement("div",{style:{flex:1}},e.createElement("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:Ve?"#F9FAFB":"#111827"}},"Raise Ticket"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:Ve?"#9CA3AF":"#6B7280"}},"Submit a support ticket")),e.createElement("svg",{style:{width:"16px",height:"16px",color:Ve?"#9CA3AF":"#6B7280"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),F&&"query"===Re&&e.createElement("div",{ref:Fe,className:"crm-chat-window ".concat(He()," ").concat(Ve?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:d}},e.createElement("div",{className:"crm-header-content"},e.createElement("button",{onClick:function(){Te(null),Ae(!0)},className:"crm-back-btn",title:"Back to Menu",style:{background:"none",border:"none",color:"#fff",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",marginRight:"8px"}},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"}))),e.createElement("div",{className:"crm-avatar"},"💬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},x),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(Y?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===ye?e.createElement("span",{style:{color:"#10B981"}},"✓ Resolved"):"Support Agent"!==ce?e.createElement("span",null,"💬 ",ce):Y?"Online":re?"Connecting…":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),z&&z.disconnect(),W(null),V(null),$(null),Q(!1),me(!1),be("active"),Ne.current=!1,I([]),q(""),console.log("🆕 Starting new query...")},className:"crm-new-query-btn",title:"Start New Query"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"}))),e.createElement("button",{onClick:function(){j(!1),Ae(!1),Te(null)},className:"crm-close-btn"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),e.createElement("div",{className:"crm-messages"},!fe&&0===P.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,v),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"👋 Start typing to begin your conversation")),P.map(function(t,r){return e.createElement("div",{key:r,className:"crm-message ".concat("guest"===t.sender?"crm-message-guest":"system"===t.sender?"crm-message-system":"crm-message-agent")},e.createElement("div",{className:"crm-message-bubble",style:"guest"===t.sender?{backgroundColor:d}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||ce),function(){var r=String(t.message||""),n=r.match(/https?:[^\s]+\.(?:png|jpg|jpeg|gif|webp)/i);if(n){var o=n[0],s=r.replace(o,"").trim();return e.createElement("div",null,s&&e.createElement("p",{className:"crm-message-text",style:{opacity:.85}},s),e.createElement("img",{src:o,alt:"snapshot",style:{maxWidth:"240px",maxHeight:"180px",borderRadius:"8px",border:"1px solid #E5E7EB",display:"block"}}))}return e.createElement("p",{className:"crm-message-text"},r)}(),e.createElement("p",{className:"crm-message-time"},(n=t.timestamp,new Date(n).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})))));var n}),se&&e.createElement("div",{className:"crm-message crm-message-agent"},e.createElement("div",{className:"crm-message-bubble"},e.createElement("div",{className:"crm-typing-indicator"},e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"})))),e.createElement("div",{ref:Be})),we&&e.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",zIndex:1e4}},e.createElement("div",{style:{background:Ve?"#1F2937":"#fff",color:Ve?"#E5E7EB":"#111827",border:Ve?"1px solid #374151":"1px solid #E5E7EB",borderRadius:12,width:360,maxWidth:"100%"}},e.createElement("div",{style:{padding:16}},e.createElement("h3",{style:{margin:0,fontSize:18,fontWeight:600}},"Camera access requested"),e.createElement("p",{style:{marginTop:8,fontSize:14,opacity:.9}},(null==we?void 0:we.requesterName)||"Agent"," is requesting a photo from your camera. Do you allow?")),e.createElement("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",borderTop:Ve?"1px solid #374151":"1px solid #E5E7EB",padding:12}},e.createElement("button",{onClick:function(){return xe(null)},className:"crm-close-btn"},"Cancel"),e.createElement("button",{onClick:We,className:"crm-send-btn",style:{backgroundColor:d},disabled:ke},ke?"Capturing…":"Allow & Capture")))),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:U,onChange:function(e){return q(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),qe())},placeholder:"resolved"===ye?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===ye}),e.createElement("button",{onClick:qe,disabled:!U.trim()||Z||"resolved"===ye,className:"crm-send-btn",style:{backgroundColor:d}},Z?e.createElement("svg",{className:"crm-icon-sm crm-spin",fill:"none",viewBox:"0 0 24 24"},e.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})):e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})))),e.createElement("p",{className:"crm-input-hint"},fe?"Press Enter to send • Shift+Enter for new line":"Send your first message to start conversation"))),"ticket"===Re&&e.createElement(sn,{apiKey:s,apiUrl:c,primaryColor:d,userData:Ie(),theme:R,onClose:function(){Te(null),Ae(!0)}}))};export{an as ChatCRMWidget,sn as TicketBoard};
4
4
  //# sourceMappingURL=index.esm.js.map