bitmax-crm-widget 1.5.4 β 1.5.6
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 +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import e,{useState as t,useRef as n,useEffect as r}from"react";function o(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 i(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function a(e){i(s,r,o,a,c,"next",e)}function c(e){i(s,r,o,a,c,"throw",e)}a(void 0)})}}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(){
|
|
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",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return p(l,"_invoke",function(n,r,o){var i,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,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,i=u[t],h=p.p,m=i[2];n>3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return s;throw d=!0,r}return function(o,u,m){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&h(u,m),a=u,c=m;(t=a<2?e:c)||!d;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,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=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(d=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,i),!0),l}var s={};function a(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),h=l.prototype=a.prototype=Object.create(u);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,o,"GeneratorFunction")),e.prototype=Object.create(h),e}return c.prototype=l,p(h,"constructor",l),p(l,"constructor",c),c.displayName="GeneratorFunction",p(l,o,"GeneratorFunction"),p(h),p(h,o,"Generator"),p(h,r,function(){return this}),p(h,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:m}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function i(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},p(e,t,n,r)}function h(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,o,i,s,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))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 m(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 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)?o(e,t):void 0}}const g=Object.create(null);g.open="0",g.close="1",g.ping="2",g.pong="3",g.message="4",g.upgrade="5",g.noop="6";const y=Object.create(null);Object.keys(g).forEach(e=>{y[g[e]]=e});const b={type:"error",data:"parser error"},x="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),v="function"==typeof ArrayBuffer,E=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,w=({type:e,data:t},n,r)=>x&&t instanceof Blob?n?r(t):k(t,r):v&&(t instanceof ArrayBuffer||E(t))?n?r(t):k(new Blob([t]),r):r(g[e]+(t||"")),k=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function C(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let S;const A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)_[A.charCodeAt(e)]=e;const N="function"==typeof ArrayBuffer,R=(e,t)=>{if("string"!=typeof e)return{type:"message",data:B(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:T(e.substring(1),t)};return y[n]?e.length>1?{type:y[n],data:e.substring(1)}:{type:y[n]}:b},T=(e,t)=>{if(N){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=_[e.charCodeAt(t)],r=_[e.charCodeAt(t+1)],o=_[e.charCodeAt(t+2)],i=_[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|o>>2,u[c++]=(3&o)<<6|63&i;return l})(e);return B(n,t)}return{base64:!0,data:e}},B=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,O=String.fromCharCode(30);function F(){return new TransformStream({transform(e,t){!function(e,t){x&&e.data instanceof Blob?e.data.arrayBuffer().then(C).then(t):v&&(e.data instanceof ArrayBuffer||E(e.data))?t(C(e.data)):w(e,!1,e=>{S||(S=new TextEncoder),t(S.encode(e))})}(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let L;function j(e){return e.reduce((e,t)=>e+t.length,0)}function I(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=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 z(e){if(e)return function(e){for(var t in z.prototype)e[t]=z.prototype[t];return e}(e)}z.prototype.on=z.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},z.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},z.prototype.off=z.prototype.removeListener=z.prototype.removeAllListeners=z.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 o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},z.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 o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},z.prototype.emitReserved=z.prototype.emit,z.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},z.prototype.hasListeners=function(e){return!!this.listeners(e).length};const P="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),M="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function D(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const U=M.setTimeout,q=M.clearTimeout;function H(e,t){t.useNativeTimers?(e.setTimeoutFn=U.bind(M),e.clearTimeoutFn=q.bind(M)):(e.setTimeoutFn=M.setTimeout.bind(M),e.clearTimeoutFn=M.clearTimeout.bind(M))}function W(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;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 V(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class K extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class G extends z{constructor(e){super(),this.writable=!1,H(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 K(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=R(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&&443!==Number(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 Y extends G{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(O),r=[];for(let e=0;e<n.length;e++){const o=R(n[e],t);if(r.push(o),"error"===o.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 o=0;e.forEach((e,i)=>{w(e,!1,e=>{r[i]=e,++o===n&&t(r.join(O))})})})(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]=V()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let J=!1;try{J="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const $=J;function X(){}class Q extends Y{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 Z extends z{constructor(e,t,n){super(),this.createRequest=e,H(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=D(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=Z.requestsCount++,Z.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=X,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Z.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(Z.requestsCount=0,Z.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",ee);else if("function"==typeof addEventListener){addEventListener("onpagehide"in M?"pagehide":"unload",ee,!1)}function ee(){for(let e in Z.requests)Z.requests.hasOwnProperty(e)&&Z.requests[e].abort()}const te=function(){const e=ne({xdomain:!1});return e&&null!==e.responseType}();function ne(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||$))return new XMLHttpRequest}catch(e){}if(!t)try{return new(M[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const re="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class oe extends G{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=re?{}:D(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;w(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&P(()=>{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]=V()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ie=M.WebSocket||M.MozWebSocket;const se={websocket:class extends oe{createSocket(e,t,n){return re?new ie(e,t,n):t?new ie(e,t):new ie(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends G{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){L||(L=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(j(n)<1)break;const e=I(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(j(n)<2)break;const e=I(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(j(n)<8)break;const e=I(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(b);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(j(n)<o)break;const e=I(n,o);a.enqueue(R(i?e:L.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(b);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=F();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&P(()=>{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=te&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Z(ne,this.uri(),e)}}},ae=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ce=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function le(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 o=ae.exec(e||""),i={},s=14;for(;s--;)i[ce[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const 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,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,i.query),i}const ue="function"==typeof addEventListener&&"function"==typeof removeEventListener,de=[];ue&&addEventListener("offline",()=>{de.forEach(e=>e())},!1);class pe extends z{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=le(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=le(t.host).host);H(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)),ue&&(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"})},de.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&&pe.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",pe.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+=W(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,P(()=>{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 o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),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(pe.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(),ue&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=de.indexOf(this._offlineEventListener);-1!==e&&de.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}pe.protocol=4;class he extends pe{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;pe.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;pe.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 o(){n||(n=!0,l(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function c(e){t&&e.name!==t.name&&o()}const l=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",i),t.once("close",s),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 me=class extends he{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=>se[e]).filter(e=>!!e)),super(e,n)}};const fe="function"==typeof ArrayBuffer,ge=Object.prototype.toString,ye="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ge.call(Blob),be="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ge.call(File);function xe(e){return fe&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||ye&&e instanceof Blob||be&&e instanceof File}function ve(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ve(e[t]))return!0;return!1}if(xe(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 Ee(e){const t=[],n=e.data,r=e;return r.data=we(n,t),r.attachments=t.length,{packet:r,buffers:t}}function we(e,t){if(!e)return e;if(xe(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]=we(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]=we(e[r],t));return n}return e}function ke(e,t){return e.data=Ce(e.data,t),delete e.attachments,e}function Ce(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]=Ce(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Ce(e[n],t));return e}const Se=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ae;!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"}(Ae||(Ae={}));class _e extends z{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===Ae.BINARY_EVENT;n||t.type===Ae.BINARY_ACK?(t.type=n?Ae.EVENT:Ae.ACK,this.reconstructor=new Ne(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!xe(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===Ae[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ae.BINARY_EVENT||n.type===Ae.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}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(!_e.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 Ae.CONNECT:return Te(t);case Ae.DISCONNECT:return void 0===t;case Ae.CONNECT_ERROR:return"string"==typeof t||Te(t);case Ae.EVENT:case Ae.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Se.indexOf(t[0]));case Ae.ACK:case Ae.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ne{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=ke(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Re=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function Te(e){return"[object Object]"===Object.prototype.toString.call(e)}var Be=Object.freeze({__proto__:null,Decoder:_e,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ae.EVENT&&e.type!==Ae.ACK||!ve(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ae.EVENT?Ae.BINARY_EVENT:Ae.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ae.BINARY_EVENT&&e.type!==Ae.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=Ee(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Ae},isPacketValid:function(e){return"string"==typeof e.nsp&&(void 0===(t=e.id)||Re(t))&&function(e,t){switch(e){case Ae.CONNECT:return void 0===t||Te(t);case Ae.DISCONNECT:return void 0===t;case Ae.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Se.indexOf(t[0]));case Ae.ACK:return Array.isArray(t);case Ae.CONNECT_ERROR:return"string"==typeof t||Te(t);default:return!1}}(e.type,e.data);var t},protocol:5});function Oe(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Fe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Le extends z{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=[Oe(e,"open",this.onopen.bind(this)),Oe(e,"packet",this.onpacket.bind(this)),Oe(e,"error",this.onerror.bind(this)),Oe(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,o;if(Fe.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 i={type:Ae.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=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===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),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 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"))},r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{const o=(e,t)=>e?r(e):n(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 n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{this._queue[0];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:Ae.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 Ae.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 Ae.EVENT:case Ae.BINARY_EVENT:this.onevent(e);break;case Ae.ACK:case Ae.BINARY_ACK:this.onack(e);break;case Ae.DISCONNECT:this.ondisconnect();break;case Ae.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:Ae.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._drainQueue(!0),this.emitReserved("connect")}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:Ae.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 je(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}je.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)},je.prototype.reset=function(){this.attempts=0},je.prototype.setMin=function(e){this.ms=e},je.prototype.setMax=function(e){this.max=e},je.prototype.setJitter=function(e){this.jitter=e};class Ie extends z{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,H(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 je({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||Be;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 me(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Oe(t,"open",function(){n.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Oe(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),o(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(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Oe(e,"ping",this.onping.bind(this)),Oe(e,"data",this.ondata.bind(this)),Oe(e,"error",this.onerror.bind(this)),Oe(e,"close",this.onclose.bind(this)),Oe(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){P(()=>{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 Le(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 ze={};function Pe(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=le(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 o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=ze[o]&&i in ze[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Ie(r,t):(ze[o]||(ze[o]=new Ie(r,t)),a=ze[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Me(e,t){return function(){return e.apply(t,arguments)}}Object.assign(Pe,{Manager:Ie,Socket:Le,io:Pe,connect:Pe});const{toString:De}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:qe,toStringTag:He}=Symbol,We=(e=>t=>{const n=De.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=e=>(e=e.toLowerCase(),t=>We(t)===e),Ke=e=>t=>typeof t===e,{isArray:Ge}=Array,Ye=Ke("undefined");function Je(e){return null!==e&&!Ye(e)&&null!==e.constructor&&!Ye(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=Ve("ArrayBuffer");const Xe=Ke("string"),Qe=Ke("function"),Ze=Ke("number"),et=e=>null!==e&&"object"==typeof e,tt=e=>{if("object"!==We(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||He in e||qe in e)},nt=Ve("Date"),rt=Ve("File"),ot=Ve("Blob"),it=Ve("FileList"),st=Ve("URLSearchParams"),[at,ct,lt,ut]=["ReadableStream","Request","Response","Headers"].map(Ve);function dt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Ge(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Je(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function pt(e,t){if(Je(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,mt=e=>!Ye(e)&&e!==ht;const ft=(gt="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>gt&&e instanceof gt);var gt;const yt=Ve("HTMLFormElement"),bt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xt=Ve("RegExp"),vt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};dt(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Et=Ve("AsyncFunction"),wt=(kt="function"==typeof setImmediate,Ct=Qe(ht.postMessage),kt?setImmediate:Ct?(St=`axios@${Math.random()}`,At=[],ht.addEventListener("message",({source:e,data:t})=>{e===ht&&t===St&&At.length&&At.shift()()},!1),e=>{At.push(e),ht.postMessage(St,"*")}):e=>setTimeout(e));var kt,Ct,St,At;const _t="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ht):"undefined"!=typeof process&&process.nextTick||wt;var Nt={isArray:Ge,isArrayBuffer:$e,isBuffer:Je,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Qe(e.append)&&("formdata"===(t=We(e))||"object"===t&&Qe(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:Xe,isNumber:Ze,isBoolean:e=>!0===e||!1===e,isObject:et,isPlainObject:tt,isEmptyObject:e=>{if(!et(e)||Je(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:at,isRequest:ct,isResponse:lt,isHeaders:ut,isUndefined:Ye,isDate:nt,isFile:rt,isBlob:ot,isRegExp:xt,isFunction:Qe,isStream:e=>et(e)&&Qe(e.pipe),isURLSearchParams:st,isTypedArray:ft,isFileList:it,forEach:dt,merge:function e(){const{caseless:t,skipUndefined:n}=mt(this)&&this||{},r={},o=(o,i)=>{const s=t&&pt(r,i)||i;tt(r[s])&&tt(o)?r[s]=e(r[s],o):tt(o)?r[s]=e({},o):Ge(o)?r[s]=o.slice():n&&Ye(o)||(r[s]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&dt(arguments[e],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(dt(t,(t,r)=>{n&&Qe(t)?e[r]=Me(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 o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:We,kindOfTest:Ve,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(Ge(e))return e;let t=e.length;if(!Ze(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[qe]).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:yt,hasOwnProperty:bt,hasOwnProp:bt,reduceDescriptors:vt,freezeMethods:e=>{vt(e,(t,n)=>{if(Qe(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Qe(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 Ge(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:pt,global:ht,isContextDefined:mt,isSpecCompliantForm:function(e){return!!(e&&Qe(e.append)&&"FormData"===e[He]&&e[qe])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(et(e)){if(t.indexOf(e)>=0)return;if(Je(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Ge(e)?[]:{};return dt(e,(e,t)=>{const i=n(e,r+1);!Ye(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Et,isThenable:e=>e&&(et(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),setImmediate:wt,asap:_t,isIterable:e=>null!=e&&Qe(e[qe])};function Rt(e,t,n,r,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),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}Nt.inherits(Rt,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:Nt.toJSONObject(this.config),code:this.code,status:this.status}}});const Tt=Rt.prototype,Bt={};["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=>{Bt[e]={value:e}}),Object.defineProperties(Rt,Bt),Object.defineProperty(Tt,"isAxiosError",{value:!0}),Rt.from=(e,t,n,r,o,i)=>{const s=Object.create(Tt);Nt.toFlatObject(e,s,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 Rt.call(s,a,c,n,r,o),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",i&&Object.assign(s,i),s};function Ot(e){return Nt.isPlainObject(e)||Nt.isArray(e)}function Ft(e){return Nt.endsWith(e,"[]")?e.slice(0,-2):e}function Lt(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ft(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const jt=Nt.toFlatObject(Nt,{},null,function(e){return/^is[A-Z]/.test(e)});function It(e,t,n){if(!Nt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Nt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Nt.isUndefined(t[e])})).metaTokens,o=n.visitor||l,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Nt.isSpecCompliantForm(t);if(!Nt.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Nt.isDate(e))return e.toISOString();if(Nt.isBoolean(e))return e.toString();if(!a&&Nt.isBlob(e))throw new Rt("Blob is not supported. Use a Buffer instead.");return Nt.isArrayBuffer(e)||Nt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(Nt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Nt.isArray(e)&&function(e){return Nt.isArray(e)&&!e.some(Ot)}(e)||(Nt.isFileList(e)||Nt.endsWith(n,"[]"))&&(a=Nt.toArray(e)))return n=Ft(n),a.forEach(function(e,r){!Nt.isUndefined(e)&&null!==e&&t.append(!0===s?Lt([n],r,i):null===s?n:n+"[]",c(e))}),!1;return!!Ot(e)||(t.append(Lt(o,n,i),c(e)),!1)}const u=[],d=Object.assign(jt,{defaultVisitor:l,convertValue:c,isVisitable:Ot});if(!Nt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Nt.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Nt.forEach(n,function(n,i){!0===(!(Nt.isUndefined(n)||null===n)&&o.call(t,n,Nt.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function zt(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&&It(e,this,t)}const Mt=Pt.prototype;function Dt(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||Dt;Nt.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(t,n):Nt.isURLSearchParams(t)?t.toString():new Pt(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Mt.append=function(e,t){this._pairs.push([e,t])},Mt.toString=function(e){const t=e?function(t){return e.call(this,t,zt)}:zt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qt{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){Nt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ht={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wt={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 Vt="undefined"!=typeof window&&"undefined"!=typeof document,Kt="object"==typeof navigator&&navigator||void 0,Gt=Vt&&(!Kt||["ReactNative","NativeScript","NS"].indexOf(Kt.product)<0),Yt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Jt=Vt&&window.location.href||"http://localhost";var $t={...Object.freeze({__proto__:null,hasBrowserEnv:Vt,hasStandardBrowserEnv:Gt,hasStandardBrowserWebWorkerEnv:Yt,navigator:Kt,origin:Jt}),...Wt};function Xt(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&Nt.isArray(r)?r.length:i,a)return Nt.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Nt.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Nt.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(Nt.isFormData(e)&&Nt.isFunction(e.entries)){const n={};return Nt.forEachEntry(e,(e,r)=>{t(function(e){return Nt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Qt={transitional:Ht,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Nt.isObject(e);o&&Nt.isHTMLForm(e)&&(e=new FormData(e));if(Nt.isFormData(e))return r?JSON.stringify(Xt(e)):e;if(Nt.isArrayBuffer(e)||Nt.isBuffer(e)||Nt.isStream(e)||Nt.isFile(e)||Nt.isBlob(e)||Nt.isReadableStream(e))return e;if(Nt.isArrayBufferView(e))return e.buffer;if(Nt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return It(e,new $t.classes.URLSearchParams,{visitor:function(e,t,n,r){return $t.isNode&&Nt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Nt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return It(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Nt.isString(e))try{return(t||JSON.parse)(e),Nt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Qt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Nt.isResponse(e)||Nt.isReadableStream(e))return e;if(e&&Nt.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 Rt.from(e,Rt.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}}};Nt.forEach(["delete","get","head","post","put","patch"],e=>{Qt.headers[e]={}});const Zt=Nt.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 en=Symbol("internals");function tn(e){return e&&String(e).trim().toLowerCase()}function nn(e){return!1===e||null==e?e:Nt.isArray(e)?e.map(nn):String(e)}function rn(e,t,n,r,o){return Nt.isFunction(r)?r.call(this,t,n):(o&&(t=n),Nt.isString(t)?Nt.isString(r)?-1!==t.indexOf(r):Nt.isRegExp(r)?r.test(t):void 0:void 0)}let on=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=tn(t);if(!o)throw new Error("header name must be a non-empty string");const i=Nt.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=nn(e))}const i=(e,t)=>Nt.forEach(e,(e,n)=>o(e,n,t));if(Nt.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Nt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Zt[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(Nt.isObject(e)&&Nt.isIterable(e)){let n,r,o={};for(const t of e){if(!Nt.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Nt.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=tn(e)){const n=Nt.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(Nt.isFunction(t))return t.call(this,e,n);if(Nt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=tn(e)){const n=Nt.findKey(this,e);return!(!n||void 0===this[n]||t&&!rn(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=tn(e)){const o=Nt.findKey(n,e);!o||t&&!rn(0,n[o],o,t)||(delete n[o],r=!0)}}return Nt.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!rn(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Nt.forEach(this,(r,o)=>{const i=Nt.findKey(n,o);if(i)return t[i]=nn(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=nn(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Nt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Nt.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[en]=this[en]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=tn(e);t[r]||(!function(e,t){const n=Nt.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Nt.isArray(e)?e.forEach(r):r(e),this}};function sn(e,t){const n=this||Qt,r=t||n,o=on.from(r.headers);let i=r.data;return Nt.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function an(e){return!(!e||!e.__CANCEL__)}function cn(e,t,n){Rt.call(this,null==e?"canceled":e,Rt.ERR_CANCELED,t,n),this.name="CanceledError"}function ln(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Rt("Request failed with status code "+n.status,[Rt.ERR_BAD_REQUEST,Rt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}on.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Nt.reduceDescriptors(on.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Nt.freezeMethods(on),Nt.inherits(cn,Rt,{__CANCEL__:!0});const un=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[s];o||(o=c),n[i]=a,r[i]=c;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+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 n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,c=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},dn=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},pn=e=>(...t)=>Nt.asap(()=>e(...t));var hn=$t.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$t.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,mn=$t.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Nt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Nt.isString(r)&&a.push(`path=${r}`),Nt.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),Nt.isString(s)&&a.push(`SameSite=${s}`),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 fn(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 gn=e=>e instanceof on?{...e}:e;function yn(e,t){t=t||{};const n={};function r(e,t,n,r){return Nt.isPlainObject(e)&&Nt.isPlainObject(t)?Nt.merge.call({caseless:r},e,t):Nt.isPlainObject(t)?Nt.merge({},t):Nt.isArray(t)?t.slice():t}function o(e,t,n,o){return Nt.isUndefined(t)?Nt.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Nt.isUndefined(t))return r(void 0,t)}function s(e,t){return Nt.isUndefined(t)?Nt.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(gn(e),gn(t),0,!0)};return Nt.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,s=i(e[r],t[r],r);Nt.isUndefined(s)&&i!==a||(n[r]=s)}),n}var bn=e=>{const t=yn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=on.from(s),t.url=Ut(fn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Nt.isFormData(n))if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Nt.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if($t.hasStandardBrowserEnv&&(r&&Nt.isFunction(r)&&(r=r(t)),r||!1!==r&&hn(t.url))){const e=o&&i&&mn.read(i);e&&s.set(o,e)}return t};var xn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=bn(e);let o=r.data;const i=on.from(r.headers).normalize();let s,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:h}=r;function m(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let f=new XMLHttpRequest;function g(){if(!f)return;const r=on.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());ln(function(e){t(e),m()},function(e){n(e),m()},{data:d&&"text"!==d&&"json"!==d?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f}),f=null}f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout,"onloadend"in f?f.onloadend=g:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(g)},f.onabort=function(){f&&(n(new Rt("Request aborted",Rt.ECONNABORTED,e,f)),f=null)},f.onerror=function(t){const r=new Rt(t&&t.message?t.message:"Network Error",Rt.ERR_NETWORK,e,f);r.event=t||null,n(r),f=null},f.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ht;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Rt(t,o.clarifyTimeoutError?Rt.ETIMEDOUT:Rt.ECONNABORTED,e,f)),f=null},void 0===o&&i.setContentType(null),"setRequestHeader"in f&&Nt.forEach(i.toJSON(),function(e,t){f.setRequestHeader(t,e)}),Nt.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),d&&"json"!==d&&(f.responseType=r.responseType),h&&([c,u]=un(h,!0),f.addEventListener("progress",c)),p&&f.upload&&([a,l]=un(p),f.upload.addEventListener("progress",a),f.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(s=t=>{f&&(n(!t||t.type?new cn(null,e,f):t),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===$t.protocols.indexOf(y)?n(new Rt("Unsupported protocol "+y+":",Rt.ERR_BAD_REQUEST,e)):f.send(o||null)})};const vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Rt?t:new cn(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Rt(`timeout ${t} of ms exceeded`,Rt.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=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}=r;return a.unsubscribe=()=>Nt.asap(s),a}},En=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},wn=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()}},kn=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of wn(e))yield*En(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Cn}=Nt,Sn=(({Request:e,Response:t})=>({Request:e,Response:t}))(Nt.global),{ReadableStream:An,TextEncoder:_n}=Nt.global,Nn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Rn=e=>{e=Nt.merge.call({skipUndefined:!0},Sn,e);const{fetch:t,Request:n,Response:r}=e,o=t?Cn(t):"function"==typeof fetch,i=Cn(n),s=Cn(r);if(!o)return!1;const a=o&&Cn(An),c=o&&("function"==typeof _n?(l=new _n,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=i&&a&&Nn(()=>{let e=!1;const t=new n($t.origin,{body:new An,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=s&&a&&Nn(()=>Nt.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Rt(`Response type '${e}' is not supported`,Rt.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Nt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Nt.isBlob(e))return e.size;if(Nt.isSpecCompliantForm(e)){const t=new n($t.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Nt.isArrayBufferView(e)||Nt.isArrayBuffer(e)?e.byteLength:(Nt.isURLSearchParams(e)&&(e+=""),Nt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:c,cancelToken:l,timeout:m,onDownloadProgress:f,onUploadProgress:g,responseType:y,headers:b,withCredentials:x="same-origin",fetchOptions:v}=bn(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let w=vn([c,l&&l.toAbortSignal()],m),k=null;const C=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let S;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(S=await h(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(Nt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=dn(S,un(pn(g)));a=kn(t.body,65536,e,n)}}Nt.isString(x)||(x=x?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:w,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?x:void 0};k=i&&new n(o,c);let l=await(i?E(k,v):E(o,c));const m=d&&("stream"===y||"response"===y);if(d&&(f||m&&C)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Nt.toFiniteNumber(l.headers.get("content-length")),[n,o]=f&&dn(t,un(pn(f),!0))||[];l=new r(kn(l.body,65536,n,()=>{o&&o(),C&&C()}),e)}y=y||"text";let A=await p[Nt.findKey(p,y)||"text"](l,e);return!m&&C&&C(),await new Promise((t,n)=>{ln(t,n,{data:A,headers:on.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(C&&C(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Rt("Network Error",Rt.ERR_NETWORK,e,k),{cause:t.cause||t});throw Rt.from(t,t&&t.code,e,k)}}},Tn=new Map,Bn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,l=Tn;for(;c--;)s=i[c],a=l.get(s),void 0===a&&l.set(s,a=c?new Map:Rn(t)),l=a;return a};Bn();const On={http:null,xhr:xn,fetch:{get:Bn}};Nt.forEach(On,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Fn=e=>`- ${e}`,Ln=e=>Nt.isFunction(e)||null===e||!1===e;var jn={getAdapter:function(e,t){e=Nt.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ln(r)&&(o=On[(n=String(r)).toLowerCase()],void 0===o))throw new Rt(`Unknown adapter '${n}'`);if(o&&(Nt.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Rt("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Fn).join("\n"):" "+Fn(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o},adapters:On};function In(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new cn(null,e)}function zn(e){In(e),e.headers=on.from(e.headers),e.data=sn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return jn.getAdapter(e.adapter||Qt.adapter,e)(e).then(function(t){return In(e),t.data=sn.call(e,e.transformResponse,t),t.headers=on.from(t.headers),t},function(t){return an(t)||(In(e),t&&t.response&&(t.response.data=sn.call(e,e.transformResponse,t.response),t.response.headers=on.from(t.response.headers))),Promise.reject(t)})}const Pn="1.13.2",Mn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Mn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Dn={};Mn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Pn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Rt(r(o," has been removed"+(t?" in "+t:"")),Rt.ERR_DEPRECATED);return t&&!Dn[o]&&(Dn[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Mn.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 Rt("options must be an object",Rt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new Rt("option "+i+" must be "+n,Rt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Rt("Unknown option "+i,Rt.ERR_BAD_OPTION)}},validators:Mn};const qn=Un.validators;let Hn=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 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=yn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Un.assertOptions(n,{silentJSONParsing:qn.transitional(qn.boolean),forcedJSONParsing:qn.transitional(qn.boolean),clarifyTimeoutError:qn.transitional(qn.boolean)},!1),null!=r&&(Nt.isFunction(r)?t.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:qn.function,serialize:qn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Un.assertOptions(t,{baseUrl:qn.spelling("baseURL"),withXsrfToken:qn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Nt.merge(o.common,o[t.method]);o&&Nt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=on.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.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=[zn.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=s.length;let p=t;for(;d<u;){const e=s[d++],t=s[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=zn.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(fn((e=yn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Nt.forEach(["delete","get","head","options"],function(e){Hn.prototype[e]=function(t,n){return this.request(yn(n||{},{method:e,url:t,data:(n||{}).data}))}}),Nt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(yn(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Hn.prototype[e]=t(),Hn.prototype[e+"Form"]=t(!0)});const Wn={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(Wn).forEach(([e,t])=>{Wn[t]=e});const Vn=function e(t){const n=new Hn(t),r=Me(Hn.prototype.request,n);return Nt.extend(r,Hn.prototype,n,{allOwnKeys:!0}),Nt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(yn(t,n))},r}(Qt);Vn.Axios=Hn,Vn.CanceledError=cn,Vn.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,o){n.reason||(n.reason=new cn(e,r,o),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}}},Vn.isCancel=an,Vn.VERSION=Pn,Vn.toFormData=It,Vn.AxiosError=Rt,Vn.Cancel=Vn.CanceledError,Vn.all=function(e){return Promise.all(e)},Vn.spread=function(e){return function(t){return e.apply(null,t)}},Vn.isAxiosError=function(e){return Nt.isObject(e)&&!0===e.isAxiosError},Vn.mergeConfig=yn,Vn.AxiosHeaders=on,Vn.formToJSON=e=>Xt(Nt.isHTMLForm(e)?new FormData(e):e),Vn.getAdapter=jn.getAdapter,Vn.HttpStatusCode=Wn,Vn.default=Vn;const{Axios:Kn,AxiosError:Gn,CanceledError:Yn,isCancel:Jn,CancelToken:$n,VERSION:Xn,all:Qn,Cancel:Zn,isAxiosError:er,spread:tr,toFormData:nr,AxiosHeaders:rr,HttpStatusCode:or,formToJSON:ir,getAdapter:sr,mergeConfig:ar}=Vn;var cr=function(o){var i=o.apiKey,a=o.apiUrl,c=o.primaryColor,l=void 0===c?"#4F46E5":c,p=o.userData,f=void 0===p?null:p,g=o.theme,y=void 0===g?"light":g,b=o.onClose,x=h(t("create"),2),v=x[0],E=x[1],w=h(t([]),2),k=w[0],C=w[1],S=h(t(null),2),A=S[0],_=S[1],N=h(t([]),2),R=N[0],T=N[1],B=h(t(!1),2),O=B[0],F=B[1],L=h(t(""),2),j=L[0],I=L[1],z=h(t(""),2),P=z[0],M=z[1],D=h(t([]),2),U=D[0],q=D[1],H=h(t(null),2),W=H[0],V=H[1],K=h(t(!1),2);K[0],K[1];var G=h(t(""),2);G[0],G[1];var Y=h(t("success"),2);Y[0],Y[1];var J=h(t([]),2),$=J[0],X=J[1],Q=n(null),Z=n(null),ee=h(t({subject:"",message:"",htmlMessage:"",priority:"medium",category:"general",attachments:[]}),2),te=ee[0],ne=ee[1],re="dark"===y||"auto"===y&&window.matchMedia("(prefers-color-scheme: dark)").matches,oe=function(e){V(e),setTimeout(function(){return V(null)},4e3)},ie=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success",n=Date.now(),r={id:n,message:e,type:t};X(function(e){return[].concat(m(e),[r])}),setTimeout(function(){X(function(e){return e.filter(function(e){return e.id!==n})})},4e3)},se=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;document.execCommand(e,!1,n),null===(t=Z.current)||void 0===t||t.focus()},ae=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Array.from(e.target.files),r=t?U.length:te.attachments.length;if(r+n.length>10)return oe("You can only select up to 10 files total. You have ".concat(r," files already selected and are trying to add ").concat(n.length," more.")),void(e.target.value="");var o=n.filter(function(e){return e.size<=10485760?!!["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/svg+xml","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel.sheet.macroEnabled.12","text/csv","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/rtf","application/rtf","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"].includes(e.type)||(oe('File "'.concat(e.name,'" is not supported. Allowed: Images, PDF, Word, Excel, PowerPoint, Text files, Archives (ZIP, RAR, 7Z).')),!1):(oe('File "'.concat(e.name,'" is too large. Maximum size is 10MB per file.')),!1)});t?q(function(e){return[].concat(m(e),m(o))}):ne(function(e){return u(u({},e),{},{attachments:[].concat(m(e.attachments),m(o))})}),e.target.value=""},ce=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?q(function(t){return t.filter(function(t,n){return n!==e})}):ne(function(t){return u(u({},t),{},{attachments:t.attachments.filter(function(t,n){return n!==e})})})};r(function(){"create"===v||A||le()},[v]),r(function(){A?(T([]),ue(A.ticketId)):T([])},[A]);var le=function(){var e=s(d().m(function e(){var t,n,r;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(F(!0),e.p=1,(t=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")}).email){e.n=2;break}return console.error("No customer email available"),ie("Please provide your email to view tickets","error"),F(!1),e.a(2);case 2:return e.n=3,Vn.get("".concat(a,"/api/v1/email-ticketing/tickets"),{headers:{"x-api-key":i},params:{status:"all",customerEmail:t.email},timeout:3e4});case 3:(n=e.v).data.success&&C(n.data.data.tickets||[]),e.n=5;break;case 4:e.p=4,r=e.v,console.error("Error fetching tickets:",r),ie("Failed to load tickets","error");case 5:return e.p=5,F(!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=s(d().m(function e(t){var n,r,o,s;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return F(!0),e.p=1,n=f||{email:localStorage.getItem("chatGuestEmail")||"guest@example.com",name:localStorage.getItem("chatGuestName")||"Guest User"},console.log("Fetching messages for ticket:",t,"user:",n.email),e.n=2,Vn.get("".concat(a,"/api/v1/email-ticketing/tickets/").concat(t,"/messages"),{headers:{"x-api-key":i},params:{customerEmail:n.email},timeout:3e4});case 2:r=e.v,console.log("Messages response:",r.data),r.data.success&&(T(r.data.messages||[]),console.log("Set messages:",(null===(o=r.data.messages)||void 0===o?void 0:o.length)||0)),e.n=4;break;case 3:e.p=3,s=e.v,console.error("Error fetching messages:",s),T([]);case 4:return e.p=4,F(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),de=function(){var e=s(d().m(function e(t){var n,r,o,s,c,l;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),F(!0),e.p=1,(n=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")||"Guest User"}).email){e.n=2;break}return ie("β You can't raise ticket without login","error"),F(!1),e.a(2);case 2:return(r=n.email)&&"guest@example.com"!==r&&localStorage.setItem("chatGuestEmail",r),(o=new FormData).append("subject",te.subject),o.append("message",te.message),o.append("html",te.htmlMessage),o.append("priority",te.priority),o.append("category",te.category),o.append("customerEmail",r),o.append("customerName",n.name),te.attachments.forEach(function(e){o.append("attachments",e)}),e.n=3,Vn.post("".concat(a,"/api/v1/email-ticketing/tickets"),o,{headers:{"x-api-key":i},timeout:3e4});case 3:s=e.v,console.log("Ticket creation response:",s.data),s.data.success&&(ie("β
Ticket created successfully!","success"),ne({subject:"",message:"",htmlMessage:"",priority:"medium",category:"general",attachments:[]}),Z.current&&(Z.current.innerHTML=""),E("myTickets")),e.n=5;break;case 4:e.p=4,l=e.v,console.error("Error creating ticket:",l),"ECONNABORTED"===l.code?ie("β±οΈ Server timeout. The server may be waking up. Please wait a moment and try again.","error"):l.response?ie("β Failed to create ticket: ".concat((null===(c=l.response.data)||void 0===c?void 0:c.message)||"Server error"),"error"):l.request?ie("β Cannot reach server. Please check your connection or try again later.","error"):ie("β Failed to create ticket. Please try again.","error");case 5:return e.p=5,F(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),pe=function(){var e=s(d().m(function e(t){var n,r,o,s;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),j.trim()||0!==U.length){e.n=1;break}return e.a(2);case 1:return F(!0),e.p=2,n=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")},(r=new FormData).append("ticketId",A.ticketId),r.append("message",j),r.append("html",P),r.append("senderType","customer"),r.append("customerEmail",n.email),U.forEach(function(e){r.append("attachments",e)}),e.n=3,Vn.post("".concat(a,"/api/v1/email-ticketing/tickets/widget/reply"),r,{headers:{"x-api-key":i},timeout:3e4});case 3:e.v.data.success&&(ie("β
Reply sent successfully!","success"),I(""),M(""),q([]),Z.current&&(Z.current.innerHTML=""),setTimeout(function(){ue(A.ticketId)},500)),e.n=5;break;case 4:e.p=4,s=e.v,console.error("Error sending reply:",s),"ECONNABORTED"===s.code?ie("β±οΈ Request timeout. Server may be starting up. Please try again in 30 seconds.","error"):s.response?ie("β Failed to send reply: ".concat((null===(o=s.response.data)||void 0===o?void 0:o.message)||"Server error"),"error"):s.request?ie("β Cannot reach server. Please check your connection.","error"):ie("β Failed to send reply. Please try again.","error");case 5:return e.p=5,F(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),he=function(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},me=function(e){switch(e){case"open":return"#10B981";case"pending":return"#F59E0B";default:return"#6B7280"}},fe=function(e){switch(e){case"high":return"#EF4444";case"medium":return"#F59E0B";case"low":return"#10B981";default:return"#6B7280"}},ge=function(t){return t.startsWith("image/")?e.createElement("svg",{style:{width:"20px",height:"20px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})):e.createElement("svg",{style:{width:"20px",height:"20px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"}))},ye=function(t){var n=t.onCommand,r=t.showSendButton,o=void 0!==r&&r,i=t.onSend,s=void 0===i?null:i,a=t.isLoading,c=void 0!==a&&a,u=t.canSend,d=void 0!==u&&u;return e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#F9FAFB"}},e.createElement("div",{style:{display:"flex",gap:"4px",alignItems:"center"}},e.createElement("button",{type:"button",onClick:function(){return n("bold")},style:be,title:"Bold"},e.createElement("strong",null,"B")),e.createElement("button",{type:"button",onClick:function(){return n("italic")},style:be,title:"Italic"},e.createElement("em",null,"I")),e.createElement("button",{type:"button",onClick:function(){return n("underline")},style:be,title:"Underline"},e.createElement("u",null,"U")),e.createElement("button",{type:"button",onClick:function(){return n("strikeThrough")},style:be,title:"Strikethrough"},e.createElement("s",null,"S")),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("justifyLeft")},style:be,title:"Align Left"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}))),e.createElement("button",{type:"button",onClick:function(){return n("justifyCenter")},style:be,title:"Align Center"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}))),e.createElement("button",{type:"button",onClick:function(){return n("justifyRight")},style:be,title:"Align Right"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("insertUnorderedList")},style:be,title:"Bullet List"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"}))),e.createElement("button",{type:"button",onClick:function(){return n("insertOrderedList")},style:be,title:"Numbered List"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("indent")},style:be,title:"Increase Indent"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}))),e.createElement("button",{type:"button",onClick:function(){return n("outdent")},style:be,title:"Decrease Indent"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zM3 8l4 4 4-4H3zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("insertHorizontalRule")},style:be,title:"Insert Line"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"}))),e.createElement("button",{type:"button",onClick:function(){var e;return null===(e=Q.current)||void 0===e?void 0:e.click()},style:be,title:"Attach File"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})))),o&&e.createElement("button",{type:"button",onClick:s,disabled:c||!d,style:{padding:"6px 16px",fontSize:"12px",fontWeight:600,color:"#fff",backgroundColor:l,border:"none",borderRadius:"6px",cursor:c||!d?"not-allowed":"pointer",opacity:c||!d?.5:1,display:"flex",alignItems:"center",gap:"4px",transition:"all 0.2s"},title:c?"Sending...":"Send Reply"},c?e.createElement(e.Fragment,null,e.createElement("svg",{style:{width:"12px",height:"12px",animation:"spin 1s linear infinite"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})),"Sending..."):e.createElement(e.Fragment,null,e.createElement("svg",{style:{width:"12px",height:"12px"},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"})),"Send")))},be={background:"none",border:"none",padding:"6px 10px",borderRadius:"4px",cursor:"pointer",color:re?"#F9FAFB":"#111827",fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"};return e.createElement(e.Fragment,null,e.createElement("style",null,"\n .ticket-message-content ul,\n .ticket-message-content ol {\n margin-left: 1.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .ticket-message-content ul {\n list-style-type: disc;\n }\n .ticket-message-content ol {\n list-style-type: decimal;\n }\n .ticket-message-content li {\n margin-bottom: 0.25rem;\n }\n .ticket-editor[contenteditable] {\n max-width: 100%;\n word-break: break-word;\n overflow-wrap: break-word;\n }\n .ticket-editor ul,\n .ticket-editor ol {\n margin-left: 1.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .ticket-editor ul {\n list-style-type: disc;\n }\n .ticket-editor ol {\n list-style-type: decimal;\n }\n .ticket-editor li {\n margin-bottom: 0.25rem;\n }\n .ticket-editor:empty:before {\n content: attr(placeholder);\n color: #9CA3AF;\n pointer-events: none;\n }\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes modalAppear {\n from { \n transform: scale(0.9);\n opacity: 0;\n }\n to { \n transform: scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromRight {\n from {\n transform: translateX(100%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n @keyframes slideOutToRight {\n from {\n transform: translateX(0);\n opacity: 1;\n }\n to {\n transform: translateX(100%);\n opacity: 0;\n }\n }\n "),e.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:re?"#111827":"#F9FAFB",zIndex:999999,display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",padding:"8px 16px",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:l,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:re?"#F9FAFB":"#111827"}},"Support Tickets"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"13px",color:re?"#9CA3AF":"#6B7280"}},"Manage your support requests"))),e.createElement("button",{onClick:b,style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",color:re?"#9CA3AF":"#6B7280"}},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:{flex:1,display:"flex",overflow:"hidden"}},e.createElement("div",{style:{width:"200px",backgroundColor:re?"#1F2937":"#fff",borderRight:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexDirection:"column",padding:"16px 0"}},e.createElement("button",{onClick:function(){E("create"),_(null)},style:{padding:"12px 20px",border:"none",backgroundColor:"create"===v?"".concat(l,"15"):"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"create"===v?l:re?"#D1D5DB":"#6B7280",textAlign:"left",borderLeft:"create"===v?"3px solid ".concat(l):"3px solid transparent",transition:"all 0.2s"}},"Create Ticket"),e.createElement("button",{onClick:function(){E("myTickets"),_(null)},style:{padding:"12px 20px",border:"none",backgroundColor:"myTickets"===v?"".concat(l,"15"):"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"myTickets"===v?l:re?"#D1D5DB":"#6B7280",textAlign:"left",borderLeft:"myTickets"===v?"3px solid ".concat(l):"3px solid transparent",transition:"all 0.2s"}},"My Tickets")),e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}},"create"===v&&e.createElement("div",{style:{flex:1,overflow:"auto",padding:"24px"}},e.createElement("div",{style:{maxWidth:"800px",margin:"0 auto"}},null!=f&&f.email||localStorage.getItem("chatGuestEmail")?e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderRadius:"12px",padding:"24px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:re?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h2",{style:{margin:"0 0 16px 0",fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Create New Support Ticket"),e.createElement("form",{onSubmit:de},e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:re?"#F9FAFB":"#111827"}},"Subject *"),e.createElement("input",{type:"text",name:"subject",value:te.subject,onChange:function(e){return ne(function(t){return u(u({},t),{},{subject:e.target.value})})},required:!0,placeholder:"Brief description of your issue",style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827",outline:"none"}})),e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:re?"#F9FAFB":"#111827"}},"Description *"),e.createElement("div",{style:{border:re?"1px solid #374151":"1px solid #D1D5DB",borderRadius:"8px",overflow:"hidden"}},e.createElement(ye,{onCommand:se}),e.createElement("div",{ref:Z,className:"ticket-editor",contentEditable:!0,onInput:function(e){var t=e.target.innerHTML,n=e.target.innerText;ne(function(e){return u(u({},e),{},{htmlMessage:t,message:n})})},placeholder:"Provide detailed information about your issue...",style:{minHeight:"150px",maxHeight:"300px",overflowY:"auto",padding:"12px",fontSize:"14px",color:re?"#F9FAFB":"#111827",backgroundColor:re?"#111827":"#fff",outline:"none"}}),e.createElement("input",{ref:Q,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.xlsm,.csv,.ppt,.pptx,.txt,.rtf,.zip,.rar,.7z",onChange:function(e){return ae(e,!1)},style:{display:"none"}}),te.attachments.length>0&&e.createElement("div",{style:{padding:"8px 12px",borderTop:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexWrap:"wrap",gap:"8px"}},te.attachments.map(function(t,n){return e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"6px",backgroundColor:re?"#374151":"#F3F4F6",fontSize:"12px",color:re?"#F9FAFB":"#111827"}},ge(t.type),e.createElement("span",null,t.name),e.createElement("button",{type:"button",onClick:function(){return ce(n,!1)},style:{background:"none",border:"none",cursor:"pointer",padding:"2px",color:"#EF4444"}},"Γ"))})))),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:re?"#F9FAFB":"#111827"}},"Priority"),e.createElement("select",{value:te.priority,onChange:function(e){return ne(function(t){return u(u({},t),{},{priority:e.target.value})})},style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827"}},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:re?"#F9FAFB":"#111827"}},"Category"),e.createElement("select",{value:te.category,onChange:function(e){return ne(function(t){return u(u({},t),{},{category:e.target.value})})},style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827"}},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:O||!te.subject||!te.message,style:{width:"100%",padding:"12px 24px",fontSize:"14px",fontWeight:600,color:"#fff",backgroundColor:l,border:"none",borderRadius:"8px",cursor:O?"not-allowed":"pointer",opacity:!O&&te.subject&&te.message?1:.5}},O?"Creating Ticket...":"Submit Ticket"))):e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderRadius:"12px",padding:"48px 24px",textAlign:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:re?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("div",{style:{width:"80px",height:"80px",margin:"0 auto 24px",borderRadius:"50%",backgroundColor:"#FEE2E2",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{style:{width:"40px",height:"40px",color:"#EF4444"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"}))),e.createElement("h2",{style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Login Required"),e.createElement("p",{style:{margin:"0 0 24px 0",fontSize:"14px",color:re?"#9CA3AF":"#6B7280",lineHeight:"1.5"}},"You can't raise ticket without login. Please login to your account to create support tickets.")))),"myTickets"===v&&e.createElement("div",{style:{flex:1,display:"flex",overflow:"hidden"}},e.createElement("div",{style:{width:"320px",borderRight:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#F9FAFB",display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{padding:"16px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",flexShrink:0}},e.createElement("h3",{style:{margin:0,fontSize:"14px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"My Tickets")),e.createElement("div",{style:{flex:1,overflow:"auto"}},O?e.createElement("div",{style:{textAlign:"center",padding:"40px",color:re?"#9CA3AF":"#6B7280"}},"Loading tickets..."):0===k.length?e.createElement("div",{style:{textAlign:"center",padding:"40px"}},e.createElement("p",{style:{margin:0,fontSize:"14px",color:re?"#9CA3AF":"#6B7280"}},"No tickets found")):e.createElement("div",{style:{padding:"8px"}},k.map(function(t){var n=t.hasUnreadMessages||t.lastActivityAt&&new Date(t.lastActivityAt)>new Date(t.lastViewedAt||0),r=A&&A._id===t._id;return e.createElement("div",{key:t._id,onClick:function(){return _(t)},style:{padding:"12px",marginBottom:"8px",borderRadius:"8px",cursor:"pointer",backgroundColor:r?re?"#374151":"#fff":re?"#1F2937":"#fff",border:r?"2px solid ".concat(l):n?"2px solid ".concat(l,"40"):re?"1px solid #374151":"1px solid #E5E7EB",transition:"all 0.2s",position:"relative"}},n&&e.createElement("div",{style:{position:"absolute",top:"8px",right:"8px",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#EF4444"}}),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}},e.createElement("h4",{style:{margin:0,fontSize:"13px",fontWeight:r?700:600,color:re?"#F9FAFB":"#111827",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1}},t.subject),e.createElement("button",{onClick:function(e){e.stopPropagation(),A&&A._id===t._id?ue(t.ticketId):le()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.7,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.7",e.target.style.backgroundColor="transparent"},title:"Refresh"},e.createElement("svg",{style:{width:"14px",height:"14px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})))),e.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"11px",color:re?"#9CA3AF":"#6B7280"}},t.ticketId),e.createElement("p",{style:{margin:"0 0 6px 0",fontSize:"11px",color:re?"#9CA3AF":"#6B7280"}},he(t.createdAt)),e.createElement("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"}},e.createElement("span",{style:{padding:"2px 6px",fontSize:"10px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(me(t.status),"20"),color:me(t.status)}},t.status),e.createElement("span",{style:{padding:"2px 6px",fontSize:"10px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(fe(t.priority),"20"),color:fe(t.priority)}},t.priority)))})))),A?e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{padding:"8px 16px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#fff"}},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"2px"}},e.createElement("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},A.subject),e.createElement("span",{style:{padding:"2px 8px",fontSize:"11px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(me(A.status),"20"),color:me(A.status)}},A.status)),e.createElement("p",{style:{margin:0,fontSize:"13px",color:re?"#9CA3AF":"#6B7280"}},A.ticketId)),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("button",{onClick:function(){return ue(A.ticketId)},style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"6px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.8,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.8",e.target.style.backgroundColor="transparent"},title:"Refresh conversation"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))),e.createElement("button",{onClick:function(){return _(null)},style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"6px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.8,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.8",e.target.style.backgroundColor="transparent"},title:"Close"},e.createElement("svg",{style:{width:"18px",height:"18px"},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:{flex:1,overflow:"auto",padding:"16px 24px"}},O?e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px",color:re?"#9CA3AF":"#6B7280"}},e.createElement("div",{style:{width:"20px",height:"20px",border:"2px solid ".concat(l),borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 1s linear infinite",marginRight:"10px"}}),j.trim()||U.length>0?"Sending reply...":"Loading conversation..."):0===R.length?e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px",color:re?"#9CA3AF":"#6B7280",textAlign:"center"}},"No messages in this conversation yet."):R.map(function(t,n){var r;return e.createElement("div",{key:t._id||n,style:{marginBottom:"16px",width:"100%"}},e.createElement("div",{style:{width:"100%",backgroundColor:"customer"===t.senderType?re?"#1E3A8A20":"#DBEAFE":re?"#1F2937":"#F3F4F6",borderRadius:"8px",padding:"12px",border:re?"customer"===t.senderType?"1px solid #1E40AF":"1px solid #374151":"customer"===t.senderType?"1px solid #93C5FD":"1px solid #E5E7EB"}},e.createElement("div",{style:{fontSize:"12px",color:re?"#9CA3AF":"#6B7280",marginBottom:"8px",display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:500}},e.createElement("span",null,"customer"===t.senderType?t.senderName||"You":((null===(r=t.sender)||void 0===r?void 0:r.alias)||t.senderName||"AGENT").toUpperCase()),e.createElement("span",null,he(t.createdAt))),e.createElement("div",{className:"ticket-message-content",style:{color:re?"#F9FAFB":"#111827",fontSize:"14px",lineHeight:"1.5",wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"},dangerouslySetInnerHTML:{__html:t.html||t.message}}),t.attachments&&t.attachments.length>0&&e.createElement("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"}},t.attachments.map(function(t,n){return e.createElement("div",{key:n,style:{border:re?"1px solid #374151":"1px solid #E5E7EB",borderRadius:"8px",overflow:"hidden"}},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",backgroundColor:re?"#111827":"#F9FAFB"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1,minWidth:0}},ge(t.contentType),e.createElement("span",{style:{fontSize:"12px",color:re?"#F9FAFB":"#111827",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.filename),t.size&&e.createElement("span",{style:{color:re?"#9CA3AF":"#6B7280",fontSize:"12px",flexShrink:0}},"(",(t.size/1024).toFixed(1)," KB)")),e.createElement("button",{onClick:function(){var e=s(d().m(function e(n){var r,o,i,s;return d().w(function(e){for(;;)switch(e.n){case 0:n.preventDefault(),n.stopPropagation();try{r=String(t.filename||"download").replace(/\s+/g,"_").replace(/[^a-zA-Z0-9._-]/g,"_"),t.url&&t.url.includes("cloudinary.com")?(o="".concat(a,"/api/v1/email-ticketing/attachments/download?filename=").concat(encodeURIComponent(r),"&url=").concat(encodeURIComponent(t.url)),(i=document.createElement("a")).href=o,i.rel="noopener",document.body.appendChild(i),i.click(),document.body.removeChild(i)):t.url&&((s=document.createElement("a")).href=t.url,s.download=r,s.rel="noopener",document.body.appendChild(s),s.click(),document.body.removeChild(s))}catch(e){console.error("Download failed:",e),window.open(t.url,"_blank","noopener,noreferrer")}case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),style:{marginLeft:"8px",padding:"4px 8px",fontSize:"12px",backgroundColor:l,color:"#fff",borderRadius:"4px",border:"none",cursor:"pointer",flexShrink:0,transition:"all 0.2s"},onMouseEnter:function(e){return e.target.style.backgroundColor="".concat(l,"dd")},onMouseLeave:function(e){return e.target.style.backgroundColor=l}},"Download")))}))))})),"closed"!==A.status&&e.createElement("div",{style:{borderTop:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#fff",padding:"16px 24px"}},e.createElement("div",{style:{border:re?"1px solid #374151":"1px solid #E5E7EB",borderRadius:"8px",overflow:"hidden"}},e.createElement(ye,{onCommand:se,showSendButton:!0,onSend:function(e){e.preventDefault(),pe(e)},isLoading:O,canSend:j.trim()||U.length>0}),e.createElement("div",{ref:Z,className:"ticket-editor",contentEditable:!0,onInput:function(e){var t=e.target.innerHTML,n=e.target.innerText;M(t),I(n)},placeholder:"Type your reply...",style:{minHeight:"100px",maxHeight:"200px",overflowY:"auto",padding:"12px",fontSize:"14px",color:re?"#F9FAFB":"#111827",backgroundColor:re?"#111827":"#fff",outline:"none"}}),e.createElement("input",{ref:Q,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.xlsm,.csv,.ppt,.pptx,.txt,.rtf,.zip,.rar,.7z",onChange:function(e){return ae(e,!0)},style:{display:"none"}}),U.length>0&&e.createElement("div",{style:{padding:"8px 12px",borderTop:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexWrap:"wrap",gap:"8px"}},U.map(function(t,n){return e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"6px",backgroundColor:re?"#374151":"#F3F4F6",fontSize:"12px",color:re?"#F9FAFB":"#111827"}},ge(t.type),e.createElement("span",null,t.name),e.createElement("button",{type:"button",onClick:function(){return ce(n,!0)},style:{background:"none",border:"none",cursor:"pointer",padding:"2px",color:"#EF4444"}},"Γ"))}))))):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:re?"#111827":"#F9FAFB"}},e.createElement("div",{style:{textAlign:"center",padding:"40px"}},e.createElement("svg",{style:{width:"64px",height:"64px",margin:"0 auto 16px",color:re?"#374151":"#D1D5DB"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})),e.createElement("h3",{style:{margin:"0 0 8px 0",fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Select a ticket"),e.createElement("p",{style:{margin:0,fontSize:"14px",color:re?"#9CA3AF":"#6B7280"}},"Choose a ticket from the list to view details")))),!1)),W&&e.createElement("div",{style:{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,padding:"20px"}},e.createElement("div",{style:{backgroundColor:re?"#1f2937":"#ffffff",color:re?"#f9fafb":"#111827",borderRadius:"16px",padding:"32px 40px",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.3)",maxWidth:"500px",width:"100%",textAlign:"center",border:re?"1px solid #374151":"1px solid #e5e7eb",position:"relative",transform:"scale(1)",animation:"modalAppear 0.3s ease-out"}},e.createElement("div",{style:{width:"64px",height:"64px",borderRadius:"50%",backgroundColor:"#fef2f2",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 20px",border:"3px solid #fee2e2"}},e.createElement("svg",{style:{width:"32px",height:"32px",color:"#ef4444"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"}))),e.createElement("h3",{style:{color:"#ef4444",fontSize:"20px",fontWeight:"700",marginBottom:"12px",margin:"0 0 12px 0"}},"File Upload Limit Exceeded"),e.createElement("p",{style:{fontSize:"16px",lineHeight:"1.6",color:re?"#d1d5db":"#6b7280",marginBottom:"24px",margin:"0 0 24px 0"}},W),e.createElement("div",{style:{display:"flex",gap:"12px",justifyContent:"center"}},e.createElement("button",{onClick:function(){return V(null)},style:{padding:"12px 32px",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"8px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"all 0.2s",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.3)"},onMouseOver:function(e){e.target.style.backgroundColor="#dc2626",e.target.style.transform="translateY(-1px)",e.target.style.boxShadow="0 6px 16px rgba(239, 68, 68, 0.4)"},onMouseOut:function(e){e.target.style.backgroundColor="#ef4444",e.target.style.transform="translateY(0)",e.target.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.3)"}},"Understood")))),$.length>0&&e.createElement("div",{style:{position:"fixed",bottom:"20px",right:"20px",zIndex:10001,display:"flex",flexDirection:"column",gap:"12px",pointerEvents:"none"}},$.map(function(t){return e.createElement("div",{key:t.id,style:{backgroundColor:re?"#1f2937":"#ffffff",color:re?"#f9fafb":"#111827",padding:"16px 20px",borderRadius:"12px",boxShadow:"0 8px 25px rgba(0, 0, 0, 0.15)",border:"2px solid ".concat("success"===t.type?"#10b981":"#ef4444"),minWidth:"300px",maxWidth:"400px",animation:"slideInFromRight 0.3s ease-out",display:"flex",alignItems:"center",gap:"12px",pointerEvents:"auto"}},e.createElement("div",{style:{width:"24px",height:"24px",borderRadius:"50%",backgroundColor:"success"===t.type?"#10b981":"#ef4444",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},"success"===t.type?e.createElement("svg",{style:{width:"14px",height:"14px",color:"white"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})):e.createElement("svg",{style:{width:"14px",height:"14px",color:"white"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M6 18L18 6M6 6l12 12"}))),e.createElement("div",{style:{flex:1,fontSize:"14px",fontWeight:"500",lineHeight:"1.4"}},t.message),e.createElement("button",{onClick:function(){return X(function(e){return e.filter(function(e){return e.id!==t.id})})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",color:re?"#9ca3af":"#6b7280",flexShrink:0,opacity:.7,transition:"opacity 0.2s"},onMouseEnter:function(e){return e.target.style.opacity="1"},onMouseLeave:function(e){return e.target.style.opacity="0.7"}},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))}))))};function lr(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}lr(".camera-capture-wrapper{animation:slideUp .4s cubic-bezier(.4,0,.2,1);background:#fff;border:2px solid #e5e7eb;border-radius:16px;box-shadow:0 8px 32px rgba(0,0,0,.12);margin:12px 0;max-width:100%;overflow:hidden;position:relative;width:100%;z-index:1}@keyframes slideUp{0%{opacity:0;transform:translateY(40px)}to{opacity:1;transform:translateY(0)}}.camera-header-banner{align-items:center;background:linear-gradient(135deg,#6366f1,#8b5cf6);display:flex;justify-content:space-between;padding:16px 20px}.camera-header-content{align-items:center;display:flex;gap:14px}.camera-icon-badge{align-items:center;backdrop-filter:blur(10px);background:hsla(0,0%,100%,.2);border-radius:12px;display:flex;font-size:24px;height:48px;justify-content:center;width:48px}.camera-header-text{color:#fff}.camera-title{font-size:18px;font-weight:700;letter-spacing:-.5px;margin:0}.camera-subtitle{font-size:13px;font-weight:400;margin:4px 0 0;opacity:.9}.camera-close-button{align-items:center;backdrop-filter:blur(10px);background:hsla(0,0%,100%,.15);border:none;border-radius:8px;color:#fff;cursor:pointer;display:flex;font-size:20px;height:36px;justify-content:center;transition:all .2s;width:36px}.camera-close-button:hover{background:hsla(0,0%,100%,.25);transform:scale(1.05)}.camera-view-container{background:#000;max-height:500px;min-height:400px;overflow:hidden;position:relative}.camera-loading-state{align-items:center;color:#fff;display:flex;flex-direction:column;height:400px;justify-content:center}.loading-spinner{animation:spin 1s linear infinite;border:4px solid hsla(0,0%,100%,.2);border-radius:50%;border-top-color:#fff;height:48px;margin-bottom:16px;width:48px}@keyframes spin{to{transform:rotate(1turn)}}.camera-error-state{align-items:center;color:#fff;display:flex;flex-direction:column;height:400px;justify-content:center;padding:40px;text-align:center}.error-icon-large{font-size:64px;margin-bottom:16px;opacity:.5}.error-message{font-size:16px;line-height:1.5;margin-bottom:24px}.retry-button{background:#6366f1;border:none;border-radius:8px;color:#fff;cursor:pointer;font-size:15px;font-weight:600;padding:12px 28px;transition:all .2s}.retry-button:hover{background:#4f46e5;transform:scale(1.05)}.camera-live-mode{height:100%;min-height:400px;position:relative;width:100%}.camera-video-feed{display:block;height:100%;object-fit:cover;width:100%}.camera-overlay{bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0}.camera-frame{aspect-ratio:4/3;border:3px solid hsla(0,0%,100%,.5);border-radius:16px;box-shadow:0 0 0 2000px rgba(0,0,0,.3);left:50%;max-width:350px;position:absolute;top:50%;transform:translate(-50%,-50%);width:80%}.camera-preview-mode{background:#000;min-height:400px;position:relative;width:100%}.preview-image-wrapper{align-items:center;display:flex;height:100%;justify-content:center;position:relative;width:100%}.preview-image{display:block;max-height:500px;max-width:100%;object-fit:contain}.preview-badge{backdrop-filter:blur(10px);background:rgba(99,102,241,.95);border-radius:20px;color:#fff;font-size:13px;font-weight:600;padding:8px 16px;position:absolute;right:16px;top:16px}.camera-action-section{background:#fff;padding:24px 20px}.preview-actions{display:grid;gap:12px;grid-template-columns:1fr 1fr}.action-button{align-items:center;border:none;border-radius:12px;cursor:pointer;display:flex;font-family:inherit;font-size:16px;font-weight:600;gap:10px;justify-content:center;padding:16px 24px;transition:all .2s}.button-icon{font-size:20px}.retake-button{background:#f3f4f6;border:2px solid #e5e7eb;color:#374151}.retake-button:hover{background:#e5e7eb;box-shadow:0 4px 12px rgba(0,0,0,.1);transform:translateY(-2px)}.submit-button{background:linear-gradient(135deg,#10b981,#059669);box-shadow:0 4px 16px rgba(16,185,129,.3);color:#fff}.submit-button:hover{box-shadow:0 6px 20px rgba(16,185,129,.4);transform:translateY(-2px)}.camera-actions{align-items:center;display:flex;gap:16px;justify-content:space-between}.flip-camera-button{align-items:center;background:#f3f4f6;border:2px solid #e5e7eb;border-radius:50%;cursor:pointer;display:flex;flex-direction:column;height:64px;justify-content:center;transition:all .2s;width:64px}.flip-camera-button:hover:not(:disabled){background:#e5e7eb;transform:scale(1.05)}.flip-camera-button:disabled{cursor:not-allowed;opacity:.4}.flip-icon{font-size:24px}.flip-text{color:#6b7280;font-size:11px;font-weight:600;margin-top:2px}.capture-button-main{align-items:center;background:#fff;border:4px solid #6366f1;border-radius:50%;box-shadow:0 4px 20px rgba(99,102,241,.3);cursor:pointer;display:flex;height:80px;justify-content:center;position:relative;transition:all .2s;width:80px}.capture-button-main:hover:not(:disabled){box-shadow:0 6px 24px rgba(99,102,241,.4);transform:scale(1.08)}.capture-button-main:active:not(:disabled){transform:scale(.95)}.capture-button-main:disabled{cursor:not-allowed;opacity:.4}.capture-button-inner{align-items:center;display:flex;height:100%;justify-content:center;position:relative;width:100%}.capture-ring{animation:pulse 2s ease-in-out infinite;border:3px solid #6366f1;border-radius:50%;height:68px;position:absolute;width:68px}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.1)}}.capture-center{background:linear-gradient(135deg,#6366f1,#8b5cf6);border-radius:50%;height:56px;width:56px}.placeholder-space{width:64px}.camera-instructions{background:#f9fafb;border-top:1px solid #e5e7eb;padding:16px 20px;text-align:center}.camera-instructions p{color:#6b7280;font-size:14px;font-weight:500;margin:0}.camera-instructions.success{background:#ecfdf5;border-top-color:#d1fae5}.camera-instructions.success p{color:#059669}@media (max-width:768px){.camera-capture-wrapper{border-radius:12px;margin:12px 0}.camera-header-banner{padding:14px 16px}.camera-icon-badge{font-size:20px;height:42px;width:42px}.camera-title{font-size:16px}.camera-subtitle{font-size:12px}.camera-view-container{max-height:400px;min-height:350px}.camera-live-mode{min-height:350px}.camera-action-section{padding:20px 16px}.action-button{font-size:15px;padding:14px 20px}.capture-button-main{height:72px;width:72px}.capture-ring{height:60px;width:60px}.capture-center{height:48px;width:48px}}@media (max-width:480px){.camera-capture-wrapper{border-radius:10px;margin:8px 0}.camera-header-banner{padding:12px 14px}.camera-icon-badge{border-radius:10px;font-size:18px;height:38px;width:38px}.camera-title{font-size:15px}.camera-subtitle{font-size:11px}.camera-close-button{font-size:18px;height:32px;width:32px}.camera-view-container{max-height:350px;min-height:300px}.camera-live-mode{min-height:300px}.camera-action-section{padding:18px 14px}.action-button{font-size:14px;padding:13px 18px}.button-icon{font-size:18px}.flip-camera-button{height:56px;width:56px}.flip-icon{font-size:20px}.capture-button-main{height:68px;width:68px}.capture-ring{height:56px;width:56px}.capture-center{height:44px;width:44px}.placeholder-space{width:56px}.camera-instructions{padding:14px 16px}.camera-instructions p{font-size:13px}}");var ur=function(o){var i=o.onCapture,a=o.onClose,c=o.requesterName,l=void 0===c?"Agent":c,u=h(t(null),2),p=u[0],m=u[1],f=h(t(null),2),g=f[0],y=f[1],b=h(t(!1),2),x=b[0],v=b[1],E=h(t("environment"),2),w=E[0],k=E[1],C=h(t(null),2),S=C[0],A=C[1],_=h(t(!0),2),N=_[0],R=_[1],T=n(null),B=n(null);r(function(){return O(),function(){F()}},[w]);var O=function(){var e=s(d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,A(null),R(!0),e.n=1,navigator.mediaDevices.getUserMedia({video:{facingMode:w,width:{ideal:1920},height:{ideal:1080}},audio:!1});case 1:t=e.v,m(t),T.current&&(T.current.srcObject=t),v(!0),R(!1),e.n=3;break;case 2:e.p=2,n=e.v,console.error("Camera access error:",n),A("Camera access denied. Please allow camera permissions."),v(!1),R(!1);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),F=function(){p&&(p.getTracks().forEach(function(e){return e.stop()}),m(null),v(!1))},L=function(){F(),a&&a()};return e.createElement("div",{className:"camera-capture-wrapper"},e.createElement("div",{className:"camera-header-banner"},e.createElement("div",{className:"camera-header-content"},e.createElement("div",{className:"camera-icon-badge"},"πΈ"),e.createElement("div",{className:"camera-header-text"},e.createElement("h3",{className:"camera-title"},"Camera Capture"),e.createElement("p",{className:"camera-subtitle"},l," requested a photo"))),e.createElement("button",{className:"camera-close-button",onClick:L},e.createElement("span",null,"β"))),e.createElement("div",{className:"camera-view-container"},S?e.createElement("div",{className:"camera-error-state"},e.createElement("div",{className:"error-icon-large"},"π·"),e.createElement("p",{className:"error-message"},S),e.createElement("button",{className:"retry-button",onClick:O},"π Try Again")):N?e.createElement("div",{className:"camera-loading-state"},e.createElement("div",{className:"loading-spinner"}),e.createElement("p",null,"Loading camera...")):g?e.createElement("div",{className:"camera-preview-mode"},e.createElement("div",{className:"preview-image-wrapper"},e.createElement("img",{src:g,alt:"Captured",className:"preview-image"}),e.createElement("div",{className:"preview-badge"},"Preview"))):e.createElement("div",{className:"camera-live-mode"},e.createElement("video",{ref:T,autoPlay:!0,playsInline:!0,muted:!0,className:"camera-video-feed"}),e.createElement("div",{className:"camera-overlay"},e.createElement("div",{className:"camera-frame"})),e.createElement("canvas",{ref:B,style:{display:"none"}}))),e.createElement("div",{className:"camera-action-section"},g?e.createElement("div",{className:"preview-actions"},e.createElement("button",{className:"action-button retake-button",onClick:function(){y(null),O()}},e.createElement("span",{className:"button-icon"},"π"),e.createElement("span",{className:"button-text"},"Retake")),e.createElement("button",{className:"action-button submit-button",onClick:function(){g&&i&&(i(g),L())}},e.createElement("span",{className:"button-icon"},"β"),e.createElement("span",{className:"button-text"},"Submit Photo"))):e.createElement("div",{className:"camera-actions"},e.createElement("button",{className:"flip-camera-button",onClick:function(){k(function(e){return"user"===e?"environment":"user"})},disabled:!x},e.createElement("span",{className:"flip-icon"},"π"),e.createElement("span",{className:"flip-text"},"Flip")),e.createElement("button",{className:"capture-button-main",onClick:function(){if(T.current&&B.current){var e=T.current,t=B.current,n=t.getContext("2d");t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height);var r=t.toDataURL("image/jpeg",.95);y(r),F()}},disabled:!x},e.createElement("div",{className:"capture-button-inner"},e.createElement("div",{className:"capture-ring"}),e.createElement("div",{className:"capture-center"}))),e.createElement("div",{className:"placeholder-space"}))),!g&&!S&&e.createElement("div",{className:"camera-instructions"},e.createElement("p",null,"πΈ Position and tap the button to capture")),g&&e.createElement("div",{className:"camera-instructions success"},e.createElement("p",null,"β Photo captured! Review and submit or retake")))};lr(".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;animation:crm-pulse 2s ease-in-out infinite;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 0 rgba(79,70,229,.4);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .3s cubic-bezier(.4,0,.2,1);width:64px}.crm-chat-button:hover{animation:none;box-shadow:0 15px 35px rgba(79,70,229,.5),0 0 0 8px rgba(79,70,229,.1);transform:scale(1.1)}@keyframes crm-pulse{0%,to{box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 0 rgba(79,70,229,.4)}50%{box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 8px rgba(79,70,229,0)}}.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%;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;font-size:20px;height:40px;justify-content:center;transition:transform .2s;width:40px}.crm-avatar:hover{transform:scale(1.05)}.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 dr=function(o){var i,c=o.apiKey,l=o.apiUrl,u=void 0===l?"https://chat-crm-backend-7mzo.onrender.com":l,p=o.primaryColor,f=void 0===p?"#4F46E5":p,g=o.position,y=void 0===g?"bottom-right":g,b=o.userData,x=void 0===b?null:b,v=o.welcomeMessage,E=void 0===v?"π Welcome! How can we help you today?":v,w=o.companyName,k=void 0===w?"Support":w,C=o.autoOpen,S=void 0!==C&&C,A=o.showNotifications,_=void 0===A||A,N=o.playSound,R=void 0!==N&&N,T=o.theme,B=void 0===T?"light":T,O=o.zIndex,F=void 0===O?9999:O,L=h(t(S),2),j=L[0],I=L[1],z=h(t([]),2),P=z[0],M=z[1],D=h(t(""),2),U=D[0],q=D[1],H=h(t(null),2),W=H[0],V=H[1],K=h(t(null),2);K[0];var G=K[1],Y=h(t(null),2),J=Y[0],$=Y[1],X=h(t(!1),2),Q=X[0],Z=X[1],ee=h(t(!1),2),te=ee[0],ne=ee[1],re=h(t(!1),2),oe=re[0],ie=re[1],se=h(t(!1),2),ae=se[0],ce=se[1],le=h(t("Support Agent"),2),ue=le[0],de=le[1],pe=h(t(0),2),he=pe[0],me=pe[1],fe=h(t(!1),2),ge=fe[0],ye=fe[1],be=h(t("active"),2),xe=be[0],ve=be[1],Ee=h(t(null),2),we=Ee[0],ke=Ee[1],Ce=h(t(!1),2),Se=Ce[0],Ae=Ce[1],_e=h(t(!1),2),Ne=_e[0],Re=_e[1],Te=h(t(null),2),Be=Te[0],Oe=Te[1],Fe=h(t(null),2),Le=Fe[0],je=Fe[1],Ie=n(null),ze=n(null),Me=h(t(!1),2),De=Me[0],Ue=Me[1],qe=h(t(0),2),He=qe[0],We=qe[1],Ve=h(t(""),2),Ke=Ve[0],Ge=Ve[1],Ye=h(t(!1),2),Je=Ye[0],$e=Ye[1],Xe=h(t(!1),2),Qe=Xe[0],Ze=Xe[1],et=h(t(!1),2),tt=et[0],nt=et[1],rt=h(t(null),2),ot=rt[0],it=rt[1],st=h(t([]),2),at=st[0],ct=st[1],lt=n(!1),ut=n(null),dt=n(null),pt=n(null),ht=n(null);r(function(){var e=function(e){if(j){var t=dt.current,n=pt.current,r=ht.current;!t||t.contains(e.target)||!n||n.contains(e.target)||r&&r.contains(e.target)||(I(!1),nt(!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=ut.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[P]),r(function(){return function(){W&&W.disconnect()}},[W]);var mt=function(){if(x)return{name:x.name||"Guest User",email:x.email||null,phone:x.phone||null,userId:x.userId||null};var e=function(){for(var e={name:null,email:null,phone:null},t=function(e){var t,n;return e?"META"===e.tagName?e.getAttribute("content")||null:"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value||e.getAttribute("value")||e.getAttribute("placeholder")||null:e.getAttribute("data-name")||e.getAttribute("data-user-name")||e.getAttribute("data-full-name")||e.getAttribute("data-display-name")||e.getAttribute("data-email")||e.getAttribute("data-phone")||(null===(t=e.textContent)||void 0===t?void 0:t.trim())||(null===(n=e.innerText)||void 0===n?void 0:n.trim())||null:null},n=null,r=null,o=null,i=0,s=['[name="firstName"], [name="firstname"], [name="FirstName"], [name="FIRSTNAME"]','[name="lastName"], [name="lastname"], [name="LastName"], [name="LASTNAME"]','[name="fullName"], [name="fullname"], [name="FullName"], [name="FULLNAME"]','[name="userName"], [name="username"], [name="UserName"], [name="USERNAME"]','[name="displayName"], [name="display_name"]','[name="name"], [name="Name"], [name="NAME"]',"#firstName, #firstname, #FirstName, #FIRSTNAME","#lastName, #lastname, #LastName, #LASTNAME","#fullName, #fullname, #FullName, #FULLNAME","#userName, #username, #UserName, #USERNAME","#displayName, #display_name","#name, #Name, #NAME",".firstName, .firstname, .FirstName, .FIRSTNAME",".lastName, .lastname, .LastName, .LASTNAME",".fullName, .fullname, .FullName, .FULLNAME",".userName, .username, .UserName, .USERNAME",".displayName, .display_name",".name, .Name, .NAME","[data-name], [data-user-name], [data-full-name], [data-display-name]",".profile-name, .user-name, .username, .full-name",".header-name, .nav-name, .account-name",'meta[name="user-name"], meta[property="user:name"]'];i<s.length;i++){var c=s[i];try{var l,u=a(document.querySelectorAll(c));try{for(u.s();!(l=u.n()).done;){var d=t(l.value);d&&d.length>1&&"Guest User"!==d&&(c.toLowerCase().includes("firstname")&&!n?n=d:c.toLowerCase().includes("lastname")&&!r?r=d:(c.toLowerCase().includes("fullname")||c.toLowerCase().includes("username")||c.toLowerCase().includes("displayname")||c.toLowerCase().includes("name"))&&!o&&(o=d))}}catch(e){u.e(e)}finally{u.f()}}catch(e){}}n&&r?e.name="".concat(n," ").concat(r):n?e.name=n:r?e.name=r:o&&(e.name=o);for(var p=0,h=['[name="email"], [name="Email"], [name="EMAIL"]','[type="email"]',"#email, #Email, #EMAIL",".email, .Email, .EMAIL","[data-email]",'meta[name="user-email"], meta[property="user:email"]'];p<h.length;p++){var m=h[p];try{var f=t(document.querySelector(m));if(f&&f.includes("@")){e.email=f;break}}catch(e){}}for(var g=0,y=['[name="phone"], [name="Phone"], [name="PHONE"]','[name="phoneNumber"], [name="phone_number"]','[type="tel"]',"#phone, #Phone, #PHONE",".phone, .Phone, .PHONE","[data-phone]"];g<y.length;g++){var b=y[g];try{var x=t(document.querySelector(b));if(x&&/[\d\+\-\(\)\s]{10,}/.test(x)){e.phone=x;break}}catch(e){}}return e}();return{name:e.name||localStorage.getItem("chatGuestName")||"Guest User",email:e.email||localStorage.getItem("chatGuestEmail")||null,phone:e.phone||localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},ft=function(){var e=s(d().m(function e(){var t,n,r,o,i,s,a;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=mt(),ne(!0),e.p=1,console.log("π Creating new conversation for first message..."),e.n=2,Vn.post("".concat(u,"/api/v1/webhook/guest-conversation"),{apiKey:c,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,o=r.conversationId,i=r.petitionId,s=r.queryId,G(s),$(o),ye(!0),localStorage.setItem("chatGuestId",s),localStorage.setItem("chatConversationId",o),localStorage.setItem("chatPetitionId",i),t.email&&localStorage.setItem("chatGuestEmail",t.email),t.name&&localStorage.setItem("chatGuestName",t.name),t.phone&&localStorage.setItem("chatGuestPhone",t.phone),console.log("β
Conversation created:",{petitionId:i,queryId:s}),e.a(2,{newConvId:o,petitionId:i});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,a=e.v,console.error("β Create conversation error:",a),a;case 5:return e.p=5,ne(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),gt=function(){var e=s(d().m(function e(t){var n,r;return d().w(function(e){for(;;)if(0===e.n)return n=t.convId,r=t.petitionId,ie(!0),e.a(2,new Promise(function(e,t){try{var o,i=Pe("".concat(u,"/widget"),{query:{conversationId:n,petitionId:r,apiKey:c},transports:["websocket","polling"]});i.on("connect",function(){Z(!0),ie(!1),console.log("β
Connected to Chat CRM Widget Namespace"),e(i)}),i.on("connect_error",function(e){ie(!1),console.error("β Socket connect_error:",(null==e?void 0:e.message)||e)}),i.on("error",function(e){console.error("β Socket error:",e)}),i.on("disconnect",function(){Z(!1),console.log("β Disconnected from Chat CRM")}),i.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||"Support Agent",timestamp:e.timestamp||new Date,read:!1};M(function(e){var n=[].concat(m(e),[t]);return"guest"!==t.sender&&t.message&&(t.message.toLowerCase().includes("requested a photo")||t.message.toLowerCase().includes("send a photo")||t.message.toLowerCase().includes("send photo"))&&ct(function(e){var t=n.length-1;return e.includes(t)?e:[].concat(m(e),[t])}),n}),de((e.senderName||"Support Agent").toUpperCase()),ce(!1),!j&&_&&(me(function(e){return e+1}),R&&vt())}),i.on("query-accepted",function(e){console.log("β
Query accepted by agent:",e);var t=(e.agentName||"Support Agent").toUpperCase();de(t),ve("active"),M(function(e){return[].concat(m(e),[{message:"".concat(t," has accepted your query and will assist you now."),sender:"system",timestamp:new Date,read:!0}])})}),i.on("query-transferred",function(e){console.log("π Query transferred:",e);var t=(e.toAgentName||"Support Agent").toUpperCase();de(t),M(function(e){return[].concat(m(e),[{message:"Your query has been escalated and will be assisted shortly.",sender:"system",timestamp:new Date,read:!0}])})}),i.on("query-resolved",function(e){console.log("β
Query resolved:",e),ve("resolved"),lt.current?console.log("π Skipping duplicate resolved system message"):(lt.current=!0,M(function(e){return[].concat(m(e),[{message:"β
This query has been resolved by the agent.",sender:"system",timestamp:new Date,read:!0}])}))}),i.on("request-feedback",function(e){console.log("π Feedback requested:",e),Ue(!0)}),i.on("request-camera-snapshot",function(e){console.log("πΈ Snapshot request received:",e);try{var t,n=localStorage.getItem("chatPetitionId");if(console.log("πΈ Checking petitionId match:",{received:null==e?void 0:e.petitionId,stored:n}),null!=e&&e.petitionId&&n&&e.petitionId===n)console.log("β
PetitionId match - showing camera"),ke({requesterName:e.requesterName||(null===(t=e.requester)||void 0===t?void 0:t.name)||"Agent",at:Date.now()});else console.log("β PetitionId mismatch or missing")}catch(e){console.error("Snapshot request error:",e)}}),i.on("query-reopened",function(e){console.log("π Query reopened:",e),ve("active"),lt.current=!1}),i.on("agent-typing",function(e){e.isTyping?(ce(!0),de(e.agentName||"Support Agent"),o&&clearTimeout(o),o=setTimeout(function(){ce(!1)},3e3)):(ce(!1),o&&clearTimeout(o))}),V(i)}catch(e){ie(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),yt=function(){var e=s(d().m(function e(){var t,n,r,o,i,s,a,c,l,u;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(U.trim()&&"resolved"!==xe){e.n=1;break}return e.a(2);case 1:if(W&&localStorage.getItem("chatPetitionId")&&(t=localStorage.getItem("chatPetitionId"),W.emit("customer-typing",{petitionId:t,isTyping:!1})),n=mt(),r=U.trim(),o=Date.now(),M(function(e){return[].concat(m(e),[{message:r,sender:"guest",senderName:n.name||"Guest User",read:!0,timestamp:new Date,tempId:o}])}),q(""),e.p=2,i=localStorage.getItem("chatPetitionId"),s=J||localStorage.getItem("chatConversationId"),i&&s){e.n=4;break}return e.n=3,ft();case 3:a=e.v,s=a.newConvId,i=a.petitionId;case 4:if((c=W)&&Q){e.n=6;break}try{W&&W.disconnect()}catch(e){}return e.n=5,gt({convId:s,petitionId:i});case 5:c=e.v;case 6:l={conversationId:s,petitionId:i,message:r,senderName:n.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,u=e.v,console.error("β Send message error:",u),M(function(e){return e.filter(function(e){return e.tempId!==o})}),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)}}(),bt=function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),W&&W.disconnect(),V(null),G(null),$(null),Z(!1),ye(!1),ve("active"),lt.current=!1,M([]),q(""),Ue(!1),We(0),Ge(""),$e(!1),console.log("π Starting new query...")},xt=function(e){if("ticket"===e&&!((null==x?void 0:x.email)||localStorage.getItem("chatGuestEmail")))return it(e),void nt(!1);it(e),nt(!1)},vt=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)},Et=function(){var e=s(d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.mediaDevices.getUserMedia({video:{facingMode:"user"}});case 1:t=e.v,Oe(t),Ie.current&&(Ie.current.srcObject=t,Ie.current.play()),e.n=3;break;case 2:e.p=2,n=e.v,console.error("Camera access error:",n),alert("Camera access denied. Please allow camera permissions."),Ct();case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),wt=function(){var e=s(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return je(null),e.n=1,Et();case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),kt=function(){var e=s(d().m(function e(){var t,n,r,o,i,s,a,l,p;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(Le){e.n=1;break}return e.a(2);case 1:return Ae(!0),e.p=2,e.n=3,fetch(Le).then(function(e){return e.blob()});case 3:return n=e.v,r=localStorage.getItem("chatPetitionId"),o=new FormData,i="snapshot-".concat(r,"-").concat(Date.now(),".png"),o.append("screenshot",n,i),o.append("petitionId",r),o.append("apiKey",c),o.append("metadata",JSON.stringify({source:"widget",requesterName:null==we?void 0:we.requesterName})),e.n=4,Vn.post("".concat(u,"/api/v1/webhook/upload-snapshot"),o,{headers:{"Content-Type":"multipart/form-data"}});case 4:if(s=e.v,!(a=null==s||null===(t=s.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.imageUrl)){e.n=5;break}return l=new Date,M(function(e){return[].concat(m(e),[{message:"πΈ Screenshot: ".concat(a),sender:"guest",senderName:"You",timestamp:l,read:!0}])}),e.n=5,Vn.post("".concat(u,"/api/v1/webhook/send-message"),{apiKey:c,petitionId:r,message:"πΈ Screenshot: ".concat(a),senderName:"Guest User"});case 5:Ct(),e.n=7;break;case 6:e.p=6,p=e.v,console.error("Widget capture error:",p),alert("Failed to upload photo. Please try again.");case 7:return e.p=7,Ae(!1),e.f(7);case 8:return e.a(2)}},e,null,[[2,6,7,8]])}));return function(){return e.apply(this,arguments)}}(),Ct=function(){Be&&(Be.getTracks().forEach(function(e){return e.stop()}),Oe(null)),Re(!1),je(null),ke(null)};r(function(){console.log("πΈ Snapshot useEffect triggered:",{snapshotRequest:we,showCamera:Ne}),we&&!Ne&&(console.log("πΈ Setting showCamera to true and initializing camera"),Re(!0),setTimeout(function(){console.log("πΈ Calling initializeCamera"),Et()},100))},[we,Ne]),r(function(){console.log("πΈ Video ref useEffect:",{showCamera:Ne,hasVideoRef:!!Ie.current,currentStream:Be,capturedImage:Le}),Ne&&Ie.current&&!Be&&!Le&&(console.log("πΈ Reinitializing camera from video ref useEffect"),Et())},[Ne,Ie.current]);var St=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[y]||e["bottom-right"]},At="dark"===B||"auto"===B&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:F}},e.createElement("button",{ref:pt,onClick:function(){I(function(e){var t=!e;return t?(me(0),nt(!0),it(null)):(nt(!1),it(null)),t})},className:"crm-chat-button ".concat(St()),style:{background:"linear-gradient(135deg, ".concat(f," 0%, #6366f1 100%)")},"aria-label":j?"Close help":"Help & Support",title:"Help & Support"},j&&!tt?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 3a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-5l-5 3v-3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12z"}),e.createElement("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),e.createElement("circle",{cx:"12",cy:"10",r:"1",fill:"currentColor"}),e.createElement("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"}),e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 14c.5.5 1.5 1 3 1s2.5-.5 3-1"})),!j&&he>0&&e.createElement("span",{className:"crm-badge"},he)),j&&tt&&e.createElement("div",{ref:ht,className:"crm-menu-popup ".concat(St()," ").concat(At?"crm-dark":""),style:{position:"fixed",bottom:y.includes("bottom")?"90px":"auto",top:y.includes("top")?"90px":"auto",right:y.includes("right")?"24px":"auto",left:y.includes("left")?"24px":"auto",width:"280px",backgroundColor:At?"#1F2937":"#fff",borderRadius:"12px",boxShadow:"0 10px 40px rgba(0,0,0,0.15)",border:At?"1px solid #374151":"1px solid #E5E7EB",overflow:"hidden",zIndex:F+1}},e.createElement("div",{style:{padding:"16px",borderBottom:At?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,color:At?"#F9FAFB":"#111827"}},"Help & Support"),e.createElement("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:At?"#9CA3AF":"#6B7280"}},"How can we assist you today?")),e.createElement("div",{style:{padding:"8px"}},e.createElement("button",{onClick:function(){return xt("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=At?"#374151":"#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"8px",backgroundColor:f,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:At?"#F9FAFB":"#111827"}},"Start Query"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:At?"#9CA3AF":"#6B7280"}},"Chat with our support team")),e.createElement("svg",{style:{width:"16px",height:"16px",color:At?"#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 xt("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=At?"#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:At?"#F9FAFB":"#111827"}},"Raise Ticket"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:At?"#9CA3AF":"#6B7280"}},"Submit a support ticket")),e.createElement("svg",{style:{width:"16px",height:"16px",color:At?"#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"}))))),j&&"query"===ot&&e.createElement("div",{ref:dt,className:"crm-chat-window ".concat(St()," ").concat(At?"crm-dark":""),style:{position:"relative"}},e.createElement("div",{className:"crm-header",style:{backgroundColor:f}},e.createElement("div",{className:"crm-header-content"},e.createElement("button",{onClick:function(){it(null),nt(!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("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:f,strokeWidth:"2"},e.createElement("path",{d:"M12 2a4 4 0 0 1 4 4v2a4 4 0 0 1-8 0V6a4 4 0 0 1 4-4z"}),e.createElement("path",{d:"M12 14v8"}),e.createElement("path",{d:"M8 22h8"}),e.createElement("path",{d:"M8 14c-2 0-3 1-3 3v1c0 2 1 3 3 3h8c2 0 3-1 3-3v-1c0-2-1-3-3-3H8z"}))),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},k),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(Q?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===xe?e.createElement("span",{style:{color:"#10B981"}},"β Resolved"):"Support Agent"!==ue?e.createElement("span",null,"π¬ ",ue):Q?"Online":oe?"Connectingβ¦":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:bt,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(){I(!1),nt(!1),it(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"}))))),Ne&&e.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:At?"#1F2937":"#fff",zIndex:9999,display:"flex",flexDirection:"column",padding:"16px",overflow:"auto"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"}},e.createElement("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,color:At?"#E5E7EB":"#111827"}},"πΈ Camera Capture"),e.createElement("button",{onClick:Ct,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",padding:"0",color:At?"#9CA3AF":"#6B7280"}},"Γ")),e.createElement("p",{style:{fontSize:"14px",color:At?"#9CA3AF":"#6B7280",marginBottom:"12px"}},(null==we?void 0:we.requesterName)||"Agent"," requested a photo"),e.createElement("div",{style:{width:"100%",height:"300px",display:"flex",alignItems:"center",justifyContent:"center",background:"#000",borderRadius:"8px",overflow:"hidden",marginBottom:"12px",position:"relative"}},Le?e.createElement("img",{src:Le,alt:"Captured",style:{width:"100%",height:"100%",objectFit:"contain"}}):e.createElement(e.Fragment,null,e.createElement("video",{ref:Ie,autoPlay:!0,playsInline:!0,muted:!0,style:{width:"100%",height:"100%",objectFit:"cover",display:Be?"block":"none"}}),!Be&&e.createElement("div",{style:{position:"absolute",color:"#fff",textAlign:"center"}},e.createElement("div",{style:{fontSize:"14px",marginBottom:"8px"}},"Initializing camera..."),e.createElement("div",{style:{fontSize:"24px"}},"πΉ"))),e.createElement("canvas",{ref:ze,style:{display:"none"}})),e.createElement("div",{style:{display:"flex",gap:"8px",justifyContent:"center"}},Le?e.createElement(e.Fragment,null,e.createElement("button",{onClick:wt,className:"crm-close-btn",style:{padding:"12px 24px",fontSize:"14px",fontWeight:600}},"π Retake"),e.createElement("button",{onClick:kt,className:"crm-send-btn",style:{backgroundColor:f,padding:"12px 24px",fontSize:"14px",fontWeight:600},disabled:Se},Se?"β³ Uploading...":"β
Submit")):e.createElement("button",{onClick:function(){if(Ie.current&&ze.current){var e=Ie.current,t=ze.current;t.width=e.videoWidth||640,t.height=e.videoHeight||480,t.getContext("2d").drawImage(e,0,0,t.width,t.height);var n=t.toDataURL("image/png");je(n),Be&&(Be.getTracks().forEach(function(e){return e.stop()}),Oe(null))}},className:"crm-send-btn",style:{backgroundColor:f,padding:"12px 24px",fontSize:"14px",fontWeight:600}},"πΈ Capture"))),e.createElement("div",{className:"crm-messages"},!ge&&0===P.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,E),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"π Start typing to begin your conversation")),P.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:f}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},(t.senderName||ue).toUpperCase()),function(){var n=String(t.message||""),r=n.match(/https?:[^\s]+\.(?:png|jpg|jpeg|gif|webp)/i);if(r){var o=r[0],i=n.replace(o,"").trim();return e.createElement("div",null,i&&e.createElement("p",{className:"crm-message-text",style:{opacity:.85}},i),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"},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}),ae&&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"})))),De&&!Je&&e.createElement("div",{className:"crm-message crm-message-system"},e.createElement("div",{className:"crm-feedback-form",style:{backgroundColor:"#F9FAFB",padding:"16px",borderRadius:"12px",border:"1px solid #E5E7EB"}},e.createElement("p",{style:{fontWeight:"600",marginBottom:"12px",color:"#111827"}},"β Rate Your Experience"),e.createElement("div",{style:{display:"flex",gap:"8px",marginBottom:"12px",justifyContent:"center"}},[1,2,3,4,5].map(function(t){return e.createElement("button",{key:t,onClick:function(){return We(t)},style:{background:"none",border:"none",cursor:"pointer",fontSize:"32px",padding:"0",transition:"transform 0.2s",filter:He>=t?"none":"grayscale(100%)"},onMouseEnter:function(e){return e.currentTarget.style.transform="scale(1.2)"},onMouseLeave:function(e){return e.currentTarget.style.transform="scale(1)"}},He>=t?"β":"β")})),e.createElement("textarea",{value:Ke,onChange:function(e){return Ge(e.target.value)},placeholder:"Share your thoughts (optional)...",rows:"3",style:{width:"100%",padding:"8px 12px",border:"1px solid #D1D5DB",borderRadius:"8px",fontSize:"14px",fontFamily:"inherit",resize:"none",marginBottom:"12px"}}),e.createElement("button",{onClick:function(){if(He&&!Je&&!Qe){Ze(!0);var e=localStorage.getItem("chatPetitionId");W&&e?(W.emit("submit-feedback",{petitionId:e,rating:He,comment:Ke.trim()}),console.log("π€ Feedback submitted:",{rating:He,comment:Ke}),$e(!0),Ze(!1),setTimeout(function(){Ue(!1)},2e3)):Ze(!1)}},disabled:!He||Qe,style:{width:"100%",padding:"10px",backgroundColor:He?f:"#D1D5DB",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:"600",cursor:He?"pointer":"not-allowed",transition:"all 0.2s"}},Qe?"Submitting...":"Submit Feedback"))),Je&&e.createElement("div",{className:"crm-message crm-message-system"},e.createElement("div",{className:"crm-message-bubble",style:{backgroundColor:"#D1FAE5",color:"#065F46",border:"1px solid #A7F3D0"}},e.createElement("p",{className:"crm-message-text"},"β
Thank you for your feedback!"))),e.createElement("div",{ref:ut})),e.createElement("div",{className:"crm-input-container"},"resolved"===xe?e.createElement("button",{onClick:bt,className:"crm-send-btn",style:{backgroundColor:f,width:"100%",padding:"12px",fontSize:"14px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",border:"none",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s"}},e.createElement("svg",{style:{width:"18px",height:"18px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})),"New Query"):e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:U,onChange:function(e){var t=e.target.value;if(q(t),t.trim()&&W&&localStorage.getItem("chatPetitionId")){var n=localStorage.getItem("chatPetitionId"),r=mt();W.emit("customer-typing",{petitionId:n,userName:r.name||"Customer",isTyping:!0})}},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),yt())},placeholder:"Type your message...",rows:"1",className:"crm-input"}),e.createElement("button",{onClick:yt,disabled:!U.trim()||te,className:"crm-send-btn",style:{backgroundColor:f}},te?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"})))),"resolved"!==xe&&e.createElement("p",{className:"crm-input-hint"},ge?"Press Enter to send β’ Shift+Enter for new line":"Send your first message to start conversation"))),"ticket"===ot&&e.createElement(cr,{apiKey:c,apiUrl:u,primaryColor:f,userData:mt(),theme:B,onClose:function(){it(null),nt(!0)}}),at.length>0&&e.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.75)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e5,padding:"16px"}},e.createElement("div",{style:{width:"100%",maxWidth:"500px",maxHeight:"90vh",overflow:"auto"}},e.createElement(ur,{onCapture:function(){var e=s(d().m(function e(t){var n;return d().w(function(e){for(;;)switch(e.n){case 0:try{n={message:"πΈ Photo sent",sender:"guest",timestamp:Date.now()},M(function(e){return[].concat(m(e),[n])}),W&&W.emit("chatMessage",{conversationId:J,message:"πΈ Photo sent",image:t}),ct([])}catch(e){console.error("Failed to send photo:",e)}case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),onClose:function(){ct([])},requesterName:(null===(i=P.find(function(e,t){return at.includes(t)}))||void 0===i?void 0:i.senderName)||ue}))))};export{dr as ChatCRMWidget,cr as TicketBoard};
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return p(l,"_invoke",function(n,r,o){var i,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,n){return i=t,a=0,c=e,p.n=n,s}};function h(n,r){for(a=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,i=u[t],h=p.p,m=i[2];n>3?(o=m===r)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=n<2&&h<i[1])?(a=0,p.v=r,p.n=i[1]):h<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,p.n=m,a=0))}if(o||n>1)return s;throw d=!0,r}return function(o,u,m){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&h(u,m),a=u,c=m;(t=a<2?e:c)||!d;){i||(a?a<3?(a>1&&(p.n=-1),h(a,c)):p.n=c:p.v=c);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,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=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(d=p.n<0)?c:n.call(r,p))!==s)break}catch(t){i=e,a=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,i),!0),l}var s={};function a(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),h=l.prototype=a.prototype=Object.create(u);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,o,"GeneratorFunction")),e.prototype=Object.create(h),e}return c.prototype=l,p(h,"constructor",l),p(l,"constructor",c),c.displayName="GeneratorFunction",p(l,o,"GeneratorFunction"),p(h),p(h,o,"Generator"),p(h,r,function(){return this}),p(h,"toString",function(){return"[object Generator]"}),(d=function(){return{w:i,m:m}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function i(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},p(e,t,n,r)}function h(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,o,i,s,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))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 m(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 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)?o(e,t):void 0}}const g=Object.create(null);g.open="0",g.close="1",g.ping="2",g.pong="3",g.message="4",g.upgrade="5",g.noop="6";const y=Object.create(null);Object.keys(g).forEach(e=>{y[g[e]]=e});const b={type:"error",data:"parser error"},x="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),v="function"==typeof ArrayBuffer,E=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,w=({type:e,data:t},n,r)=>x&&t instanceof Blob?n?r(t):k(t,r):v&&(t instanceof ArrayBuffer||E(t))?n?r(t):k(new Blob([t]),r):r(g[e]+(t||"")),k=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function C(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let S;const A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)_[A.charCodeAt(e)]=e;const N="function"==typeof ArrayBuffer,R=(e,t)=>{if("string"!=typeof e)return{type:"message",data:B(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:T(e.substring(1),t)};return y[n]?e.length>1?{type:y[n],data:e.substring(1)}:{type:y[n]}:b},T=(e,t)=>{if(N){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=_[e.charCodeAt(t)],r=_[e.charCodeAt(t+1)],o=_[e.charCodeAt(t+2)],i=_[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|o>>2,u[c++]=(3&o)<<6|63&i;return l})(e);return B(n,t)}return{base64:!0,data:e}},B=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,O=String.fromCharCode(30);function F(){return new TransformStream({transform(e,t){!function(e,t){x&&e.data instanceof Blob?e.data.arrayBuffer().then(C).then(t):v&&(e.data instanceof ArrayBuffer||E(e.data))?t(C(e.data)):w(e,!1,e=>{S||(S=new TextEncoder),t(S.encode(e))})}(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let L;function j(e){return e.reduce((e,t)=>e+t.length,0)}function I(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=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 z(e){if(e)return function(e){for(var t in z.prototype)e[t]=z.prototype[t];return e}(e)}z.prototype.on=z.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},z.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},z.prototype.off=z.prototype.removeListener=z.prototype.removeAllListeners=z.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 o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},z.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 o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},z.prototype.emitReserved=z.prototype.emit,z.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},z.prototype.hasListeners=function(e){return!!this.listeners(e).length};const P="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),M="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function D(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const U=M.setTimeout,q=M.clearTimeout;function H(e,t){t.useNativeTimers?(e.setTimeoutFn=U.bind(M),e.clearTimeoutFn=q.bind(M)):(e.setTimeoutFn=M.setTimeout.bind(M),e.clearTimeoutFn=M.clearTimeout.bind(M))}function W(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;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 V(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class K extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class G extends z{constructor(e){super(),this.writable=!1,H(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 K(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=R(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&&443!==Number(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 Y extends G{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(O),r=[];for(let e=0;e<n.length;e++){const o=R(n[e],t);if(r.push(o),"error"===o.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 o=0;e.forEach((e,i)=>{w(e,!1,e=>{r[i]=e,++o===n&&t(r.join(O))})})})(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]=V()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let J=!1;try{J="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const $=J;function X(){}class Q extends Y{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 Z extends z{constructor(e,t,n){super(),this.createRequest=e,H(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=D(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=Z.requestsCount++,Z.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=X,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Z.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(Z.requestsCount=0,Z.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",ee);else if("function"==typeof addEventListener){addEventListener("onpagehide"in M?"pagehide":"unload",ee,!1)}function ee(){for(let e in Z.requests)Z.requests.hasOwnProperty(e)&&Z.requests[e].abort()}const te=function(){const e=ne({xdomain:!1});return e&&null!==e.responseType}();function ne(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||$))return new XMLHttpRequest}catch(e){}if(!t)try{return new(M[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const re="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class oe extends G{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=re?{}:D(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;w(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&P(()=>{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]=V()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ie=M.WebSocket||M.MozWebSocket;const se={websocket:class extends oe{createSocket(e,t,n){return re?new ie(e,t,n):t?new ie(e,t):new ie(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends G{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){L||(L=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(j(n)<1)break;const e=I(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(j(n)<2)break;const e=I(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(j(n)<8)break;const e=I(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(b);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(j(n)<o)break;const e=I(n,o);a.enqueue(R(i?e:L.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(b);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=F();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&P(()=>{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=te&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Z(ne,this.uri(),e)}}},ae=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ce=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function le(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 o=ae.exec(e||""),i={},s=14;for(;s--;)i[ce[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const 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,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,i.query),i}const ue="function"==typeof addEventListener&&"function"==typeof removeEventListener,de=[];ue&&addEventListener("offline",()=>{de.forEach(e=>e())},!1);class pe extends z{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=le(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=le(t.host).host);H(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)),ue&&(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"})},de.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&&pe.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",pe.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+=W(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,P(()=>{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 o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),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(pe.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(),ue&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=de.indexOf(this._offlineEventListener);-1!==e&&de.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}pe.protocol=4;class he extends pe{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;pe.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;pe.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 o(){n||(n=!0,l(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function c(e){t&&e.name!==t.name&&o()}const l=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",i),t.once("close",s),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 me=class extends he{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=>se[e]).filter(e=>!!e)),super(e,n)}};const fe="function"==typeof ArrayBuffer,ge=Object.prototype.toString,ye="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ge.call(Blob),be="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ge.call(File);function xe(e){return fe&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||ye&&e instanceof Blob||be&&e instanceof File}function ve(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ve(e[t]))return!0;return!1}if(xe(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 Ee(e){const t=[],n=e.data,r=e;return r.data=we(n,t),r.attachments=t.length,{packet:r,buffers:t}}function we(e,t){if(!e)return e;if(xe(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]=we(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]=we(e[r],t));return n}return e}function ke(e,t){return e.data=Ce(e.data,t),delete e.attachments,e}function Ce(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]=Ce(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Ce(e[n],t));return e}const Se=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ae;!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"}(Ae||(Ae={}));class _e extends z{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===Ae.BINARY_EVENT;n||t.type===Ae.BINARY_ACK?(t.type=n?Ae.EVENT:Ae.ACK,this.reconstructor=new Ne(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!xe(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===Ae[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ae.BINARY_EVENT||n.type===Ae.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}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(!_e.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 Ae.CONNECT:return Te(t);case Ae.DISCONNECT:return void 0===t;case Ae.CONNECT_ERROR:return"string"==typeof t||Te(t);case Ae.EVENT:case Ae.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Se.indexOf(t[0]));case Ae.ACK:case Ae.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ne{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=ke(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Re=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function Te(e){return"[object Object]"===Object.prototype.toString.call(e)}var Be=Object.freeze({__proto__:null,Decoder:_e,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ae.EVENT&&e.type!==Ae.ACK||!ve(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ae.EVENT?Ae.BINARY_EVENT:Ae.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ae.BINARY_EVENT&&e.type!==Ae.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=Ee(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Ae},isPacketValid:function(e){return"string"==typeof e.nsp&&(void 0===(t=e.id)||Re(t))&&function(e,t){switch(e){case Ae.CONNECT:return void 0===t||Te(t);case Ae.DISCONNECT:return void 0===t;case Ae.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Se.indexOf(t[0]));case Ae.ACK:return Array.isArray(t);case Ae.CONNECT_ERROR:return"string"==typeof t||Te(t);default:return!1}}(e.type,e.data);var t},protocol:5});function Oe(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Fe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Le extends z{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=[Oe(e,"open",this.onopen.bind(this)),Oe(e,"packet",this.onpacket.bind(this)),Oe(e,"error",this.onerror.bind(this)),Oe(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,o;if(Fe.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 i={type:Ae.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=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===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),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 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"))},r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{const o=(e,t)=>e?r(e):n(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 n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{this._queue[0];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:Ae.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 Ae.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 Ae.EVENT:case Ae.BINARY_EVENT:this.onevent(e);break;case Ae.ACK:case Ae.BINARY_ACK:this.onack(e);break;case Ae.DISCONNECT:this.ondisconnect();break;case Ae.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:Ae.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._drainQueue(!0),this.emitReserved("connect")}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:Ae.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 je(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}je.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)},je.prototype.reset=function(){this.attempts=0},je.prototype.setMin=function(e){this.ms=e},je.prototype.setMax=function(e){this.max=e},je.prototype.setJitter=function(e){this.jitter=e};class Ie extends z{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,H(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 je({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||Be;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 me(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Oe(t,"open",function(){n.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Oe(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),o(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(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Oe(e,"ping",this.onping.bind(this)),Oe(e,"data",this.ondata.bind(this)),Oe(e,"error",this.onerror.bind(this)),Oe(e,"close",this.onclose.bind(this)),Oe(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){P(()=>{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 Le(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 ze={};function Pe(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=le(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 o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=ze[o]&&i in ze[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Ie(r,t):(ze[o]||(ze[o]=new Ie(r,t)),a=ze[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Me(e,t){return function(){return e.apply(t,arguments)}}Object.assign(Pe,{Manager:Ie,Socket:Le,io:Pe,connect:Pe});const{toString:De}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:qe,toStringTag:He}=Symbol,We=(e=>t=>{const n=De.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ve=e=>(e=e.toLowerCase(),t=>We(t)===e),Ke=e=>t=>typeof t===e,{isArray:Ge}=Array,Ye=Ke("undefined");function Je(e){return null!==e&&!Ye(e)&&null!==e.constructor&&!Ye(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=Ve("ArrayBuffer");const Xe=Ke("string"),Qe=Ke("function"),Ze=Ke("number"),et=e=>null!==e&&"object"==typeof e,tt=e=>{if("object"!==We(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||He in e||qe in e)},nt=Ve("Date"),rt=Ve("File"),ot=Ve("Blob"),it=Ve("FileList"),st=Ve("URLSearchParams"),[at,ct,lt,ut]=["ReadableStream","Request","Response","Headers"].map(Ve);function dt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Ge(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Je(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function pt(e,t){if(Je(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,mt=e=>!Ye(e)&&e!==ht;const ft=(gt="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>gt&&e instanceof gt);var gt;const yt=Ve("HTMLFormElement"),bt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xt=Ve("RegExp"),vt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};dt(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Et=Ve("AsyncFunction"),wt=(kt="function"==typeof setImmediate,Ct=Qe(ht.postMessage),kt?setImmediate:Ct?(St=`axios@${Math.random()}`,At=[],ht.addEventListener("message",({source:e,data:t})=>{e===ht&&t===St&&At.length&&At.shift()()},!1),e=>{At.push(e),ht.postMessage(St,"*")}):e=>setTimeout(e));var kt,Ct,St,At;const _t="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ht):"undefined"!=typeof process&&process.nextTick||wt;var Nt={isArray:Ge,isArrayBuffer:$e,isBuffer:Je,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Qe(e.append)&&("formdata"===(t=We(e))||"object"===t&&Qe(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:Xe,isNumber:Ze,isBoolean:e=>!0===e||!1===e,isObject:et,isPlainObject:tt,isEmptyObject:e=>{if(!et(e)||Je(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:at,isRequest:ct,isResponse:lt,isHeaders:ut,isUndefined:Ye,isDate:nt,isFile:rt,isBlob:ot,isRegExp:xt,isFunction:Qe,isStream:e=>et(e)&&Qe(e.pipe),isURLSearchParams:st,isTypedArray:ft,isFileList:it,forEach:dt,merge:function e(){const{caseless:t,skipUndefined:n}=mt(this)&&this||{},r={},o=(o,i)=>{const s=t&&pt(r,i)||i;tt(r[s])&&tt(o)?r[s]=e(r[s],o):tt(o)?r[s]=e({},o):Ge(o)?r[s]=o.slice():n&&Ye(o)||(r[s]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&dt(arguments[e],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(dt(t,(t,r)=>{n&&Qe(t)?e[r]=Me(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 o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:We,kindOfTest:Ve,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(Ge(e))return e;let t=e.length;if(!Ze(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[qe]).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:yt,hasOwnProperty:bt,hasOwnProp:bt,reduceDescriptors:vt,freezeMethods:e=>{vt(e,(t,n)=>{if(Qe(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Qe(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 Ge(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:pt,global:ht,isContextDefined:mt,isSpecCompliantForm:function(e){return!!(e&&Qe(e.append)&&"FormData"===e[He]&&e[qe])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(et(e)){if(t.indexOf(e)>=0)return;if(Je(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Ge(e)?[]:{};return dt(e,(e,t)=>{const i=n(e,r+1);!Ye(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Et,isThenable:e=>e&&(et(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),setImmediate:wt,asap:_t,isIterable:e=>null!=e&&Qe(e[qe])};function Rt(e,t,n,r,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),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}Nt.inherits(Rt,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:Nt.toJSONObject(this.config),code:this.code,status:this.status}}});const Tt=Rt.prototype,Bt={};["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=>{Bt[e]={value:e}}),Object.defineProperties(Rt,Bt),Object.defineProperty(Tt,"isAxiosError",{value:!0}),Rt.from=(e,t,n,r,o,i)=>{const s=Object.create(Tt);Nt.toFlatObject(e,s,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 Rt.call(s,a,c,n,r,o),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",i&&Object.assign(s,i),s};function Ot(e){return Nt.isPlainObject(e)||Nt.isArray(e)}function Ft(e){return Nt.endsWith(e,"[]")?e.slice(0,-2):e}function Lt(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ft(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const jt=Nt.toFlatObject(Nt,{},null,function(e){return/^is[A-Z]/.test(e)});function It(e,t,n){if(!Nt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Nt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Nt.isUndefined(t[e])})).metaTokens,o=n.visitor||l,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Nt.isSpecCompliantForm(t);if(!Nt.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Nt.isDate(e))return e.toISOString();if(Nt.isBoolean(e))return e.toString();if(!a&&Nt.isBlob(e))throw new Rt("Blob is not supported. Use a Buffer instead.");return Nt.isArrayBuffer(e)||Nt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(Nt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Nt.isArray(e)&&function(e){return Nt.isArray(e)&&!e.some(Ot)}(e)||(Nt.isFileList(e)||Nt.endsWith(n,"[]"))&&(a=Nt.toArray(e)))return n=Ft(n),a.forEach(function(e,r){!Nt.isUndefined(e)&&null!==e&&t.append(!0===s?Lt([n],r,i):null===s?n:n+"[]",c(e))}),!1;return!!Ot(e)||(t.append(Lt(o,n,i),c(e)),!1)}const u=[],d=Object.assign(jt,{defaultVisitor:l,convertValue:c,isVisitable:Ot});if(!Nt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Nt.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Nt.forEach(n,function(n,i){!0===(!(Nt.isUndefined(n)||null===n)&&o.call(t,n,Nt.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function zt(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&&It(e,this,t)}const Mt=Pt.prototype;function Dt(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||Dt;Nt.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(t,n):Nt.isURLSearchParams(t)?t.toString():new Pt(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Mt.append=function(e,t){this._pairs.push([e,t])},Mt.toString=function(e){const t=e?function(t){return e.call(this,t,zt)}:zt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qt{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){Nt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ht={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wt={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 Vt="undefined"!=typeof window&&"undefined"!=typeof document,Kt="object"==typeof navigator&&navigator||void 0,Gt=Vt&&(!Kt||["ReactNative","NativeScript","NS"].indexOf(Kt.product)<0),Yt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Jt=Vt&&window.location.href||"http://localhost";var $t={...Object.freeze({__proto__:null,hasBrowserEnv:Vt,hasStandardBrowserEnv:Gt,hasStandardBrowserWebWorkerEnv:Yt,navigator:Kt,origin:Jt}),...Wt};function Xt(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&Nt.isArray(r)?r.length:i,a)return Nt.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Nt.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Nt.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(Nt.isFormData(e)&&Nt.isFunction(e.entries)){const n={};return Nt.forEachEntry(e,(e,r)=>{t(function(e){return Nt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Qt={transitional:Ht,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Nt.isObject(e);o&&Nt.isHTMLForm(e)&&(e=new FormData(e));if(Nt.isFormData(e))return r?JSON.stringify(Xt(e)):e;if(Nt.isArrayBuffer(e)||Nt.isBuffer(e)||Nt.isStream(e)||Nt.isFile(e)||Nt.isBlob(e)||Nt.isReadableStream(e))return e;if(Nt.isArrayBufferView(e))return e.buffer;if(Nt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return It(e,new $t.classes.URLSearchParams,{visitor:function(e,t,n,r){return $t.isNode&&Nt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Nt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return It(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Nt.isString(e))try{return(t||JSON.parse)(e),Nt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Qt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Nt.isResponse(e)||Nt.isReadableStream(e))return e;if(e&&Nt.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 Rt.from(e,Rt.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}}};Nt.forEach(["delete","get","head","post","put","patch"],e=>{Qt.headers[e]={}});const Zt=Nt.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 en=Symbol("internals");function tn(e){return e&&String(e).trim().toLowerCase()}function nn(e){return!1===e||null==e?e:Nt.isArray(e)?e.map(nn):String(e)}function rn(e,t,n,r,o){return Nt.isFunction(r)?r.call(this,t,n):(o&&(t=n),Nt.isString(t)?Nt.isString(r)?-1!==t.indexOf(r):Nt.isRegExp(r)?r.test(t):void 0:void 0)}let on=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=tn(t);if(!o)throw new Error("header name must be a non-empty string");const i=Nt.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=nn(e))}const i=(e,t)=>Nt.forEach(e,(e,n)=>o(e,n,t));if(Nt.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Nt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Zt[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(Nt.isObject(e)&&Nt.isIterable(e)){let n,r,o={};for(const t of e){if(!Nt.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Nt.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=tn(e)){const n=Nt.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(Nt.isFunction(t))return t.call(this,e,n);if(Nt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=tn(e)){const n=Nt.findKey(this,e);return!(!n||void 0===this[n]||t&&!rn(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=tn(e)){const o=Nt.findKey(n,e);!o||t&&!rn(0,n[o],o,t)||(delete n[o],r=!0)}}return Nt.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!rn(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Nt.forEach(this,(r,o)=>{const i=Nt.findKey(n,o);if(i)return t[i]=nn(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=nn(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Nt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Nt.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[en]=this[en]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=tn(e);t[r]||(!function(e,t){const n=Nt.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Nt.isArray(e)?e.forEach(r):r(e),this}};function sn(e,t){const n=this||Qt,r=t||n,o=on.from(r.headers);let i=r.data;return Nt.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function an(e){return!(!e||!e.__CANCEL__)}function cn(e,t,n){Rt.call(this,null==e?"canceled":e,Rt.ERR_CANCELED,t,n),this.name="CanceledError"}function ln(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Rt("Request failed with status code "+n.status,[Rt.ERR_BAD_REQUEST,Rt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}on.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Nt.reduceDescriptors(on.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Nt.freezeMethods(on),Nt.inherits(cn,Rt,{__CANCEL__:!0});const un=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[s];o||(o=c),n[i]=a,r[i]=c;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+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 n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,c=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},dn=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},pn=e=>(...t)=>Nt.asap(()=>e(...t));var hn=$t.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$t.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($t.origin),$t.navigator&&/(msie|trident)/i.test($t.navigator.userAgent)):()=>!0,mn=$t.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Nt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Nt.isString(r)&&a.push(`path=${r}`),Nt.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),Nt.isString(s)&&a.push(`SameSite=${s}`),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 fn(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 gn=e=>e instanceof on?{...e}:e;function yn(e,t){t=t||{};const n={};function r(e,t,n,r){return Nt.isPlainObject(e)&&Nt.isPlainObject(t)?Nt.merge.call({caseless:r},e,t):Nt.isPlainObject(t)?Nt.merge({},t):Nt.isArray(t)?t.slice():t}function o(e,t,n,o){return Nt.isUndefined(t)?Nt.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Nt.isUndefined(t))return r(void 0,t)}function s(e,t){return Nt.isUndefined(t)?Nt.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(gn(e),gn(t),0,!0)};return Nt.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,s=i(e[r],t[r],r);Nt.isUndefined(s)&&i!==a||(n[r]=s)}),n}var bn=e=>{const t=yn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=on.from(s),t.url=Ut(fn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Nt.isFormData(n))if($t.hasStandardBrowserEnv||$t.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Nt.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if($t.hasStandardBrowserEnv&&(r&&Nt.isFunction(r)&&(r=r(t)),r||!1!==r&&hn(t.url))){const e=o&&i&&mn.read(i);e&&s.set(o,e)}return t};var xn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=bn(e);let o=r.data;const i=on.from(r.headers).normalize();let s,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:h}=r;function m(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let f=new XMLHttpRequest;function g(){if(!f)return;const r=on.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());ln(function(e){t(e),m()},function(e){n(e),m()},{data:d&&"text"!==d&&"json"!==d?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f}),f=null}f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout,"onloadend"in f?f.onloadend=g:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(g)},f.onabort=function(){f&&(n(new Rt("Request aborted",Rt.ECONNABORTED,e,f)),f=null)},f.onerror=function(t){const r=new Rt(t&&t.message?t.message:"Network Error",Rt.ERR_NETWORK,e,f);r.event=t||null,n(r),f=null},f.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ht;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Rt(t,o.clarifyTimeoutError?Rt.ETIMEDOUT:Rt.ECONNABORTED,e,f)),f=null},void 0===o&&i.setContentType(null),"setRequestHeader"in f&&Nt.forEach(i.toJSON(),function(e,t){f.setRequestHeader(t,e)}),Nt.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),d&&"json"!==d&&(f.responseType=r.responseType),h&&([c,u]=un(h,!0),f.addEventListener("progress",c)),p&&f.upload&&([a,l]=un(p),f.upload.addEventListener("progress",a),f.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(s=t=>{f&&(n(!t||t.type?new cn(null,e,f):t),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===$t.protocols.indexOf(y)?n(new Rt("Unsupported protocol "+y+":",Rt.ERR_BAD_REQUEST,e)):f.send(o||null)})};const vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Rt?t:new cn(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Rt(`timeout ${t} of ms exceeded`,Rt.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=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}=r;return a.unsubscribe=()=>Nt.asap(s),a}},En=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},wn=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()}},kn=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of wn(e))yield*En(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Cn}=Nt,Sn=(({Request:e,Response:t})=>({Request:e,Response:t}))(Nt.global),{ReadableStream:An,TextEncoder:_n}=Nt.global,Nn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Rn=e=>{e=Nt.merge.call({skipUndefined:!0},Sn,e);const{fetch:t,Request:n,Response:r}=e,o=t?Cn(t):"function"==typeof fetch,i=Cn(n),s=Cn(r);if(!o)return!1;const a=o&&Cn(An),c=o&&("function"==typeof _n?(l=new _n,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=i&&a&&Nn(()=>{let e=!1;const t=new n($t.origin,{body:new An,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=s&&a&&Nn(()=>Nt.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Rt(`Response type '${e}' is not supported`,Rt.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Nt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Nt.isBlob(e))return e.size;if(Nt.isSpecCompliantForm(e)){const t=new n($t.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Nt.isArrayBufferView(e)||Nt.isArrayBuffer(e)?e.byteLength:(Nt.isURLSearchParams(e)&&(e+=""),Nt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:c,cancelToken:l,timeout:m,onDownloadProgress:f,onUploadProgress:g,responseType:y,headers:b,withCredentials:x="same-origin",fetchOptions:v}=bn(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let w=vn([c,l&&l.toAbortSignal()],m),k=null;const C=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let S;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(S=await h(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(Nt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=dn(S,un(pn(g)));a=kn(t.body,65536,e,n)}}Nt.isString(x)||(x=x?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:w,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?x:void 0};k=i&&new n(o,c);let l=await(i?E(k,v):E(o,c));const m=d&&("stream"===y||"response"===y);if(d&&(f||m&&C)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Nt.toFiniteNumber(l.headers.get("content-length")),[n,o]=f&&dn(t,un(pn(f),!0))||[];l=new r(kn(l.body,65536,n,()=>{o&&o(),C&&C()}),e)}y=y||"text";let A=await p[Nt.findKey(p,y)||"text"](l,e);return!m&&C&&C(),await new Promise((t,n)=>{ln(t,n,{data:A,headers:on.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(C&&C(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Rt("Network Error",Rt.ERR_NETWORK,e,k),{cause:t.cause||t});throw Rt.from(t,t&&t.code,e,k)}}},Tn=new Map,Bn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,l=Tn;for(;c--;)s=i[c],a=l.get(s),void 0===a&&l.set(s,a=c?new Map:Rn(t)),l=a;return a};Bn();const On={http:null,xhr:xn,fetch:{get:Bn}};Nt.forEach(On,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Fn=e=>`- ${e}`,Ln=e=>Nt.isFunction(e)||null===e||!1===e;var jn={getAdapter:function(e,t){e=Nt.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ln(r)&&(o=On[(n=String(r)).toLowerCase()],void 0===o))throw new Rt(`Unknown adapter '${n}'`);if(o&&(Nt.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Rt("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Fn).join("\n"):" "+Fn(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o},adapters:On};function In(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new cn(null,e)}function zn(e){In(e),e.headers=on.from(e.headers),e.data=sn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return jn.getAdapter(e.adapter||Qt.adapter,e)(e).then(function(t){return In(e),t.data=sn.call(e,e.transformResponse,t),t.headers=on.from(t.headers),t},function(t){return an(t)||(In(e),t&&t.response&&(t.response.data=sn.call(e,e.transformResponse,t.response),t.response.headers=on.from(t.response.headers))),Promise.reject(t)})}const Pn="1.13.2",Mn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Mn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Dn={};Mn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Pn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Rt(r(o," has been removed"+(t?" in "+t:"")),Rt.ERR_DEPRECATED);return t&&!Dn[o]&&(Dn[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Mn.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 Rt("options must be an object",Rt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new Rt("option "+i+" must be "+n,Rt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Rt("Unknown option "+i,Rt.ERR_BAD_OPTION)}},validators:Mn};const qn=Un.validators;let Hn=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 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=yn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Un.assertOptions(n,{silentJSONParsing:qn.transitional(qn.boolean),forcedJSONParsing:qn.transitional(qn.boolean),clarifyTimeoutError:qn.transitional(qn.boolean)},!1),null!=r&&(Nt.isFunction(r)?t.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:qn.function,serialize:qn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Un.assertOptions(t,{baseUrl:qn.spelling("baseURL"),withXsrfToken:qn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Nt.merge(o.common,o[t.method]);o&&Nt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=on.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.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=[zn.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=s.length;let p=t;for(;d<u;){const e=s[d++],t=s[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=zn.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(fn((e=yn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Nt.forEach(["delete","get","head","options"],function(e){Hn.prototype[e]=function(t,n){return this.request(yn(n||{},{method:e,url:t,data:(n||{}).data}))}}),Nt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(yn(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Hn.prototype[e]=t(),Hn.prototype[e+"Form"]=t(!0)});const Wn={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(Wn).forEach(([e,t])=>{Wn[t]=e});const Vn=function e(t){const n=new Hn(t),r=Me(Hn.prototype.request,n);return Nt.extend(r,Hn.prototype,n,{allOwnKeys:!0}),Nt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(yn(t,n))},r}(Qt);Vn.Axios=Hn,Vn.CanceledError=cn,Vn.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,o){n.reason||(n.reason=new cn(e,r,o),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}}},Vn.isCancel=an,Vn.VERSION=Pn,Vn.toFormData=It,Vn.AxiosError=Rt,Vn.Cancel=Vn.CanceledError,Vn.all=function(e){return Promise.all(e)},Vn.spread=function(e){return function(t){return e.apply(null,t)}},Vn.isAxiosError=function(e){return Nt.isObject(e)&&!0===e.isAxiosError},Vn.mergeConfig=yn,Vn.AxiosHeaders=on,Vn.formToJSON=e=>Xt(Nt.isHTMLForm(e)?new FormData(e):e),Vn.getAdapter=jn.getAdapter,Vn.HttpStatusCode=Wn,Vn.default=Vn;const{Axios:Kn,AxiosError:Gn,CanceledError:Yn,isCancel:Jn,CancelToken:$n,VERSION:Xn,all:Qn,Cancel:Zn,isAxiosError:er,spread:tr,toFormData:nr,AxiosHeaders:rr,HttpStatusCode:or,formToJSON:ir,getAdapter:sr,mergeConfig:ar}=Vn;var cr=function(o){var i=o.apiKey,a=o.apiUrl,c=o.primaryColor,l=void 0===c?"#4F46E5":c,p=o.userData,f=void 0===p?null:p,g=o.theme,y=void 0===g?"light":g,b=o.onClose,x=h(t("create"),2),v=x[0],E=x[1],w=h(t([]),2),k=w[0],C=w[1],S=h(t(null),2),A=S[0],_=S[1],N=h(t([]),2),R=N[0],T=N[1],B=h(t(!1),2),O=B[0],F=B[1],L=h(t(""),2),j=L[0],I=L[1],z=h(t(""),2),P=z[0],M=z[1],D=h(t([]),2),U=D[0],q=D[1],H=h(t(null),2),W=H[0],V=H[1],K=h(t(!1),2);K[0],K[1];var G=h(t(""),2);G[0],G[1];var Y=h(t("success"),2);Y[0],Y[1];var J=h(t([]),2),$=J[0],X=J[1],Q=n(null),Z=n(null),ee=h(t({subject:"",message:"",htmlMessage:"",priority:"medium",category:"general",attachments:[]}),2),te=ee[0],ne=ee[1],re="dark"===y||"auto"===y&&window.matchMedia("(prefers-color-scheme: dark)").matches,oe=function(e){V(e),setTimeout(function(){return V(null)},4e3)},ie=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success",n=Date.now(),r={id:n,message:e,type:t};X(function(e){return[].concat(m(e),[r])}),setTimeout(function(){X(function(e){return e.filter(function(e){return e.id!==n})})},4e3)},se=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;document.execCommand(e,!1,n),null===(t=Z.current)||void 0===t||t.focus()},ae=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Array.from(e.target.files),r=t?U.length:te.attachments.length;if(r+n.length>10)return oe("You can only select up to 10 files total. You have ".concat(r," files already selected and are trying to add ").concat(n.length," more.")),void(e.target.value="");var o=n.filter(function(e){return e.size<=10485760?!!["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/svg+xml","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel.sheet.macroEnabled.12","text/csv","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/rtf","application/rtf","application/zip","application/x-zip-compressed","application/x-rar-compressed","application/x-7z-compressed"].includes(e.type)||(oe('File "'.concat(e.name,'" is not supported. Allowed: Images, PDF, Word, Excel, PowerPoint, Text files, Archives (ZIP, RAR, 7Z).')),!1):(oe('File "'.concat(e.name,'" is too large. Maximum size is 10MB per file.')),!1)});t?q(function(e){return[].concat(m(e),m(o))}):ne(function(e){return u(u({},e),{},{attachments:[].concat(m(e.attachments),m(o))})}),e.target.value=""},ce=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?q(function(t){return t.filter(function(t,n){return n!==e})}):ne(function(t){return u(u({},t),{},{attachments:t.attachments.filter(function(t,n){return n!==e})})})};r(function(){"create"===v||A||le()},[v]),r(function(){A?(T([]),ue(A.ticketId)):T([])},[A]);var le=function(){var e=s(d().m(function e(){var t,n,r;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(F(!0),e.p=1,(t=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")}).email){e.n=2;break}return console.error("No customer email available"),ie("Please provide your email to view tickets","error"),F(!1),e.a(2);case 2:return e.n=3,Vn.get("".concat(a,"/api/v1/email-ticketing/tickets"),{headers:{"x-api-key":i},params:{status:"all",customerEmail:t.email},timeout:3e4});case 3:(n=e.v).data.success&&C(n.data.data.tickets||[]),e.n=5;break;case 4:e.p=4,r=e.v,console.error("Error fetching tickets:",r),ie("Failed to load tickets","error");case 5:return e.p=5,F(!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=s(d().m(function e(t){var n,r,o,s;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return F(!0),e.p=1,n=f||{email:localStorage.getItem("chatGuestEmail")||"guest@example.com",name:localStorage.getItem("chatGuestName")||"Guest User"},console.log("Fetching messages for ticket:",t,"user:",n.email),e.n=2,Vn.get("".concat(a,"/api/v1/email-ticketing/tickets/").concat(t,"/messages"),{headers:{"x-api-key":i},params:{customerEmail:n.email},timeout:3e4});case 2:r=e.v,console.log("Messages response:",r.data),r.data.success&&(T(r.data.messages||[]),console.log("Set messages:",(null===(o=r.data.messages)||void 0===o?void 0:o.length)||0)),e.n=4;break;case 3:e.p=3,s=e.v,console.error("Error fetching messages:",s),T([]);case 4:return e.p=4,F(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),de=function(){var e=s(d().m(function e(t){var n,r,o,s,c,l;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),F(!0),e.p=1,(n=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")||"Guest User"}).email){e.n=2;break}return ie("β You can't raise ticket without login","error"),F(!1),e.a(2);case 2:return(r=n.email)&&"guest@example.com"!==r&&localStorage.setItem("chatGuestEmail",r),(o=new FormData).append("subject",te.subject),o.append("message",te.message),o.append("html",te.htmlMessage),o.append("priority",te.priority),o.append("category",te.category),o.append("customerEmail",r),o.append("customerName",n.name),te.attachments.forEach(function(e){o.append("attachments",e)}),e.n=3,Vn.post("".concat(a,"/api/v1/email-ticketing/tickets"),o,{headers:{"x-api-key":i},timeout:3e4});case 3:s=e.v,console.log("Ticket creation response:",s.data),s.data.success&&(ie("β
Ticket created successfully!","success"),ne({subject:"",message:"",htmlMessage:"",priority:"medium",category:"general",attachments:[]}),Z.current&&(Z.current.innerHTML=""),E("myTickets")),e.n=5;break;case 4:e.p=4,l=e.v,console.error("Error creating ticket:",l),"ECONNABORTED"===l.code?ie("β±οΈ Server timeout. The server may be waking up. Please wait a moment and try again.","error"):l.response?ie("β Failed to create ticket: ".concat((null===(c=l.response.data)||void 0===c?void 0:c.message)||"Server error"),"error"):l.request?ie("β Cannot reach server. Please check your connection or try again later.","error"):ie("β Failed to create ticket. Please try again.","error");case 5:return e.p=5,F(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),pe=function(){var e=s(d().m(function e(t){var n,r,o,s;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),j.trim()||0!==U.length){e.n=1;break}return e.a(2);case 1:return F(!0),e.p=2,n=f||{email:localStorage.getItem("chatGuestEmail"),name:localStorage.getItem("chatGuestName")},(r=new FormData).append("ticketId",A.ticketId),r.append("message",j),r.append("html",P),r.append("senderType","customer"),r.append("customerEmail",n.email),U.forEach(function(e){r.append("attachments",e)}),e.n=3,Vn.post("".concat(a,"/api/v1/email-ticketing/tickets/widget/reply"),r,{headers:{"x-api-key":i},timeout:3e4});case 3:e.v.data.success&&(ie("β
Reply sent successfully!","success"),I(""),M(""),q([]),Z.current&&(Z.current.innerHTML=""),setTimeout(function(){ue(A.ticketId)},500)),e.n=5;break;case 4:e.p=4,s=e.v,console.error("Error sending reply:",s),"ECONNABORTED"===s.code?ie("β±οΈ Request timeout. Server may be starting up. Please try again in 30 seconds.","error"):s.response?ie("β Failed to send reply: ".concat((null===(o=s.response.data)||void 0===o?void 0:o.message)||"Server error"),"error"):s.request?ie("β Cannot reach server. Please check your connection.","error"):ie("β Failed to send reply. Please try again.","error");case 5:return e.p=5,F(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),he=function(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},me=function(e){switch(e){case"open":return"#10B981";case"pending":return"#F59E0B";default:return"#6B7280"}},fe=function(e){switch(e){case"high":return"#EF4444";case"medium":return"#F59E0B";case"low":return"#10B981";default:return"#6B7280"}},ge=function(t){return t.startsWith("image/")?e.createElement("svg",{style:{width:"20px",height:"20px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})):e.createElement("svg",{style:{width:"20px",height:"20px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"}))},ye=function(t){var n=t.onCommand,r=t.showSendButton,o=void 0!==r&&r,i=t.onSend,s=void 0===i?null:i,a=t.isLoading,c=void 0!==a&&a,u=t.canSend,d=void 0!==u&&u;return e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#F9FAFB"}},e.createElement("div",{style:{display:"flex",gap:"4px",alignItems:"center"}},e.createElement("button",{type:"button",onClick:function(){return n("bold")},style:be,title:"Bold"},e.createElement("strong",null,"B")),e.createElement("button",{type:"button",onClick:function(){return n("italic")},style:be,title:"Italic"},e.createElement("em",null,"I")),e.createElement("button",{type:"button",onClick:function(){return n("underline")},style:be,title:"Underline"},e.createElement("u",null,"U")),e.createElement("button",{type:"button",onClick:function(){return n("strikeThrough")},style:be,title:"Strikethrough"},e.createElement("s",null,"S")),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("justifyLeft")},style:be,title:"Align Left"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}))),e.createElement("button",{type:"button",onClick:function(){return n("justifyCenter")},style:be,title:"Align Center"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}))),e.createElement("button",{type:"button",onClick:function(){return n("justifyRight")},style:be,title:"Align Right"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("insertUnorderedList")},style:be,title:"Bullet List"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"}))),e.createElement("button",{type:"button",onClick:function(){return n("insertOrderedList")},style:be,title:"Numbered List"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("indent")},style:be,title:"Increase Indent"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}))),e.createElement("button",{type:"button",onClick:function(){return n("outdent")},style:be,title:"Decrease Indent"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{d:"M3 21h18v-2H3v2zM3 8l4 4 4-4H3zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}))),e.createElement("div",{style:{width:"1px",backgroundColor:re?"#374151":"#E5E7EB",height:"20px",margin:"0 4px"}}),e.createElement("button",{type:"button",onClick:function(){return n("insertHorizontalRule")},style:be,title:"Insert Line"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"}))),e.createElement("button",{type:"button",onClick:function(){var e;return null===(e=Q.current)||void 0===e?void 0:e.click()},style:be,title:"Attach File"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})))),o&&e.createElement("button",{type:"button",onClick:s,disabled:c||!d,style:{padding:"6px 16px",fontSize:"12px",fontWeight:600,color:"#fff",backgroundColor:l,border:"none",borderRadius:"6px",cursor:c||!d?"not-allowed":"pointer",opacity:c||!d?.5:1,display:"flex",alignItems:"center",gap:"4px",transition:"all 0.2s"},title:c?"Sending...":"Send Reply"},c?e.createElement(e.Fragment,null,e.createElement("svg",{style:{width:"12px",height:"12px",animation:"spin 1s linear infinite"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})),"Sending..."):e.createElement(e.Fragment,null,e.createElement("svg",{style:{width:"12px",height:"12px"},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"})),"Send")))},be={background:"none",border:"none",padding:"6px 10px",borderRadius:"4px",cursor:"pointer",color:re?"#F9FAFB":"#111827",fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"};return e.createElement(e.Fragment,null,e.createElement("style",null,"\n .ticket-message-content ul,\n .ticket-message-content ol {\n margin-left: 1.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .ticket-message-content ul {\n list-style-type: disc;\n }\n .ticket-message-content ol {\n list-style-type: decimal;\n }\n .ticket-message-content li {\n margin-bottom: 0.25rem;\n }\n .ticket-editor[contenteditable] {\n max-width: 100%;\n word-break: break-word;\n overflow-wrap: break-word;\n }\n .ticket-editor ul,\n .ticket-editor ol {\n margin-left: 1.5rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .ticket-editor ul {\n list-style-type: disc;\n }\n .ticket-editor ol {\n list-style-type: decimal;\n }\n .ticket-editor li {\n margin-bottom: 0.25rem;\n }\n .ticket-editor:empty:before {\n content: attr(placeholder);\n color: #9CA3AF;\n pointer-events: none;\n }\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes modalAppear {\n from { \n transform: scale(0.9);\n opacity: 0;\n }\n to { \n transform: scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromRight {\n from {\n transform: translateX(100%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n @keyframes slideOutToRight {\n from {\n transform: translateX(0);\n opacity: 1;\n }\n to {\n transform: translateX(100%);\n opacity: 0;\n }\n }\n "),e.createElement("div",{style:{position:"fixed",inset:0,backgroundColor:re?"#111827":"#F9FAFB",zIndex:999999,display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",padding:"8px 16px",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:l,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:re?"#F9FAFB":"#111827"}},"Support Tickets"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"13px",color:re?"#9CA3AF":"#6B7280"}},"Manage your support requests"))),e.createElement("button",{onClick:b,style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",color:re?"#9CA3AF":"#6B7280"}},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:{flex:1,display:"flex",overflow:"hidden"}},e.createElement("div",{style:{width:"200px",backgroundColor:re?"#1F2937":"#fff",borderRight:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexDirection:"column",padding:"16px 0"}},e.createElement("button",{onClick:function(){E("create"),_(null)},style:{padding:"12px 20px",border:"none",backgroundColor:"create"===v?"".concat(l,"15"):"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"create"===v?l:re?"#D1D5DB":"#6B7280",textAlign:"left",borderLeft:"create"===v?"3px solid ".concat(l):"3px solid transparent",transition:"all 0.2s"}},"Create Ticket"),e.createElement("button",{onClick:function(){E("myTickets"),_(null)},style:{padding:"12px 20px",border:"none",backgroundColor:"myTickets"===v?"".concat(l,"15"):"transparent",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"myTickets"===v?l:re?"#D1D5DB":"#6B7280",textAlign:"left",borderLeft:"myTickets"===v?"3px solid ".concat(l):"3px solid transparent",transition:"all 0.2s"}},"My Tickets")),e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}},"create"===v&&e.createElement("div",{style:{flex:1,overflow:"auto",padding:"24px"}},e.createElement("div",{style:{maxWidth:"800px",margin:"0 auto"}},null!=f&&f.email||localStorage.getItem("chatGuestEmail")?e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderRadius:"12px",padding:"24px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:re?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h2",{style:{margin:"0 0 16px 0",fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Create New Support Ticket"),e.createElement("form",{onSubmit:de},e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:re?"#F9FAFB":"#111827"}},"Subject *"),e.createElement("input",{type:"text",name:"subject",value:te.subject,onChange:function(e){return ne(function(t){return u(u({},t),{},{subject:e.target.value})})},required:!0,placeholder:"Brief description of your issue",style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827",outline:"none"}})),e.createElement("div",{style:{marginBottom:"16px"}},e.createElement("label",{style:{display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:re?"#F9FAFB":"#111827"}},"Description *"),e.createElement("div",{style:{border:re?"1px solid #374151":"1px solid #D1D5DB",borderRadius:"8px",overflow:"hidden"}},e.createElement(ye,{onCommand:se}),e.createElement("div",{ref:Z,className:"ticket-editor",contentEditable:!0,onInput:function(e){var t=e.target.innerHTML,n=e.target.innerText;ne(function(e){return u(u({},e),{},{htmlMessage:t,message:n})})},placeholder:"Provide detailed information about your issue...",style:{minHeight:"150px",maxHeight:"300px",overflowY:"auto",padding:"12px",fontSize:"14px",color:re?"#F9FAFB":"#111827",backgroundColor:re?"#111827":"#fff",outline:"none"}}),e.createElement("input",{ref:Q,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.xlsm,.csv,.ppt,.pptx,.txt,.rtf,.zip,.rar,.7z",onChange:function(e){return ae(e,!1)},style:{display:"none"}}),te.attachments.length>0&&e.createElement("div",{style:{padding:"8px 12px",borderTop:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexWrap:"wrap",gap:"8px"}},te.attachments.map(function(t,n){return e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"6px",backgroundColor:re?"#374151":"#F3F4F6",fontSize:"12px",color:re?"#F9FAFB":"#111827"}},ge(t.type),e.createElement("span",null,t.name),e.createElement("button",{type:"button",onClick:function(){return ce(n,!1)},style:{background:"none",border:"none",cursor:"pointer",padding:"2px",color:"#EF4444"}},"Γ"))})))),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:re?"#F9FAFB":"#111827"}},"Priority"),e.createElement("select",{value:te.priority,onChange:function(e){return ne(function(t){return u(u({},t),{},{priority:e.target.value})})},style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827"}},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:re?"#F9FAFB":"#111827"}},"Category"),e.createElement("select",{value:te.category,onChange:function(e){return ne(function(t){return u(u({},t),{},{category:e.target.value})})},style:{width:"100%",padding:"10px 12px",fontSize:"14px",borderRadius:"8px",border:re?"1px solid #374151":"1px solid #D1D5DB",backgroundColor:re?"#111827":"#fff",color:re?"#F9FAFB":"#111827"}},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:O||!te.subject||!te.message,style:{width:"100%",padding:"12px 24px",fontSize:"14px",fontWeight:600,color:"#fff",backgroundColor:l,border:"none",borderRadius:"8px",cursor:O?"not-allowed":"pointer",opacity:!O&&te.subject&&te.message?1:.5}},O?"Creating Ticket...":"Submit Ticket"))):e.createElement("div",{style:{backgroundColor:re?"#1F2937":"#fff",borderRadius:"12px",padding:"48px 24px",textAlign:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",border:re?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("div",{style:{width:"80px",height:"80px",margin:"0 auto 24px",borderRadius:"50%",backgroundColor:"#FEE2E2",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("svg",{style:{width:"40px",height:"40px",color:"#EF4444"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"}))),e.createElement("h2",{style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Login Required"),e.createElement("p",{style:{margin:"0 0 24px 0",fontSize:"14px",color:re?"#9CA3AF":"#6B7280",lineHeight:"1.5"}},"You can't raise ticket without login. Please login to your account to create support tickets.")))),"myTickets"===v&&e.createElement("div",{style:{flex:1,display:"flex",overflow:"hidden"}},e.createElement("div",{style:{width:"320px",borderRight:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#F9FAFB",display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{padding:"16px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",flexShrink:0}},e.createElement("h3",{style:{margin:0,fontSize:"14px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"My Tickets")),e.createElement("div",{style:{flex:1,overflow:"auto"}},O?e.createElement("div",{style:{textAlign:"center",padding:"40px",color:re?"#9CA3AF":"#6B7280"}},"Loading tickets..."):0===k.length?e.createElement("div",{style:{textAlign:"center",padding:"40px"}},e.createElement("p",{style:{margin:0,fontSize:"14px",color:re?"#9CA3AF":"#6B7280"}},"No tickets found")):e.createElement("div",{style:{padding:"8px"}},k.map(function(t){var n=t.hasUnreadMessages||t.lastActivityAt&&new Date(t.lastActivityAt)>new Date(t.lastViewedAt||0),r=A&&A._id===t._id;return e.createElement("div",{key:t._id,onClick:function(){return _(t)},style:{padding:"12px",marginBottom:"8px",borderRadius:"8px",cursor:"pointer",backgroundColor:r?re?"#374151":"#fff":re?"#1F2937":"#fff",border:r?"2px solid ".concat(l):n?"2px solid ".concat(l,"40"):re?"1px solid #374151":"1px solid #E5E7EB",transition:"all 0.2s",position:"relative"}},n&&e.createElement("div",{style:{position:"absolute",top:"8px",right:"8px",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#EF4444"}}),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}},e.createElement("h4",{style:{margin:0,fontSize:"13px",fontWeight:r?700:600,color:re?"#F9FAFB":"#111827",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1}},t.subject),e.createElement("button",{onClick:function(e){e.stopPropagation(),A&&A._id===t._id?ue(t.ticketId):le()},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.7,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.7",e.target.style.backgroundColor="transparent"},title:"Refresh"},e.createElement("svg",{style:{width:"14px",height:"14px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})))),e.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"11px",color:re?"#9CA3AF":"#6B7280"}},t.ticketId),e.createElement("p",{style:{margin:"0 0 6px 0",fontSize:"11px",color:re?"#9CA3AF":"#6B7280"}},he(t.createdAt)),e.createElement("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"}},e.createElement("span",{style:{padding:"2px 6px",fontSize:"10px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(me(t.status),"20"),color:me(t.status)}},t.status),e.createElement("span",{style:{padding:"2px 6px",fontSize:"10px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(fe(t.priority),"20"),color:fe(t.priority)}},t.priority)))})))),A?e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}},e.createElement("div",{style:{padding:"8px 16px",borderBottom:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#fff"}},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},e.createElement("div",{style:{flex:1}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"2px"}},e.createElement("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},A.subject),e.createElement("span",{style:{padding:"2px 8px",fontSize:"11px",fontWeight:500,borderRadius:"4px",backgroundColor:"".concat(me(A.status),"20"),color:me(A.status)}},A.status)),e.createElement("p",{style:{margin:0,fontSize:"13px",color:re?"#9CA3AF":"#6B7280"}},A.ticketId)),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.createElement("button",{onClick:function(){return ue(A.ticketId)},style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"6px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.8,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.8",e.target.style.backgroundColor="transparent"},title:"Refresh conversation"},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"}))),e.createElement("button",{onClick:function(){return _(null)},style:{background:"none",border:"none",cursor:"pointer",padding:"8px",borderRadius:"6px",color:re?"#9CA3AF":"#6B7280",display:"flex",alignItems:"center",opacity:.8,transition:"all 0.2s"},onMouseEnter:function(e){e.target.style.opacity="1",e.target.style.backgroundColor=re?"#374151":"#F3F4F6"},onMouseLeave:function(e){e.target.style.opacity="0.8",e.target.style.backgroundColor="transparent"},title:"Close"},e.createElement("svg",{style:{width:"18px",height:"18px"},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:{flex:1,overflow:"auto",padding:"16px 24px"}},O?e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px",color:re?"#9CA3AF":"#6B7280"}},e.createElement("div",{style:{width:"20px",height:"20px",border:"2px solid ".concat(l),borderTop:"2px solid transparent",borderRadius:"50%",animation:"spin 1s linear infinite",marginRight:"10px"}}),j.trim()||U.length>0?"Sending reply...":"Loading conversation..."):0===R.length?e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px",color:re?"#9CA3AF":"#6B7280",textAlign:"center"}},"No messages in this conversation yet."):R.map(function(t,n){var r;return e.createElement("div",{key:t._id||n,style:{marginBottom:"16px",width:"100%"}},e.createElement("div",{style:{width:"100%",backgroundColor:"customer"===t.senderType?re?"#1E3A8A20":"#DBEAFE":re?"#1F2937":"#F3F4F6",borderRadius:"8px",padding:"12px",border:re?"customer"===t.senderType?"1px solid #1E40AF":"1px solid #374151":"customer"===t.senderType?"1px solid #93C5FD":"1px solid #E5E7EB"}},e.createElement("div",{style:{fontSize:"12px",color:re?"#9CA3AF":"#6B7280",marginBottom:"8px",display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:500}},e.createElement("span",null,"customer"===t.senderType?t.senderName||"You":((null===(r=t.sender)||void 0===r?void 0:r.alias)||t.senderName||"AGENT").toUpperCase()),e.createElement("span",null,he(t.createdAt))),e.createElement("div",{className:"ticket-message-content",style:{color:re?"#F9FAFB":"#111827",fontSize:"14px",lineHeight:"1.5",wordBreak:"break-word",overflowWrap:"break-word",whiteSpace:"pre-wrap"},dangerouslySetInnerHTML:{__html:t.html||t.message}}),t.attachments&&t.attachments.length>0&&e.createElement("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"8px"}},t.attachments.map(function(t,n){return e.createElement("div",{key:n,style:{border:re?"1px solid #374151":"1px solid #E5E7EB",borderRadius:"8px",overflow:"hidden"}},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",backgroundColor:re?"#111827":"#F9FAFB"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",flex:1,minWidth:0}},ge(t.contentType),e.createElement("span",{style:{fontSize:"12px",color:re?"#F9FAFB":"#111827",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.filename),t.size&&e.createElement("span",{style:{color:re?"#9CA3AF":"#6B7280",fontSize:"12px",flexShrink:0}},"(",(t.size/1024).toFixed(1)," KB)")),e.createElement("button",{onClick:function(){var e=s(d().m(function e(n){var r,o,i,s;return d().w(function(e){for(;;)switch(e.n){case 0:n.preventDefault(),n.stopPropagation();try{r=String(t.filename||"download").replace(/\s+/g,"_").replace(/[^a-zA-Z0-9._-]/g,"_"),t.url&&t.url.includes("cloudinary.com")?(o="".concat(a,"/api/v1/email-ticketing/attachments/download?filename=").concat(encodeURIComponent(r),"&url=").concat(encodeURIComponent(t.url)),(i=document.createElement("a")).href=o,i.rel="noopener",document.body.appendChild(i),i.click(),document.body.removeChild(i)):t.url&&((s=document.createElement("a")).href=t.url,s.download=r,s.rel="noopener",document.body.appendChild(s),s.click(),document.body.removeChild(s))}catch(e){console.error("Download failed:",e),window.open(t.url,"_blank","noopener,noreferrer")}case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),style:{marginLeft:"8px",padding:"4px 8px",fontSize:"12px",backgroundColor:l,color:"#fff",borderRadius:"4px",border:"none",cursor:"pointer",flexShrink:0,transition:"all 0.2s"},onMouseEnter:function(e){return e.target.style.backgroundColor="".concat(l,"dd")},onMouseLeave:function(e){return e.target.style.backgroundColor=l}},"Download")))}))))})),"closed"!==A.status&&e.createElement("div",{style:{borderTop:re?"1px solid #374151":"1px solid #E5E7EB",backgroundColor:re?"#1F2937":"#fff",padding:"16px 24px"}},e.createElement("div",{style:{border:re?"1px solid #374151":"1px solid #E5E7EB",borderRadius:"8px",overflow:"hidden"}},e.createElement(ye,{onCommand:se,showSendButton:!0,onSend:function(e){e.preventDefault(),pe(e)},isLoading:O,canSend:j.trim()||U.length>0}),e.createElement("div",{ref:Z,className:"ticket-editor",contentEditable:!0,onInput:function(e){var t=e.target.innerHTML,n=e.target.innerText;M(t),I(n)},placeholder:"Type your reply...",style:{minHeight:"100px",maxHeight:"200px",overflowY:"auto",padding:"12px",fontSize:"14px",color:re?"#F9FAFB":"#111827",backgroundColor:re?"#111827":"#fff",outline:"none"}}),e.createElement("input",{ref:Q,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.xlsm,.csv,.ppt,.pptx,.txt,.rtf,.zip,.rar,.7z",onChange:function(e){return ae(e,!0)},style:{display:"none"}}),U.length>0&&e.createElement("div",{style:{padding:"8px 12px",borderTop:re?"1px solid #374151":"1px solid #E5E7EB",display:"flex",flexWrap:"wrap",gap:"8px"}},U.map(function(t,n){return e.createElement("div",{key:n,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"6px",backgroundColor:re?"#374151":"#F3F4F6",fontSize:"12px",color:re?"#F9FAFB":"#111827"}},ge(t.type),e.createElement("span",null,t.name),e.createElement("button",{type:"button",onClick:function(){return ce(n,!0)},style:{background:"none",border:"none",cursor:"pointer",padding:"2px",color:"#EF4444"}},"Γ"))}))))):e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:re?"#111827":"#F9FAFB"}},e.createElement("div",{style:{textAlign:"center",padding:"40px"}},e.createElement("svg",{style:{width:"64px",height:"64px",margin:"0 auto 16px",color:re?"#374151":"#D1D5DB"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})),e.createElement("h3",{style:{margin:"0 0 8px 0",fontSize:"18px",fontWeight:600,color:re?"#F9FAFB":"#111827"}},"Select a ticket"),e.createElement("p",{style:{margin:0,fontSize:"14px",color:re?"#9CA3AF":"#6B7280"}},"Choose a ticket from the list to view details")))),!1)),W&&e.createElement("div",{style:{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,padding:"20px"}},e.createElement("div",{style:{backgroundColor:re?"#1f2937":"#ffffff",color:re?"#f9fafb":"#111827",borderRadius:"16px",padding:"32px 40px",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.3)",maxWidth:"500px",width:"100%",textAlign:"center",border:re?"1px solid #374151":"1px solid #e5e7eb",position:"relative",transform:"scale(1)",animation:"modalAppear 0.3s ease-out"}},e.createElement("div",{style:{width:"64px",height:"64px",borderRadius:"50%",backgroundColor:"#fef2f2",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 20px",border:"3px solid #fee2e2"}},e.createElement("svg",{style:{width:"32px",height:"32px",color:"#ef4444"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"}))),e.createElement("h3",{style:{color:"#ef4444",fontSize:"20px",fontWeight:"700",marginBottom:"12px",margin:"0 0 12px 0"}},"File Upload Limit Exceeded"),e.createElement("p",{style:{fontSize:"16px",lineHeight:"1.6",color:re?"#d1d5db":"#6b7280",marginBottom:"24px",margin:"0 0 24px 0"}},W),e.createElement("div",{style:{display:"flex",gap:"12px",justifyContent:"center"}},e.createElement("button",{onClick:function(){return V(null)},style:{padding:"12px 32px",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"8px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"all 0.2s",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.3)"},onMouseOver:function(e){e.target.style.backgroundColor="#dc2626",e.target.style.transform="translateY(-1px)",e.target.style.boxShadow="0 6px 16px rgba(239, 68, 68, 0.4)"},onMouseOut:function(e){e.target.style.backgroundColor="#ef4444",e.target.style.transform="translateY(0)",e.target.style.boxShadow="0 4px 12px rgba(239, 68, 68, 0.3)"}},"Understood")))),$.length>0&&e.createElement("div",{style:{position:"fixed",bottom:"20px",right:"20px",zIndex:10001,display:"flex",flexDirection:"column",gap:"12px",pointerEvents:"none"}},$.map(function(t){return e.createElement("div",{key:t.id,style:{backgroundColor:re?"#1f2937":"#ffffff",color:re?"#f9fafb":"#111827",padding:"16px 20px",borderRadius:"12px",boxShadow:"0 8px 25px rgba(0, 0, 0, 0.15)",border:"2px solid ".concat("success"===t.type?"#10b981":"#ef4444"),minWidth:"300px",maxWidth:"400px",animation:"slideInFromRight 0.3s ease-out",display:"flex",alignItems:"center",gap:"12px",pointerEvents:"auto"}},e.createElement("div",{style:{width:"24px",height:"24px",borderRadius:"50%",backgroundColor:"success"===t.type?"#10b981":"#ef4444",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},"success"===t.type?e.createElement("svg",{style:{width:"14px",height:"14px",color:"white"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})):e.createElement("svg",{style:{width:"14px",height:"14px",color:"white"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M6 18L18 6M6 6l12 12"}))),e.createElement("div",{style:{flex:1,fontSize:"14px",fontWeight:"500",lineHeight:"1.4"}},t.message),e.createElement("button",{onClick:function(){return X(function(e){return e.filter(function(e){return e.id!==t.id})})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",color:re?"#9ca3af":"#6b7280",flexShrink:0,opacity:.7,transition:"opacity 0.2s"},onMouseEnter:function(e){return e.target.style.opacity="1"},onMouseLeave:function(e){return e.target.style.opacity="0.7"}},e.createElement("svg",{style:{width:"16px",height:"16px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))}))))};function lr(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}lr(".camera-capture-wrapper{animation:slideUp .4s cubic-bezier(.4,0,.2,1);background:#fff;border:2px solid #e5e7eb;border-radius:16px;box-shadow:0 8px 32px rgba(0,0,0,.12);margin:12px 0;max-width:100%;overflow:hidden;position:relative;width:100%;z-index:100!important}@keyframes slideUp{0%{opacity:0;transform:translateY(40px)}to{opacity:1;transform:translateY(0)}}.camera-header-banner{align-items:center;background:linear-gradient(135deg,#6366f1,#8b5cf6);display:flex;justify-content:space-between;padding:16px 20px}.camera-header-content{align-items:center;display:flex;gap:14px}.camera-icon-badge{align-items:center;backdrop-filter:blur(10px);background:hsla(0,0%,100%,.2);border-radius:12px;display:flex;font-size:24px;height:48px;justify-content:center;width:48px}.camera-header-text{color:#fff}.camera-title{font-size:18px;font-weight:700;letter-spacing:-.5px;margin:0}.camera-subtitle{font-size:13px;font-weight:400;margin:4px 0 0;opacity:.9}.camera-close-button{align-items:center;backdrop-filter:blur(10px);background:hsla(0,0%,100%,.15);border:none;border-radius:8px;color:#fff;cursor:pointer;display:flex;font-size:20px;height:36px;justify-content:center;transition:all .2s;width:36px}.camera-close-button:hover{background:hsla(0,0%,100%,.25);transform:scale(1.05)}.camera-view-container{background:#000;max-height:500px;min-height:400px;overflow:hidden;position:relative}.camera-loading-state{align-items:center;color:#fff;display:flex;flex-direction:column;height:400px;justify-content:center}.loading-spinner{animation:spin 1s linear infinite;border:4px solid hsla(0,0%,100%,.2);border-radius:50%;border-top-color:#fff;height:48px;margin-bottom:16px;width:48px}@keyframes spin{to{transform:rotate(1turn)}}.camera-error-state{align-items:center;color:#fff;display:flex;flex-direction:column;height:400px;justify-content:center;padding:40px;text-align:center}.error-icon-large{font-size:64px;margin-bottom:16px;opacity:.5}.error-message{font-size:16px;line-height:1.5;margin-bottom:24px}.retry-button{background:#6366f1;border:none;border-radius:8px;color:#fff;cursor:pointer;font-size:15px;font-weight:600;padding:12px 28px;transition:all .2s}.retry-button:hover{background:#4f46e5;transform:scale(1.05)}.camera-live-mode{height:100%;min-height:400px;position:relative;width:100%}.camera-video-feed{display:block;height:100%;object-fit:cover;width:100%}.camera-overlay{bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0}.camera-frame{aspect-ratio:4/3;border:3px solid hsla(0,0%,100%,.5);border-radius:16px;box-shadow:0 0 0 2000px rgba(0,0,0,.3);left:50%;max-width:350px;position:absolute;top:50%;transform:translate(-50%,-50%);width:80%}.camera-preview-mode{background:#000;min-height:400px;position:relative;width:100%}.preview-image-wrapper{align-items:center;display:flex;height:100%;justify-content:center;position:relative;width:100%}.preview-image{display:block;max-height:500px;max-width:100%;object-fit:contain}.preview-badge{backdrop-filter:blur(10px);background:rgba(99,102,241,.95);border-radius:20px;color:#fff;font-size:13px;font-weight:600;padding:8px 16px;position:absolute;right:16px;top:16px}.camera-action-section{background:#fff;padding:24px 20px}.preview-actions{display:grid;gap:12px;grid-template-columns:1fr 1fr}.action-button{align-items:center;border:none;border-radius:12px;cursor:pointer;display:flex;font-family:inherit;font-size:16px;font-weight:600;gap:10px;justify-content:center;padding:16px 24px;transition:all .2s}.button-icon{font-size:20px}.retake-button{background:#f3f4f6;border:2px solid #e5e7eb;color:#374151}.retake-button:hover{background:#e5e7eb;box-shadow:0 4px 12px rgba(0,0,0,.1);transform:translateY(-2px)}.submit-button{background:linear-gradient(135deg,#10b981,#059669);box-shadow:0 4px 16px rgba(16,185,129,.3);color:#fff}.submit-button:hover{box-shadow:0 6px 20px rgba(16,185,129,.4);transform:translateY(-2px)}.camera-actions{align-items:center;display:flex;gap:16px;justify-content:space-between}.flip-camera-button{align-items:center;background:#f3f4f6;border:2px solid #e5e7eb;border-radius:50%;cursor:pointer;display:flex;flex-direction:column;height:64px;justify-content:center;transition:all .2s;width:64px}.flip-camera-button:hover:not(:disabled){background:#e5e7eb;transform:scale(1.05)}.flip-camera-button:disabled{cursor:not-allowed;opacity:.4}.flip-icon{font-size:24px}.flip-text{color:#6b7280;font-size:11px;font-weight:600;margin-top:2px}.capture-button-main{align-items:center;background:#fff;border:4px solid #6366f1;border-radius:50%;box-shadow:0 4px 20px rgba(99,102,241,.3);cursor:pointer;display:flex;height:80px;justify-content:center;position:relative;transition:all .2s;width:80px}.capture-button-main:hover:not(:disabled){box-shadow:0 6px 24px rgba(99,102,241,.4);transform:scale(1.08)}.capture-button-main:active:not(:disabled){transform:scale(.95)}.capture-button-main:disabled{cursor:not-allowed;opacity:.4}.capture-button-inner{align-items:center;display:flex;height:100%;justify-content:center;position:relative;width:100%}.capture-ring{animation:pulse 2s ease-in-out infinite;border:3px solid #6366f1;border-radius:50%;height:68px;position:absolute;width:68px}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.1)}}.capture-center{background:linear-gradient(135deg,#6366f1,#8b5cf6);border-radius:50%;height:56px;width:56px}.placeholder-space{width:64px}.camera-instructions{background:#f9fafb;border-top:1px solid #e5e7eb;padding:16px 20px;text-align:center}.camera-instructions p{color:#6b7280;font-size:14px;font-weight:500;margin:0}.camera-instructions.success{background:#ecfdf5;border-top-color:#d1fae5}.camera-instructions.success p{color:#059669}@media (max-width:768px){.camera-capture-wrapper{border-radius:12px;margin:12px 0}.camera-header-banner{padding:14px 16px}.camera-icon-badge{font-size:20px;height:42px;width:42px}.camera-title{font-size:16px}.camera-subtitle{font-size:12px}.camera-view-container{max-height:400px;min-height:350px}.camera-live-mode{min-height:350px}.camera-action-section{padding:20px 16px}.action-button{font-size:15px;padding:14px 20px}.capture-button-main{height:72px;width:72px}.capture-ring{height:60px;width:60px}.capture-center{height:48px;width:48px}}@media (max-width:480px){.camera-capture-wrapper{border-radius:10px;margin:8px 0}.camera-header-banner{padding:12px 14px}.camera-icon-badge{border-radius:10px;font-size:18px;height:38px;width:38px}.camera-title{font-size:15px}.camera-subtitle{font-size:11px}.camera-close-button{font-size:18px;height:32px;width:32px}.camera-view-container{max-height:350px;min-height:300px}.camera-live-mode{min-height:300px}.camera-action-section{padding:18px 14px}.action-button{font-size:14px;padding:13px 18px}.button-icon{font-size:18px}.flip-camera-button{height:56px;width:56px}.flip-icon{font-size:20px}.capture-button-main{height:68px;width:68px}.capture-ring{height:56px;width:56px}.capture-center{height:44px;width:44px}.placeholder-space{width:56px}.camera-instructions{padding:14px 16px}.camera-instructions p{font-size:13px}}");var ur=function(o){var i=o.onCapture,a=o.onClose,c=o.requesterName,l=void 0===c?"Agent":c,u=h(t(null),2),p=u[0],m=u[1],f=h(t(null),2),g=f[0],y=f[1],b=h(t(!1),2),x=b[0],v=b[1],E=h(t("environment"),2),w=E[0],k=E[1],C=h(t(null),2),S=C[0],A=C[1],_=h(t(!0),2),N=_[0],R=_[1],T=n(null),B=n(null);r(function(){return O(),function(){F()}},[w]);var O=function(){var e=s(d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,A(null),R(!0),e.n=1,navigator.mediaDevices.getUserMedia({video:{facingMode:w,width:{ideal:1920},height:{ideal:1080}},audio:!1});case 1:t=e.v,m(t),T.current&&(T.current.srcObject=t),v(!0),R(!1),e.n=3;break;case 2:e.p=2,n=e.v,console.error("Camera access error:",n),A("Camera access denied. Please allow camera permissions."),v(!1),R(!1);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),F=function(){p&&(p.getTracks().forEach(function(e){return e.stop()}),m(null),v(!1))},L=function(){F(),a&&a()};return e.createElement("div",{className:"camera-capture-wrapper"},e.createElement("div",{className:"camera-header-banner"},e.createElement("div",{className:"camera-header-content"},e.createElement("div",{className:"camera-icon-badge"},"πΈ"),e.createElement("div",{className:"camera-header-text"},e.createElement("h3",{className:"camera-title"},"Camera Capture"),e.createElement("p",{className:"camera-subtitle"},l," requested a photo"))),e.createElement("button",{className:"camera-close-button",onClick:L},e.createElement("span",null,"β"))),e.createElement("div",{className:"camera-view-container"},S?e.createElement("div",{className:"camera-error-state"},e.createElement("div",{className:"error-icon-large"},"π·"),e.createElement("p",{className:"error-message"},S),e.createElement("button",{className:"retry-button",onClick:O},"π Try Again")):N?e.createElement("div",{className:"camera-loading-state"},e.createElement("div",{className:"loading-spinner"}),e.createElement("p",null,"Loading camera...")):g?e.createElement("div",{className:"camera-preview-mode"},e.createElement("div",{className:"preview-image-wrapper"},e.createElement("img",{src:g,alt:"Captured",className:"preview-image"}),e.createElement("div",{className:"preview-badge"},"Preview"))):e.createElement("div",{className:"camera-live-mode"},e.createElement("video",{ref:T,autoPlay:!0,playsInline:!0,muted:!0,className:"camera-video-feed"}),e.createElement("div",{className:"camera-overlay"},e.createElement("div",{className:"camera-frame"})),e.createElement("canvas",{ref:B,style:{display:"none"}}))),e.createElement("div",{className:"camera-action-section"},g?e.createElement("div",{className:"preview-actions"},e.createElement("button",{className:"action-button retake-button",onClick:function(){y(null),O()}},e.createElement("span",{className:"button-icon"},"π"),e.createElement("span",{className:"button-text"},"Retake")),e.createElement("button",{className:"action-button submit-button",onClick:function(){g&&i&&(i(g),L())}},e.createElement("span",{className:"button-icon"},"β"),e.createElement("span",{className:"button-text"},"Submit Photo"))):e.createElement("div",{className:"camera-actions"},e.createElement("button",{className:"flip-camera-button",onClick:function(){k(function(e){return"user"===e?"environment":"user"})},disabled:!x},e.createElement("span",{className:"flip-icon"},"π"),e.createElement("span",{className:"flip-text"},"Flip")),e.createElement("button",{className:"capture-button-main",onClick:function(){if(T.current&&B.current){var e=T.current,t=B.current,n=t.getContext("2d");t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height);var r=t.toDataURL("image/jpeg",.95);y(r),F()}},disabled:!x},e.createElement("div",{className:"capture-button-inner"},e.createElement("div",{className:"capture-ring"}),e.createElement("div",{className:"capture-center"}))),e.createElement("div",{className:"placeholder-space"}))),!g&&!S&&e.createElement("div",{className:"camera-instructions"},e.createElement("p",null,"πΈ Position and tap the button to capture")),g&&e.createElement("div",{className:"camera-instructions success"},e.createElement("p",null,"β Photo captured! Review and submit or retake")))};lr(".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;animation:crm-pulse 2s ease-in-out infinite;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 0 rgba(79,70,229,.4);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .3s cubic-bezier(.4,0,.2,1);width:64px}.crm-chat-button:hover{animation:none;box-shadow:0 15px 35px rgba(79,70,229,.5),0 0 0 8px rgba(79,70,229,.1);transform:scale(1.1)}@keyframes crm-pulse{0%,to{box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 0 rgba(79,70,229,.4)}50%{box-shadow:0 10px 25px rgba(79,70,229,.4),0 0 0 8px rgba(79,70,229,0)}}.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%;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;font-size:20px;height:40px;justify-content:center;transition:transform .2s;width:40px}.crm-avatar:hover{transform:scale(1.05)}.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 dr=function(o){var i=o.apiKey,c=o.apiUrl,l=void 0===c?"https://chat-crm-backend-7mzo.onrender.com":c,u=o.primaryColor,p=void 0===u?"#4F46E5":u,f=o.position,g=void 0===f?"bottom-right":f,y=o.userData,b=void 0===y?null:y,x=o.welcomeMessage,v=void 0===x?"π Welcome! How can we help you today?":x,E=o.companyName,w=void 0===E?"Support":E,k=o.autoOpen,C=void 0!==k&&k,S=o.showNotifications,A=void 0===S||S,_=o.playSound,N=void 0!==_&&_,R=o.theme,T=void 0===R?"light":R,B=o.zIndex,O=void 0===B?9999:B,F=h(t(C),2),L=F[0],j=F[1],I=h(t([]),2),z=I[0],P=I[1],M=h(t(""),2),D=M[0],U=M[1],q=h(t(null),2),H=q[0],W=q[1],V=h(t(null),2);V[0];var K=V[1],G=h(t(null),2),Y=G[0],J=G[1],$=h(t(!1),2),X=$[0],Q=$[1],Z=h(t(!1),2),ee=Z[0],te=Z[1],ne=h(t(!1),2),re=ne[0],oe=ne[1],ie=h(t(!1),2),se=ie[0],ae=ie[1],ce=h(t("Support Agent"),2),le=ce[0],ue=ce[1],de=h(t(0),2),pe=de[0],he=de[1],me=h(t(!1),2),fe=me[0],ge=me[1],ye=h(t("active"),2),be=ye[0],xe=ye[1],ve=h(t(null),2),Ee=ve[0],we=ve[1],ke=h(t(!1),2),Ce=ke[0],Se=ke[1],Ae=h(t(!1),2),_e=Ae[0],Ne=Ae[1],Re=h(t(null),2),Te=Re[0],Be=Re[1],Oe=h(t(null),2),Fe=Oe[0],Le=Oe[1],je=n(null),Ie=n(null),ze=h(t(!1),2),Me=ze[0],De=ze[1],Ue=h(t(0),2),qe=Ue[0],He=Ue[1],We=h(t(""),2),Ve=We[0],Ke=We[1],Ge=h(t(!1),2),Ye=Ge[0],Je=Ge[1],$e=h(t(!1),2),Xe=$e[0],Qe=$e[1],Ze=h(t(!1),2),et=Ze[0],tt=Ze[1],nt=h(t(null),2),rt=nt[0],ot=nt[1],it=h(t([]),2),st=it[0],at=it[1],ct=n(!1),lt=n(null),ut=n(null),dt=n(null),pt=n(null);r(function(){var e=function(e){if(L){var t=ut.current,n=dt.current,r=pt.current;!t||t.contains(e.target)||!n||n.contains(e.target)||r&&r.contains(e.target)||(j(!1),tt(!1))}};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[L]);r(function(){var e;null===(e=lt.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[z]),r(function(){return function(){H&&H.disconnect()}},[H]);var ht=function(){if(b)return{name:b.name||"Guest User",email:b.email||null,phone:b.phone||null,userId:b.userId||null};var e=function(){for(var e={name:null,email:null,phone:null},t=function(e){var t,n;return e?"META"===e.tagName?e.getAttribute("content")||null:"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value||e.getAttribute("value")||e.getAttribute("placeholder")||null:e.getAttribute("data-name")||e.getAttribute("data-user-name")||e.getAttribute("data-full-name")||e.getAttribute("data-display-name")||e.getAttribute("data-email")||e.getAttribute("data-phone")||(null===(t=e.textContent)||void 0===t?void 0:t.trim())||(null===(n=e.innerText)||void 0===n?void 0:n.trim())||null:null},n=null,r=null,o=null,i=0,s=['[name="firstName"], [name="firstname"], [name="FirstName"], [name="FIRSTNAME"]','[name="lastName"], [name="lastname"], [name="LastName"], [name="LASTNAME"]','[name="fullName"], [name="fullname"], [name="FullName"], [name="FULLNAME"]','[name="userName"], [name="username"], [name="UserName"], [name="USERNAME"]','[name="displayName"], [name="display_name"]','[name="name"], [name="Name"], [name="NAME"]',"#firstName, #firstname, #FirstName, #FIRSTNAME","#lastName, #lastname, #LastName, #LASTNAME","#fullName, #fullname, #FullName, #FULLNAME","#userName, #username, #UserName, #USERNAME","#displayName, #display_name","#name, #Name, #NAME",".firstName, .firstname, .FirstName, .FIRSTNAME",".lastName, .lastname, .LastName, .LASTNAME",".fullName, .fullname, .FullName, .FULLNAME",".userName, .username, .UserName, .USERNAME",".displayName, .display_name",".name, .Name, .NAME","[data-name], [data-user-name], [data-full-name], [data-display-name]",".profile-name, .user-name, .username, .full-name",".header-name, .nav-name, .account-name",'meta[name="user-name"], meta[property="user:name"]'];i<s.length;i++){var c=s[i];try{var l,u=a(document.querySelectorAll(c));try{for(u.s();!(l=u.n()).done;){var d=t(l.value);d&&d.length>1&&"Guest User"!==d&&(c.toLowerCase().includes("firstname")&&!n?n=d:c.toLowerCase().includes("lastname")&&!r?r=d:(c.toLowerCase().includes("fullname")||c.toLowerCase().includes("username")||c.toLowerCase().includes("displayname")||c.toLowerCase().includes("name"))&&!o&&(o=d))}}catch(e){u.e(e)}finally{u.f()}}catch(e){}}n&&r?e.name="".concat(n," ").concat(r):n?e.name=n:r?e.name=r:o&&(e.name=o);for(var p=0,h=['[name="email"], [name="Email"], [name="EMAIL"]','[type="email"]',"#email, #Email, #EMAIL",".email, .Email, .EMAIL","[data-email]",'meta[name="user-email"], meta[property="user:email"]'];p<h.length;p++){var m=h[p];try{var f=t(document.querySelector(m));if(f&&f.includes("@")){e.email=f;break}}catch(e){}}for(var g=0,y=['[name="phone"], [name="Phone"], [name="PHONE"]','[name="phoneNumber"], [name="phone_number"]','[type="tel"]',"#phone, #Phone, #PHONE",".phone, .Phone, .PHONE","[data-phone]"];g<y.length;g++){var b=y[g];try{var x=t(document.querySelector(b));if(x&&/[\d\+\-\(\)\s]{10,}/.test(x)){e.phone=x;break}}catch(e){}}return e}();return{name:e.name||localStorage.getItem("chatGuestName")||"Guest User",email:e.email||localStorage.getItem("chatGuestEmail")||null,phone:e.phone||localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},mt=function(){var e=s(d().m(function e(){var t,n,r,o,s,a,c;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=ht(),te(!0),e.p=1,console.log("π Creating new conversation for first message..."),e.n=2,Vn.post("".concat(l,"/api/v1/webhook/guest-conversation"),{apiKey:i,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,o=r.conversationId,s=r.petitionId,a=r.queryId,K(a),J(o),ge(!0),localStorage.setItem("chatGuestId",a),localStorage.setItem("chatConversationId",o),localStorage.setItem("chatPetitionId",s),t.email&&localStorage.setItem("chatGuestEmail",t.email),t.name&&localStorage.setItem("chatGuestName",t.name),t.phone&&localStorage.setItem("chatGuestPhone",t.phone),console.log("β
Conversation created:",{petitionId:s,queryId:a}),e.a(2,{newConvId:o,petitionId:s});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,c=e.v,console.error("β Create conversation error:",c),c;case 5:return e.p=5,te(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),ft=function(){var e=s(d().m(function e(t){var n,r;return d().w(function(e){for(;;)if(0===e.n)return n=t.convId,r=t.petitionId,oe(!0),e.a(2,new Promise(function(e,t){try{var o,s=Pe("".concat(l,"/widget"),{query:{conversationId:n,petitionId:r,apiKey:i},transports:["websocket","polling"]});s.on("connect",function(){Q(!0),oe(!1),console.log("β
Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){oe(!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||"Support Agent",timestamp:e.timestamp||new Date,read:!1};P(function(e){var n=[].concat(m(e),[t]);return"guest"!==t.sender&&t.message&&(t.message.toLowerCase().includes("requested a photo")||t.message.toLowerCase().includes("send a photo")||t.message.toLowerCase().includes("send photo"))&&at(function(e){var t=n.length-1;return e.includes(t)?e:[].concat(m(e),[t])}),n}),ue((e.senderName||"Support Agent").toUpperCase()),ae(!1),!L&&A&&(he(function(e){return e+1}),N&&xt())}),s.on("query-accepted",function(e){console.log("β
Query accepted by agent:",e);var t=(e.agentName||"Support Agent").toUpperCase();ue(t),xe("active"),P(function(e){return[].concat(m(e),[{message:"".concat(t," has accepted your query and will assist you now."),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-transferred",function(e){console.log("π Query transferred:",e);var t=(e.toAgentName||"Support Agent").toUpperCase();ue(t),P(function(e){return[].concat(m(e),[{message:"Your query has been escalated and will be assisted shortly.",sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-resolved",function(e){console.log("β
Query resolved:",e),xe("resolved"),ct.current?console.log("π Skipping duplicate resolved system message"):(ct.current=!0,P(function(e){return[].concat(m(e),[{message:"β
This query has been resolved by the agent.",sender:"system",timestamp:new Date,read:!0}])}))}),s.on("request-feedback",function(e){console.log("π Feedback requested:",e),De(!0)}),s.on("request-camera-snapshot",function(e){console.log("πΈ Snapshot request received:",e);try{var t,n=localStorage.getItem("chatPetitionId");if(console.log("πΈ Checking petitionId match:",{received:null==e?void 0:e.petitionId,stored:n}),null!=e&&e.petitionId&&n&&e.petitionId===n)console.log("β
PetitionId match - showing camera"),we({requesterName:e.requesterName||(null===(t=e.requester)||void 0===t?void 0:t.name)||"Agent",at:Date.now()});else console.log("β PetitionId mismatch or missing")}catch(e){console.error("Snapshot request error:",e)}}),s.on("query-reopened",function(e){console.log("π Query reopened:",e),xe("active"),ct.current=!1}),s.on("agent-typing",function(e){e.isTyping?(ae(!0),ue(e.agentName||"Support Agent"),o&&clearTimeout(o),o=setTimeout(function(){ae(!1)},3e3)):(ae(!1),o&&clearTimeout(o))}),W(s)}catch(e){oe(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),gt=function(){var e=s(d().m(function e(){var t,n,r,o,i,s,a,c,l,u;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(D.trim()&&"resolved"!==be){e.n=1;break}return e.a(2);case 1:if(H&&localStorage.getItem("chatPetitionId")&&(t=localStorage.getItem("chatPetitionId"),H.emit("customer-typing",{petitionId:t,isTyping:!1})),n=ht(),r=D.trim(),o=Date.now(),P(function(e){return[].concat(m(e),[{message:r,sender:"guest",senderName:n.name||"Guest User",read:!0,timestamp:new Date,tempId:o}])}),U(""),e.p=2,i=localStorage.getItem("chatPetitionId"),s=Y||localStorage.getItem("chatConversationId"),i&&s){e.n=4;break}return e.n=3,mt();case 3:a=e.v,s=a.newConvId,i=a.petitionId;case 4:if((c=H)&&X){e.n=6;break}try{H&&H.disconnect()}catch(e){}return e.n=5,ft({convId:s,petitionId:i});case 5:c=e.v;case 6:l={conversationId:s,petitionId:i,message:r,senderName:n.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,u=e.v,console.error("β Send message error:",u),P(function(e){return e.filter(function(e){return e.tempId!==o})}),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)}}(),yt=function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),H&&H.disconnect(),W(null),K(null),J(null),Q(!1),ge(!1),xe("active"),ct.current=!1,P([]),U(""),De(!1),He(0),Ke(""),Je(!1),console.log("π Starting new query...")},bt=function(e){if("ticket"===e&&!((null==b?void 0:b.email)||localStorage.getItem("chatGuestEmail")))return ot(e),void tt(!1);ot(e),tt(!1)},xt=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)},vt=function(){var e=s(d().m(function e(){var t,n;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.mediaDevices.getUserMedia({video:{facingMode:"user"}});case 1:t=e.v,Be(t),je.current&&(je.current.srcObject=t,je.current.play()),e.n=3;break;case 2:e.p=2,n=e.v,console.error("Camera access error:",n),alert("Camera access denied. Please allow camera permissions."),kt();case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),Et=function(){var e=s(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return Le(null),e.n=1,vt();case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),wt=function(){var e=s(d().m(function e(){var t,n,r,o,s,a,c,u,p;return d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(Fe){e.n=1;break}return e.a(2);case 1:return Se(!0),e.p=2,e.n=3,fetch(Fe).then(function(e){return e.blob()});case 3:return n=e.v,r=localStorage.getItem("chatPetitionId"),o=new FormData,s="snapshot-".concat(r,"-").concat(Date.now(),".png"),o.append("screenshot",n,s),o.append("petitionId",r),o.append("apiKey",i),o.append("metadata",JSON.stringify({source:"widget",requesterName:null==Ee?void 0:Ee.requesterName})),e.n=4,Vn.post("".concat(l,"/api/v1/webhook/upload-snapshot"),o,{headers:{"Content-Type":"multipart/form-data"}});case 4:if(a=e.v,!(c=null==a||null===(t=a.data)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.imageUrl)){e.n=5;break}return u=new Date,P(function(e){return[].concat(m(e),[{message:"πΈ Screenshot: ".concat(c),sender:"guest",senderName:"You",timestamp:u,read:!0}])}),e.n=5,Vn.post("".concat(l,"/api/v1/webhook/send-message"),{apiKey:i,petitionId:r,message:"πΈ Screenshot: ".concat(c),senderName:"Guest User"});case 5:kt(),e.n=7;break;case 6:e.p=6,p=e.v,console.error("Widget capture error:",p),alert("Failed to upload photo. Please try again.");case 7:return e.p=7,Se(!1),e.f(7);case 8:return e.a(2)}},e,null,[[2,6,7,8]])}));return function(){return e.apply(this,arguments)}}(),kt=function(){Te&&(Te.getTracks().forEach(function(e){return e.stop()}),Be(null)),Ne(!1),Le(null),we(null)};r(function(){console.log("πΈ Snapshot useEffect triggered:",{snapshotRequest:Ee,showCamera:_e}),Ee&&!_e&&(console.log("πΈ Setting showCamera to true and initializing camera"),Ne(!0),setTimeout(function(){console.log("πΈ Calling initializeCamera"),vt()},100))},[Ee,_e]),r(function(){console.log("πΈ Video ref useEffect:",{showCamera:_e,hasVideoRef:!!je.current,currentStream:Te,capturedImage:Fe}),_e&&je.current&&!Te&&!Fe&&(console.log("πΈ Reinitializing camera from video ref useEffect"),vt())},[_e,je.current]);var Ct=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[g]||e["bottom-right"]},St="dark"===T||"auto"===T&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:O}},e.createElement("button",{ref:dt,onClick:function(){j(function(e){var t=!e;return t?(he(0),tt(!0),ot(null)):(tt(!1),ot(null)),t})},className:"crm-chat-button ".concat(Ct()),style:{background:"linear-gradient(135deg, ".concat(p," 0%, #6366f1 100%)")},"aria-label":L?"Close help":"Help & Support",title:"Help & Support"},L&&!et?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 3a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-5l-5 3v-3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h12z"}),e.createElement("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),e.createElement("circle",{cx:"12",cy:"10",r:"1",fill:"currentColor"}),e.createElement("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"}),e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 14c.5.5 1.5 1 3 1s2.5-.5 3-1"})),!L&&pe>0&&e.createElement("span",{className:"crm-badge"},pe)),L&&et&&e.createElement("div",{ref:pt,className:"crm-menu-popup ".concat(Ct()," ").concat(St?"crm-dark":""),style:{position:"fixed",bottom:g.includes("bottom")?"90px":"auto",top:g.includes("top")?"90px":"auto",right:g.includes("right")?"24px":"auto",left:g.includes("left")?"24px":"auto",width:"280px",backgroundColor:St?"#1F2937":"#fff",borderRadius:"12px",boxShadow:"0 10px 40px rgba(0,0,0,0.15)",border:St?"1px solid #374151":"1px solid #E5E7EB",overflow:"hidden",zIndex:O+1}},e.createElement("div",{style:{padding:"16px",borderBottom:St?"1px solid #374151":"1px solid #E5E7EB"}},e.createElement("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,color:St?"#F9FAFB":"#111827"}},"Help & Support"),e.createElement("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:St?"#9CA3AF":"#6B7280"}},"How can we assist you today?")),e.createElement("div",{style:{padding:"8px"}},e.createElement("button",{onClick:function(){return bt("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=St?"#374151":"#F3F4F6"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},e.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"8px",backgroundColor:p,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:St?"#F9FAFB":"#111827"}},"Start Query"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:St?"#9CA3AF":"#6B7280"}},"Chat with our support team")),e.createElement("svg",{style:{width:"16px",height:"16px",color:St?"#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 bt("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=St?"#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:St?"#F9FAFB":"#111827"}},"Raise Ticket"),e.createElement("p",{style:{margin:"2px 0 0 0",fontSize:"12px",color:St?"#9CA3AF":"#6B7280"}},"Submit a support ticket")),e.createElement("svg",{style:{width:"16px",height:"16px",color:St?"#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"}))))),L&&"query"===rt&&e.createElement("div",{ref:ut,className:"crm-chat-window ".concat(Ct()," ").concat(St?"crm-dark":""),style:{position:"relative"}},e.createElement("div",{className:"crm-header",style:{backgroundColor:p}},e.createElement("div",{className:"crm-header-content"},e.createElement("button",{onClick:function(){ot(null),tt(!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("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:p,strokeWidth:"2"},e.createElement("path",{d:"M12 2a4 4 0 0 1 4 4v2a4 4 0 0 1-8 0V6a4 4 0 0 1 4-4z"}),e.createElement("path",{d:"M12 14v8"}),e.createElement("path",{d:"M8 22h8"}),e.createElement("path",{d:"M8 14c-2 0-3 1-3 3v1c0 2 1 3 3 3h8c2 0 3-1 3-3v-1c0-2-1-3-3-3H8z"}))),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},w),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(X?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===be?e.createElement("span",{style:{color:"#10B981"}},"β Resolved"):"Support Agent"!==le?e.createElement("span",null,"π¬ ",le):X?"Online":re?"Connectingβ¦":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:yt,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),tt(!1),ot(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&&e.createElement("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:St?"#1F2937":"#fff",zIndex:9999,display:"flex",flexDirection:"column",padding:"16px",overflow:"auto"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"}},e.createElement("h3",{style:{margin:0,fontSize:"16px",fontWeight:600,color:St?"#E5E7EB":"#111827"}},"πΈ Camera Capture"),e.createElement("button",{onClick:kt,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",padding:"0",color:St?"#9CA3AF":"#6B7280"}},"Γ")),e.createElement("p",{style:{fontSize:"14px",color:St?"#9CA3AF":"#6B7280",marginBottom:"12px"}},(null==Ee?void 0:Ee.requesterName)||"Agent"," requested a photo"),e.createElement("div",{style:{width:"100%",height:"300px",display:"flex",alignItems:"center",justifyContent:"center",background:"#000",borderRadius:"8px",overflow:"hidden",marginBottom:"12px",position:"relative"}},Fe?e.createElement("img",{src:Fe,alt:"Captured",style:{width:"100%",height:"100%",objectFit:"contain"}}):e.createElement(e.Fragment,null,e.createElement("video",{ref:je,autoPlay:!0,playsInline:!0,muted:!0,style:{width:"100%",height:"100%",objectFit:"cover",display:Te?"block":"none"}}),!Te&&e.createElement("div",{style:{position:"absolute",color:"#fff",textAlign:"center"}},e.createElement("div",{style:{fontSize:"14px",marginBottom:"8px"}},"Initializing camera..."),e.createElement("div",{style:{fontSize:"24px"}},"πΉ"))),e.createElement("canvas",{ref:Ie,style:{display:"none"}})),e.createElement("div",{style:{display:"flex",gap:"8px",justifyContent:"center"}},Fe?e.createElement(e.Fragment,null,e.createElement("button",{onClick:Et,className:"crm-close-btn",style:{padding:"12px 24px",fontSize:"14px",fontWeight:600}},"π Retake"),e.createElement("button",{onClick:wt,className:"crm-send-btn",style:{backgroundColor:p,padding:"12px 24px",fontSize:"14px",fontWeight:600},disabled:Ce},Ce?"β³ Uploading...":"β
Submit")):e.createElement("button",{onClick:function(){if(je.current&&Ie.current){var e=je.current,t=Ie.current;t.width=e.videoWidth||640,t.height=e.videoHeight||480,t.getContext("2d").drawImage(e,0,0,t.width,t.height);var n=t.toDataURL("image/png");Le(n),Te&&(Te.getTracks().forEach(function(e){return e.stop()}),Be(null))}},className:"crm-send-btn",style:{backgroundColor:p,padding:"12px 24px",fontSize:"14px",fontWeight:600}},"πΈ Capture"))),e.createElement("div",{className:"crm-messages"},!fe&&0===z.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")),z.map(function(t,n){return e.createElement(e.Fragment,{key:n},e.createElement("div",{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||le).toUpperCase()),function(){var n=String(t.message||""),r=n.match(/https?:[^\s]+\.(?:png|jpg|jpeg|gif|webp)/i);if(r){var o=r[0],i=n.replace(o,"").trim();return e.createElement("div",null,i&&e.createElement("p",{className:"crm-message-text",style:{opacity:.85}},i),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"},n)}(),e.createElement("p",{className:"crm-message-time"},(r=t.timestamp,new Date(r).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}))))),"guest"!==t.sender&&t.message&&(t.message.toLowerCase().includes("requested a photo")||t.message.toLowerCase().includes("send a photo")||t.message.toLowerCase().includes("send photo"))&&st.includes(n)&&e.createElement("div",{style:{width:"100%",padding:"0 8px",marginBottom:"16px"}},e.createElement(ur,{onCapture:function(){var e=s(d().m(function e(t){var r;return d().w(function(e){for(;;)switch(e.n){case 0:try{r={message:"πΈ Photo sent",sender:"guest",timestamp:Date.now()},P(function(e){return[].concat(m(e),[r])}),H&&H.emit("chatMessage",{conversationId:Y,message:"πΈ Photo sent",image:t}),at(function(e){return e.filter(function(e){return e!==n})})}catch(e){console.error("Failed to send photo:",e)}case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),onClose:function(){at(function(e){return e.filter(function(e){return e!==n})})},requesterName:t.senderName||le})));var r}),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"})))),Me&&!Ye&&e.createElement("div",{className:"crm-message crm-message-system"},e.createElement("div",{className:"crm-feedback-form",style:{backgroundColor:"#F9FAFB",padding:"16px",borderRadius:"12px",border:"1px solid #E5E7EB"}},e.createElement("p",{style:{fontWeight:"600",marginBottom:"12px",color:"#111827"}},"β Rate Your Experience"),e.createElement("div",{style:{display:"flex",gap:"8px",marginBottom:"12px",justifyContent:"center"}},[1,2,3,4,5].map(function(t){return e.createElement("button",{key:t,onClick:function(){return He(t)},style:{background:"none",border:"none",cursor:"pointer",fontSize:"32px",padding:"0",transition:"transform 0.2s",filter:qe>=t?"none":"grayscale(100%)"},onMouseEnter:function(e){return e.currentTarget.style.transform="scale(1.2)"},onMouseLeave:function(e){return e.currentTarget.style.transform="scale(1)"}},qe>=t?"β":"β")})),e.createElement("textarea",{value:Ve,onChange:function(e){return Ke(e.target.value)},placeholder:"Share your thoughts (optional)...",rows:"3",style:{width:"100%",padding:"8px 12px",border:"1px solid #D1D5DB",borderRadius:"8px",fontSize:"14px",fontFamily:"inherit",resize:"none",marginBottom:"12px"}}),e.createElement("button",{onClick:function(){if(qe&&!Ye&&!Xe){Qe(!0);var e=localStorage.getItem("chatPetitionId");H&&e?(H.emit("submit-feedback",{petitionId:e,rating:qe,comment:Ve.trim()}),console.log("π€ Feedback submitted:",{rating:qe,comment:Ve}),Je(!0),Qe(!1),setTimeout(function(){De(!1)},2e3)):Qe(!1)}},disabled:!qe||Xe,style:{width:"100%",padding:"10px",backgroundColor:qe?p:"#D1D5DB",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:"600",cursor:qe?"pointer":"not-allowed",transition:"all 0.2s"}},Xe?"Submitting...":"Submit Feedback"))),Ye&&e.createElement("div",{className:"crm-message crm-message-system"},e.createElement("div",{className:"crm-message-bubble",style:{backgroundColor:"#D1FAE5",color:"#065F46",border:"1px solid #A7F3D0"}},e.createElement("p",{className:"crm-message-text"},"β
Thank you for your feedback!"))),e.createElement("div",{ref:lt})),e.createElement("div",{className:"crm-input-container"},"resolved"===be?e.createElement("button",{onClick:yt,className:"crm-send-btn",style:{backgroundColor:p,width:"100%",padding:"12px",fontSize:"14px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",border:"none",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s"}},e.createElement("svg",{style:{width:"18px",height:"18px"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})),"New Query"):e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:D,onChange:function(e){var t=e.target.value;if(U(t),t.trim()&&H&&localStorage.getItem("chatPetitionId")){var n=localStorage.getItem("chatPetitionId"),r=ht();H.emit("customer-typing",{petitionId:n,userName:r.name||"Customer",isTyping:!0})}},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),gt())},placeholder:"Type your message...",rows:"1",className:"crm-input"}),e.createElement("button",{onClick:gt,disabled:!D.trim()||ee,className:"crm-send-btn",style:{backgroundColor:p}},ee?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"})))),"resolved"!==be&&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"===rt&&e.createElement(cr,{apiKey:i,apiUrl:l,primaryColor:p,userData:ht(),theme:T,onClose:function(){ot(null),tt(!0)}}))};export{dr as ChatCRMWidget,cr as TicketBoard};
|
|
4
4
|
//# sourceMappingURL=index.esm.js.map
|