@ecodrix/erix-api 1.3.4 → 1.3.5
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/cli.js +1 -1
- package/dist/index.d.ts +470 -388
- package/dist/ts/browser/index.global.js +1 -1
- package/dist/ts/browser/index.global.js.map +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/cjs/index.cjs.map +1 -1
- package/dist/ts/cjs/index.d.cts +470 -388
- package/dist/ts/esm/index.d.ts +470 -388
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
`,Qh=_s.encode(ft),Zh=2,wa=class{constructor(e,s){let{escapeName:i}=this.constructor,n=d.isString(s),a=`Content-Disposition: form-data; name="${i(e)}"${!n&&s.name?`; filename="${i(s.name)}"`:""}${ft}`;n?s=_s.encode(String(s).replace(/\r?\n|\r\n?/g,ft)):a+=`Content-Type: ${s.type||"application/octet-stream"}${ft}`,this.headers=_s.encode(a+ft),this.contentLength=n?s.byteLength:s.size,this.size=this.headers.byteLength+this.contentLength+Zh,this.name=e,this.value=s}encode(){return Ie(this,null,function*(){yield this.headers;let{value:e}=this;d.isTypedArray(e)?yield e:yield*Me(ui(e)),yield Qh})}static escapeName(e){return String(e).replace(/[\r\n"]/g,s=>({"\r":"%0D","\n":"%0A",'"':"%22"})[s])}},ex=(t,e,s)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+j.generateString(n,Yh)}=s||{};if(!d.isFormData(t))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let r=_s.encode("--"+a+ft),o=_s.encode("--"+a+"--"+ft),l=o.byteLength,u=Array.from(t.entries()).map(([m,f])=>{let g=new wa(m,f);return l+=g.size,g});l+=r.byteLength*u.length,l=d.toFiniteNumber(l);let p={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(l)&&(p["Content-Length"]=l),e&&e(p),Dp.Readable.from((function(){return Ie(this,null,function*(){for(let m of u)yield r,yield*Me(m.encode());yield o})})())},Bp=ex;var Ip=B(T("stream"),1),Ea=class extends Ip.default.Transform{__transform(e,s,i){this.push(e),i()}_transform(e,s,i){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,s)}this.__transform(e,s,i)}},jp=Ea;var tx=(t,e)=>d.isAsyncFn(t)?function(...s){let i=s.pop();t.apply(this,s).then(n=>{try{e?i(null,...e(n)):i(null,n)}catch(a){i(a)}},i)}:t,Up=tx;function sx(t,e){t=t||10;let s=new Array(t),i=new Array(t),n=0,a=0,r;return e=e!==void 0?e:1e3,function(l){let u=Date.now(),p=i[a];r||(r=u),s[n]=l,i[n]=u;let m=a,f=0;for(;m!==n;)f+=s[m++],m=m%t;if(n=(n+1)%t,n===a&&(a=(a+1)%t),u-r<e)return;let g=p&&u-p;return g?Math.round(f*1e3/g):void 0}}var Fp=sx;function ix(t,e){let s=0,i=1e3/e,n,a,r=(u,p=Date.now())=>{s=p,n=null,a&&(clearTimeout(a),a=null),t(...u)};return[(...u)=>{let p=Date.now(),m=p-s;m>=i?r(u,p):(n=u,a||(a=setTimeout(()=>{a=null,r(n)},i-m)))},()=>n&&r(n)]}var Mp=ix;var ze=(t,e,s=3)=>{let i=0,n=Fp(50,250);return Mp(a=>{let r=a.loaded,o=a.lengthComputable?a.total:void 0,l=r-i,u=n(l),p=r<=o;i=r;let m={loaded:r,total:o,progress:o?r/o:void 0,bytes:l,rate:u||void 0,estimated:u&&o&&p?(o-r)/u:void 0,event:a,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},s)},jt=(t,e)=>{let s=t!=null;return[i=>e[0]({lengthComputable:s,total:t,loaded:i}),e[1]]},Ut=t=>(...e)=>d.asap(()=>t(...e));function Ta(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let s=t.slice(5,e),i=t.slice(e+1);if(/;base64/i.test(s)){let a=i.length,r=i.length;for(let f=0;f<r;f++)if(i.charCodeAt(f)===37&&f+2<r){let g=i.charCodeAt(f+1),h=i.charCodeAt(f+2);(g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(a-=2,f+=2)}let o=0,l=r-1,u=f=>f>=2&&i.charCodeAt(f-2)===37&&i.charCodeAt(f-1)===51&&(i.charCodeAt(f)===68||i.charCodeAt(f)===100);l>=0&&(i.charCodeAt(l)===61?(o++,l--):u(l)&&(o++,l-=3)),o===1&&l>=0&&(i.charCodeAt(l)===61||u(l))&&o++;let m=Math.floor(a/4)*3-(o||0);return m>0?m:0}return Buffer.byteLength(i,"utf8")}var zp={flush:He.default.constants.Z_SYNC_FLUSH,finishFlush:He.default.constants.Z_SYNC_FLUSH},nx={flush:He.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:He.default.constants.BROTLI_OPERATION_FLUSH},$p=d.isFunction(He.default.createBrotliDecompress),{http:ax,https:rx}=Xp.default,ox=/https:?/,Hp=j.protocols.map(t=>t+":"),Vp=(t,[e,s])=>(t.on("end",s).on("error",s),e),Sa=class{constructor(){this.sessions=Object.create(null)}getSession(e,s){s=Object.assign({sessionTimeout:1e3},s);let i=this.sessions[e];if(i){let p=i.length;for(let m=0;m<p;m++){let[f,g]=i[m];if(!f.destroyed&&!f.closed&&Ra.default.isDeepStrictEqual(g,s))return f}}let n=ka.default.connect(e,s),a,r=()=>{if(a)return;a=!0;let p=i,m=p.length,f=m;for(;f--;)if(p[f][0]===n){m===1?delete this.sessions[e]:p.splice(f,1);return}},o=n.request,{sessionTimeout:l}=s;if(l!=null){let p,m=0;n.request=function(){let f=o.apply(this,arguments);return m++,p&&(clearTimeout(p),p=null),f.once("close",()=>{--m||(p=setTimeout(()=>{p=null,r()},l))}),f}}n.once("close",r);let u=[n,s];return i?i.push(u):i=this.sessions[e]=[u],n}},cx=new Sa;function px(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function Qp(t,e,s){let i=e;if(!i&&i!==!1){let n=Gp.default.getProxyForUrl(s);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){if(!!(i.auth.username||i.auth.password))i.auth=(i.auth.username||"")+":"+(i.auth.password||"");else if(typeof i.auth=="object")throw new _("Invalid proxy authorization",_.ERR_BAD_OPTION,{proxy:i});let r=Buffer.from(i.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+r}t.headers.host=t.hostname+(t.port?":"+t.port:"");let n=i.hostname||i.host;t.hostname=n,t.host=n,t.port=i.port,t.path=s,i.protocol&&(t.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}t.beforeRedirects.proxy=function(a){Qp(a,e,a.href)}}var lx=typeof process!="undefined"&&d.kindOf(process)==="process",ux=t=>new Promise((e,s)=>{let i,n,a=(l,u)=>{n||(n=!0,i&&i(l,u))},r=l=>{a(l),e(l)},o=l=>{a(l,!0),s(l)};t(r,o,l=>i=l).catch(o)}),dx=({address:t,family:e})=>{if(!d.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},Wp=(t,e)=>dx(d.isObject(t)?t:{address:t,family:e}),mx={request(t,e){let s=t.protocol+"//"+t.hostname+":"+(t.port||(t.protocol==="https:"?443:80)),{http2Options:i,headers:n}=t,a=cx.getSession(s,i),{HTTP2_HEADER_SCHEME:r,HTTP2_HEADER_METHOD:o,HTTP2_HEADER_PATH:l,HTTP2_HEADER_STATUS:u}=ka.default.constants,p={[r]:t.protocol.replace(":",""),[o]:t.method,[l]:t.path};d.forEach(n,(f,g)=>{g.charAt(0)!==":"&&(p[g]=f)});let m=a.request(p);return m.once("response",f=>{let g=m;f=Object.assign({},f);let h=f[u];delete f[u],g.headers=f,g.statusCode=+h,e(g)}),m}},Zp=lx&&function(e){return ux(function(i,n,a){return c(this,null,function*(){let{data:r,lookup:o,family:l,httpVersion:u=1,http2Options:p}=e,{responseType:m,responseEncoding:f}=e,g=e.method.toUpperCase(),h,x=!1,y;if(u=+u,Number.isNaN(u))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(u!==1&&u!==2)throw TypeError(`Unsupported protocol version '${u}'`);let R=u===2;if(o){let A=Up(o,S=>d.isArray(S)?S:[S]);o=(S,F,ne)=>{A(S,F,(N,Z,ae)=>{if(N)return ne(N);let ee=d.isArray(Z)?Z.map(Et=>Wp(Et)):[Wp(Z,ae)];F.all?ne(N,ee):ne(N,ee[0].address,ee[0].family)})}}let C=new Yp.EventEmitter;function v(A){try{C.emit("abort",!A||A.type?new ye(null,e,y):A)}catch(S){console.warn("emit error",S)}}C.once("abort",n);let E=()=>{e.cancelToken&&e.cancelToken.unsubscribe(v),e.signal&&e.signal.removeEventListener("abort",v),C.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(v),e.signal&&(e.signal.aborted?v():e.signal.addEventListener("abort",v))),a((A,S)=>{if(h=!0,S){x=!0,E();return}let{data:F}=A;if(F instanceof $e.default.Readable||F instanceof $e.default.Duplex){let ne=$e.default.finished(F,()=>{ne(),E()})}else E()});let U=pt(e.baseURL,e.url,e.allowAbsoluteUrls),P=new URL(U,j.hasBrowserEnv?j.origin:void 0),I=P.protocol||Hp[0];if(I==="data:"){if(e.maxContentLength>-1){let S=String(e.url||U||"");if(Ta(S)>e.maxContentLength)return n(new _("maxContentLength size of "+e.maxContentLength+" exceeded",_.ERR_BAD_RESPONSE,e))}let A;if(g!=="GET")return je(i,n,{status:405,statusText:"method not allowed",headers:{},config:e});try{A=ya(e.url,m==="blob",{Blob:e.env&&e.env.Blob})}catch(S){throw _.from(S,_.ERR_BAD_REQUEST,e)}return m==="text"?(A=A.toString(f),(!f||f==="utf8")&&(A=d.stripBOM(A))):m==="stream"&&(A=$e.default.Readable.from(A)),je(i,n,{data:A,status:200,statusText:"OK",headers:new W,config:e})}if(Hp.indexOf(I)===-1)return n(new _("Unsupported protocol "+I,_.ERR_BAD_REQUEST,e));let M=W.from(e.headers).normalize();M.set("User-Agent","axios/"+mt,!1);let{onUploadProgress:ce,onDownloadProgress:Be}=e,Fe=e.maxRate,Re,K;if(d.isSpecCompliantForm(r)){let A=M.getContentType(/boundary=([-_\w\d]{10,70})/i);r=Bp(r,S=>{M.set(S)},{tag:`axios-${mt}-boundary`,boundary:A&&A[1]||void 0})}else if(d.isFormData(r)&&d.isFunction(r.getHeaders)){if(M.set(r.getHeaders()),!M.hasContentLength())try{let A=yield Ra.default.promisify(r.getLength).call(r);Number.isFinite(A)&&A>=0&&M.setContentLength(A)}catch(A){}}else if(d.isBlob(r)||d.isFile(r))r.size&&M.setContentType(r.type||"application/octet-stream"),M.setContentLength(r.size||0),r=$e.default.Readable.from(ui(r));else if(r&&!d.isStream(r)){if(!Buffer.isBuffer(r))if(d.isArrayBuffer(r))r=Buffer.from(new Uint8Array(r));else if(d.isString(r))r=Buffer.from(r,"utf-8");else return n(new _("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",_.ERR_BAD_REQUEST,e));if(M.setContentLength(r.length,!1),e.maxBodyLength>-1&&r.length>e.maxBodyLength)return n(new _("Request body larger than maxBodyLength limit",_.ERR_BAD_REQUEST,e))}let ge=d.toFiniteNumber(M.getContentLength());d.isArray(Fe)?(Re=Fe[0],K=Fe[1]):Re=K=Fe,r&&(ce||Re)&&(d.isStream(r)||(r=$e.default.Readable.from(r,{objectMode:!1})),r=$e.default.pipeline([r,new _a({maxRate:d.toFiniteNumber(Re)})],d.noop),ce&&r.on("progress",Vp(r,jt(ge,ze(Ut(ce),!1,3)))));let Ee;if(e.auth){let A=e.auth.username||"",S=e.auth.password||"";Ee=A+":"+S}if(!Ee&&P.username){let A=P.username,S=P.password;Ee=A+":"+S}Ee&&M.delete("authorization");let J;try{J=ct(P.pathname+P.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(A){let S=new Error(A.message);return S.config=e,S.url=e.url,S.exists=!0,n(S)}M.set("Accept-Encoding","gzip, compress, deflate"+($p?", br":""),!1);let V={path:J,method:g,headers:M.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Ee,protocol:I,family:l,beforeRedirect:px,beforeRedirects:{},http2Options:p};!d.isUndefined(o)&&(V.lookup=o),e.socketPath?V.socketPath=e.socketPath:(V.hostname=P.hostname.startsWith("[")?P.hostname.slice(1,-1):P.hostname,V.port=P.port,Qp(V,e.proxy,I+"//"+P.hostname+(P.port?":"+P.port:"")+V.path));let X,Ze=ox.test(V.protocol);if(V.agent=Ze?e.httpsAgent:e.httpAgent,R?X=mx:e.transport?X=e.transport:e.maxRedirects===0?X=Ze?Jp.default:Kp.default:(e.maxRedirects&&(V.maxRedirects=e.maxRedirects),e.beforeRedirect&&(V.beforeRedirects.config=e.beforeRedirect),X=Ze?rx:ax),e.maxBodyLength>-1?V.maxBodyLength=e.maxBodyLength:V.maxBodyLength=1/0,e.insecureHTTPParser&&(V.insecureHTTPParser=e.insecureHTTPParser),y=X.request(V,function(S){if(y.destroyed)return;let F=[S],ne=d.toFiniteNumber(S.headers["content-length"]);if(Be||K){let ee=new _a({maxRate:d.toFiniteNumber(K)});Be&&ee.on("progress",Vp(ee,jt(ne,ze(Ut(Be),!0,3)))),F.push(ee)}let N=S,Z=S.req||y;if(e.decompress!==!1&&S.headers["content-encoding"])switch((g==="HEAD"||S.statusCode===204)&&delete S.headers["content-encoding"],(S.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":F.push(He.default.createUnzip(zp)),delete S.headers["content-encoding"];break;case"deflate":F.push(new jp),F.push(He.default.createUnzip(zp)),delete S.headers["content-encoding"];break;case"br":$p&&(F.push(He.default.createBrotliDecompress(nx)),delete S.headers["content-encoding"])}N=F.length>1?$e.default.pipeline(F,d.noop):F[0];let ae={status:S.statusCode,statusText:S.statusMessage,headers:new W(S.headers),config:e,request:Z};if(m==="stream")ae.data=N,je(i,n,ae);else{let ee=[],Et=0;N.on("data",function(le){ee.push(le),Et+=le.length,e.maxContentLength>-1&&Et>e.maxContentLength&&(x=!0,N.destroy(),v(new _("maxContentLength size of "+e.maxContentLength+" exceeded",_.ERR_BAD_RESPONSE,e,Z)))}),N.on("aborted",function(){if(x)return;let le=new _("stream has been aborted",_.ERR_BAD_RESPONSE,e,Z);N.destroy(le),n(le)}),N.on("error",function(le){y.destroyed||n(_.from(le,null,e,Z))}),N.on("end",function(){try{let le=ee.length===1?ee[0]:Buffer.concat(ee);m!=="arraybuffer"&&(le=le.toString(f),(!f||f==="utf8")&&(le=d.stripBOM(le))),ae.data=le}catch(le){return n(_.from(le,null,e,ae.request,ae))}je(i,n,ae)})}C.once("abort",ee=>{N.destroyed||(N.emit("error",ee),N.destroy())})}),C.once("abort",A=>{y.close?y.close():y.destroy(A)}),y.on("error",function(S){n(_.from(S,null,e,y))}),y.on("socket",function(S){S.setKeepAlive(!0,1e3*60)}),e.timeout){let A=parseInt(e.timeout,10);if(Number.isNaN(A)){v(new _("error trying to parse `config.timeout` to int",_.ERR_BAD_OPTION_VALUE,e,y));return}y.setTimeout(A,function(){if(h)return;let F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",ne=e.transitional||st;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),v(new _(F,ne.clarifyTimeoutError?_.ETIMEDOUT:_.ECONNABORTED,e,y))})}else y.setTimeout(0);if(d.isStream(r)){let A=!1,S=!1;r.on("end",()=>{A=!0}),r.once("error",F=>{S=!0,y.destroy(F)}),r.on("close",()=>{!A&&!S&&v(new ye("Request stream has been aborted",e,y))}),r.pipe(y)}else r&&y.write(r),y.end()})})};var el=j.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,j.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0;var tl=j.hasStandardBrowserEnv?{write(t,e,s,i,n,a,r){if(typeof document=="undefined")return;let o=[`${t}=${encodeURIComponent(e)}`];d.isNumber(s)&&o.push(`expires=${new Date(s).toUTCString()}`),d.isString(i)&&o.push(`path=${i}`),d.isString(n)&&o.push(`domain=${n}`),a===!0&&o.push("secure"),d.isString(r)&&o.push(`SameSite=${r}`),document.cookie=o.join("; ")},read(t){if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};var sl=t=>t instanceof W?L({},t):t;function Le(t,e){e=e||{};let s={};function i(u,p,m,f){return d.isPlainObject(u)&&d.isPlainObject(p)?d.merge.call({caseless:f},u,p):d.isPlainObject(p)?d.merge({},p):d.isArray(p)?p.slice():p}function n(u,p,m,f){if(d.isUndefined(p)){if(!d.isUndefined(u))return i(void 0,u,m,f)}else return i(u,p,m,f)}function a(u,p){if(!d.isUndefined(p))return i(void 0,p)}function r(u,p){if(d.isUndefined(p)){if(!d.isUndefined(u))return i(void 0,u)}else return i(void 0,p)}function o(u,p,m){if(m in e)return i(u,p);if(m in t)return i(void 0,u)}let l={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(u,p,m)=>n(sl(u),sl(p),m,!0)};return d.forEach(Object.keys(L(L({},t),e)),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;let m=d.hasOwnProp(l,p)?l[p]:n,f=m(t[p],e[p],p);d.isUndefined(f)&&m!==o||(s[p]=f)}),s}var di=t=>{let e=Le({},t),{data:s,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:r,auth:o}=e;if(e.headers=r=W.from(r),e.url=ct(pt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&r.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),d.isFormData(s)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)r.setContentType(void 0);else if(d.isFunction(s.getHeaders)){let l=s.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([p,m])=>{u.includes(p.toLowerCase())&&r.set(p,m)})}}if(j.hasStandardBrowserEnv&&(i&&d.isFunction(i)&&(i=i(e)),i||i!==!1&&el(e.url))){let l=n&&a&&tl.read(a);l&&r.set(n,l)}return e};var fx=typeof XMLHttpRequest!="undefined",il=fx&&function(t){return new Promise(function(s,i){let n=di(t),a=n.data,r=W.from(n.headers).normalize(),{responseType:o,onUploadProgress:l,onDownloadProgress:u}=n,p,m,f,g,h;function x(){g&&g(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(p),n.signal&&n.signal.removeEventListener("abort",p)}let y=new XMLHttpRequest;y.open(n.method.toUpperCase(),n.url,!0),y.timeout=n.timeout;function R(){if(!y)return;let v=W.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),U={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:v,config:t,request:y};je(function(I){s(I),x()},function(I){i(I),x()},U),y=null}"onloadend"in y?y.onloadend=R:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(R)},y.onabort=function(){y&&(i(new _("Request aborted",_.ECONNABORTED,t,y)),y=null)},y.onerror=function(E){let U=E&&E.message?E.message:"Network Error",P=new _(U,_.ERR_NETWORK,t,y);P.event=E||null,i(P),y=null},y.ontimeout=function(){let E=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",U=n.transitional||st;n.timeoutErrorMessage&&(E=n.timeoutErrorMessage),i(new _(E,U.clarifyTimeoutError?_.ETIMEDOUT:_.ECONNABORTED,t,y)),y=null},a===void 0&&r.setContentType(null),"setRequestHeader"in y&&d.forEach(r.toJSON(),function(E,U){y.setRequestHeader(U,E)}),d.isUndefined(n.withCredentials)||(y.withCredentials=!!n.withCredentials),o&&o!=="json"&&(y.responseType=n.responseType),u&&([f,h]=ze(u,!0),y.addEventListener("progress",f)),l&&y.upload&&([m,g]=ze(l),y.upload.addEventListener("progress",m),y.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(p=v=>{y&&(i(!v||v.type?new ye(null,t,y):v),y.abort(),y=null)},n.cancelToken&&n.cancelToken.subscribe(p),n.signal&&(n.signal.aborted?p():n.signal.addEventListener("abort",p)));let C=bs(n.url);if(C&&j.protocols.indexOf(C)===-1){i(new _("Unsupported protocol "+C+":",_.ERR_BAD_REQUEST,t));return}y.send(a||null)})};var hx=(t,e)=>{let{length:s}=t=t?t.filter(Boolean):[];if(e||s){let i=new AbortController,n,a=function(u){if(!n){n=!0,o();let p=u instanceof Error?u:this.reason;i.abort(p instanceof _?p:new ye(p instanceof Error?p.message:p))}},r=e&&setTimeout(()=>{r=null,a(new _(`timeout of ${e}ms exceeded`,_.ETIMEDOUT))},e),o=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),t=null)};t.forEach(u=>u.addEventListener("abort",a));let{signal:l}=i;return l.unsubscribe=()=>d.asap(o),l}},nl=hx;var xx=function*(t,e){let s=t.byteLength;if(!e||s<e){yield t;return}let i=0,n;for(;i<s;)n=i+e,yield t.slice(i,n),i=n},gx=function(t,e){return Ie(this,null,function*(){try{for(var s=jr(yx(t)),i,n,a;i=!(n=yield new Ce(s.next())).done;i=!1){let r=n.value;yield*Me(xx(r,e))}}catch(n){a=[n]}finally{try{i&&(n=s.return)&&(yield new Ce(n.call(s)))}finally{if(a)throw a[0]}}})},yx=function(t){return Ie(this,null,function*(){if(t[Symbol.asyncIterator]){yield*Me(t);return}let e=t.getReader();try{for(;;){let{done:s,value:i}=yield new Ce(e.read());if(s)break;yield i}}finally{yield new Ce(e.cancel())}})},Ca=(t,e,s,i)=>{let n=gx(t,e),a=0,r,o=u=>{r||(r=!0,i&&i(u))};return new ReadableStream({pull(u){return c(this,null,function*(){try{let{done:p,value:m}=yield n.next();if(p){o(),u.close();return}let f=m.byteLength;if(s){let g=a+=f;s(g)}u.enqueue(new Uint8Array(m))}catch(p){throw o(p),p}})},cancel(u){return o(u),n.return()}},{highWaterMark:2})};var al=64*1024,{isFunction:mi}=d,vx=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:rl,TextEncoder:ol}=d.global,cl=(t,...e)=>{try{return!!t(...e)}catch(s){return!1}},bx=t=>{t=d.merge.call({skipUndefined:!0},vx,t);let{fetch:e,Request:s,Response:i}=t,n=e?mi(e):typeof fetch=="function",a=mi(s),r=mi(i);if(!n)return!1;let o=n&&mi(rl),l=n&&(typeof ol=="function"?(h=>x=>h.encode(x))(new ol):h=>c(null,null,function*(){return new Uint8Array(yield new s(h).arrayBuffer())})),u=a&&o&&cl(()=>{let h=!1,x=new s(j.origin,{body:new rl,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!x}),p=r&&o&&cl(()=>d.isReadableStream(new i("").body)),m={stream:p&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!m[h]&&(m[h]=(x,y)=>{let R=x&&x[h];if(R)return R.call(x);throw new _(`Response type '${h}' is not supported`,_.ERR_NOT_SUPPORT,y)})});let f=h=>c(null,null,function*(){if(h==null)return 0;if(d.isBlob(h))return h.size;if(d.isSpecCompliantForm(h))return(yield new s(j.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(d.isArrayBufferView(h)||d.isArrayBuffer(h))return h.byteLength;if(d.isURLSearchParams(h)&&(h=h+""),d.isString(h))return(yield l(h)).byteLength}),g=(h,x)=>c(null,null,function*(){let y=d.toFiniteNumber(h.getContentLength());return y==null?f(x):y});return h=>c(null,null,function*(){let{url:x,method:y,data:R,signal:C,cancelToken:v,timeout:E,onDownloadProgress:U,onUploadProgress:P,responseType:I,headers:M,withCredentials:ce="same-origin",fetchOptions:Be}=di(h),Fe=e||fetch;I=I?(I+"").toLowerCase():"text";let Re=nl([C,v&&v.toAbortSignal()],E),K=null,ge=Re&&Re.unsubscribe&&(()=>{Re.unsubscribe()}),Ee;try{if(P&&u&&y!=="get"&&y!=="head"&&(Ee=yield g(M,R))!==0){let S=new s(x,{method:"POST",body:R,duplex:"half"}),F;if(d.isFormData(R)&&(F=S.headers.get("content-type"))&&M.setContentType(F),S.body){let[ne,N]=jt(Ee,ze(Ut(P)));R=Ca(S.body,al,ne,N)}}d.isString(ce)||(ce=ce?"include":"omit");let J=a&&"credentials"in s.prototype,V=re(L({},Be),{signal:Re,method:y.toUpperCase(),headers:M.normalize().toJSON(),body:R,duplex:"half",credentials:J?ce:void 0});K=a&&new s(x,V);let X=yield a?Fe(K,Be):Fe(x,V),Ze=p&&(I==="stream"||I==="response");if(p&&(U||Ze&&ge)){let S={};["status","statusText","headers"].forEach(Z=>{S[Z]=X[Z]});let F=d.toFiniteNumber(X.headers.get("content-length")),[ne,N]=U&&jt(F,ze(Ut(U),!0))||[];X=new i(Ca(X.body,al,ne,()=>{N&&N(),ge&&ge()}),S)}I=I||"text";let A=yield m[d.findKey(m,I)||"text"](X,h);return!Ze&&ge&&ge(),yield new Promise((S,F)=>{je(S,F,{data:A,headers:W.from(X.headers),status:X.status,statusText:X.statusText,config:h,request:K})})}catch(J){throw ge&&ge(),J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new _("Network Error",_.ERR_NETWORK,h,K,J&&J.response),{cause:J.cause||J}):_.from(J,J&&J.code,h,K,J&&J.response)}})},_x=new Map,Aa=t=>{let e=t&&t.env||{},{fetch:s,Request:i,Response:n}=e,a=[i,n,s],r=a.length,o=r,l,u,p=_x;for(;o--;)l=a[o],u=p.get(l),u===void 0&&p.set(l,u=o?new Map:bx(e)),p=u;return u},Nw=Aa();var Oa={http:Zp,xhr:il,fetch:{get:Aa}};d.forEach(Oa,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(s){}Object.defineProperty(t,"adapterName",{value:e})}});var pl=t=>`- ${t}`,Ex=t=>d.isFunction(t)||t===null||t===!1;function Tx(t,e){t=d.isArray(t)?t:[t];let{length:s}=t,i,n,a={};for(let r=0;r<s;r++){i=t[r];let o;if(n=i,!Ex(i)&&(n=Oa[(o=String(i)).toLowerCase()],n===void 0))throw new _(`Unknown adapter '${o}'`);if(n&&(d.isFunction(n)||(n=n.get(e))))break;a[o||"#"+r]=n}if(!n){let r=Object.entries(a).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build")),o=s?r.length>1?`since :
|
|
17
17
|
`+r.map(pl).join(`
|
|
18
18
|
`):" "+pl(r[0]):"as no adapter specified";throw new _("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n}var fi={getAdapter:Tx,adapters:Oa};function Pa(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ye(null,t)}function hi(t){return Pa(t),t.headers=W.from(t.headers),t.data=fs.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),fi.getAdapter(t.adapter||Pt.adapter,t)(t).then(function(i){return Pa(t),i.data=fs.call(t,t.transformResponse,i),i.headers=W.from(i.headers),i},function(i){return hs(i)||(Pa(t),i&&i.response&&(i.response.data=fs.call(t,t.transformResponse,i.response),i.response.headers=W.from(i.response.headers))),Promise.reject(i)})}var xi={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{xi[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});var ll={};xi.transitional=function(e,s,i){function n(a,r){return"[Axios v"+mt+"] Transitional option '"+a+"'"+r+(i?". "+i:"")}return(a,r,o)=>{if(e===!1)throw new _(n(r," has been removed"+(s?" in "+s:"")),_.ERR_DEPRECATED);return s&&!ll[r]&&(ll[r]=!0,console.warn(n(r," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(a,r,o):!0}};xi.spelling=function(e){return(s,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function Sx(t,e,s){if(typeof t!="object")throw new _("options must be an object",_.ERR_BAD_OPTION_VALUE);let i=Object.keys(t),n=i.length;for(;n-- >0;){let a=i[n],r=e[a];if(r){let o=t[a],l=o===void 0||r(o,a,t);if(l!==!0)throw new _("option "+a+" must be "+l,_.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new _("Unknown option "+a,_.ERR_BAD_OPTION)}}var ws={assertOptions:Sx,validators:xi};var Te=ws.validators,Ft=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Wn,response:new Wn}}request(e,s){return c(this,null,function*(){try{return yield this._request(e,s)}catch(i){if(i instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;let a=n.stack?n.stack.replace(/^.+\n/,""):"";try{i.stack?a&&!String(i.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(i.stack+=`
|
|
19
|
-
`+a):i.stack=a}catch(r){}}throw i}})}_request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=Le(this.defaults,s);let{transitional:i,paramsSerializer:n,headers:a}=s;i!==void 0&&ws.assertOptions(i,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean)},!1),n!=null&&(d.isFunction(n)?s.paramsSerializer={serialize:n}:ws.assertOptions(n,{encode:Te.function,serialize:Te.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),ws.assertOptions(s,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let r=a&&d.merge(a.common,a[s.method]);a&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),s.headers=W.concat(r,a);let o=[],l=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(s)===!1)return;l=l&&x.synchronous;let y=s.transitional||st;y&&y.legacyInterceptorReqResOrdering?o.unshift(x.fulfilled,x.rejected):o.push(x.fulfilled,x.rejected)});let u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let p,m=0,f;if(!l){let h=[hi.bind(this),void 0];for(h.unshift(...o),h.push(...u),f=h.length,p=Promise.resolve(s);m<f;)p=p.then(h[m++],h[m++]);return p}f=o.length;let g=s;for(;m<f;){let h=o[m++],x=o[m++];try{g=h(g)}catch(y){x.call(this,y);break}}try{p=hi.call(this,g)}catch(h){return Promise.reject(h)}for(m=0,f=u.length;m<f;)p=p.then(u[m++],u[m++]);return p}getUri(e){e=Le(this.defaults,e);let s=pt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(s,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Ft.prototype[e]=function(s,i){return this.request(Le(i||{},{method:e,url:s,data:(i||{}).data}))}});d.forEach(["post","put","patch"],function(e){function s(i){return function(a,r,o){return this.request(Le(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:r}))}}Ft.prototype[e]=s(),Ft.prototype[e+"Form"]=s(!0)});var Es=Ft;var La=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(a){s=a});let i=this;this.promise.then(n=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](n);i._listeners=null}),this.promise.then=n=>{let a,r=new Promise(o=>{i.subscribe(o),a=o}).then(n);return r.cancel=function(){i.unsubscribe(a)},r},e(function(a,r,o){i.reason||(i.reason=new ye(a,r,o),s(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){let e=new AbortController,s=i=>{e.abort(i)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new t(function(n){e=n}),cancel:e}}},ul=La;function Na(t){return function(s){return t.apply(null,s)}}function qa(t){return d.isObject(t)&&t.isAxiosError===!0}var Da={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(Da).forEach(([t,e])=>{Da[e]=t});var dl=Da;function ml(t){let e=new Es(t),s=as(Es.prototype.request,e);return d.extend(s,Es.prototype,e,{allOwnKeys:!0}),d.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return ml(Le(t,n))},s}var Y=ml(Pt);Y.Axios=Es;Y.CanceledError=ye;Y.CancelToken=ul;Y.isCancel=hs;Y.VERSION=mt;Y.toFormData=tt;Y.AxiosError=_;Y.Cancel=Y.CanceledError;Y.all=function(e){return Promise.all(e)};Y.spread=Na;Y.isAxiosError=qa;Y.mergeConfig=Le;Y.AxiosHeaders=W;Y.formToJSON=t=>ai(d.isHTMLForm(t)?new FormData(t):t);Y.getAdapter=fi.getAdapter;Y.HttpStatusCode=dl;Y.default=Y;var Mt=Y;var{Axios:LE,AxiosError:NE,CanceledError:qE,isCancel:DE,CancelToken:BE,VERSION:IE,all:jE,Cancel:UE,isAxiosError:FE,spread:ME,toFormData:zE,AxiosHeaders:$E,HttpStatusCode:HE,formToJSON:VE,getAdapter:WE,mergeConfig:GE}=Mt;var gl=B(hl(),1);var Ba="axios-retry";function yl(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,gl.default)(t)}var vl=["get","head","options"],Rx=vl.concat(["put","delete"]);function Ia(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function Cx(t){var e;return(e=t.config)!=null&&e.method?Ia(t)&&vl.indexOf(t.config.method)!==-1:!1}function bl(t){var e;return(e=t.config)!=null&&e.method?Ia(t)&&Rx.indexOf(t.config.method)!==-1:!1}function _l(t){return yl(t)||bl(t)}function ja(t=void 0){var i;let e=(i=t==null?void 0:t.response)==null?void 0:i.headers["retry-after"];if(!e)return 0;let s=(Number(e)||0)*1e3;return s===0&&(s=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,s)}function Ax(t=0,e=void 0){return Math.max(0,ja(e))}function Ox(t=0,e=void 0,s=100){let i=Br(2,t)*s,n=Math.max(i,ja(e)),a=n*.2*Math.random();return n+a}function Px(t=100){return(e=0,s=void 0)=>{let i=e*t;return Math.max(i,ja(s))}}var Lx={retries:3,retryCondition:_l,retryDelay:Ax,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Nx(t,e){return L(L(L({},Lx),e),t[Ba])}function xl(t,e,s=!1){let i=Nx(t,e||{});return i.retryCount=i.retryCount||0,(!i.lastRequestTime||s)&&(i.lastRequestTime=Date.now()),t[Ba]=i,i}function qx(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}function Dx(t,e){return c(this,null,function*(){let{retries:s,retryCondition:i}=t,n=(t.retryCount||0)<s&&i(e);if(typeof n=="object")try{return(yield n)!==!1}catch(a){return!1}return n})}function Bx(t,e,s,i){return c(this,null,function*(){var l;e.retryCount+=1;let{retryDelay:n,shouldResetTimeout:a,onRetry:r}=e,o=n(e.retryCount,s);if(qx(t,i),!a&&i.timeout&&e.lastRequestTime){let u=Date.now()-e.lastRequestTime,p=i.timeout-u-o;if(p<=0)return Promise.reject(s);i.timeout=p}return i.transformRequest=[u=>u],yield r(e.retryCount,s,i),(l=i.signal)!=null&&l.aborted?Promise.resolve(t(i)):new Promise(u=>{var f;let p=()=>{clearTimeout(m),u(t(i))},m=setTimeout(()=>{var g;u(t(i)),(g=i.signal)!=null&&g.removeEventListener&&i.signal.removeEventListener("abort",p)},o);(f=i.signal)!=null&&f.addEventListener&&i.signal.addEventListener("abort",p,{once:!0})})})}function Ix(t,e){return c(this,null,function*(){t.retryCount>=t.retries&&(yield t.onMaxRetryTimesExceeded(e,t.retryCount))})}var it=(t,e)=>{let s=t.interceptors.request.use(n=>{var a;return xl(n,e,!0),(a=n[Ba])!=null&&a.validateResponse&&(n.validateStatus=()=>!1),n}),i=t.interceptors.response.use(null,n=>c(null,null,function*(){var o;let{config:a}=n;if(!a)return Promise.reject(n);let r=xl(a,e);return n.response&&((o=r.validateResponse)!=null&&o.call(r,n.response))?n.response:(yield Dx(r,n))?Bx(t,r,n,a):(yield Ix(r,n),Promise.reject(n))}));return{requestInterceptorId:s,responseInterceptorId:i}};it.isNetworkError=yl;it.isSafeRequestError=Cx;it.isIdempotentRequestError=bl;it.isNetworkOrIdempotentRequestError=_l;it.exponentialDelay=Ox;it.linearDelay=Px;it.isRetryableError=Ia;var gi=it;var Va=B(Tl(),1);var Ne=Object.create(null);Ne.open="0";Ne.close="1";Ne.ping="2";Ne.pong="3";Ne.message="4";Ne.upgrade="5";Ne.noop="6";var Ts=Object.create(null);Object.keys(Ne).forEach(t=>{Ts[Ne[t]]=t});var Ss={type:"error",data:"parser error"};var ks=({type:t,data:e},s,i)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?i(s?e:"b"+Sl(e,!0).toString("base64")):i(Ne[t]+(e||"")),Sl=(t,e)=>Buffer.isBuffer(t)||t instanceof Uint8Array&&!e?t:t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t.buffer,t.byteOffset,t.byteLength),Fa;function kl(t,e){if(t.data instanceof ArrayBuffer||ArrayBuffer.isView(t.data))return e(Sl(t.data,!1));ks(t,!0,s=>{Fa||(Fa=new TextEncoder),e(Fa.encode(s))})}var Rs=(t,e)=>{if(typeof t!="string")return{type:"message",data:Rl(t,e)};let s=t.charAt(0);if(s==="b"){let i=Buffer.from(t.substring(1),"base64");return{type:"message",data:Rl(i,e)}}return Ts[s]?t.length>1?{type:Ts[s],data:t.substring(1)}:{type:Ts[s]}:Ss},Rl=(t,e)=>{switch(e){case"arraybuffer":return t instanceof ArrayBuffer?t:Buffer.isBuffer(t)?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t.buffer;case"nodebuffer":default:return Buffer.isBuffer(t)?t:Buffer.from(t)}};var Cl="",Al=(t,e)=>{let s=t.length,i=new Array(s),n=0;t.forEach((a,r)=>{ks(a,!1,o=>{i[r]=o,++n===s&&e(i.join(Cl))})})},Ol=(t,e)=>{let s=t.split(Cl),i=[];for(let n=0;n<s.length;n++){let a=Rs(s[n],e);if(i.push(a),a.type==="error")break}return i};function Pl(){return new TransformStream({transform(t,e){kl(t,s=>{let i=s.length,n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);let a=new DataView(n.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{n=new Uint8Array(9);let a=new DataView(n.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(s)})}})}var Ma;function yi(t){return t.reduce((e,s)=>e+s.length,0)}function vi(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),i=0;for(let n=0;n<e;n++)s[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),s}function Ll(t,e){Ma||(Ma=new TextDecoder);let s=[],i=0,n=-1,a=!1;return new TransformStream({transform(r,o){for(s.push(r);;){if(i===0){if(yi(s)<1)break;let l=vi(s,1);a=(l[0]&128)===128,n=l[0]&127,n<126?i=3:n===126?i=1:i=2}else if(i===1){if(yi(s)<2)break;let l=vi(s,2);n=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(yi(s)<8)break;let l=vi(s,8),u=new DataView(l.buffer,l.byteOffset,l.length),p=u.getUint32(0);if(p>Math.pow(2,21)-1){o.enqueue(Ss);break}n=p*Math.pow(2,32)+u.getUint32(4),i=3}else{if(yi(s)<n)break;let l=vi(s,n);o.enqueue(Rs(a?l:Ma.decode(l),e)),i=0}if(n===0||n>t){o.enqueue(Ss);break}}}})}var za=4;function $(t){if(t)return Ux(t)}function Ux(t){for(var e in $.prototype)t[e]=$.prototype[e];return t}$.prototype.on=$.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};$.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+t];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,n=0;n<s.length;n++)if(i=s[n],i===e||i.fn===e){s.splice(n,1);break}return s.length===0&&delete this._callbacks["$"+t],this};$.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,n=s.length;i<n;++i)s[i].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};$.prototype.hasListeners=function(t){return!!this.listeners(t).length};var Ve=process.nextTick,de=global,Nl="nodebuffer";function ql(){return new $a}function Fx(t){let e=t.split("; "),s=e[0].indexOf("=");if(s===-1)return;let i=e[0].substring(0,s).trim();if(!i.length)return;let n=e[0].substring(s+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let a={name:i,value:n};for(let r=1;r<e.length;r++){let o=e[r].split("=");if(o.length!==2)continue;let l=o[0].trim(),u=o[1].trim();switch(l){case"Expires":a.expires=new Date(u);break;case"Max-Age":let p=new Date;p.setUTCSeconds(p.getUTCSeconds()+parseInt(u,10)),a.expires=p;break;default:}}return a}var $a=class{constructor(){this._cookies=new Map}parseCookies(e){e&&e.forEach(s=>{let i=Fx(s);i&&this._cookies.set(i.name,i)})}get cookies(){let e=Date.now();return this._cookies.forEach((s,i)=>{var n;((n=s.expires)===null||n===void 0?void 0:n.getTime())<e&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(e){let s=[];for(let[i,n]of this.cookies)s.push(`${i}=${n.value}`);s.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",s.join("; ")))}appendCookies(e){for(let[s,i]of this.cookies)e.append("cookie",`${s}=${i.value}`)}};function bi(t,...e){return e.reduce((s,i)=>(t.hasOwnProperty(i)&&(s[i]=t[i]),s),{})}var Mx=de.setTimeout,zx=de.clearTimeout;function We(t,e){e.useNativeTimers?(t.setTimeoutFn=Mx.bind(de),t.clearTimeoutFn=zx.bind(de)):(t.setTimeoutFn=de.setTimeout.bind(de),t.clearTimeoutFn=de.clearTimeout.bind(de))}var $x=1.33;function Dl(t){return typeof t=="string"?Hx(t):Math.ceil((t.byteLength||t.size)*$x)}function Hx(t){let e=0,s=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function _i(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Bl(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}function Il(t){let e={},s=t.split("&");for(let i=0,n=s.length;i<n;i++){let a=s[i].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}var jl=B(ve(),1),Vx=(0,jl.default)("engine.io-client:transport"),wi=class extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}},Ge=class extends ${constructor(e){super(),this.writable=!1,We(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new wi(e,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Vx("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let s=Rs(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let s=Bl(e);return s.length?"?"+s:""}};var Ul=B(ve(),1),qe=(0,Ul.default)("engine.io-client:polling"),Cs=class extends Ge{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let s=()=>{qe("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(qe("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){qe("pre-pause polling complete"),--i||s()})),this.writable||(qe("we are currently writing - waiting to pause"),i++,this.once("drain",function(){qe("pre-pause writing complete"),--i||s()}))}else s()}_poll(){qe("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){qe("polling got data %s",e);let s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};Ol(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():qe('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{qe("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(qe("transport open - closing"),e()):(qe("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,Al(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=_i()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}};var Fl=!1;try{Fl=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(t){}var Ml=Fl;var $l=B(ve(),1),Ha=(0,$l.default)("engine.io-client:polling");function Wx(){}var Ei=class extends Cs{constructor(e){if(super(e),typeof location!="undefined"){let s=location.protocol==="https:",i=location.port;i||(i=s?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){let i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(n,a)=>{this.onError("xhr post error",n,a)})}doPoll(){Ha("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}},Ke=class t extends ${constructor(e,s,i){super(),this.createRequest=e,We(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;let s=bi(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{Ha("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch(n){}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{i.setRequestHeader("Accept","*/*")}catch(n){}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Ha("xhr data %s",this._data),i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document!="undefined"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr=="undefined"||this._xhr===null)){if(this._xhr.onreadystatechange=Wx,e)try{this._xhr.abort()}catch(s){}typeof document!="undefined"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ke.requestsCount=0;Ke.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",zl);else if(typeof addEventListener=="function"){let t="onpagehide"in de?"pagehide":"unload";addEventListener(t,zl,!1)}}function zl(){for(let t in Ke.requests)Ke.requests.hasOwnProperty(t)&&Ke.requests[t].abort()}var CT=(function(){let t=Gx({xdomain:!1});return t&&t.responseType!==null})();function Gx(t){let e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Ml))return new XMLHttpRequest}catch(s){}if(!e)try{return new de[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(s){}}var Kx=Va.default||Va,$t=class extends Ei{request(e={}){var s;return Object.assign(e,{xd:this.xd,cookieJar:(s=this.socket)===null||s===void 0?void 0:s._cookieJar},this.opts),new Ke(i=>new Kx(i),this.uri(),e)}};var my=B(ju(),1),fy=B(sr(),1),hy=B(ar(),1),mr=B(Di(),1),xy=B(Gu(),1);var Ku=B(ve(),1),yy=(0,Ku.default)("engine.io-client:websocket"),vy=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ii=class extends Ge{get name(){return"websocket"}doOpen(){let e=this.uri(),s=this.opts.protocols,i=vy?{}:bi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,s,i)}catch(n){return this.emitReserved("error",n)}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 s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;ks(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch(r){yy("websocket closed before onclose event")}n&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=_i()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}},n0=de.WebSocket||de.MozWebSocket;var Yt=class extends Ii{createSocket(e,s,i){var n;if(!((n=this.socket)===null||n===void 0)&&n._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[a,r]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${a}=${r.value}`)}return new mr.default(e,s,i)}doWrite(e,s){let i={};e.options&&(i.compress=e.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(s,i)}};var Ju=B(ve(),1),Is=(0,Ju.default)("engine.io-client:webtransport"),Qt=class extends Ge{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(()=>{Is("transport closed gracefully"),this.onClose()}).catch(e=>{Is("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let s=Ll(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),n=Pl();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();let a=()=>{i.read().then(({done:o,value:l})=>{if(o){Is("session is closed");return}Is("received chunk: %o",l),this.onPacket(l),a()}).catch(o=>{Is("an error occurred while reading: %s",o)})};a();let r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;this._writer.write(i).then(()=>{n&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var fr={websocket:Yt,webtransport:Qt,polling:$t};var by=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_y=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zt(t){if(t.length>8e3)throw"URI too long";let e=t,s=t.indexOf("["),i=t.indexOf("]");s!=-1&&i!=-1&&(t=t.substring(0,s)+t.substring(s,i).replace(/:/g,";")+t.substring(i,t.length));let n=by.exec(t||""),a={},r=14;for(;r--;)a[_y[r]]=n[r]||"";return s!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=wy(a,a.path),a.queryKey=Ey(a,a.query),a}function wy(t,e){let s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Ey(t,e){let s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,a){n&&(s[n]=a)}),s}var Xu=B(ve(),1),z=(0,Xu.default)("engine.io-client:socket"),hr=typeof addEventListener=="function"&&typeof removeEventListener=="function",js=[];hr&&addEventListener("offline",()=>{z("closing %d connection(s) because the network was lost",js.length),js.forEach(t=>t())},!1);var bt=class t extends ${constructor(e,s){if(super(),this.binaryType=Nl,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){let i=Zt(e);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Zt(s.host).host);We(this,s),this.secure=s.secure!=null?s.secure:typeof location!="undefined"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=s.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Il(this.opts.query)),hr&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(z("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},js.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=ql()),this._open()}createTransport(e){z('creating transport "%s"',e);let s=Object.assign({},this.opts.query);s.EIO=za,s.transport=e,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return z("options: %j",i),new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){z("setting transport %s",e.name),this.transport&&(z("clearing existing transport %s",this.transport.name),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",s=>this._onClose("transport close",s))}onOpen(){z("socket open"),this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(z('socket receive: type "%s", data "%s"',e.type,e.data),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":let s=new Error("server error");s.code=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else z('packet received with socket readyState "%s"',this.readyState)}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(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let 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,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();z("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Dl(n)),i>0&&s>this._maxPayload)return z("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);s+=2}return z("payload size is %d (max: %d)",s,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(z("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,Ve(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let a={type:e,data:s,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),z("socket closing - telling transport to close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(z("socket error %j",e),t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return z("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(z('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=js.indexOf(this._offlineEventListener);i!==-1&&(z("removing listener for the 'offline' event"),js.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}};bt.protocol=za;var ji=class extends bt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){z("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){z('probing transport "%s"',e);let s=this.createTransport(e),i=!1;bt.priorWebsocketSuccess=!1;let n=()=>{i||(z('probe transport "%s" opened',e),s.send([{type:"ping",data:"probe"}]),s.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(z('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;bt.priorWebsocketSuccess=s.name==="websocket",z('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(z("changing transport and sending upgrade packet"),p(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{z('probe transport "%s" failed',e);let f=new Error("probe error");f.transport=s.name,this.emitReserved("upgradeError",f)}}))};function a(){i||(i=!0,p(),s.close(),s=null)}let r=m=>{let f=new Error("probe error: "+m);f.transport=s.name,a(),z('probe transport "%s" failed because of error: %s',e,m),this.emitReserved("upgradeError",f)};function o(){r("transport closed")}function l(){r("socket closed")}function u(m){s&&m.name!==s.name&&(z('"%s" works - aborting "%s"',m.name,s.name),a())}let p=()=>{s.removeListener("open",n),s.removeListener("error",r),s.removeListener("close",o),this.off("close",l),this.off("upgrading",u)};s.once("open",n),s.once("error",r),s.once("close",o),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}},es=class extends ji{constructor(e,s={}){let i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(n=>fr[n]).filter(n=>!!n)),super(e,i)}};var C0=es.protocol;var Qu=B(ve(),1),Yu=(0,Qu.default)("socket.io-client:url");function Zu(t,e="",s){let i=t;s=s||typeof location!="undefined"&&location,t==null&&(t=s.protocol+"//"+s.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=s.protocol+t:t=s.host+t),/^(https?|wss?):\/\//.test(t)||(Yu("protocol-less url %s",t),typeof s!="undefined"?t=s.protocol+"//"+t:t="https://"+t),Yu("parse %s",t),i=Zt(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+e,i.href=i.protocol+"://"+a+(s&&s.port===i.port?"":":"+i.port),i}var wr={};_n(wr,{Decoder:()=>br,Encoder:()=>vr,PacketType:()=>O,isPacketValid:()=>qy,protocol:()=>ad});var Ry=typeof ArrayBuffer=="function",Cy=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ed=Object.prototype.toString,Ay=typeof Blob=="function"||typeof Blob!="undefined"&&ed.call(Blob)==="[object BlobConstructor]",Oy=typeof File=="function"||typeof File!="undefined"&&ed.call(File)==="[object FileConstructor]";function Fs(t){return Ry&&(t instanceof ArrayBuffer||Cy(t))||Ay&&t instanceof Blob||Oy&&t instanceof File}function Us(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let s=0,i=t.length;s<i;s++)if(Us(t[s]))return!0;return!1}if(Fs(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Us(t.toJSON(),!0);for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Us(t[s]))return!0;return!1}function td(t){let e=[],s=t.data,i=t;return i.data=xr(s,e),i.attachments=e.length,{packet:i,buffers:e}}function xr(t,e){if(!t)return t;if(Fs(t)){let s={_placeholder:!0,num:e.length};return e.push(t),s}else if(Array.isArray(t)){let s=new Array(t.length);for(let i=0;i<t.length;i++)s[i]=xr(t[i],e);return s}else if(typeof t=="object"&&!(t instanceof Date)){let s={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=xr(t[i],e));return s}return t}function sd(t,e){return t.data=gr(t.data,e),delete t.attachments,t}function gr(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let s=0;s<t.length;s++)t[s]=gr(t[s],e);else if(typeof t=="object")for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(t[s]=gr(t[s],e));return t}var id=B(ve(),1),yr=(0,id.default)("socket.io-parser"),nd=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ad=5,O;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(O||(O={}));var vr=class{constructor(e){this.replacer=e}encode(e){return yr("encoding packet %j",e),(e.type===O.EVENT||e.type===O.ACK)&&Us(e)?this.encodeAsBinary({type:e.type===O.EVENT?O.BINARY_EVENT:O.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===O.BINARY_EVENT||e.type===O.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),yr("encoded %j as %s",e,s),s}encodeAsBinary(e){let s=td(e),i=this.encodeAsString(s.packet),n=s.buffers;return n.unshift(i),n}},br=class t extends ${constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);let i=s.type===O.BINARY_EVENT;i||s.type===O.BINARY_ACK?(s.type=i?O.EVENT:O.ACK,this.reconstructor=new _r(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Fs(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let s=0,i={type:Number(e.charAt(0))};if(O[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===O.BINARY_EVENT||i.type===O.BINARY_ACK){let a=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);let r=e.substring(a,s);if(r!=Number(r)||e.charAt(s)!=="-")throw new Error("Illegal attachments");let o=Number(r);if(!rd(o)||o<0)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=o}if(e.charAt(s+1)==="/"){let a=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(a,s)}else i.nsp="/";let n=e.charAt(s+1);if(n!==""&&Number(n)==n){let a=s+1;for(;++s;){let r=e.charAt(s);if(r==null||Number(r)!=r){--s;break}if(s===e.length)break}i.id=Number(e.substring(a,s+1))}if(e.charAt(++s)){let a=this.tryParse(e.substr(s));if(t.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return yr("decoded %s as %j",e,i),i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(s){return!1}}static isPayloadValid(e,s){switch(e){case O.CONNECT:return Ui(s);case O.DISCONNECT:return s===void 0;case O.CONNECT_ERROR:return typeof s=="string"||Ui(s);case O.EVENT:case O.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&nd.indexOf(s[0])===-1);case O.ACK:case O.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},_r=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let s=sd(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Py(t){return typeof t=="string"}var rd=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Ly(t){return t===void 0||rd(t)}function Ui(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ny(t,e){switch(t){case O.CONNECT:return e===void 0||Ui(e);case O.DISCONNECT:return e===void 0;case O.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&nd.indexOf(e[0])===-1);case O.ACK:return Array.isArray(e);case O.CONNECT_ERROR:return typeof e=="string"||Ui(e);default:return!1}}function qy(t){return Py(t.nsp)&&Ly(t.id)&&Ny(t.type,t.data)}function _e(t,e,s){return t.on(e,s),function(){t.off(e,s)}}var od=B(ve(),1),Q=(0,od.default)("socket.io-client:socket"),Dy=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ts=class extends ${constructor(e,s,i){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=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[_e(e,"open",this.onopen.bind(this)),_e(e,"packet",this.onpacket.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,n,a;if(Dy.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;let r={type:O.EVENT,data:s};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){let p=this.ids++;Q("emitting packet with ack id %d",p);let m=s.pop();this._registerAckCallback(p,m),r.id=p}let o=(n=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||n===void 0?void 0:n.writable,l=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o?Q("discard packet as the transport is not currently writable"):l?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,s){var i;let n=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(n===void 0){this.acks[e]=s;return}let a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(Q("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));Q("event with ack id %d has timed out after %d ms",e,n),s.call(this,new Error("operation has timed out"))},n),r=(...o)=>{this.io.clearTimeoutFn(a),s.apply(this,o)};r.withError=!0,this.acks[e]=r}emitWithAck(e,...s){return new Promise((i,n)=>{let a=(r,o)=>r?n(r):i(o);a.withError=!0,s.push(a),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...a)=>i!==this._queue[0]?Q("packet [%d] already acknowledged",i.id):(n!==null?i.tryCount>this._opts.retries&&(Q("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),s&&s(n)):(Q("packet [%d] was successfully sent",i.id),this._queue.shift(),s&&s(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(Q("draining queue"),!this.connected||this._queue.length===0)return;let s=this._queue[0];if(s.pending&&!e){Q("packet [%d] has already been sent and is waiting for an ack",s.id);return}s.pending=!0,s.tryCount++,Q("sending packet [%d] (try n\xB0%d)",s.id,s.tryCount),this.flags=s.flags,this.emit.apply(this,s.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){Q("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:O.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,s){Q("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case O.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 O.EVENT:case O.BINARY_EVENT:this.onevent(e);break;case O.ACK:case O.BINARY_ACK:this.onack(e);break;case O.DISCONNECT:this.ondisconnect();break;case O.CONNECT_ERROR:this.destroy();let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let s=e.data||[];Q("emitting event %j",s),e.id!=null&&(Q("attaching ack callback to event"),s.push(this.ack(e.id))),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let s=this._anyListeners.slice();for(let i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let s=this,i=!1;return function(...n){i||(i=!0,Q("sending ack %j",n),s.packet({type:O.ACK,id:e,data:n}))}}onack(e){let s=this.acks[e.id];if(typeof s!="function"){Q("bad ack %s",e.id);return}delete this.acks[e.id],Q("calling ack %s with %j",e.id,e.data),s.withError&&e.data.unshift(null),s.apply(this,e.data)}onconnect(e,s){Q("socket connected with id %s",e),this.id=e,this.recovered=s&&this._pid===s,this._pid=s,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(){Q("server disconnect (%s)",this.nsp),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&&(Q("performing disconnect (%s)",this.nsp),this.packet({type:O.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){let s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,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){let s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let s=this._anyOutgoingListeners.slice();for(let i of s)i.apply(this,e.data)}}};function _t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}_t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-s:t+s}return Math.min(t,this.max)|0};_t.prototype.reset=function(){this.attempts=0};_t.prototype.setMin=function(t){this.ms=t};_t.prototype.setMax=function(t){this.max=t};_t.prototype.setJitter=function(t){this.jitter=t};var cd=B(ve(),1),oe=(0,cd.default)("socket.io-client:manager"),ss=class extends ${constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,We(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new _t({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;let n=s.parser||wr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(oe("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;oe("opening %s",this.uri),this.engine=new es(this.uri,this.opts);let s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=_e(s,"open",function(){i.onopen(),e&&e()}),a=o=>{oe("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},r=_e(s,"error",a);if(this._timeout!==!1){let o=this._timeout;oe("connect attempt will timeout after %d",o);let l=this.setTimeoutFn(()=>{oe("connect attempt timed out after %d",o),n(),a(new Error("timeout")),s.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(n),this.subs.push(r),this}connect(e){return this.open(e)}onopen(){oe("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(_e(e,"ping",this.onping.bind(this)),_e(e,"data",this.ondata.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this)),_e(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Ve(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){oe("error",e),this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ts(this,e,s),this.nsps[e]=i),i}_destroy(e){let s=Object.keys(this.nsps);for(let i of s)if(this.nsps[i].active){oe("socket %s is still active, skipping close",i);return}this._close()}_packet(e){oe("writing packet %j",e);let s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){oe("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){oe("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;oe("closed due to %s",e),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)oe("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let s=this.backoff.duration();oe("will wait %dms before reconnect attempt",s),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(oe("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(oe("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(oe("reconnect success"),e.onreconnect())}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ld=B(ve(),1),pd=(0,ld.default)("socket.io-client"),Ms={};function zs(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};let s=Zu(t,e.path||"/socket.io"),i=s.source,n=s.id,a=s.path,r=Ms[n]&&a in Ms[n].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||r,l;return o?(pd("ignoring socket cache for %s",i),l=new ss(i,e)):(Ms[n]||(pd("new io instance for %s",i),Ms[n]=new ss(i,e)),l=Ms[n]),s.query&&!e.query&&(e.query=s.queryKey),l.socket(s.path,e)}Object.assign(zs,{Manager:ss,Socket:ts,io:zs,connect:zs});var Fi=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},we=class extends Fi{constructor(s,i,n){super(s);k(this,"status");k(this,"code");this.name="APIError",this.status=i,this.code=n}},$s=class extends we{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},Er=class extends we{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var w=class{constructor(e){this.client=e}post(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.post(e,s,n)).data}catch(n){this.handleError(n)}})}get(e,s){return c(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.get(e,i)).data}catch(i){this.handleError(i)}})}patch(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.patch(e,s,n)).data}catch(n){this.handleError(n)}})}put(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.put(e,s,n)).data}catch(n){this.handleError(n)}})}deleteRequest(e,s){return c(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.delete(e,i)).data}catch(i){this.handleError(i)}})}buildConfig(e){if(!e)return;let s=L({},e);return e.idempotencyKey&&(s.headers=re(L({},s.headers),{"Idempotency-Key":e.idempotencyKey})),s}handleError(e){var s,i,n;throw e.response?new we(((s=e.response.data)==null?void 0:s.message)||((i=e.response.data)==null?void 0:i.error)||"API Request Failed",e.response.status,(n=e.response.data)==null?void 0:n.code):new we(e.message||"Network Error")}};var Tr=class extends w{list(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/notes`)})}create(e,s){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/notes`,s)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/notes/${e}`,{content:s})})}pin(e,s=!0){return c(this,null,function*(){return this.patch(`/api/crm/notes/${e}/pin`,{isPinned:s})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/notes/${e}`)})}},Mi=class extends w{constructor(s){super(s);k(this,"notes");this.notes=new Tr(s)}timeline(s,i){return c(this,null,function*(){return this.get(`/api/crm/leads/${s}/timeline`,{params:i})})}list(s,i){return c(this,null,function*(){return this.get(`/api/crm/leads/${s}/activities`,{params:L({},i)})})}log(s){return c(this,null,function*(){return this.post(`/api/crm/leads/${s.leadId}/activities`,s)})}logCall(s,i){return c(this,null,function*(){return this.post(`/api/crm/leads/${s}/calls`,i)})}};var zi=class extends w{overview(e){return c(this,null,function*(){return this.get("/api/crm/analytics/overview",{params:e})})}funnel(e){return c(this,null,function*(){return this.get("/api/crm/analytics/funnel",{params:{pipelineId:e}})})}forecast(e){return c(this,null,function*(){return this.get("/api/crm/analytics/forecast",{params:{pipelineId:e}})})}sources(e){return c(this,null,function*(){return this.get("/api/crm/analytics/sources",{params:e})})}team(e){return c(this,null,function*(){return this.get("/api/crm/analytics/team",{params:e})})}heatmap(e){return c(this,null,function*(){return this.get("/api/crm/analytics/heatmap",{params:e})})}scores(){return c(this,null,function*(){return this.get("/api/crm/analytics/scores")})}stageTime(e){return c(this,null,function*(){return this.get("/api/crm/analytics/stage-time",{params:{pipelineId:e}})})}tiered(e){return c(this,null,function*(){return this.get("/api/crm/analytics/tiered",{params:e})})}summary(e){return c(this,null,function*(){return this.get("/api/crm/analytics/summary",{params:e})})}whatsapp(e){return c(this,null,function*(){return this.get("/api/crm/analytics/whatsapp",{params:e})})}};var $i=class extends w{stats(){return c(this,null,function*(){return this.get("/api/crm/automation/stats")})}logs(e){return c(this,null,function*(){return this.get("/api/crm/automation/logs",{params:e})})}retryFailedEvent(e){return c(this,null,function*(){return this.post(`/api/crm/automation/logs/${e}/retry`,{})})}};var Hi=class extends w{list(){return c(this,null,function*(){return this.get("/api/crm/automations")})}create(e){return c(this,null,function*(){return this.post("/api/crm/automations",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/automations/${e}`,s)})}toggle(e){return c(this,null,function*(){return this.patch(`/api/crm/automations/${e}/toggle`)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/automations/${e}`)})}bulkDelete(e){return c(this,null,function*(){return this.post("/api/crm/automations/bulk-delete",{ids:e})})}test(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/test`,{leadId:s})})}getAvailableEvents(){return c(this,null,function*(){return this.post("/api/crm/automations/events",{})})}enrollments(e,s){return c(this,null,function*(){return this.get(`/api/crm/automations/${e}/enrollments`,{params:s})})}getEnrollment(e){return c(this,null,function*(){return this.get(`/api/crm/automations/enrollments/${e}`)})}pauseEnrollment(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/enrollments/${s}/pause`,{})})}resumeEnrollment(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/enrollments/${s}/resume`,{})})}runs(e){return c(this,null,function*(){return this.get(`/api/crm/automations/${e}/runs`)})}getRun(e){return c(this,null,function*(){return this.get(`/api/crm/automations/runs/${e}`)})}resumeRun(e){return c(this,null,function*(){return this.post(`/api/crm/automations/runs/${e}/resume`,{})})}abortRun(e){return c(this,null,function*(){return this.post(`/api/crm/automations/runs/${e}/abort`,{})})}webhookEvent(e,s,i){return c(this,null,function*(){return this.post("/api/crm/automations/webhook-event",{ruleId:e,eventName:s,payload:i})})}trigger(e){return c(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}};var Vi=class extends w{create(e){return c(this,null,function*(){return this.post("/api/crm/leads",e)})}describe(){return c(this,null,function*(){let e=yield this.fields(),s=Array.isArray(e.data)?e.data:[],i=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:[{label:"New",value:"new"},{label:"Contacted",value:"contacted"},{label:"Qualified",value:"qualified"},{label:"Won",value:"won"},{label:"Lost",value:"lost"}]},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],n=s.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...i,...n],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}})}upsert(e){return c(this,null,function*(){return this.post("/api/crm/leads/upsert",e)})}createMany(e,s=50){return c(this,null,function*(){let i=[];for(let n=0;n<e.length;n+=s){let r=e.slice(n,n+s).map(l=>this.create(l)),o=yield Promise.allSettled(r);for(let l of o)if(l.status==="fulfilled")i.push(l.value);else throw l.reason}return i})}import(e){return c(this,null,function*(){return this.post("/api/crm/leads/import",{leads:e})})}bulkUpsert(e){return c(this,null,function*(){return this.import(e)})}list(e){return c(this,null,function*(){let s=L({},e);return Array.isArray(s.tags)&&(s.tags=s.tags.join(",")),this.get("/api/crm/leads",{params:s})})}listAutoPaging(e){return Ie(this,null,function*(){let s=(e==null?void 0:e.page)||1,i=!0;for(;i;){let n=yield new Ce(this.list(re(L({},e),{page:s}))),a=Array.isArray(n.data)?n.data:n||[];if(a.length===0){i=!1;break}for(let r of a)yield r;n.pagination&&s<n.pagination.pages||!n.pagination&&a.length>0?s++:i=!1}})}retrieve(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}`)})}retrieveByPhone(e){return c(this,null,function*(){return this.get(`/api/crm/leads/phone/${encodeURIComponent(e)}`)})}byStage(n,a){return c(this,arguments,function*(e,s,i={}){return this.get(`/api/crm/pipelines/${e}/stages/${s}/leads`,{params:i})})}retrieveByRef(e,s){return c(this,null,function*(){return this.get(`/api/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(s)}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}`,s)})}move(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/move`,{stageId:s})})}convert(e,s,i){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/convert`,{outcome:s,reason:i})})}tags(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/tags`,s)})}recalculateScore(e){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/score`,{})})}updateMetadata(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/metadata`,s)})}fields(){return c(this,null,function*(){return this.get("/api/crm/leads/fields")})}notes(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/notes`)})}activities(e,s){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/timeline`,{params:s})})}createNote(e,s){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/notes`,s)})}updateNote(e,s,i){return c(this,null,function*(){return this.patch(`/api/crm/notes/${s}`,i)})}deleteNote(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/crm/notes/${s}`)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/leads/${e}`)})}bulkArchive(e){return c(this,null,function*(){return this.patch("/api/crm/leads/bulk-archive",{ids:e})})}bulkDelete(e){return c(this,null,function*(){return this.deleteRequest("/api/crm/leads",{data:{ids:e}})})}archive(e){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/archive`,{})})}};var Wi=class extends w{capture(e){return c(this,null,function*(){return this.post("/api/crm/payments/capture",e)})}};var Gi=class extends w{list(){return c(this,null,function*(){return this.get("/api/crm/pipelines")})}getStageManifest(e){return c(this,null,function*(){var n,a;let s=yield this.retrieve(e),i=Array.isArray((n=s.data)==null?void 0:n.stages)?s.data.stages:[];return{name:`Pipeline: ${((a=s.data)==null?void 0:a.name)||e}`,fields:i.map(r=>({key:r._id,label:r.name,type:"string",required:!0,options:[{label:r.name,value:r._id}],group:"Stages",uiHints:{color:r.color||"#cbd5e1",probability:r.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}})}create(e){return c(this,null,function*(){return this.post("/api/crm/pipelines",e)})}retrieve(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}`,s)})}setDefault(e){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/default`,{})})}duplicate(e,s){return c(this,null,function*(){return this.post(`/api/crm/pipelines/${e}/duplicate`,{newName:s})})}archive(e){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/archive`,{})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/pipelines/${e}`)})}checkInUse(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/in-use`)})}board(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/board`)})}forecast(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/forecast`)})}addStage(e,s){return c(this,null,function*(){return this.post(`/api/crm/pipelines/${e}/stages`,s)})}reorderStages(e,s){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/stages/reorder`,{order:s})})}updateStage(e,s){return c(this,null,function*(){return this.patch(`/api/crm/stages/${e}`,s)})}deleteStage(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/crm/stages/${e}`,{data:s?{moveLeadsToStageId:s}:void 0})})}};var Ki=class extends w{getConfig(){return c(this,null,function*(){return this.get("/api/crm/scoring")})}updateConfig(e){return c(this,null,function*(){return this.patch("/api/crm/scoring",e)})}recalculate(e){return c(this,null,function*(){return this.post(`/api/crm/scoring/${e}/recalculate`,{})})}};var Ji=class extends w{enroll(e){return c(this,null,function*(){return this.post("/api/crm/sequences/enroll",e)})}unenroll(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/sequences/unenroll/${e}`)})}listForLead(e){return c(this,null,function*(){return this.get(`/api/crm/sequences/lead/${e}`)})}};var Xi=class{constructor(e){k(this,"leads");k(this,"pipelines");k(this,"activities");k(this,"analytics");k(this,"automations");k(this,"sequences");k(this,"scoring");k(this,"payments");k(this,"automationDashboard");this.leads=new Vi(e),this.pipelines=new Gi(e),this.activities=new Mi(e),this.analytics=new zi(e),this.automations=new Hi(e),this.sequences=new Ji(e),this.scoring=new Ki(e),this.payments=new Wi(e),this.automationDashboard=new $i(e)}};var Yi=class extends w{sendCampaign(e){return c(this,null,function*(){return this.post("/api/saas/emails/campaign",e)})}sendTest(e){return c(this,null,function*(){return this.post("/api/saas/emails/test",{to:e})})}listTemplates(e){return c(this,null,function*(){return this.get("/api/saas/mail/templates",{params:e})})}getTemplate(e){return c(this,null,function*(){return this.get(`/api/saas/mail/templates/${e}`)})}createTemplate(e){return c(this,null,function*(){return this.post("/api/saas/mail/templates",e)})}updateTemplate(e,s){return c(this,null,function*(){return this.put(`/api/saas/mail/templates/${e}`,s)})}deleteTemplate(e,s=!1){return c(this,null,function*(){return this.deleteRequest(`/api/saas/mail/templates/${e}`,{params:{force:s}})})}previewTemplate(e,s){return c(this,null,function*(){return this.post(`/api/saas/mail/templates/${e}/preview`,s)})}};var Qi=class extends w{list(){return c(this,null,function*(){return this.get("/api/saas/events")})}assign(e){return c(this,null,function*(){return this.post("/api/saas/events/assign",e)})}unassign(e){return c(this,null,function*(){return this.post("/api/saas/events/unassign",{name:e})})}unassignBulk(e){return c(this,null,function*(){return this.post("/api/saas/events/unassign/bulk",{names:e})})}trigger(e){return c(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}listCustomEvents(){return c(this,null,function*(){return this.get("/api/saas/crm/custom-events")})}createCustomEvent(e){return c(this,null,function*(){return this.post("/api/saas/crm/custom-events",e)})}deleteCustomEvent(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/crm/custom-events/${e}`)})}emit(e){return c(this,null,function*(){return this.post("/api/crm/events/emit",e)})}};var Zi=class extends w{system(){return c(this,null,function*(){return(yield this.get("/api/saas/health")).data})}clientHealth(){return c(this,null,function*(){return(yield this.get("/api/saas/health/client")).data})}getDiagnosticReport(){return c(this,null,function*(){return this.clientHealth()})}jobStatus(e){return c(this,null,function*(){return(yield this.get(`/api/saas/jobs/status/${e}`)).data})}};var en=class extends w{listEventLogs(e){return c(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}getEventLog(e){return c(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}listCallbackLogs(e){return c(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}getStats(){return c(this,null,function*(){return this.get("/api/saas/events/stats")})}};var Sr=class extends w{sendCampaign(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/campaign",e)})}sendTest(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/test",{to:e})})}},kr=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/marketing/campaigns",{params:e})})}create(e){return c(this,null,function*(){return this.post("/api/saas/marketing/campaigns",e)})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/marketing/campaigns/${e}`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/marketing/campaigns/${e}`)})}send(e,s){return c(this,null,function*(){return this.post(`/api/saas/marketing/campaigns/${e}/send`,s||{})})}stats(e){return c(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}/stats`)})}},Rr=class extends w{sendTemplate(e){return c(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",e)})}},tn=class extends w{constructor(s){super(s);k(this,"emails");k(this,"campaigns");k(this,"whatsapp");this.emails=new Sr(s),this.campaigns=new kr(s),this.whatsapp=new Rr(s)}};var sn=class extends w{getUsage(){return c(this,null,function*(){return this.get("/api/saas/storage/usage")})}createFolder(e){return c(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}list(e,s){return c(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}delete(e){return c(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}getDownloadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}upload(e,s){return c(this,null,function*(){let i=yield this.post("/api/saas/storage/upload-url",s),{uploadUrl:n,key:a}=i.data;yield Mt.put(n,e,{headers:{"Content-Type":s.contentType}});let r=e.size||e.byteLength||0;return this.post("/api/saas/storage/confirm-upload",{key:a,sizeBytes:r})})}};var nn=class extends w{create(e){return c(this,null,function*(){return this.post("/api/saas/meet",e)})}list(e){return c(this,null,function*(){return this.get("/api/saas/meet",{params:e})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/meet/${e}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}reschedule(e,s){return c(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}delete(e){return c(this,null,function*(){return this.update(e,{status:"cancelled"})})}};var an=class extends w{listLogs(e){return c(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}retrieveLog(e){return c(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}getStats(e){return c(this,null,function*(){return this.get("/api/saas/events/stats",{params:e})})}listCallbacks(e){return c(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}listAlerts(e){return c(this,null,function*(){return this.get("/api/crm/notifications",{params:e})})}dismissAlert(e){return c(this,null,function*(){return this.patch(`/api/crm/notifications/${e}/dismiss`)})}clearAllAlerts(){return c(this,null,function*(){return this.deleteRequest("/api/crm/notifications/clear-all")})}retryAction(e){return c(this,null,function*(){return this.post(`/api/crm/notifications/${e}/retry`,{})})}};var rn=class extends w{listFailed(){return c(this,null,function*(){return this.get("/api/saas/admin/queue/failed")})}getStats(){return c(this,null,function*(){return this.get("/api/saas/admin/queue/stats")})}retryJob(e){return c(this,null,function*(){return this.post(`/api/saas/admin/queue/${e}/retry`,{})})}deleteJob(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/admin/queue/${e}`)})}};var Cr=class extends w{create(e){return c(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/storage/folders/${encodeURIComponent(e)}`)})}},Ar=class extends w{list(e,s){return c(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}getUploadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/upload-url",e)})}confirmUpload(e){return c(this,null,function*(){return this.post("/api/saas/storage/confirm-upload",e)})}getDownloadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}delete(e){return c(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}},on=class extends w{constructor(s){super(s);k(this,"folders");k(this,"files");this.folders=new Cr(s),this.files=new Ar(s)}usage(){return c(this,null,function*(){return this.get("/api/saas/storage/usage")})}};var is=class extends we{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},cn=class{constructEvent(e,s,i){return c(this,null,function*(){if(!s)throw new is("No webhook signature provided");let n=Array.isArray(s)?s[0]:s;n.startsWith("sha256=")&&(n=n.slice(7));try{let a=yield import("crypto"),o=a.createHmac("sha256",i).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(o),Buffer.from(n)))throw new is("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof is?a:new is(`Webhook payload parsing failed: ${a.message}`)}})}};var pn=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/broadcasts",{params:e})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/broadcasts/${e}`)})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/broadcast",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/chat/broadcasts/${e}`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/broadcasts/${e}`)})}};var ln=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/conversations",{params:e})})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/conversations",e)})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}`)})}messages(e,s){return c(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}/messages`,{params:s})})}linkLead(e,s,i){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/link-lead`,{leadId:s,leadData:i})})}markRead(e){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`,{})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/conversations/${e}`)})}bulkDelete(e){return c(this,null,function*(){return this.post("/api/saas/chat/conversations/bulk-delete",{ids:e})})}};var un=class extends w{send(e){return c(this,null,function*(){return this.post("/api/saas/chat/send",e)})}sendTemplate(e){return c(this,null,function*(){return this.post("/api/saas/chat/send",re(L({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))})}star(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/star`,{isStarred:s})})}react(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/react`,{reaction:s})})}markRead(e){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`)})}upload(e){return c(this,null,function*(){let s=new FormData;return s.append("file",e),this.post("/api/saas/chat/upload",s,{headers:{"Content-Type":"multipart/form-data"}})})}};var dn=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/templates",{params:e})})}sync(){return c(this,null,function*(){return this.post("/api/saas/chat/templates/sync",{})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}`)})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/templates",e)})}update(e,s){return c(this,null,function*(){return this.put(`/api/saas/chat/templates/${e}`,s)})}deleteTemplate(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/templates/${encodeURIComponent(e)}${s?"?force=true":""}`)})}mappingConfig(){return c(this,null,function*(){return this.get("/api/saas/chat/templates/mapping/config")})}collections(){return c(this,null,function*(){return this.get("/api/saas/chat/templates/collections")})}collectionFields(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/collections/${encodeURIComponent(e)}/fields`)})}updateMapping(e,s){return c(this,null,function*(){return this.put(`/api/saas/chat/templates/${encodeURIComponent(e)}/mapping`,s)})}validate(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}/validate`)})}preview(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/templates/${encodeURIComponent(e)}/preview`,{context:s})})}getVariableManifest(e){return c(this,null,function*(){var a,r;let s=yield this.retrieve(e),i=Array.isArray((a=s.data)==null?void 0:a.components)?s.data.components:[],n=[];for(let o of i)if(o.text){let l=o.text.match(/{{(\d+)}}/g);if(l)for(let u of l){let p=u.replace(/{{|}}/g,"");n.push({key:`var_${p}`,label:`${o.type} Var {{${p}}}`,type:"string",required:!0,group:o.type,description:`Variable placeholder in template ${o.type}`})}}return{name:`Template variables: ${((r=s.data)==null?void 0:r.name)||e}`,fields:n,uiHints:{icon:"Variables",primaryColor:"#059669"}}})}checkUsage(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}/usage`)})}};var mn=class extends w{constructor(s){super(s);k(this,"messages");k(this,"conversations");k(this,"broadcasts");k(this,"templates");this.messages=new un(s),this.conversations=new ln(s),this.broadcasts=new pn(s),this.templates=new dn(s)}upload(s,i){return c(this,null,function*(){let n=new FormData;return n.append("file",s,i),this.post("/api/saas/chat/upload",n,{headers:typeof n.getHeaders=="function"?n.getHeaders():void 0})})}sendTemplate(s){return c(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",s)})}};var fn=class extends w{listBlueprints(){return c(this,null,function*(){return this.get("/api/agency/blueprints")})}createBlueprint(e){return c(this,null,function*(){return this.post("/api/agency/blueprints",e)})}deployBlueprint(e){return c(this,null,function*(){return this.post("/api/agency/blueprints/deploy",e)})}getPortfolioStats(e){return c(this,null,function*(){return this.get(`/api/agency/portfolio/${e}/stats`)})}getPortfolioHealth(e){return c(this,null,function*(){return this.get(`/api/agency/portfolio/${e}/health`)})}getUsage(e){return c(this,null,function*(){return this.get(`/api/agency/usage/${e}`)})}listStaff(e){return c(this,null,function*(){return this.get(`/api/agency/staff/${e}`)})}createStaff(e){return c(this,null,function*(){return this.post("/api/agency/staff",e)})}};var Or=class extends w{list(){return c(this,null,function*(){return this.get("/api/services/clients")})}getCountAndGenerateCode(){return c(this,null,function*(){return this.get("/api/services/clients/count")})}retrieve(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}`)})}getApiKey(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/api-key`)})}rotateApiKey(e){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/api-key`,{})})}create(e){return c(this,null,function*(){return this.post("/api/services/clients",e)})}getConfig(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/config`)})}updateConfig(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/config`,s)})}getSecrets(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/secrets`)})}updateSecrets(e,s){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/secrets`,s)})}replaceSecrets(e,s){return c(this,null,function*(){return this.put(`/api/services/clients/${e}/secrets`,s)})}patchSecrets(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/secrets`,s)})}getDataSource(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/datasource`)})}manageDataSource(e,s){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/datasource`,s)})}updateIdentity(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/identity`,s)})}googleReauth(i){return c(this,arguments,function*(e,s={}){return this.post(`/api/services/clients/${e}/google/reauth`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/services/clients/${e}`)})}},Pr=class extends w{list(){return c(this,null,function*(){return this.get("/api/services/blogs")})}},Lr=class extends w{add(e){return c(this,null,function*(){return this.post("/api/services/add-lead",e)})}},hn=class extends w{constructor(s){super(s);k(this,"clients");k(this,"blogs");k(this,"globalLeads");this.clients=new Or(s),this.blogs=new Pr(s),this.globalLeads=new Lr(s)}};var Nr=class extends w{getConfig(){return c(this,null,function*(){return this.get("/api/settings/email")})}switchProvider(e){return c(this,null,function*(){return this.post("/api/settings/email/provider",{provider:e})})}saveSmtp(e){return c(this,null,function*(){return this.post("/api/settings/email/smtp",e)})}initDomainVerification(e){return c(this,null,function*(){return this.post("/api/settings/email/ses/domain",{domain:e})})}saveEmailConfig(e){return c(this,null,function*(){return this.post("/api/settings/email/ses/config",e)})}checkSesVerification(){return c(this,null,function*(){return this.get("/api/settings/email/ses/verify")})}removeSesIdentity(){return c(this,null,function*(){return this.deleteRequest("/api/settings/email/ses/domain")})}sendTest(e){return c(this,null,function*(){return this.post("/api/settings/email/test",{toEmail:e})})}saveAdvancedConfig(e){return c(this,null,function*(){return this.post("/api/settings/email/advanced",e)})}getHealth(){return c(this,null,function*(){return this.get("/api/settings/email/health")})}fixDmarc(){return c(this,null,function*(){return this.post("/api/settings/email/ses/fix-dmarc",{})})}listProviders(){return c(this,null,function*(){return this.get("/api/settings/email/providers")})}},xn=class extends w{constructor(s){super(s);k(this,"email");this.email=new Nr(s)}};var gn=class extends w{list(){return c(this,null,function*(){return this.get("/api/saas/cors")})}create(e){return c(this,null,function*(){return this.post("/api/saas/cors",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/cors/${e}`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/cors/${e}`)})}};var yn=class extends w{getProduct(e){return c(this,null,function*(){return this.get(`/api/v1/checkout/products/${e}`)})}createSession(e){return c(this,null,function*(){return this.post("/api/v1/checkout/session",e)})}applyCoupon(e){return c(this,null,function*(){return this.post("/api/v1/checkout/coupon",e)})}verify(e){return c(this,null,function*(){return this.post("/api/v1/checkout/verify",e)})}createOrder(e){return c(this,null,function*(){return this.post("/api/v1/checkout/order",e)})}};var By="https://api.ecodrix.com",wt=class{constructor(e){k(this,"client");k(this,"socket");k(this,"clientCode");k(this,"whatsapp");k(this,"crm");k(this,"media");k(this,"meet");k(this,"notifications");k(this,"email");k(this,"logs");k(this,"events");k(this,"webhooks");k(this,"storage");k(this,"marketing");k(this,"health");k(this,"queue");k(this,"agency");k(this,"services");k(this,"settings");k(this,"cors");k(this,"checkout");var l,u,p,m,f;if(!e.apiKey)throw new $s("API Key is required");this.clientCode=(l=e.clientCode)==null?void 0:l.toUpperCase();let s=(u=e.baseUrl)!=null?u:By,i=e.socketUrl||s,n=typeof window!="undefined"&&typeof window.document!="undefined",a=n?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",r=n?((p=globalThis.navigator)==null?void 0:p.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",o={"x-api-key":e.apiKey,"x-client-code":((m=e.clientCode)==null?void 0:m.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:"1.0.0",runtime:a,os:r})};if(e.coreApiKey&&(o["x-core-api-key"]=e.coreApiKey),this.client=Mt.create({baseURL:s,headers:o}),gi(this.client,{retries:3,retryDelay:gi.exponentialDelay,retryCondition:g=>{var h;return gi.isNetworkOrIdempotentRequestError(g)||((h=g.response)==null?void 0:h.status)===429},onRetry:(g,h,x)=>{var R,C;typeof process!="undefined"&&((R=process.env)==null?void 0:R.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${g}/3): ${(C=x.method)==null?void 0:C.toUpperCase()} ${x.url}. Reason: ${h.message}`)}}),this.whatsapp=new mn(this.client),this.crm=new Xi(this.client),this.media=new sn(this.client),this.meet=new nn(this.client),this.notifications=new an(this.client),this.email=new Yi(this.client),this.logs=new en(this.client),this.events=new Qi(this.client),this.webhooks=new cn,this.storage=new on(this.client),this.marketing=new tn(this.client),this.health=new Zi(this.client),this.queue=new rn(this.client),this.agency=new fn(this.client),this.services=new hn(this.client),this.settings=new xn(this.client),this.cors=new gn(this.client),this.checkout=new yn(this.client),this.socket=zs(i,{extraHeaders:{"x-api-key":e.apiKey,"x-client-code":((f=e.clientCode)==null?void 0:f.toUpperCase())||""}}),this.setupSocket(e.clientCode),n){let g={version:"1.2.2",clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=g,window.ecodrix||(window.ecodrix=this)}}joinRoom(e){this.socket.emit("join-room",e)}leaveRoom(e){this.socket.emit("leave-room",e)}setupSocket(e){this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,s){return this.socket.on(e,s),this}disconnect(){this.socket.disconnect()}off(e,s){return this.socket.off(e,s),this}request(e,s,i,n){return c(this,null,function*(){var a,r,o;try{return(yield this.client.request({method:e,url:s,data:i,params:n})).data}catch(l){throw l.response?new we(((a=l.response.data)==null?void 0:a.message)||((r=l.response.data)==null?void 0:r.error)||"Raw Execution Failed",l.response.status,(o=l.response.data)==null?void 0:o.code):new we(l.message||"Network Error")}})}};var Iy=wt;return vd(jy);})();
|
|
19
|
+
`+a):i.stack=a}catch(r){}}throw i}})}_request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=Le(this.defaults,s);let{transitional:i,paramsSerializer:n,headers:a}=s;i!==void 0&&ws.assertOptions(i,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean)},!1),n!=null&&(d.isFunction(n)?s.paramsSerializer={serialize:n}:ws.assertOptions(n,{encode:Te.function,serialize:Te.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),ws.assertOptions(s,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let r=a&&d.merge(a.common,a[s.method]);a&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),s.headers=W.concat(r,a);let o=[],l=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(s)===!1)return;l=l&&x.synchronous;let y=s.transitional||st;y&&y.legacyInterceptorReqResOrdering?o.unshift(x.fulfilled,x.rejected):o.push(x.fulfilled,x.rejected)});let u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let p,m=0,f;if(!l){let h=[hi.bind(this),void 0];for(h.unshift(...o),h.push(...u),f=h.length,p=Promise.resolve(s);m<f;)p=p.then(h[m++],h[m++]);return p}f=o.length;let g=s;for(;m<f;){let h=o[m++],x=o[m++];try{g=h(g)}catch(y){x.call(this,y);break}}try{p=hi.call(this,g)}catch(h){return Promise.reject(h)}for(m=0,f=u.length;m<f;)p=p.then(u[m++],u[m++]);return p}getUri(e){e=Le(this.defaults,e);let s=pt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(s,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Ft.prototype[e]=function(s,i){return this.request(Le(i||{},{method:e,url:s,data:(i||{}).data}))}});d.forEach(["post","put","patch"],function(e){function s(i){return function(a,r,o){return this.request(Le(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:r}))}}Ft.prototype[e]=s(),Ft.prototype[e+"Form"]=s(!0)});var Es=Ft;var La=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(a){s=a});let i=this;this.promise.then(n=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](n);i._listeners=null}),this.promise.then=n=>{let a,r=new Promise(o=>{i.subscribe(o),a=o}).then(n);return r.cancel=function(){i.unsubscribe(a)},r},e(function(a,r,o){i.reason||(i.reason=new ye(a,r,o),s(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){let e=new AbortController,s=i=>{e.abort(i)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new t(function(n){e=n}),cancel:e}}},ul=La;function Na(t){return function(s){return t.apply(null,s)}}function qa(t){return d.isObject(t)&&t.isAxiosError===!0}var Da={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(Da).forEach(([t,e])=>{Da[e]=t});var dl=Da;function ml(t){let e=new Es(t),s=as(Es.prototype.request,e);return d.extend(s,Es.prototype,e,{allOwnKeys:!0}),d.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return ml(Le(t,n))},s}var Y=ml(Pt);Y.Axios=Es;Y.CanceledError=ye;Y.CancelToken=ul;Y.isCancel=hs;Y.VERSION=mt;Y.toFormData=tt;Y.AxiosError=_;Y.Cancel=Y.CanceledError;Y.all=function(e){return Promise.all(e)};Y.spread=Na;Y.isAxiosError=qa;Y.mergeConfig=Le;Y.AxiosHeaders=W;Y.formToJSON=t=>ai(d.isHTMLForm(t)?new FormData(t):t);Y.getAdapter=fi.getAdapter;Y.HttpStatusCode=dl;Y.default=Y;var Mt=Y;var{Axios:LE,AxiosError:NE,CanceledError:qE,isCancel:DE,CancelToken:BE,VERSION:IE,all:jE,Cancel:UE,isAxiosError:FE,spread:ME,toFormData:zE,AxiosHeaders:$E,HttpStatusCode:HE,formToJSON:VE,getAdapter:WE,mergeConfig:GE}=Mt;var gl=B(hl(),1);var Ba="axios-retry";function yl(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,gl.default)(t)}var vl=["get","head","options"],Rx=vl.concat(["put","delete"]);function Ia(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function Cx(t){var e;return(e=t.config)!=null&&e.method?Ia(t)&&vl.indexOf(t.config.method)!==-1:!1}function bl(t){var e;return(e=t.config)!=null&&e.method?Ia(t)&&Rx.indexOf(t.config.method)!==-1:!1}function _l(t){return yl(t)||bl(t)}function ja(t=void 0){var i;let e=(i=t==null?void 0:t.response)==null?void 0:i.headers["retry-after"];if(!e)return 0;let s=(Number(e)||0)*1e3;return s===0&&(s=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,s)}function Ax(t=0,e=void 0){return Math.max(0,ja(e))}function Ox(t=0,e=void 0,s=100){let i=Br(2,t)*s,n=Math.max(i,ja(e)),a=n*.2*Math.random();return n+a}function Px(t=100){return(e=0,s=void 0)=>{let i=e*t;return Math.max(i,ja(s))}}var Lx={retries:3,retryCondition:_l,retryDelay:Ax,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Nx(t,e){return L(L(L({},Lx),e),t[Ba])}function xl(t,e,s=!1){let i=Nx(t,e||{});return i.retryCount=i.retryCount||0,(!i.lastRequestTime||s)&&(i.lastRequestTime=Date.now()),t[Ba]=i,i}function qx(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}function Dx(t,e){return c(this,null,function*(){let{retries:s,retryCondition:i}=t,n=(t.retryCount||0)<s&&i(e);if(typeof n=="object")try{return(yield n)!==!1}catch(a){return!1}return n})}function Bx(t,e,s,i){return c(this,null,function*(){var l;e.retryCount+=1;let{retryDelay:n,shouldResetTimeout:a,onRetry:r}=e,o=n(e.retryCount,s);if(qx(t,i),!a&&i.timeout&&e.lastRequestTime){let u=Date.now()-e.lastRequestTime,p=i.timeout-u-o;if(p<=0)return Promise.reject(s);i.timeout=p}return i.transformRequest=[u=>u],yield r(e.retryCount,s,i),(l=i.signal)!=null&&l.aborted?Promise.resolve(t(i)):new Promise(u=>{var f;let p=()=>{clearTimeout(m),u(t(i))},m=setTimeout(()=>{var g;u(t(i)),(g=i.signal)!=null&&g.removeEventListener&&i.signal.removeEventListener("abort",p)},o);(f=i.signal)!=null&&f.addEventListener&&i.signal.addEventListener("abort",p,{once:!0})})})}function Ix(t,e){return c(this,null,function*(){t.retryCount>=t.retries&&(yield t.onMaxRetryTimesExceeded(e,t.retryCount))})}var it=(t,e)=>{let s=t.interceptors.request.use(n=>{var a;return xl(n,e,!0),(a=n[Ba])!=null&&a.validateResponse&&(n.validateStatus=()=>!1),n}),i=t.interceptors.response.use(null,n=>c(null,null,function*(){var o;let{config:a}=n;if(!a)return Promise.reject(n);let r=xl(a,e);return n.response&&((o=r.validateResponse)!=null&&o.call(r,n.response))?n.response:(yield Dx(r,n))?Bx(t,r,n,a):(yield Ix(r,n),Promise.reject(n))}));return{requestInterceptorId:s,responseInterceptorId:i}};it.isNetworkError=yl;it.isSafeRequestError=Cx;it.isIdempotentRequestError=bl;it.isNetworkOrIdempotentRequestError=_l;it.exponentialDelay=Ox;it.linearDelay=Px;it.isRetryableError=Ia;var gi=it;var Va=B(Tl(),1);var Ne=Object.create(null);Ne.open="0";Ne.close="1";Ne.ping="2";Ne.pong="3";Ne.message="4";Ne.upgrade="5";Ne.noop="6";var Ts=Object.create(null);Object.keys(Ne).forEach(t=>{Ts[Ne[t]]=t});var Ss={type:"error",data:"parser error"};var ks=({type:t,data:e},s,i)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?i(s?e:"b"+Sl(e,!0).toString("base64")):i(Ne[t]+(e||"")),Sl=(t,e)=>Buffer.isBuffer(t)||t instanceof Uint8Array&&!e?t:t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t.buffer,t.byteOffset,t.byteLength),Fa;function kl(t,e){if(t.data instanceof ArrayBuffer||ArrayBuffer.isView(t.data))return e(Sl(t.data,!1));ks(t,!0,s=>{Fa||(Fa=new TextEncoder),e(Fa.encode(s))})}var Rs=(t,e)=>{if(typeof t!="string")return{type:"message",data:Rl(t,e)};let s=t.charAt(0);if(s==="b"){let i=Buffer.from(t.substring(1),"base64");return{type:"message",data:Rl(i,e)}}return Ts[s]?t.length>1?{type:Ts[s],data:t.substring(1)}:{type:Ts[s]}:Ss},Rl=(t,e)=>{switch(e){case"arraybuffer":return t instanceof ArrayBuffer?t:Buffer.isBuffer(t)?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t.buffer;case"nodebuffer":default:return Buffer.isBuffer(t)?t:Buffer.from(t)}};var Cl="",Al=(t,e)=>{let s=t.length,i=new Array(s),n=0;t.forEach((a,r)=>{ks(a,!1,o=>{i[r]=o,++n===s&&e(i.join(Cl))})})},Ol=(t,e)=>{let s=t.split(Cl),i=[];for(let n=0;n<s.length;n++){let a=Rs(s[n],e);if(i.push(a),a.type==="error")break}return i};function Pl(){return new TransformStream({transform(t,e){kl(t,s=>{let i=s.length,n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);let a=new DataView(n.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{n=new Uint8Array(9);let a=new DataView(n.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(s)})}})}var Ma;function yi(t){return t.reduce((e,s)=>e+s.length,0)}function vi(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),i=0;for(let n=0;n<e;n++)s[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),s}function Ll(t,e){Ma||(Ma=new TextDecoder);let s=[],i=0,n=-1,a=!1;return new TransformStream({transform(r,o){for(s.push(r);;){if(i===0){if(yi(s)<1)break;let l=vi(s,1);a=(l[0]&128)===128,n=l[0]&127,n<126?i=3:n===126?i=1:i=2}else if(i===1){if(yi(s)<2)break;let l=vi(s,2);n=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(yi(s)<8)break;let l=vi(s,8),u=new DataView(l.buffer,l.byteOffset,l.length),p=u.getUint32(0);if(p>Math.pow(2,21)-1){o.enqueue(Ss);break}n=p*Math.pow(2,32)+u.getUint32(4),i=3}else{if(yi(s)<n)break;let l=vi(s,n);o.enqueue(Rs(a?l:Ma.decode(l),e)),i=0}if(n===0||n>t){o.enqueue(Ss);break}}}})}var za=4;function $(t){if(t)return Ux(t)}function Ux(t){for(var e in $.prototype)t[e]=$.prototype[e];return t}$.prototype.on=$.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};$.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+t];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,n=0;n<s.length;n++)if(i=s[n],i===e||i.fn===e){s.splice(n,1);break}return s.length===0&&delete this._callbacks["$"+t],this};$.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,n=s.length;i<n;++i)s[i].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};$.prototype.hasListeners=function(t){return!!this.listeners(t).length};var Ve=process.nextTick,de=global,Nl="nodebuffer";function ql(){return new $a}function Fx(t){let e=t.split("; "),s=e[0].indexOf("=");if(s===-1)return;let i=e[0].substring(0,s).trim();if(!i.length)return;let n=e[0].substring(s+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let a={name:i,value:n};for(let r=1;r<e.length;r++){let o=e[r].split("=");if(o.length!==2)continue;let l=o[0].trim(),u=o[1].trim();switch(l){case"Expires":a.expires=new Date(u);break;case"Max-Age":let p=new Date;p.setUTCSeconds(p.getUTCSeconds()+parseInt(u,10)),a.expires=p;break;default:}}return a}var $a=class{constructor(){this._cookies=new Map}parseCookies(e){e&&e.forEach(s=>{let i=Fx(s);i&&this._cookies.set(i.name,i)})}get cookies(){let e=Date.now();return this._cookies.forEach((s,i)=>{var n;((n=s.expires)===null||n===void 0?void 0:n.getTime())<e&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(e){let s=[];for(let[i,n]of this.cookies)s.push(`${i}=${n.value}`);s.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",s.join("; ")))}appendCookies(e){for(let[s,i]of this.cookies)e.append("cookie",`${s}=${i.value}`)}};function bi(t,...e){return e.reduce((s,i)=>(t.hasOwnProperty(i)&&(s[i]=t[i]),s),{})}var Mx=de.setTimeout,zx=de.clearTimeout;function We(t,e){e.useNativeTimers?(t.setTimeoutFn=Mx.bind(de),t.clearTimeoutFn=zx.bind(de)):(t.setTimeoutFn=de.setTimeout.bind(de),t.clearTimeoutFn=de.clearTimeout.bind(de))}var $x=1.33;function Dl(t){return typeof t=="string"?Hx(t):Math.ceil((t.byteLength||t.size)*$x)}function Hx(t){let e=0,s=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function _i(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Bl(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}function Il(t){let e={},s=t.split("&");for(let i=0,n=s.length;i<n;i++){let a=s[i].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}var jl=B(ve(),1),Vx=(0,jl.default)("engine.io-client:transport"),wi=class extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}},Ge=class extends ${constructor(e){super(),this.writable=!1,We(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new wi(e,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Vx("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let s=Rs(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let s=Bl(e);return s.length?"?"+s:""}};var Ul=B(ve(),1),qe=(0,Ul.default)("engine.io-client:polling"),Cs=class extends Ge{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let s=()=>{qe("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(qe("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){qe("pre-pause polling complete"),--i||s()})),this.writable||(qe("we are currently writing - waiting to pause"),i++,this.once("drain",function(){qe("pre-pause writing complete"),--i||s()}))}else s()}_poll(){qe("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){qe("polling got data %s",e);let s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};Ol(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():qe('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{qe("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(qe("transport open - closing"),e()):(qe("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,Al(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=_i()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}};var Fl=!1;try{Fl=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(t){}var Ml=Fl;var $l=B(ve(),1),Ha=(0,$l.default)("engine.io-client:polling");function Wx(){}var Ei=class extends Cs{constructor(e){if(super(e),typeof location!="undefined"){let s=location.protocol==="https:",i=location.port;i||(i=s?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){let i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(n,a)=>{this.onError("xhr post error",n,a)})}doPoll(){Ha("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}},Ke=class t extends ${constructor(e,s,i){super(),this.createRequest=e,We(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;let s=bi(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{Ha("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch(n){}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{i.setRequestHeader("Accept","*/*")}catch(n){}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Ha("xhr data %s",this._data),i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document!="undefined"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr=="undefined"||this._xhr===null)){if(this._xhr.onreadystatechange=Wx,e)try{this._xhr.abort()}catch(s){}typeof document!="undefined"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ke.requestsCount=0;Ke.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",zl);else if(typeof addEventListener=="function"){let t="onpagehide"in de?"pagehide":"unload";addEventListener(t,zl,!1)}}function zl(){for(let t in Ke.requests)Ke.requests.hasOwnProperty(t)&&Ke.requests[t].abort()}var CT=(function(){let t=Gx({xdomain:!1});return t&&t.responseType!==null})();function Gx(t){let e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Ml))return new XMLHttpRequest}catch(s){}if(!e)try{return new de[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(s){}}var Kx=Va.default||Va,$t=class extends Ei{request(e={}){var s;return Object.assign(e,{xd:this.xd,cookieJar:(s=this.socket)===null||s===void 0?void 0:s._cookieJar},this.opts),new Ke(i=>new Kx(i),this.uri(),e)}};var my=B(ju(),1),fy=B(sr(),1),hy=B(ar(),1),mr=B(Di(),1),xy=B(Gu(),1);var Ku=B(ve(),1),yy=(0,Ku.default)("engine.io-client:websocket"),vy=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ii=class extends Ge{get name(){return"websocket"}doOpen(){let e=this.uri(),s=this.opts.protocols,i=vy?{}:bi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,s,i)}catch(n){return this.emitReserved("error",n)}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 s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;ks(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch(r){yy("websocket closed before onclose event")}n&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=_i()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}},n0=de.WebSocket||de.MozWebSocket;var Yt=class extends Ii{createSocket(e,s,i){var n;if(!((n=this.socket)===null||n===void 0)&&n._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[a,r]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${a}=${r.value}`)}return new mr.default(e,s,i)}doWrite(e,s){let i={};e.options&&(i.compress=e.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(s,i)}};var Ju=B(ve(),1),Is=(0,Ju.default)("engine.io-client:webtransport"),Qt=class extends Ge{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(()=>{Is("transport closed gracefully"),this.onClose()}).catch(e=>{Is("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let s=Ll(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),n=Pl();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();let a=()=>{i.read().then(({done:o,value:l})=>{if(o){Is("session is closed");return}Is("received chunk: %o",l),this.onPacket(l),a()}).catch(o=>{Is("an error occurred while reading: %s",o)})};a();let r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;this._writer.write(i).then(()=>{n&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var fr={websocket:Yt,webtransport:Qt,polling:$t};var by=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_y=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zt(t){if(t.length>8e3)throw"URI too long";let e=t,s=t.indexOf("["),i=t.indexOf("]");s!=-1&&i!=-1&&(t=t.substring(0,s)+t.substring(s,i).replace(/:/g,";")+t.substring(i,t.length));let n=by.exec(t||""),a={},r=14;for(;r--;)a[_y[r]]=n[r]||"";return s!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=wy(a,a.path),a.queryKey=Ey(a,a.query),a}function wy(t,e){let s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Ey(t,e){let s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,a){n&&(s[n]=a)}),s}var Xu=B(ve(),1),z=(0,Xu.default)("engine.io-client:socket"),hr=typeof addEventListener=="function"&&typeof removeEventListener=="function",js=[];hr&&addEventListener("offline",()=>{z("closing %d connection(s) because the network was lost",js.length),js.forEach(t=>t())},!1);var bt=class t extends ${constructor(e,s){if(super(),this.binaryType=Nl,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){let i=Zt(e);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Zt(s.host).host);We(this,s),this.secure=s.secure!=null?s.secure:typeof location!="undefined"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=s.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Il(this.opts.query)),hr&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(z("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},js.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=ql()),this._open()}createTransport(e){z('creating transport "%s"',e);let s=Object.assign({},this.opts.query);s.EIO=za,s.transport=e,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return z("options: %j",i),new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){z("setting transport %s",e.name),this.transport&&(z("clearing existing transport %s",this.transport.name),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",s=>this._onClose("transport close",s))}onOpen(){z("socket open"),this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(z('socket receive: type "%s", data "%s"',e.type,e.data),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":let s=new Error("server error");s.code=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else z('packet received with socket readyState "%s"',this.readyState)}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(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let 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,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();z("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Dl(n)),i>0&&s>this._maxPayload)return z("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);s+=2}return z("payload size is %d (max: %d)",s,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(z("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,Ve(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let a={type:e,data:s,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),z("socket closing - telling transport to close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(z("socket error %j",e),t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return z("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(z('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=js.indexOf(this._offlineEventListener);i!==-1&&(z("removing listener for the 'offline' event"),js.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}};bt.protocol=za;var ji=class extends bt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){z("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){z('probing transport "%s"',e);let s=this.createTransport(e),i=!1;bt.priorWebsocketSuccess=!1;let n=()=>{i||(z('probe transport "%s" opened',e),s.send([{type:"ping",data:"probe"}]),s.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(z('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;bt.priorWebsocketSuccess=s.name==="websocket",z('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(z("changing transport and sending upgrade packet"),p(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{z('probe transport "%s" failed',e);let f=new Error("probe error");f.transport=s.name,this.emitReserved("upgradeError",f)}}))};function a(){i||(i=!0,p(),s.close(),s=null)}let r=m=>{let f=new Error("probe error: "+m);f.transport=s.name,a(),z('probe transport "%s" failed because of error: %s',e,m),this.emitReserved("upgradeError",f)};function o(){r("transport closed")}function l(){r("socket closed")}function u(m){s&&m.name!==s.name&&(z('"%s" works - aborting "%s"',m.name,s.name),a())}let p=()=>{s.removeListener("open",n),s.removeListener("error",r),s.removeListener("close",o),this.off("close",l),this.off("upgrading",u)};s.once("open",n),s.once("error",r),s.once("close",o),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}},es=class extends ji{constructor(e,s={}){let i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(n=>fr[n]).filter(n=>!!n)),super(e,i)}};var C0=es.protocol;var Qu=B(ve(),1),Yu=(0,Qu.default)("socket.io-client:url");function Zu(t,e="",s){let i=t;s=s||typeof location!="undefined"&&location,t==null&&(t=s.protocol+"//"+s.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=s.protocol+t:t=s.host+t),/^(https?|wss?):\/\//.test(t)||(Yu("protocol-less url %s",t),typeof s!="undefined"?t=s.protocol+"//"+t:t="https://"+t),Yu("parse %s",t),i=Zt(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+e,i.href=i.protocol+"://"+a+(s&&s.port===i.port?"":":"+i.port),i}var wr={};_n(wr,{Decoder:()=>br,Encoder:()=>vr,PacketType:()=>O,isPacketValid:()=>qy,protocol:()=>ad});var Ry=typeof ArrayBuffer=="function",Cy=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ed=Object.prototype.toString,Ay=typeof Blob=="function"||typeof Blob!="undefined"&&ed.call(Blob)==="[object BlobConstructor]",Oy=typeof File=="function"||typeof File!="undefined"&&ed.call(File)==="[object FileConstructor]";function Fs(t){return Ry&&(t instanceof ArrayBuffer||Cy(t))||Ay&&t instanceof Blob||Oy&&t instanceof File}function Us(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let s=0,i=t.length;s<i;s++)if(Us(t[s]))return!0;return!1}if(Fs(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Us(t.toJSON(),!0);for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Us(t[s]))return!0;return!1}function td(t){let e=[],s=t.data,i=t;return i.data=xr(s,e),i.attachments=e.length,{packet:i,buffers:e}}function xr(t,e){if(!t)return t;if(Fs(t)){let s={_placeholder:!0,num:e.length};return e.push(t),s}else if(Array.isArray(t)){let s=new Array(t.length);for(let i=0;i<t.length;i++)s[i]=xr(t[i],e);return s}else if(typeof t=="object"&&!(t instanceof Date)){let s={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=xr(t[i],e));return s}return t}function sd(t,e){return t.data=gr(t.data,e),delete t.attachments,t}function gr(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let s=0;s<t.length;s++)t[s]=gr(t[s],e);else if(typeof t=="object")for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(t[s]=gr(t[s],e));return t}var id=B(ve(),1),yr=(0,id.default)("socket.io-parser"),nd=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ad=5,O;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(O||(O={}));var vr=class{constructor(e){this.replacer=e}encode(e){return yr("encoding packet %j",e),(e.type===O.EVENT||e.type===O.ACK)&&Us(e)?this.encodeAsBinary({type:e.type===O.EVENT?O.BINARY_EVENT:O.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===O.BINARY_EVENT||e.type===O.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),yr("encoded %j as %s",e,s),s}encodeAsBinary(e){let s=td(e),i=this.encodeAsString(s.packet),n=s.buffers;return n.unshift(i),n}},br=class t extends ${constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);let i=s.type===O.BINARY_EVENT;i||s.type===O.BINARY_ACK?(s.type=i?O.EVENT:O.ACK,this.reconstructor=new _r(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Fs(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let s=0,i={type:Number(e.charAt(0))};if(O[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===O.BINARY_EVENT||i.type===O.BINARY_ACK){let a=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);let r=e.substring(a,s);if(r!=Number(r)||e.charAt(s)!=="-")throw new Error("Illegal attachments");let o=Number(r);if(!rd(o)||o<0)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=o}if(e.charAt(s+1)==="/"){let a=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(a,s)}else i.nsp="/";let n=e.charAt(s+1);if(n!==""&&Number(n)==n){let a=s+1;for(;++s;){let r=e.charAt(s);if(r==null||Number(r)!=r){--s;break}if(s===e.length)break}i.id=Number(e.substring(a,s+1))}if(e.charAt(++s)){let a=this.tryParse(e.substr(s));if(t.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return yr("decoded %s as %j",e,i),i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(s){return!1}}static isPayloadValid(e,s){switch(e){case O.CONNECT:return Ui(s);case O.DISCONNECT:return s===void 0;case O.CONNECT_ERROR:return typeof s=="string"||Ui(s);case O.EVENT:case O.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&nd.indexOf(s[0])===-1);case O.ACK:case O.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},_r=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let s=sd(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Py(t){return typeof t=="string"}var rd=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Ly(t){return t===void 0||rd(t)}function Ui(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ny(t,e){switch(t){case O.CONNECT:return e===void 0||Ui(e);case O.DISCONNECT:return e===void 0;case O.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&nd.indexOf(e[0])===-1);case O.ACK:return Array.isArray(e);case O.CONNECT_ERROR:return typeof e=="string"||Ui(e);default:return!1}}function qy(t){return Py(t.nsp)&&Ly(t.id)&&Ny(t.type,t.data)}function _e(t,e,s){return t.on(e,s),function(){t.off(e,s)}}var od=B(ve(),1),Q=(0,od.default)("socket.io-client:socket"),Dy=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ts=class extends ${constructor(e,s,i){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=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[_e(e,"open",this.onopen.bind(this)),_e(e,"packet",this.onpacket.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,n,a;if(Dy.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;let r={type:O.EVENT,data:s};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){let p=this.ids++;Q("emitting packet with ack id %d",p);let m=s.pop();this._registerAckCallback(p,m),r.id=p}let o=(n=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||n===void 0?void 0:n.writable,l=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o?Q("discard packet as the transport is not currently writable"):l?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,s){var i;let n=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(n===void 0){this.acks[e]=s;return}let a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(Q("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));Q("event with ack id %d has timed out after %d ms",e,n),s.call(this,new Error("operation has timed out"))},n),r=(...o)=>{this.io.clearTimeoutFn(a),s.apply(this,o)};r.withError=!0,this.acks[e]=r}emitWithAck(e,...s){return new Promise((i,n)=>{let a=(r,o)=>r?n(r):i(o);a.withError=!0,s.push(a),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...a)=>i!==this._queue[0]?Q("packet [%d] already acknowledged",i.id):(n!==null?i.tryCount>this._opts.retries&&(Q("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),s&&s(n)):(Q("packet [%d] was successfully sent",i.id),this._queue.shift(),s&&s(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(Q("draining queue"),!this.connected||this._queue.length===0)return;let s=this._queue[0];if(s.pending&&!e){Q("packet [%d] has already been sent and is waiting for an ack",s.id);return}s.pending=!0,s.tryCount++,Q("sending packet [%d] (try n\xB0%d)",s.id,s.tryCount),this.flags=s.flags,this.emit.apply(this,s.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){Q("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:O.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,s){Q("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case O.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 O.EVENT:case O.BINARY_EVENT:this.onevent(e);break;case O.ACK:case O.BINARY_ACK:this.onack(e);break;case O.DISCONNECT:this.ondisconnect();break;case O.CONNECT_ERROR:this.destroy();let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let s=e.data||[];Q("emitting event %j",s),e.id!=null&&(Q("attaching ack callback to event"),s.push(this.ack(e.id))),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let s=this._anyListeners.slice();for(let i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let s=this,i=!1;return function(...n){i||(i=!0,Q("sending ack %j",n),s.packet({type:O.ACK,id:e,data:n}))}}onack(e){let s=this.acks[e.id];if(typeof s!="function"){Q("bad ack %s",e.id);return}delete this.acks[e.id],Q("calling ack %s with %j",e.id,e.data),s.withError&&e.data.unshift(null),s.apply(this,e.data)}onconnect(e,s){Q("socket connected with id %s",e),this.id=e,this.recovered=s&&this._pid===s,this._pid=s,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(){Q("server disconnect (%s)",this.nsp),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&&(Q("performing disconnect (%s)",this.nsp),this.packet({type:O.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){let s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,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){let s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let s=this._anyOutgoingListeners.slice();for(let i of s)i.apply(this,e.data)}}};function _t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}_t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-s:t+s}return Math.min(t,this.max)|0};_t.prototype.reset=function(){this.attempts=0};_t.prototype.setMin=function(t){this.ms=t};_t.prototype.setMax=function(t){this.max=t};_t.prototype.setJitter=function(t){this.jitter=t};var cd=B(ve(),1),oe=(0,cd.default)("socket.io-client:manager"),ss=class extends ${constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,We(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new _t({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;let n=s.parser||wr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(oe("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;oe("opening %s",this.uri),this.engine=new es(this.uri,this.opts);let s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=_e(s,"open",function(){i.onopen(),e&&e()}),a=o=>{oe("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},r=_e(s,"error",a);if(this._timeout!==!1){let o=this._timeout;oe("connect attempt will timeout after %d",o);let l=this.setTimeoutFn(()=>{oe("connect attempt timed out after %d",o),n(),a(new Error("timeout")),s.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(n),this.subs.push(r),this}connect(e){return this.open(e)}onopen(){oe("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(_e(e,"ping",this.onping.bind(this)),_e(e,"data",this.ondata.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this)),_e(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){Ve(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){oe("error",e),this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ts(this,e,s),this.nsps[e]=i),i}_destroy(e){let s=Object.keys(this.nsps);for(let i of s)if(this.nsps[i].active){oe("socket %s is still active, skipping close",i);return}this._close()}_packet(e){oe("writing packet %j",e);let s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){oe("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){oe("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;oe("closed due to %s",e),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)oe("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let s=this.backoff.duration();oe("will wait %dms before reconnect attempt",s),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(oe("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(oe("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(oe("reconnect success"),e.onreconnect())}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ld=B(ve(),1),pd=(0,ld.default)("socket.io-client"),Ms={};function zs(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};let s=Zu(t,e.path||"/socket.io"),i=s.source,n=s.id,a=s.path,r=Ms[n]&&a in Ms[n].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||r,l;return o?(pd("ignoring socket cache for %s",i),l=new ss(i,e)):(Ms[n]||(pd("new io instance for %s",i),Ms[n]=new ss(i,e)),l=Ms[n]),s.query&&!e.query&&(e.query=s.queryKey),l.socket(s.path,e)}Object.assign(zs,{Manager:ss,Socket:ts,io:zs,connect:zs});var Fi=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},we=class extends Fi{constructor(s,i,n){super(s);k(this,"status");k(this,"code");this.name="APIError",this.status=i,this.code=n}},$s=class extends we{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},Er=class extends we{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var w=class{constructor(e){this.client=e}post(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.post(e,s,n)).data}catch(n){this.handleError(n)}})}get(e,s){return c(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.get(e,i)).data}catch(i){this.handleError(i)}})}patch(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.patch(e,s,n)).data}catch(n){this.handleError(n)}})}put(e,s,i){return c(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.put(e,s,n)).data}catch(n){this.handleError(n)}})}deleteRequest(e,s){return c(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.delete(e,i)).data}catch(i){this.handleError(i)}})}buildConfig(e){if(!e)return;let s=L({},e);return e.idempotencyKey&&(s.headers=re(L({},s.headers),{"Idempotency-Key":e.idempotencyKey})),s}handleError(e){var s,i,n;throw e.response?new we(((s=e.response.data)==null?void 0:s.message)||((i=e.response.data)==null?void 0:i.error)||"API Request Failed",e.response.status,(n=e.response.data)==null?void 0:n.code):new we(e.message||"Network Error")}};var Mi=class extends w{listBlueprints(){return c(this,null,function*(){return this.get("/api/agency/blueprints")})}createBlueprint(e){return c(this,null,function*(){return this.post("/api/agency/blueprints",e)})}deployBlueprint(e){return c(this,null,function*(){return this.post("/api/agency/blueprints/deploy",e)})}getPortfolioStats(e){return c(this,null,function*(){return this.get(`/api/agency/portfolio/${e}/stats`)})}getPortfolioHealth(e){return c(this,null,function*(){return this.get(`/api/agency/portfolio/${e}/health`)})}getUsage(e){return c(this,null,function*(){return this.get(`/api/agency/usage/${e}`)})}listStaff(e){return c(this,null,function*(){return this.get(`/api/agency/staff/${e}`)})}createStaff(e){return c(this,null,function*(){return this.post("/api/agency/staff",e)})}};var zi=class extends w{getProduct(e){return c(this,null,function*(){return this.get(`/api/v1/checkout/products/${e}`)})}createSession(e){return c(this,null,function*(){return this.post("/api/v1/checkout/session",e)})}applyCoupon(e){return c(this,null,function*(){return this.post("/api/v1/checkout/coupon",e)})}verify(e){return c(this,null,function*(){return this.post("/api/v1/checkout/verify",e)})}createOrder(e){return c(this,null,function*(){return this.post("/api/v1/checkout/order",e)})}};var $i=class extends w{list(){return c(this,null,function*(){return this.get("/api/saas/cors")})}create(e){return c(this,null,function*(){return this.post("/api/saas/cors",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/cors/${e}`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/cors/${e}`)})}};var Tr=class extends w{list(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/notes`)})}create(e,s){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/notes`,s)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/notes/${e}`,{content:s})})}pin(e,s=!0){return c(this,null,function*(){return this.patch(`/api/crm/notes/${e}/pin`,{isPinned:s})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/notes/${e}`)})}},Hi=class extends w{constructor(s){super(s);k(this,"notes");this.notes=new Tr(s)}timeline(s,i){return c(this,null,function*(){return this.get(`/api/crm/leads/${s}/timeline`,{params:i})})}list(s,i){return c(this,null,function*(){return this.get(`/api/crm/leads/${s}/activities`,{params:L({},i)})})}log(s){return c(this,null,function*(){return this.post(`/api/crm/leads/${s.leadId}/activities`,s)})}logCall(s,i){return c(this,null,function*(){return this.post(`/api/crm/leads/${s}/calls`,i)})}};var Vi=class extends w{overview(e){return c(this,null,function*(){return this.get("/api/crm/analytics/overview",{params:e})})}funnel(e){return c(this,null,function*(){return this.get("/api/crm/analytics/funnel",{params:{pipelineId:e}})})}forecast(e){return c(this,null,function*(){return this.get("/api/crm/analytics/forecast",{params:{pipelineId:e}})})}sources(e){return c(this,null,function*(){return this.get("/api/crm/analytics/sources",{params:e})})}team(e){return c(this,null,function*(){return this.get("/api/crm/analytics/team",{params:e})})}heatmap(e){return c(this,null,function*(){return this.get("/api/crm/analytics/heatmap",{params:e})})}scores(){return c(this,null,function*(){return this.get("/api/crm/analytics/scores")})}stageTime(e){return c(this,null,function*(){return this.get("/api/crm/analytics/stage-time",{params:{pipelineId:e}})})}tiered(e){return c(this,null,function*(){return this.get("/api/crm/analytics/tiered",{params:e})})}summary(e){return c(this,null,function*(){return this.get("/api/crm/analytics/summary",{params:e})})}whatsapp(e){return c(this,null,function*(){return this.get("/api/crm/analytics/whatsapp",{params:e})})}};var Wi=class extends w{stats(){return c(this,null,function*(){return this.get("/api/crm/automation/stats")})}logs(e){return c(this,null,function*(){return this.get("/api/crm/automation/logs",{params:e})})}retryFailedEvent(e){return c(this,null,function*(){return this.post(`/api/crm/automation/logs/${e}/retry`,{})})}};var Gi=class extends w{list(){return c(this,null,function*(){return this.get("/api/crm/automations")})}create(e){return c(this,null,function*(){return this.post("/api/crm/automations",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/automations/${e}`,s)})}toggle(e){return c(this,null,function*(){return this.patch(`/api/crm/automations/${e}/toggle`)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/automations/${e}`)})}bulkDelete(e){return c(this,null,function*(){return this.post("/api/crm/automations/bulk-delete",{ids:e})})}test(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/test`,{leadId:s})})}getAvailableEvents(){return c(this,null,function*(){return this.post("/api/crm/automations/events",{})})}enrollments(e,s){return c(this,null,function*(){return this.get(`/api/crm/automations/${e}/enrollments`,{params:s})})}getEnrollment(e){return c(this,null,function*(){return this.get(`/api/crm/automations/enrollments/${e}`)})}pauseEnrollment(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/enrollments/${s}/pause`,{})})}resumeEnrollment(e,s){return c(this,null,function*(){return this.post(`/api/crm/automations/${e}/enrollments/${s}/resume`,{})})}runs(e){return c(this,null,function*(){return this.get(`/api/crm/automations/${e}/runs`)})}getRun(e){return c(this,null,function*(){return this.get(`/api/crm/automations/runs/${e}`)})}resumeRun(e){return c(this,null,function*(){return this.post(`/api/crm/automations/runs/${e}/resume`,{})})}abortRun(e){return c(this,null,function*(){return this.post(`/api/crm/automations/runs/${e}/abort`,{})})}webhookEvent(e,s,i){return c(this,null,function*(){return this.post("/api/crm/automations/webhook-event",{ruleId:e,eventName:s,payload:i})})}trigger(e){return c(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}};var Ki=class extends w{create(e){return c(this,null,function*(){return this.post("/api/crm/leads",e)})}describe(){return c(this,null,function*(){let e=yield this.fields(),s=Array.isArray(e.data)?e.data:[],i=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:[{label:"New",value:"new"},{label:"Contacted",value:"contacted"},{label:"Qualified",value:"qualified"},{label:"Won",value:"won"},{label:"Lost",value:"lost"}]},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],n=s.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...i,...n],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}})}upsert(e){return c(this,null,function*(){return this.post("/api/crm/leads/upsert",e)})}createMany(e,s=50){return c(this,null,function*(){let i=[];for(let n=0;n<e.length;n+=s){let r=e.slice(n,n+s).map(l=>this.create(l)),o=yield Promise.allSettled(r);for(let l of o)if(l.status==="fulfilled")i.push(l.value);else throw l.reason}return i})}import(e){return c(this,null,function*(){return this.post("/api/crm/leads/import",{leads:e})})}bulkUpsert(e){return c(this,null,function*(){return this.import(e)})}list(e){return c(this,null,function*(){let s=L({},e);return Array.isArray(s.tags)&&(s.tags=s.tags.join(",")),this.get("/api/crm/leads",{params:s})})}listAutoPaging(e){return Ie(this,null,function*(){let s=(e==null?void 0:e.page)||1,i=!0;for(;i;){let n=yield new Ce(this.list(re(L({},e),{page:s}))),a=Array.isArray(n.data)?n.data:n||[];if(a.length===0){i=!1;break}for(let r of a)yield r;n.pagination&&s<n.pagination.pages||!n.pagination&&a.length>0?s++:i=!1}})}retrieve(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}`)})}retrieveByPhone(e){return c(this,null,function*(){return this.get(`/api/crm/leads/phone/${encodeURIComponent(e)}`)})}byStage(n,a){return c(this,arguments,function*(e,s,i={}){return this.get(`/api/crm/pipelines/${e}/stages/${s}/leads`,{params:i})})}retrieveByRef(e,s){return c(this,null,function*(){return this.get(`/api/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(s)}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}`,s)})}move(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/move`,{stageId:s})})}convert(e,s,i){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/convert`,{outcome:s,reason:i})})}tags(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/tags`,s)})}recalculateScore(e){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/score`,{})})}updateMetadata(e,s){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/metadata`,s)})}fields(){return c(this,null,function*(){return this.get("/api/crm/leads/fields")})}notes(e){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/notes`)})}activities(e,s){return c(this,null,function*(){return this.get(`/api/crm/leads/${e}/timeline`,{params:s})})}createNote(e,s){return c(this,null,function*(){return this.post(`/api/crm/leads/${e}/notes`,s)})}updateNote(e,s,i){return c(this,null,function*(){return this.patch(`/api/crm/notes/${s}`,i)})}deleteNote(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/crm/notes/${s}`)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/leads/${e}`)})}bulkArchive(e){return c(this,null,function*(){return this.patch("/api/crm/leads/bulk-archive",{ids:e})})}bulkDelete(e){return c(this,null,function*(){return this.deleteRequest("/api/crm/leads",{data:{ids:e}})})}archive(e){return c(this,null,function*(){return this.patch(`/api/crm/leads/${e}/archive`,{})})}};var Ji=class extends w{capture(e){return c(this,null,function*(){return this.post("/api/crm/payments/capture",e)})}};var Xi=class extends w{list(){return c(this,null,function*(){return this.get("/api/crm/pipelines")})}getStageManifest(e){return c(this,null,function*(){var n,a;let s=yield this.retrieve(e),i=Array.isArray((n=s.data)==null?void 0:n.stages)?s.data.stages:[];return{name:`Pipeline: ${((a=s.data)==null?void 0:a.name)||e}`,fields:i.map(r=>({key:r._id,label:r.name,type:"string",required:!0,options:[{label:r.name,value:r._id}],group:"Stages",uiHints:{color:r.color||"#cbd5e1",probability:r.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}})}create(e){return c(this,null,function*(){return this.post("/api/crm/pipelines",e)})}retrieve(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}`,s)})}setDefault(e){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/default`,{})})}duplicate(e,s){return c(this,null,function*(){return this.post(`/api/crm/pipelines/${e}/duplicate`,{newName:s})})}archive(e){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/archive`,{})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/pipelines/${e}`)})}checkInUse(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/in-use`)})}board(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/board`)})}forecast(e){return c(this,null,function*(){return this.get(`/api/crm/pipelines/${e}/forecast`)})}addStage(e,s){return c(this,null,function*(){return this.post(`/api/crm/pipelines/${e}/stages`,s)})}reorderStages(e,s){return c(this,null,function*(){return this.patch(`/api/crm/pipelines/${e}/stages/reorder`,{order:s})})}updateStage(e,s){return c(this,null,function*(){return this.patch(`/api/crm/stages/${e}`,s)})}deleteStage(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/crm/stages/${e}`,{data:s?{moveLeadsToStageId:s}:void 0})})}};var Yi=class extends w{getConfig(){return c(this,null,function*(){return this.get("/api/crm/scoring")})}updateConfig(e){return c(this,null,function*(){return this.patch("/api/crm/scoring",e)})}recalculate(e){return c(this,null,function*(){return this.post(`/api/crm/scoring/${e}/recalculate`,{})})}};var Qi=class extends w{enroll(e){return c(this,null,function*(){return this.post("/api/crm/sequences/enroll",e)})}unenroll(e){return c(this,null,function*(){return this.deleteRequest(`/api/crm/sequences/unenroll/${e}`)})}listForLead(e){return c(this,null,function*(){return this.get(`/api/crm/sequences/lead/${e}`)})}};var Zi=class{constructor(e){k(this,"leads");k(this,"pipelines");k(this,"activities");k(this,"analytics");k(this,"automations");k(this,"sequences");k(this,"scoring");k(this,"payments");k(this,"automationDashboard");this.leads=new Ki(e),this.pipelines=new Xi(e),this.activities=new Hi(e),this.analytics=new Vi(e),this.automations=new Gi(e),this.sequences=new Qi(e),this.scoring=new Yi(e),this.payments=new Ji(e),this.automationDashboard=new Wi(e)}};var en=class extends w{sendCampaign(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/campaign",e)})}sendTest(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/test",{to:e})})}listTemplates(e){return c(this,null,function*(){return this.get("/api/saas/marketing/mail/templates",{params:e})})}getTemplate(e){return c(this,null,function*(){return this.get(`/api/saas/marketing/mail/templates/${e}`)})}createTemplate(e){return c(this,null,function*(){return this.post("/api/saas/marketing/mail/templates",e)})}updateTemplate(e,s){return c(this,null,function*(){return this.put(`/api/saas/marketing/mail/templates/${e}`,s)})}deleteTemplate(e,s=!1){return c(this,null,function*(){return this.deleteRequest(`/api/saas/marketing/mail/templates/${e}`,{params:{force:s}})})}previewTemplate(e,s){return c(this,null,function*(){return this.post(`/api/saas/marketing/mail/templates/${e}/preview`,s)})}};var tn=class extends w{list(){return c(this,null,function*(){return this.get("/api/saas/events")})}assign(e){return c(this,null,function*(){return this.post("/api/saas/events/assign",e)})}unassign(e){return c(this,null,function*(){return this.post("/api/saas/events/unassign",{name:e})})}unassignBulk(e){return c(this,null,function*(){return this.post("/api/saas/events/unassign/bulk",{names:e})})}trigger(e){return c(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}listCustomEvents(){return c(this,null,function*(){return this.get("/api/saas/crm/custom-events")})}createCustomEvent(e){return c(this,null,function*(){return this.post("/api/saas/crm/custom-events",e)})}deleteCustomEvent(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/crm/custom-events/${e}`)})}emit(e){return c(this,null,function*(){return this.post("/api/crm/events/emit",e)})}};var sn=class extends w{system(){return c(this,null,function*(){return(yield this.get("/api/saas/health")).data})}clientHealth(){return c(this,null,function*(){return(yield this.get("/api/saas/health/client")).data})}getDiagnosticReport(){return c(this,null,function*(){return this.clientHealth()})}jobStatus(e){return c(this,null,function*(){return(yield this.get(`/api/saas/jobs/status/${e}`)).data})}};var nn=class extends w{listEventLogs(e){return c(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}getEventLog(e){return c(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}listCallbackLogs(e){return c(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}getStats(){return c(this,null,function*(){return this.get("/api/saas/events/stats")})}};var Sr=class extends w{sendCampaign(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/campaign",e)})}sendTest(e){return c(this,null,function*(){return this.post("/api/saas/marketing/emails/test",{to:e})})}},kr=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/marketing/emails/campaigns",{params:e})})}stats(e){return c(this,null,function*(){return this.get(`/api/saas/marketing/emails/campaigns/${e}/analytics`)})}},Rr=class extends w{sendTemplate(e){return c(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",e)})}},an=class extends w{constructor(s){super(s);k(this,"emails");k(this,"campaigns");k(this,"whatsapp");this.emails=new Sr(s),this.campaigns=new kr(s),this.whatsapp=new Rr(s)}};var rn=class extends w{getUsage(){return c(this,null,function*(){return this.get("/api/saas/storage/usage")})}createFolder(e){return c(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}list(e,s){return c(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}delete(e){return c(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}getDownloadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}upload(e,s){return c(this,null,function*(){let i=yield this.post("/api/saas/storage/upload-url",s),{uploadUrl:n,key:a}=i.data;yield Mt.put(n,e,{headers:{"Content-Type":s.contentType}});let r=e.size||e.byteLength||0;return this.post("/api/saas/storage/confirm-upload",{key:a,sizeBytes:r})})}};var on=class extends w{create(e){return c(this,null,function*(){return this.post("/api/saas/meet",e)})}list(e){return c(this,null,function*(){return this.get("/api/saas/meet",{params:e})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/meet/${e}`)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}reschedule(e,s){return c(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}delete(e){return c(this,null,function*(){return this.update(e,{status:"cancelled"})})}};var cn=class extends w{listLogs(e){return c(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}retrieveLog(e){return c(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}getStats(e){return c(this,null,function*(){return this.get("/api/saas/events/stats",{params:e})})}listCallbacks(e){return c(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}listAlerts(e){return c(this,null,function*(){return this.get("/api/crm/notifications",{params:e})})}dismissAlert(e){return c(this,null,function*(){return this.patch(`/api/crm/notifications/${e}/dismiss`)})}clearAllAlerts(){return c(this,null,function*(){return this.deleteRequest("/api/crm/notifications/clear-all")})}retryAction(e){return c(this,null,function*(){return this.post(`/api/crm/notifications/${e}/retry`,{})})}};var pn=class extends w{listFailed(){return c(this,null,function*(){return this.get("/api/saas/admin/queue/failed")})}getStats(){return c(this,null,function*(){return this.get("/api/saas/admin/queue/stats")})}retryJob(e){return c(this,null,function*(){return this.post(`/api/saas/admin/queue/${e}/retry`,{})})}deleteJob(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/admin/queue/${e}`)})}};var Cr=class extends w{list(){return c(this,null,function*(){return this.get("/api/services/clients")})}getCountAndGenerateCode(){return c(this,null,function*(){return this.get("/api/services/clients/count")})}retrieve(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}`)})}getApiKey(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/api-key`)})}rotateApiKey(e){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/api-key`,{})})}create(e){return c(this,null,function*(){return this.post("/api/services/clients",e)})}getConfig(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/config`)})}updateConfig(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/config`,s)})}getSecrets(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/secrets`)})}updateSecrets(e,s){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/secrets`,s)})}replaceSecrets(e,s){return c(this,null,function*(){return this.put(`/api/services/clients/${e}/secrets`,s)})}patchSecrets(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/secrets`,s)})}getDataSource(e){return c(this,null,function*(){return this.get(`/api/services/clients/${e}/datasource`)})}manageDataSource(e,s){return c(this,null,function*(){return this.post(`/api/services/clients/${e}/datasource`,s)})}updateIdentity(e,s){return c(this,null,function*(){return this.patch(`/api/services/clients/${e}/identity`,s)})}googleReauth(i){return c(this,arguments,function*(e,s={}){return this.post(`/api/services/clients/${e}/google/reauth`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/services/clients/${e}`)})}},Ar=class extends w{list(){return c(this,null,function*(){return this.get("/api/services/blogs")})}},Or=class extends w{add(e){return c(this,null,function*(){return this.post("/api/services/add-lead",e)})}},ln=class extends w{constructor(s){super(s);k(this,"clients");k(this,"blogs");k(this,"globalLeads");this.clients=new Cr(s),this.blogs=new Ar(s),this.globalLeads=new Or(s)}};var Pr=class extends w{getConfig(){return c(this,null,function*(){return this.get("/api/settings/email")})}switchProvider(e){return c(this,null,function*(){return this.post("/api/settings/email/provider",{provider:e})})}saveSmtp(e){return c(this,null,function*(){return this.post("/api/settings/email/smtp",e)})}initDomainVerification(e){return c(this,null,function*(){return this.post("/api/settings/email/ses/domain",{domain:e})})}saveEmailConfig(e){return c(this,null,function*(){return this.post("/api/settings/email/ses/config",e)})}checkSesVerification(){return c(this,null,function*(){return this.get("/api/settings/email/ses/verify")})}removeSesIdentity(){return c(this,null,function*(){return this.deleteRequest("/api/settings/email/ses/domain")})}sendTest(e){return c(this,null,function*(){return this.post("/api/settings/email/test",{toEmail:e})})}saveAdvancedConfig(e){return c(this,null,function*(){return this.post("/api/settings/email/advanced",e)})}getHealth(){return c(this,null,function*(){return this.get("/api/settings/email/health")})}fixDmarc(){return c(this,null,function*(){return this.post("/api/settings/email/ses/fix-dmarc",{})})}listProviders(){return c(this,null,function*(){return this.get("/api/settings/email/providers")})}},un=class extends w{constructor(s){super(s);k(this,"email");this.email=new Pr(s)}};var Lr=class extends w{create(e){return c(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/storage/folders/${encodeURIComponent(e)}`)})}},Nr=class extends w{list(e,s){return c(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}getUploadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/upload-url",e)})}confirmUpload(e){return c(this,null,function*(){return this.post("/api/saas/storage/confirm-upload",e)})}getDownloadUrl(e){return c(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}delete(e){return c(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}},dn=class extends w{constructor(s){super(s);k(this,"folders");k(this,"files");this.folders=new Lr(s),this.files=new Nr(s)}usage(){return c(this,null,function*(){return this.get("/api/saas/storage/usage")})}};var is=class extends we{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},mn=class{constructEvent(e,s,i){return c(this,null,function*(){if(!s)throw new is("No webhook signature provided");let n=Array.isArray(s)?s[0]:s;n.startsWith("sha256=")&&(n=n.slice(7));try{let a=yield import("crypto"),o=a.createHmac("sha256",i).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(o),Buffer.from(n)))throw new is("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof is?a:new is(`Webhook payload parsing failed: ${a.message}`)}})}};var fn=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/broadcasts",{params:e})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/broadcasts/${e}`)})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/broadcast",e)})}update(e,s){return c(this,null,function*(){return this.patch(`/api/saas/chat/broadcasts/${e}`,s)})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/broadcasts/${e}`)})}};var hn=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/conversations",{params:e})})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/conversations",e)})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}`)})}messages(e,s){return c(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}/messages`,{params:s})})}linkLead(e,s,i){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/link-lead`,{leadId:s,leadData:i})})}markRead(e){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`,{})})}delete(e){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/conversations/${e}`)})}bulkDelete(e){return c(this,null,function*(){return this.post("/api/saas/chat/conversations/bulk-delete",{ids:e})})}};var xn=class extends w{send(e){return c(this,null,function*(){return this.post("/api/saas/chat/send",e)})}sendTemplate(e){return c(this,null,function*(){return this.post("/api/saas/chat/send",re(L({},e),{templateLanguage:e.language||e.templateLanguage||"en_US"}))})}star(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/star`,{isStarred:s})})}react(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/react`,{reaction:s})})}markRead(e){return c(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`)})}upload(e){return c(this,null,function*(){let s=new FormData;return s.append("file",e),this.post("/api/saas/chat/upload",s,{headers:{"Content-Type":"multipart/form-data"}})})}};var gn=class extends w{list(e){return c(this,null,function*(){return this.get("/api/saas/chat/templates",{params:e})})}sync(){return c(this,null,function*(){return this.post("/api/saas/chat/templates/sync",{})})}retrieve(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}`)})}create(e){return c(this,null,function*(){return this.post("/api/saas/chat/templates",e)})}update(e,s){return c(this,null,function*(){return this.put(`/api/saas/chat/templates/${e}`,s)})}deleteTemplate(e,s){return c(this,null,function*(){return this.deleteRequest(`/api/saas/chat/templates/${encodeURIComponent(e)}${s?"?force=true":""}`)})}mappingConfig(){return c(this,null,function*(){return this.get("/api/saas/chat/templates/mapping/config")})}collections(){return c(this,null,function*(){return this.get("/api/saas/chat/templates/collections")})}collectionFields(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/collections/${encodeURIComponent(e)}/fields`)})}updateMapping(e,s){return c(this,null,function*(){return this.put(`/api/saas/chat/templates/${encodeURIComponent(e)}/mapping`,s)})}validate(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}/validate`)})}preview(e,s){return c(this,null,function*(){return this.post(`/api/saas/chat/templates/${encodeURIComponent(e)}/preview`,{context:s})})}getVariableManifest(e){return c(this,null,function*(){var a,r;let s=yield this.retrieve(e),i=Array.isArray((a=s.data)==null?void 0:a.components)?s.data.components:[],n=[];for(let o of i)if(o.text){let l=o.text.match(/{{(\d+)}}/g);if(l)for(let u of l){let p=u.replace(/{{|}}/g,"");n.push({key:`var_${p}`,label:`${o.type} Var {{${p}}}`,type:"string",required:!0,group:o.type,description:`Variable placeholder in template ${o.type}`})}}return{name:`Template variables: ${((r=s.data)==null?void 0:r.name)||e}`,fields:n,uiHints:{icon:"Variables",primaryColor:"#059669"}}})}checkUsage(e){return c(this,null,function*(){return this.get(`/api/saas/chat/templates/${encodeURIComponent(e)}/usage`)})}};var yn=class extends w{constructor(s){super(s);k(this,"messages");k(this,"conversations");k(this,"broadcasts");k(this,"templates");this.messages=new xn(s),this.conversations=new hn(s),this.broadcasts=new fn(s),this.templates=new gn(s)}upload(s,i){return c(this,null,function*(){let n=new FormData;return n.append("file",s,i),this.post("/api/saas/chat/upload",n,{headers:typeof n.getHeaders=="function"?n.getHeaders():void 0})})}sendTemplate(s){return c(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",s)})}};var By="https://api.ecodrix.com",wt=class{constructor(e){k(this,"client");k(this,"socket");k(this,"clientCode");k(this,"whatsapp");k(this,"crm");k(this,"media");k(this,"meet");k(this,"notifications");k(this,"email");k(this,"logs");k(this,"events");k(this,"webhooks");k(this,"storage");k(this,"marketing");k(this,"health");k(this,"queue");k(this,"agency");k(this,"services");k(this,"settings");k(this,"cors");k(this,"checkout");var l,u,p,m,f;if(!e.apiKey)throw new $s("API Key is required");this.clientCode=(l=e.clientCode)==null?void 0:l.toUpperCase();let s=(u=e.baseUrl)!=null?u:By,i=e.socketUrl||s,n=typeof window!="undefined"&&typeof window.document!="undefined",a=n?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",r=n?((p=globalThis.navigator)==null?void 0:p.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",o={"x-api-key":e.apiKey,"x-client-code":((m=e.clientCode)==null?void 0:m.toUpperCase())||"","Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:"1.0.0",runtime:a,os:r})};if(e.coreApiKey&&(o["x-core-api-key"]=e.coreApiKey),this.client=Mt.create({baseURL:s,headers:o}),gi(this.client,{retries:3,retryDelay:gi.exponentialDelay,retryCondition:g=>{var h;return gi.isNetworkOrIdempotentRequestError(g)||((h=g.response)==null?void 0:h.status)===429},onRetry:(g,h,x)=>{var R,C;typeof process!="undefined"&&((R=process.env)==null?void 0:R.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${g}/3): ${(C=x.method)==null?void 0:C.toUpperCase()} ${x.url}. Reason: ${h.message}`)}}),this.whatsapp=new yn(this.client),this.crm=new Zi(this.client),this.media=new rn(this.client),this.meet=new on(this.client),this.notifications=new cn(this.client),this.email=new en(this.client),this.logs=new nn(this.client),this.events=new tn(this.client),this.webhooks=new mn,this.storage=new dn(this.client),this.marketing=new an(this.client),this.health=new sn(this.client),this.queue=new pn(this.client),this.agency=new Mi(this.client),this.services=new ln(this.client),this.settings=new un(this.client),this.cors=new $i(this.client),this.checkout=new zi(this.client),this.socket=zs(i,{extraHeaders:{"x-api-key":e.apiKey,"x-client-code":((f=e.clientCode)==null?void 0:f.toUpperCase())||""}}),this.setupSocket(e.clientCode),n){let g={version:"1.2.2",clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=g,window.ecodrix||(window.ecodrix=this)}}joinRoom(e){this.socket.emit("join-room",e)}leaveRoom(e){this.socket.emit("leave-room",e)}setupSocket(e){this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,s){return this.socket.on(e,s),this}disconnect(){this.socket.disconnect()}off(e,s){return this.socket.off(e,s),this}request(e,s,i,n){return c(this,null,function*(){var a,r,o;try{return(yield this.client.request({method:e,url:s,data:i,params:n})).data}catch(l){throw l.response?new we(((a=l.response.data)==null?void 0:a.message)||((r=l.response.data)==null?void 0:r.error)||"Raw Execution Failed",l.response.status,(o=l.response.data)==null?void 0:o.code):new we(l.message||"Network Error")}})}};var Iy=wt;return vd(jy);})();
|
|
20
20
|
/*! Bundled license information:
|
|
21
21
|
|
|
22
22
|
mime-db/index.js:
|