@emuanalytics/flow-engine-client 2.0.3 → 2.0.13

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/bundle.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";var FlowEngineClient=(()=>{var Us=Object.create;var se=Object.defineProperty,Ms=Object.defineProperties,$s=Object.getOwnPropertyDescriptor,Ws=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertyNames,It=Object.getOwnPropertySymbols,Ks=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty,Vs=Object.prototype.propertyIsEnumerable;var Lt=(r,e,t)=>e in r?se(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,x=(r,e)=>{for(var t in e||(e={}))Dt.call(e,t)&&Lt(r,t,e[t]);if(It)for(var t of It(e))Vs.call(e,t)&&Lt(r,t,e[t]);return r},ne=(r,e)=>Ms(r,Ws(e));var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ut=(r,e)=>{for(var t in e)se(r,t,{get:e[t],enumerable:!0})},Mt=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of js(e))!Dt.call(r,n)&&n!==t&&se(r,n,{get:()=>e[n],enumerable:!(s=$s(e,n))||s.enumerable});return r};var tt=(r,e,t)=>(t=r!=null?Us(Ks(r)):{},Mt(e||!r||!r.__esModule?se(t,"default",{value:r,enumerable:!0}):t,r)),Hs=r=>Mt(se({},"__esModule",{value:!0}),r);var rt=f((Fi,$t)=>{"use strict";$t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return e.apply(t,n)}}});var v=f((qi,Kt)=>{"use strict";var Js=rt(),nt=Object.prototype.toString,it=function(r){return function(e){var t=nt.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())}}(Object.create(null));function U(r){return r=r.toLowerCase(),function(t){return it(t)===r}}function ot(r){return Array.isArray(r)}function ve(r){return typeof r>"u"}function zs(r){return r!==null&&!ve(r)&&r.constructor!==null&&!ve(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Wt=U("ArrayBuffer");function Qs(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Wt(r.buffer),e}function Ys(r){return typeof r=="string"}function Xs(r){return typeof r=="number"}function jt(r){return r!==null&&typeof r=="object"}function be(r){if(it(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}var Gs=U("Date"),Zs=U("File"),en=U("Blob"),tn=U("FileList");function at(r){return nt.call(r)==="[object Function]"}function rn(r){return jt(r)&&at(r.pipe)}function sn(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||nt.call(r)===e||at(r.toString)&&r.toString()===e)}var nn=U("URLSearchParams");function on(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function an(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function ct(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),ot(r))for(var t=0,s=r.length;t<s;t++)e.call(null,r[t],t,r);else for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.call(null,r[n],n,r)}function st(){var r={};function e(n,i){be(r[i])&&be(n)?r[i]=st(r[i],n):be(n)?r[i]=st({},n):ot(n)?r[i]=n.slice():r[i]=n}for(var t=0,s=arguments.length;t<s;t++)ct(arguments[t],e);return r}function cn(r,e,t){return ct(e,function(n,i){t&&typeof n=="function"?r[i]=Js(n,t):r[i]=n}),r}function un(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function ln(r,e,t,s){r.prototype=Object.create(e.prototype,s),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function hn(r,e,t){var s,n,i,o={};e=e||{};do{for(s=Object.getOwnPropertyNames(r),n=s.length;n-- >0;)i=s[n],o[i]||(e[i]=r[i],o[i]=!0);r=Object.getPrototypeOf(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e}function fn(r,e,t){r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;var s=r.indexOf(e,t);return s!==-1&&s===t}function pn(r){if(!r)return null;var e=r.length;if(ve(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var dn=function(r){return function(e){return r&&e instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));Kt.exports={isArray:ot,isArrayBuffer:Wt,isBuffer:zs,isFormData:sn,isArrayBufferView:Qs,isString:Ys,isNumber:Xs,isObject:jt,isPlainObject:be,isUndefined:ve,isDate:Gs,isFile:Zs,isBlob:en,isFunction:at,isStream:rn,isURLSearchParams:nn,isStandardBrowserEnv:an,forEach:ct,merge:st,extend:cn,trim:on,stripBOM:un,inherits:ln,toFlatObject:hn,kindOf:it,kindOfTest:U,endsWith:fn,toArray:pn,isTypedArray:dn,isFileList:tn}});var ut=f((Ii,Ht)=>{"use strict";var V=v();function Vt(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ht.exports=function(e,t,s){if(!t)return e;var n;if(s)n=s(t);else if(V.isURLSearchParams(t))n=t.toString();else{var i=[];V.forEach(t,function(l,y){l===null||typeof l>"u"||(V.isArray(l)?y=y+"[]":l=[l],V.forEach(l,function(u){V.isDate(u)?u=u.toISOString():V.isObject(u)&&(u=JSON.stringify(u)),i.push(Vt(y)+"="+Vt(u))}))}),n=i.join("&")}if(n){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}});var zt=f((Li,Jt)=>{"use strict";var mn=v();function Ce(){this.handlers=[]}Ce.prototype.use=function(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1};Ce.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ce.prototype.forEach=function(e){mn.forEach(this.handlers,function(s){s!==null&&e(s)})};Jt.exports=Ce});var Yt=f((Di,Qt)=>{"use strict";var yn=v();Qt.exports=function(e,t){yn.forEach(e,function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])})}});var M=f((Ui,er)=>{"use strict";var Xt=v();function H(r,e,t,s,n){Error.call(this),this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),n&&(this.response=n)}Xt.inherits(H,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Gt=H.prototype,Zt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){Zt[r]={value:r}});Object.defineProperties(H,Zt);Object.defineProperty(Gt,"isAxiosError",{value:!0});H.from=function(r,e,t,s,n,i){var o=Object.create(Gt);return Xt.toFlatObject(r,o,function(l){return l!==Error.prototype}),H.call(o,r.message,e,t,s,n),o.name=r.name,i&&Object.assign(o,i),o};er.exports=H});var lt=f((Mi,tr)=>{"use strict";tr.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var ht=f(($i,rr)=>{"use strict";var B=v();function gn(r,e){e=e||new FormData;var t=[];function s(i){return i===null?"":B.isDate(i)?i.toISOString():B.isArrayBuffer(i)||B.isTypedArray(i)?typeof Blob=="function"?new Blob([i]):Buffer.from(i):i}function n(i,o){if(B.isPlainObject(i)||B.isArray(i)){if(t.indexOf(i)!==-1)throw Error("Circular reference detected in "+o);t.push(i),B.forEach(i,function(l,y){if(!B.isUndefined(l)){var a=o?o+"."+y:y,u;if(l&&!o&&typeof l=="object"){if(B.endsWith(y,"{}"))l=JSON.stringify(l);else if(B.endsWith(y,"[]")&&(u=B.toArray(l))){u.forEach(function(h){!B.isUndefined(h)&&e.append(a,s(h))});return}}n(l,a)}}),t.pop()}else e.append(o,s(i))}return n(r),e}rr.exports=gn});var nr=f((Wi,sr)=>{"use strict";var ft=M();sr.exports=function(e,t,s){var n=s.config.validateStatus;!s.status||!n||n(s.status)?e(s):t(new ft("Request failed with status code "+s.status,[ft.ERR_BAD_REQUEST,ft.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}});var or=f((ji,ir)=>{"use strict";var we=v();ir.exports=we.isStandardBrowserEnv()?function(){return{write:function(t,s,n,i,o,c){var l=[];l.push(t+"="+encodeURIComponent(s)),we.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),we.isString(i)&&l.push("path="+i),we.isString(o)&&l.push("domain="+o),c===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(t){var s=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var cr=f((Ki,ar)=>{"use strict";ar.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var lr=f((Vi,ur)=>{"use strict";ur.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var pt=f((Hi,hr)=>{"use strict";var bn=cr(),vn=lr();hr.exports=function(e,t){return e&&!bn(t)?vn(e,t):t}});var pr=f((Ji,fr)=>{"use strict";var dt=v(),Cn=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];fr.exports=function(e){var t={},s,n,i;return e&&dt.forEach(e.split(`
2
- `),function(c){if(i=c.indexOf(":"),s=dt.trim(c.substr(0,i)).toLowerCase(),n=dt.trim(c.substr(i+1)),s){if(t[s]&&Cn.indexOf(s)>=0)return;s==="set-cookie"?t[s]=(t[s]?t[s]:[]).concat([n]):t[s]=t[s]?t[s]+", "+n:n}}),t}});var yr=f((zi,mr)=>{"use strict";var dr=v();mr.exports=dr.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),s;function n(i){var o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return s=n(window.location.href),function(o){var c=dr.isString(o)?n(o):o;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}()});var ie=f((Qi,br)=>{"use strict";var mt=M(),wn=v();function gr(r){mt.call(this,r==null?"canceled":r,mt.ERR_CANCELED),this.name="CanceledError"}wn.inherits(gr,mt,{__CANCEL__:!0});br.exports=gr});var Cr=f((Yi,vr)=>{"use strict";vr.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}});var yt=f((Xi,wr)=>{"use strict";var oe=v(),En=nr(),xn=or(),kn=ut(),Sn=pt(),Rn=pr(),_n=yr(),An=lt(),q=M(),On=ie(),Tn=Cr();wr.exports=function(e){return new Promise(function(s,n){var i=e.data,o=e.headers,c=e.responseType,l;function y(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}oe.isFormData(i)&&oe.isStandardBrowserEnv()&&delete o["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var u=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(u+":"+h)}var g=Sn(e.baseURL,e.url);a.open(e.method.toUpperCase(),kn(g,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function re(){if(a){var b="getAllResponseHeaders"in a?Rn(a.getAllResponseHeaders()):null,P=!c||c==="text"||c==="json"?a.responseText:a.response,F={data:P,status:a.status,statusText:a.statusText,headers:b,config:e,request:a};En(function(ge){s(ge),y()},function(ge){n(ge),y()},F),a=null}}if("onloadend"in a?a.onloadend=re:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(re)},a.onabort=function(){a&&(n(new q("Request aborted",q.ECONNABORTED,e,a)),a=null)},a.onerror=function(){n(new q("Network Error",q.ERR_NETWORK,e,a,a)),a=null},a.ontimeout=function(){var P=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",F=e.transitional||An;e.timeoutErrorMessage&&(P=e.timeoutErrorMessage),n(new q(P,F.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,a)),a=null},oe.isStandardBrowserEnv()){var S=(e.withCredentials||_n(g))&&e.xsrfCookieName?xn.read(e.xsrfCookieName):void 0;S&&(o[e.xsrfHeaderName]=S)}"setRequestHeader"in a&&oe.forEach(o,function(P,F){typeof i>"u"&&F.toLowerCase()==="content-type"?delete o[F]:a.setRequestHeader(F,P)}),oe.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),c&&c!=="json"&&(a.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&a.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(b){a&&(n(!b||b&&b.type?new On:b),a.abort(),a=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),i||(i=null);var w=Tn(g);if(w&&["http","https","file"].indexOf(w)===-1){n(new q("Unsupported protocol "+w+":",q.ERR_BAD_REQUEST,e));return}a.send(i)})}});var xr=f((Gi,Er)=>{Er.exports=null});var xe=f((Zi,_r)=>{"use strict";var C=v(),kr=Yt(),Sr=M(),Pn=lt(),Bn=ht(),Nn={"Content-Type":"application/x-www-form-urlencoded"};function Rr(r,e){!C.isUndefined(r)&&C.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Fn(){var r;return typeof XMLHttpRequest<"u"?r=yt():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=yt()),r}function qn(r,e,t){if(C.isString(r))try{return(e||JSON.parse)(r),C.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}var Ee={transitional:Pn,adapter:Fn(),transformRequest:[function(e,t){if(kr(t,"Accept"),kr(t,"Content-Type"),C.isFormData(e)||C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e))return e;if(C.isArrayBufferView(e))return e.buffer;if(C.isURLSearchParams(e))return Rr(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var s=C.isObject(e),n=t&&t["Content-Type"],i;if((i=C.isFileList(e))||s&&n==="multipart/form-data"){var o=this.env&&this.env.FormData;return Bn(i?{"files[]":e}:e,o&&new o)}else if(s||n==="application/json")return Rr(t,"application/json"),qn(e);return e}],transformResponse:[function(e){var t=this.transitional||Ee.transitional,s=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!s&&this.responseType==="json";if(i||n&&C.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?Sr.from(o,Sr.ERR_BAD_RESPONSE,this,null,this.response):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xr()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};C.forEach(["delete","get","head"],function(e){Ee.headers[e]={}});C.forEach(["post","put","patch"],function(e){Ee.headers[e]=C.merge(Nn)});_r.exports=Ee});var Or=f((eo,Ar)=>{"use strict";var In=v(),Ln=xe();Ar.exports=function(e,t,s){var n=this||Ln;return In.forEach(s,function(o){e=o.call(n,e,t)}),e}});var gt=f((to,Tr)=>{"use strict";Tr.exports=function(e){return!!(e&&e.__CANCEL__)}});var Nr=f((ro,Br)=>{"use strict";var Pr=v(),bt=Or(),Dn=gt(),Un=xe(),Mn=ie();function vt(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Mn}Br.exports=function(e){vt(e),e.headers=e.headers||{},e.data=bt.call(e,e.data,e.headers,e.transformRequest),e.headers=Pr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Pr.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||Un.adapter;return t(e).then(function(n){return vt(e),n.data=bt.call(e,n.data,n.headers,e.transformResponse),n},function(n){return Dn(n)||(vt(e),n&&n.response&&(n.response.data=bt.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var Ct=f((so,Fr)=>{"use strict";var R=v();Fr.exports=function(e,t){t=t||{};var s={};function n(a,u){return R.isPlainObject(a)&&R.isPlainObject(u)?R.merge(a,u):R.isPlainObject(u)?R.merge({},u):R.isArray(u)?u.slice():u}function i(a){if(R.isUndefined(t[a])){if(!R.isUndefined(e[a]))return n(void 0,e[a])}else return n(e[a],t[a])}function o(a){if(!R.isUndefined(t[a]))return n(void 0,t[a])}function c(a){if(R.isUndefined(t[a])){if(!R.isUndefined(e[a]))return n(void 0,e[a])}else return n(void 0,t[a])}function l(a){if(a in t)return n(e[a],t[a]);if(a in e)return n(void 0,e[a])}var y={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:l};return R.forEach(Object.keys(e).concat(Object.keys(t)),function(u){var h=y[u]||i,g=h(u);R.isUndefined(g)&&h!==l||(s[u]=g)}),s}});var wt=f((no,qr)=>{qr.exports={version:"0.27.2"}});var Dr=f((io,Lr)=>{"use strict";var $n=wt().version,D=M(),Et={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){Et[r]=function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r}});var Ir={};Et.transitional=function(e,t,s){function n(i,o){return"[Axios v"+$n+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return function(i,o,c){if(e===!1)throw new D(n(o," has been removed"+(t?" in "+t:"")),D.ERR_DEPRECATED);return t&&!Ir[o]&&(Ir[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}};function Wn(r,e,t){if(typeof r!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);for(var s=Object.keys(r),n=s.length;n-- >0;){var i=s[n],o=e[i];if(o){var c=r[i],l=c===void 0||o(c,i,r);if(l!==!0)throw new D("option "+i+" must be "+l,D.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new D("Unknown option "+i,D.ERR_BAD_OPTION)}}Lr.exports={assertOptions:Wn,validators:Et}});var Kr=f((oo,jr)=>{"use strict";var $r=v(),jn=ut(),Ur=zt(),Mr=Nr(),ke=Ct(),Kn=pt(),Wr=Dr(),J=Wr.validators;function z(r){this.defaults=r,this.interceptors={request:new Ur,response:new Ur}}z.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ke(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var s=t.transitional;s!==void 0&&Wr.assertOptions(s,{silentJSONParsing:J.transitional(J.boolean),forcedJSONParsing:J.transitional(J.boolean),clarifyTimeoutError:J.transitional(J.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var o=[];this.interceptors.response.forEach(function(g){o.push(g.fulfilled,g.rejected)});var c;if(!i){var l=[Mr,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),c=Promise.resolve(t);l.length;)c=c.then(l.shift(),l.shift());return c}for(var y=t;n.length;){var a=n.shift(),u=n.shift();try{y=a(y)}catch(h){u(h);break}}try{c=Mr(y)}catch(h){return Promise.reject(h)}for(;o.length;)c=c.then(o.shift(),o.shift());return c};z.prototype.getUri=function(e){e=ke(this.defaults,e);var t=Kn(e.baseURL,e.url);return jn(t,e.params,e.paramsSerializer)};$r.forEach(["delete","get","head","options"],function(e){z.prototype[e]=function(t,s){return this.request(ke(s||{},{method:e,url:t,data:(s||{}).data}))}});$r.forEach(["post","put","patch"],function(e){function t(s){return function(i,o,c){return this.request(ke(c||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}z.prototype[e]=t(),z.prototype[e+"Form"]=t(!0)});jr.exports=z});var Hr=f((ao,Vr)=>{"use strict";var Vn=ie();function Q(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var t=this;this.promise.then(function(s){if(t._listeners){var n,i=t._listeners.length;for(n=0;n<i;n++)t._listeners[n](s);t._listeners=null}}),this.promise.then=function(s){var n,i=new Promise(function(o){t.subscribe(o),n=o}).then(s);return i.cancel=function(){t.unsubscribe(n)},i},r(function(n){t.reason||(t.reason=new Vn(n),e(t.reason))})}Q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Q.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Q.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};Q.source=function(){var e,t=new Q(function(n){e=n});return{token:t,cancel:e}};Vr.exports=Q});var zr=f((co,Jr)=>{"use strict";Jr.exports=function(e){return function(s){return e.apply(null,s)}}});var Yr=f((uo,Qr)=>{"use strict";var Hn=v();Qr.exports=function(e){return Hn.isObject(e)&&e.isAxiosError===!0}});var Zr=f((lo,xt)=>{"use strict";var Xr=v(),Jn=rt(),Se=Kr(),zn=Ct(),Qn=xe();function Gr(r){var e=new Se(r),t=Jn(Se.prototype.request,e);return Xr.extend(t,Se.prototype,e),Xr.extend(t,e),t.create=function(n){return Gr(zn(r,n))},t}var k=Gr(Qn);k.Axios=Se;k.CanceledError=ie();k.CancelToken=Hr();k.isCancel=gt();k.VERSION=wt().version;k.toFormData=ht();k.AxiosError=M();k.Cancel=k.CanceledError;k.all=function(e){return Promise.all(e)};k.spread=zr();k.isAxiosError=Yr();xt.exports=k;xt.exports.default=k});var ts=f((ho,es)=>{es.exports=Zr()});var ss=f((fo,rs)=>{var Y=1e3,X=Y*60,G=X*60,$=G*24,Yn=$*7,Xn=$*365.25;rs.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Gn(r);if(t==="number"&&isFinite(r))return e.long?ei(r):Zn(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Gn(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*Xn;case"weeks":case"week":case"w":return t*Yn;case"days":case"day":case"d":return t*$;case"hours":case"hour":case"hrs":case"hr":case"h":return t*G;case"minutes":case"minute":case"mins":case"min":case"m":return t*X;case"seconds":case"second":case"secs":case"sec":case"s":return t*Y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Zn(r){var e=Math.abs(r);return e>=$?Math.round(r/$)+"d":e>=G?Math.round(r/G)+"h":e>=X?Math.round(r/X)+"m":e>=Y?Math.round(r/Y)+"s":r+"ms"}function ei(r){var e=Math.abs(r);return e>=$?Re(r,e,$,"day"):e>=G?Re(r,e,G,"hour"):e>=X?Re(r,e,X,"minute"):e>=Y?Re(r,e,Y,"second"):r+" ms"}function Re(r,e,t,s){var n=e>=t*1.5;return Math.round(r/t)+" "+s+(n?"s":"")}});var is=f((po,ns)=>{function ti(r){t.debug=t,t.default=t,t.coerce=l,t.disable=i,t.enable=n,t.enabled=o,t.humanize=ss(),t.destroy=y,Object.keys(r).forEach(a=>{t[a]=r[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let h=0;h<a.length;h++)u=(u<<5)-u+a.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,h=null,g,re;function S(...w){if(!S.enabled)return;let b=S,P=Number(new Date),F=P-(u||P);b.diff=F,b.prev=u,b.curr=P,u=P,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let K=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(et,Ls)=>{if(et==="%%")return"%";K++;let qt=t.formatters[Ls];if(typeof qt=="function"){let Ds=w[K];et=qt.call(b,Ds),w.splice(K,1),K--}return et}),t.formatArgs.call(b,w),(b.log||t.log).apply(b,w)}return S.namespace=a,S.useColors=t.useColors(),S.color=t.selectColor(a),S.extend=s,S.destroy=t.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(g!==t.namespaces&&(g=t.namespaces,re=t.enabled(a)),re),set:w=>{h=w}}),typeof t.init=="function"&&t.init(S),S}function s(a,u){let h=t(this.namespace+(typeof u>"u"?":":u)+a);return h.log=this.log,h}function n(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u,h=(typeof a=="string"?a:"").split(/[\s,]+/),g=h.length;for(u=0;u<g;u++)h[u]&&(a=h[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function i(){let a=[...t.names.map(c),...t.skips.map(c).map(u=>"-"+u)].join(",");return t.enable(""),a}function o(a){if(a[a.length-1]==="*")return!0;let u,h;for(u=0,h=t.skips.length;u<h;u++)if(t.skips[u].test(a))return!1;for(u=0,h=t.names.length;u<h;u++)if(t.names[u].test(a))return!0;return!1}function c(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ns.exports=ti});var os=f((_,_e)=>{_.formatArgs=si;_.save=ni;_.load=ii;_.useColors=ri;_.storage=oi();_.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ri(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function si(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+_e.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,s=0;r[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(s=t))}),r.splice(s,0,e)}_.log=console.debug||console.log||(()=>{});function ni(r){try{r?_.storage.setItem("debug",r):_.storage.removeItem("debug")}catch(e){}}function ii(){let r;try{r=_.storage.getItem("debug")}catch(e){}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function oi(){try{return localStorage}catch(r){}}_e.exports=is()(_);var{formatters:ai}=_e.exports;ai.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var cs=f((Qo,as)=>{as.exports=typeof self=="object"?self.FormData:window.FormData});var Bi={};Ut(Bi,{BaseEndpoints:()=>d,Client:()=>Ft,FlowEngineError:()=>I,WebSocketChannel:()=>Fs,WebSocketGateway:()=>ye});var qs=tt(ts()),Is=tt(os());var d=class{constructor(e,t){this.client=e;this.resourcePath=t}get resourceEndpoint(){return`/api/v1/${this.resourcePath}`}list(e){if(e!=null&&e.filter){let t=e.filter;Object.keys(t).forEach(s=>{e[`filter[${s}]`]=t[s]}),delete e.filter}return this.client._get(this.resourceEndpoint,{params:e})}get(e,t={}){return this.client._get(`${this.resourceEndpoint}/${e}`,{params:t})}create(e,t={}){return this.client._post(`${this.resourceEndpoint}`,e,{params:t})}update(e,t,s={}){return this.client._put(`${this.resourceEndpoint}/${e}`,t,{params:s})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}getMetadata(e,t,s={}){let n=t?`${this.resourceEndpoint}/${e}/metadata/${t}`:`${this.resourceEndpoint}/${e}/metadata`;return this.client._get(n,{params:s})}setMetadata(e,t,s,n={}){return(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&(s={value:s}),this.client._put(`${this.resourceEndpoint}/${e}/metadata/${t}`,s,{headers:{"Content-Type":"application/json"},params:n})}deleteMetadata(e,t,s={}){return this.client._delete(`${this.resourceEndpoint}/${e}/metadata/${t}`,{headers:{"Content-Type":"application/json"},params:s})}};var Ae=class extends d{constructor(e){super(e,"apikeys")}};var Oe=class{constructor(e){this.client=e}get resourceEndpoint(){return"/api/v1/appconfig"}get(e,t={}){return this.client._get(e?`${this.resourceEndpoint}/${e}`:this.resourceEndpoint,{params:t})}set(e,t,s={}){return(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null||Array.isArray(t))&&(t={value:t}),this.client._put(e?`${this.resourceEndpoint}/${e}`:this.resourceEndpoint,t,{headers:{"Content-Type":"application/json"},params:s})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}subscribe(e){return this.client._subscribe("appconfig",e)}};var Te=class extends d{constructor(e){super(e,"applications")}};var Pe=class extends d{constructor(e){super(e,"auth/users")}me(e){return this.client._get(`${this.resourceEndpoint}/me`,{headers:{Authorization:`Bearer ${e}`}})}};var Be=class{constructor(e){this.client=e;this.users=new Pe(this.client)}login(e,t,s){return this.client._post("/api/v1/auth/login",{email:e,password:t,applicationId:s})}logout(e,t){return this.client._post("/api/v1/auth/logout",{refreshToken:t},{headers:{Authorization:`Bearer ${e}`}})}refresh(e,t){return this.client._post("/api/v1/auth/refresh",{refreshToken:e,applicationId:t})}changePassword(e,t,s){return this.client._post("/api/v1/auth/changepassword",{password:e,newPassword:t},{headers:{Authorization:`Bearer ${s}`}})}signUp(e,t,s,n,i,o,c){return c||(c=o,o=`${this.client.baseUrl}/api/v1/auth/confirmsignup`),this.client._post("/api/v1/auth/signup",{firstName:e,lastName:t,email:s,password:n,applicationId:i,confirmUrl:o,redirectUrl:c})}confirmSignUp(e,t,s){return this.client._get("/api/v1/auth/confirmsignup",{params:{email:e,token:t,redirect:s}})}requestPasswordReset(e,t,s){return this.client._post("/api/v1/auth/requestpasswordreset",{email:e,applicationId:t,redirectUrl:s})}resetPassword(e,t,s,n){return this.client._post("/api/v1/auth/resetpassword",{email:e,password:t,applicationId:s,token:n})}};var Ne=class extends d{constructor(e){super(e,"databases")}drivers(){return this.client._get("/api/v1/databases/drivers").catch(e=>{if(e.status===404)return["postgis","postgis-mapnik"]})}};var Fe=class extends d{constructor(e){super(e,"datasets")}query(e,t={},s={}){typeof e=="object"&&(s=ne(x({},e.params),{format:e.format||"json"}),t=e,e=t.datasetId,delete t.datasetId,delete t.format),typeof s=="string"&&(s={format:s});let n=null;return s.abortController&&(n=s.abortController,delete s.abortController),this.client._post(`/api/v1/datasets/${e}/query`,t,{params:ne(x({},s),{format:s.format||"json",explain:s.explain||!1}),signal:n==null?void 0:n.signal}).catch(i=>{throw i.message==="Network Error"?new Error("Query timed out"):i})}ingest(e,t={}){return this.client._post(`/api/v1/datasets/${e.datasetId}/ingest`,e,t)}getExportUrl(e,t){let s=this.client.accessToken?`accesstoken=${this.client.accessToken}`:`apikey=${this.client.apiKey}`;return`${this.client.baseUrl}/api/v1/datasets/${e}/export?format=${t}&${s}`}subscribe(e,t){return this.client._subscribe(`dataset/${e}`,t)}};var I=class extends Error{constructor(t,s=null,n=500){super(t||"Unknown Error");Object.setPrototypeOf(this,I.prototype),this.statusCode=n,this.error=s}};var qe=class extends d{constructor(e){super(e,"jobs")}submit(e){return this.client._post("/api/v1/jobs/submit",e)}getStatus(e){return this.client._get(`/api/v1/jobs/${e}/status`)}setStatus(e,t){return this.client._post(`/api/v1/jobs/${e}/status`,t)}cancel(e){return this.client._post(`/api/v1/jobs/${e}/cancel`,{})}request(e){return this.client._post("/api/v1/jobs/request",{type:e})}};var Ie=class{constructor(e){this.client=e}get(e,t={}){return this.client._get(`/maps/${e}.json`,{params:t})}};var Le=class extends d{constructor(e){super(e,"maplayers")}subscribe(e){return this.client._subscribe("maplayers",e)}};var De=class extends d{constructor(e,t,s){super(e,`pipelines/${t}/components/${s}/metrics`)}};var Ue=class extends d{constructor(t,s){super(t,`pipelines/${s}/components`);this.pipelineId=s}metrics(t){return new De(this.client,this.pipelineId,t)}};var Me=class extends d{constructor(e){super(e,"pipelines")}components(e){return new Ue(this.client,e)}async heartbeat(e,t={}){return this.client._post(`${this.resourceEndpoint}/${e}/heartbeat`,{params:t})}async publishMetrics(e,t={}){return this.client._post(`${this.resourceEndpoint}/publish-metrics`,e,{params:t})}};var $e=class extends d{constructor(e){super(e,"styles")}};var We=class extends d{constructor(e){super(e,"tilesources")}drivers(){return this.client._get("/api/v1/tilesources/drivers").catch(e=>{if(e.statusCode===404)return["tilelive","dataset"]})}};var je=class{constructor(e){this.client=e}getTileSpec(e,t={}){return this.client._get(`/tiles/${e}/index.json`,{params:t})}getPreviewStyle(e,t={}){return this.client._get(`/tiles/${e}/style.json`,{params:t})}};var us=tt(cs());var Ke=class extends d{constructor(e){super(e,"uploads")}async upload(e,t={}){var i,o,c;let s=new us.default;return e.datasetName&&s.append("name",e.datasetName),e.datasetDescription&&s.append("description",e.datasetDescription),e.attribution&&s.append("attribution",e.attribution),e.datasetId&&s.append("datasetId",e.datasetId),e.sourceSrid&&s.append("sourceSrid",e.sourceSrid),e.targetSrid&&s.append("targetSrid",e.targetSrid),e.schema&&s.append("schema",e.schema),e.metadata&&s.append("metadata",JSON.stringify(e.metadata)),s.append("file",e.data,e.filename),await this.client._post(this.resourceEndpoint,s,{headers:(o=(i=s.getHeaders)==null?void 0:i.call(s))!=null?o:{"Content-Type":"multipart/form-data"},signal:(c=e.abortController)==null?void 0:c.signal,params:t,onUploadProgress:e.progress})}};var N=Object.create(null);N.open="0";N.close="1";N.ping="2";N.pong="3";N.message="4";N.upgrade="5";N.noop="6";var ae=Object.create(null);Object.keys(N).forEach(r=>{ae[N[r]]=r});var ls={type:"error",data:"parser error"};var ci=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ui=typeof ArrayBuffer=="function",li=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,hi=({type:r,data:e},t,s)=>ci&&e instanceof Blob?t?s(e):hs(e,s):ui&&(e instanceof ArrayBuffer||li(e))?t?s(e):hs(new Blob([e]),s):s(N[r]+(e||"")),hs=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)},Ve=hi;var fs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ce=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<fs.length;r++)ce[fs.charCodeAt(r)]=r;var ps=r=>{let e=r.length*.75,t=r.length,s,n=0,i,o,c,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let y=new ArrayBuffer(e),a=new Uint8Array(y);for(s=0;s<t;s+=4)i=ce[r.charCodeAt(s)],o=ce[r.charCodeAt(s+1)],c=ce[r.charCodeAt(s+2)],l=ce[r.charCodeAt(s+3)],a[n++]=i<<2|o>>4,a[n++]=(o&15)<<4|c>>2,a[n++]=(c&3)<<6|l&63;return y};var fi=typeof ArrayBuffer=="function",pi=(r,e)=>{if(typeof r!="string")return{type:"message",data:ds(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:di(r.substring(1),e)}:ae[t]?r.length>1?{type:ae[t],data:r.substring(1)}:{type:ae[t]}:ls},di=(r,e)=>{if(fi){let t=ps(r);return ds(t,e)}else return{base64:!0,data:r}},ds=(r,e)=>{switch(e){case"blob":return r instanceof ArrayBuffer?new Blob([r]):r;case"arraybuffer":default:return r}},He=pi;var ms=String.fromCharCode(30),ys=(r,e)=>{let t=r.length,s=new Array(t),n=0;r.forEach((i,o)=>{Ve(i,!1,c=>{s[o]=c,++n===t&&e(s.join(ms))})})},gs=(r,e)=>{let t=r.split(ms),s=[];for(let n=0;n<t.length;n++){let i=He(t[n],e);if(s.push(i),i.type==="error")break}return s},kt=4;function m(r){if(r)return mi(r)}function mi(r){for(var e in m.prototype)r[e]=m.prototype[e];return r}m.prototype.on=m.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};m.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};m.prototype.off=m.prototype.removeListener=m.prototype.removeAllListeners=m.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,n=0;n<t.length;n++)if(s=t[n],s===e||s.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+r],this};m.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,n=t.length;s<n;++s)t[s].apply(this,e)}return this};m.prototype.emitReserved=m.prototype.emit;m.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};m.prototype.hasListeners=function(r){return!!this.listeners(r).length};var E=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Je(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var yi=E.setTimeout,gi=E.clearTimeout;function L(r,e){e.useNativeTimers?(r.setTimeoutFn=yi.bind(E),r.clearTimeoutFn=gi.bind(E)):(r.setTimeoutFn=E.setTimeout.bind(E),r.clearTimeoutFn=E.clearTimeout.bind(E))}var bi=1.33;function bs(r){return typeof r=="string"?vi(r):Math.ceil((r.byteLength||r.size)*bi)}function vi(r){let e=0,t=0;for(let s=0,n=r.length;s<n;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}var St=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},W=class extends m{constructor(e){super(),this.writable=!1,L(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,s){return super.emitReserved("error",new St(e,t,s)),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)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=He(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}};var Es="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Rt=64,Ci={},vs=0,ze=0,Cs;function ws(r){let e="";do e=Es[r%Rt]+e,r=Math.floor(r/Rt);while(r>0);return e}function Qe(){let r=ws(+new Date);return r!==Cs?(vs=0,Cs=r):r+"."+ws(vs++)}for(;ze<Rt;ze++)Ci[Es[ze]]=ze;function Ye(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function xs(r){let e={},t=r.split("&");for(let s=0,n=t.length;s<n;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}var ks=!1;try{ks=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(r){}var Ss=ks;function _t(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ss))return new XMLHttpRequest}catch(t){}if(!e)try{return new E[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}function wi(){}var Ei=function(){return new _t({xdomain:!1}).responseType!=null}(),Xe=class extends W{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){let s=location.protocol==="https:",n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==s}let t=e&&e.forceBase64;this.supportsBinary=Ei&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};gs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ys(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{},t=this.opts.secure?"https":"http",s="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Qe()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(s=":"+this.opts.port);let n=Ye(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(n.length?"?"+n:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new T(this.uri(),e)}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(n,i)=>{this.onError("xhr post error",n,i)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},T=class extends m{constructor(e,t){super(),L(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){let e=Je(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;let t=this.xhr=new _t(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&t.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{t.setRequestHeader("Accept","*/*")}catch(s){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(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>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=wi,e)try{this.xhr.abort()}catch(t){}typeof document<"u"&&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()}};T.requestsCount=0;T.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rs);else if(typeof addEventListener=="function"){let r="onpagehide"in E?"pagehide":"unload";addEventListener(r,Rs,!1)}}function Rs(){for(let r in T.requests)T.requests.hasOwnProperty(r)&&T.requests[r].abort()}var ue=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),le=E.WebSocket||E.MozWebSocket,Ge=!0,_s="arraybuffer";var As=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ze=class extends W{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,s=As?{}:Je(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=Ge&&!As?t?new le(e,t):new le(e):new le(e,t,s)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType||_s,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],n=t===e.length-1;Ve(s,this.supportsBinary,i=>{let o={};Ge||(s.options&&(o.compress=s.options.compress),this.opts.perMessageDeflate&&(typeof i=="string"?Buffer.byteLength(i):i.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Ge?this.ws.send(i):this.ws.send(i,o)}catch(c){}n&&ue(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{},t=this.opts.secure?"wss":"ws",s="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(s=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Qe()),this.supportsBinary||(e.b64=1);let n=Ye(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(n.length?"?"+n:"")}check(){return!!le}};var At={websocket:Ze,polling:Xe};var xi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ki=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Z(r){let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let n=xi.exec(r||""),i={},o=14;for(;o--;)i[ki[o]]=n[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Si(i,i.path),i.queryKey=Ri(i,i.query),i}function Si(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ri(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,n,i){n&&(t[n]=i)}),t}var A=class extends m{constructor(e,t={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Z(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Z(t.host).host),L(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=xs(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=kt,t.transport=e,this.id&&(t.sid=this.id);let s=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new At[e](s)}open(){let e;if(this.opts.rememberUpgrade&&A.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),s=!1;A.priorWebsocketSuccess=!1;let n=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!s)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;A.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(a(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let h=new Error("probe error");h.transport=t.name,this.emitReserved("upgradeError",h)}}))};function i(){s||(s=!0,a(),t.close(),t=null)}let o=u=>{let h=new Error("probe error: "+u);h.transport=t.name,i(),this.emitReserved("upgradeError",h)};function c(){o("transport closed")}function l(){o("socket closed")}function y(u){t&&u.name!==t.name&&i()}let a=()=>{t.removeListener("open",n),t.removeListener("error",o),t.removeListener("close",c),this.off("close",l),this.off("upgrading",y)};t.once("open",n),t.once("error",o),t.once("close",c),this.once("close",l),this.once("upgrading",y),t.open()}onOpen(){if(this.readyState="open",A.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,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();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 t=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(t+=bs(n)),s>0&&t>this.maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}write(e,t,s){return this.sendPacket("message",e,t,s),this}send(e,t,s){return this.sendPacket("message",e,t,s),this}sendPacket(e,t,s,n){if(typeof t=="function"&&(n=t,t=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){A.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],s=0,n=e.length;for(;s<n;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}};A.protocol=kt;var Ga=A.protocol;function Os(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=Z(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}var Nt={};Ut(Nt,{Decoder:()=>pe,Encoder:()=>Pt,PacketType:()=>p,protocol:()=>Ns});var _i=typeof ArrayBuffer=="function",Ai=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ts=Object.prototype.toString,Oi=typeof Blob=="function"||typeof Blob<"u"&&Ts.call(Blob)==="[object BlobConstructor]",Ti=typeof File=="function"||typeof File<"u"&&Ts.call(File)==="[object FileConstructor]";function fe(r){return _i&&(r instanceof ArrayBuffer||Ai(r))||Oi&&r instanceof Blob||Ti&&r instanceof File}function he(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(he(r[t]))return!0;return!1}if(fe(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return he(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&he(r[t]))return!0;return!1}function Ps(r){let e=[],t=r.data,s=r;return s.data=Ot(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Ot(r,e){if(!r)return r;if(fe(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=Ot(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=Ot(r[s],e));return t}return r}function Bs(r,e){return r.data=Tt(r.data,e),delete r.attachments,r}function Tt(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=Tt(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Tt(r[t],e));return r}var Ns=5,p;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(p||(p={}));var Pt=class{constructor(e){this.replacer=e}encode(e){return(e.type===p.EVENT||e.type===p.ACK)&&he(e)?this.encodeAsBinary({type:e.type===p.EVENT?p.BINARY_EVENT:p.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===p.BINARY_EVENT||e.type===p.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ps(e),s=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(s),n}},pe=class extends m{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===p.BINARY_EVENT;s||t.type===p.BINARY_ACK?(t.type=s?p.EVENT:p.ACK,this.reconstructor=new Bt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(fe(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(p[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===p.BINARY_EVENT||s.type===p.BINARY_ACK){let i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";let n=e.charAt(t+1);if(n!==""&&Number(n)==n){let i=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){let i=this.tryParse(e.substr(t));if(pe.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case p.CONNECT:return typeof t=="object";case p.DISCONNECT:return t===void 0;case p.CONNECT_ERROR:return typeof t=="string"||typeof t=="object";case p.EVENT:case p.BINARY_EVENT:return Array.isArray(t)&&t.length>0;case p.ACK:case p.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Bt=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 t=Bs(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function O(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var Pi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ee=class extends m{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[O(e,"open",this.onopen.bind(this)),O(e,"packet",this.onpacket.bind(this)),O(e,"error",this.onerror.bind(this)),O(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,...t){if(Pi.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let s={type:p.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++,c=t.pop();this._registerAckCallback(o,c),s.id=o}let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var s;let n=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},n);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...o])}}emitWithAck(e,...t){let s=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((n,i)=>{t.push((o,c)=>s?o?i(o):n(c):n(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...i)=>s!==this._queue[0]?void 0:(n!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(n)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:p.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case p.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 p.EVENT:case p.BINARY_EVENT:this.onevent(e);break;case p.ACK:case p.BINARY_ACK:this.onack(e);break;case p.DISCONNECT:this.ondisconnect();break;case p.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.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 t=this,s=!1;return function(...n){s||(s=!0,t.packet({type:p.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:p.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 t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function j(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}j.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=Math.floor(e*10)&1?r+t:r-t}return Math.min(r,this.max)|0};j.prototype.reset=function(){this.attempts=0};j.prototype.setMin=function(r){this.ms=r};j.prototype.setMax=function(r){this.max=r};j.prototype.setJitter=function(r){this.jitter=r};var te=class extends m{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,L(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new j({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let n=t.parser||Nt;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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(~this._readyState.indexOf("open"))return this;this.engine=new A(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let n=O(t,"open",function(){s.onopen(),e&&e()}),i=O(t,"error",o=>{s.cleanup(),s._readyState="closed",this.emitReserved("error",o),e?e(o):s.maybeReconnectOnOpen()});if(this._timeout!==!1){let o=this._timeout;o===0&&n();let c=this.setTimeoutFn(()=>{n(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(n),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(O(e,"ping",this.onping.bind(this)),O(e,"data",this.ondata.bind(this)),O(e,"error",this.onerror.bind(this)),O(e,"close",this.onclose.bind(this)),O(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ue(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ee(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(function(){clearTimeout(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var de={};function me(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Os(r,e.path||"/socket.io"),s=t.source,n=t.id,i=t.path,o=de[n]&&i in de[n].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,l;return c?l=new te(s,e):(de[n]||(de[n]=new te(s,e)),l=de[n]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(me,{Manager:te,Socket:ee,io:me,connect:me});var Fs=(s=>(s.System="system",s.AppConfig="appconfig",s.Dataset="dataset/",s))(Fs||{}),ye=class{constructor(e,t){this.client=e;this.options=t;this.connected=!1;this.subscribedChannels=new Set}get isConnected(){return this.connected}connect(){return this.isConnected?Promise.resolve():new Promise((e,t)=>{let s=me(this.client.baseUrl,ne(x({},this.options),{autoConnect:!1,auth:n=>{let i={};this.client.apiKey&&(i["x-api-key"]=this.client.apiKey),this.client.accessToken&&(i["x-socket-token"]=`Bearer ${this.client.accessToken}`),n(i)}}));s.on("connect",()=>{this.client.debug(`Socket connected: ${s.id}`),this.subscribedChannels.size&&this.subscribedChannels.forEach(n=>{s.emit("subscribe",{channel:n},i=>{i.status==="error"?console.error(`Error re-subscribing to channel '${n}`,i):this.client.debug(`Re-subscribed to channel '${n}`)})})}),s.io.on("reconnect_attempt",n=>{this.client.debug(`Socket reconnect attempt: ${n}`)}),s.io.on("reconnect_error",n=>{this.client.debug(`Socket reconnect error: ${n.message}`)}),s.io.on("reconnect_failed",()=>{this.client.debug("Socket reconnect failed")}),s.io.on("reconnect",()=>{this.client.debug("Socket reconnected")}),s.on("disconnect",n=>{this.client.debug(`Socket disconnected: ${n}`)}),s.on("error",n=>{this.client.debug(`Socket error: ${n.messaage}`)}),this.socket=s,this.connected=!0,s.on("connect",()=>{e()}),s.connect()})}disconnect(){return this.isConnected?new Promise(e=>{this.socket.once("disconnect",()=>{this.connected=!1,e()}),this.socket.disconnect()}):Promise.resolve()}subscribe(e,t){if(!this.isConnected)throw new Error("WebSocketGateway is not initialized");this.client.debug(`Subscribing to channel '${e}`);let s=i=>{i.channel===e&&t(null,i)},n=i=>{this.socket.off("message",s),this.unsubscribe(e,i)};return this.socket.emit("subscribe",{channel:e},i=>{if(i.status==="error")return this.client.debug(`Error subscribed to channel '${e}`,i),t(new Error(i.message));this.subscribedChannels.add(e),this.client.debug(`Subscribed to channel '${e}`),this.socket.on("message",s)}),n}unsubscribe(e,t){if(!this.isConnected)throw new Error("WebSocketGateway is not initialized");this.client.debug(`Unsubscribing from channel '${e}`),this.socket.emit("unsubscribe",{channel:e},s=>{s.status==="error"?(this.client.debug(`Error unsubscribing from channel '${e}`,s),t&&t(new Error(s.message))):(this.subscribedChannels.delete(e),this.client.debug(`Unsubscribed from channel '${e}`),t&&t(null))})}};var Ft=class{constructor(e,t=null,s){this.baseUrl=e;this.apiKey=t;this.debug=(0,Is.default)("flow-engine-client");this.accessToken=null;this.auth=new Be(this);this.tiles=new je(this);this.maps=new Ie(this);this.apiKeys=new Ae(this);this.applications=new Te(this);this.appconfig=new Oe(this);this.databases=new Ne(this);this.datasets=new Fe(this);this.styles=new $e(this);this.tileSources=new We(this);this.uploads=new Ke(this);this.jobs=new qe(this);this.maplayers=new Le(this);this.pipelines=new Me(this);this.axios=qs.default.create({baseURL:e,maxContentLength:524288e3,transformResponse:[function(i,o){var c;return(c=o==null?void 0:o["content-type"])!=null&&c.startsWith("application/json")?JSON.parse(i):i}]}),this.webSocketGateway=new ye(this,s)}connect(){return this.webSocketGateway.connect()}disconnect(){return this.webSocketGateway.disconnect()}config(){return this._get("/api/v1/config")}_get(e,t={}){var s;return(s=t.params)!=null&&s.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios(x(x({method:"get",url:e},t),this.headers(t))).then(n=>n.data).catch(this.handleError)}_post(e,t,s={}){var n;return(n=s.params)!=null&&n.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios(x(x({method:"post",url:e,data:t,maxContentLength:1/0,maxBodyLength:1/0},s),this.headers(s))).then(i=>i.data).catch(this.handleError)}_put(e,t,s={}){var n;return(n=s.params)!=null&&n.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios(x(x({method:"put",url:e,data:t},s),this.headers(s))).then(i=>i.data).catch(this.handleError)}_delete(e,t={}){var s;return(s=t.params)!=null&&s.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios(x(x({method:"delete",url:e},t),this.headers(t))).then(n=>n.data).catch(this.handleError)}_subscribe(e,t){return this.webSocketGateway.isConnected||this.webSocketGateway.connect(),this.webSocketGateway.subscribe(e,t)}_unsubscribe(e,t){this.webSocketGateway.isConnected||this.webSocketGateway.connect(),this.webSocketGateway.unsubscribe(e,t)}handleError(e){if(e.response&&e.response.data){if(typeof e.response.data=="object"){let s=e.response.data;throw new I(s.message||s.error,s.error,e.response.status)}else if(typeof e.response.data=="string")throw new I(e.response.data,null,e.response.status)}let t=e;throw delete t.config,delete t.request,delete t.response,new I(t.message,t)}headers(e){let t=e.headers||{};return(e.apiKey||this.apiKey)&&(t["X-Api-Key"]=e.apiKey||this.apiKey),this.accessToken&&(t.Authorization=t.Authorization||`Bearer ${this.accessToken}`),{headers:t}}};return Hs(Bi);})();
2
+ `),function(c){if(i=c.indexOf(":"),s=dt.trim(c.substr(0,i)).toLowerCase(),n=dt.trim(c.substr(i+1)),s){if(t[s]&&Cn.indexOf(s)>=0)return;s==="set-cookie"?t[s]=(t[s]?t[s]:[]).concat([n]):t[s]=t[s]?t[s]+", "+n:n}}),t}});var yr=f((zi,mr)=>{"use strict";var dr=v();mr.exports=dr.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),s;function n(i){var o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return s=n(window.location.href),function(o){var c=dr.isString(o)?n(o):o;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}()});var ie=f((Qi,br)=>{"use strict";var mt=M(),wn=v();function gr(r){mt.call(this,r==null?"canceled":r,mt.ERR_CANCELED),this.name="CanceledError"}wn.inherits(gr,mt,{__CANCEL__:!0});br.exports=gr});var Cr=f((Yi,vr)=>{"use strict";vr.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}});var yt=f((Xi,wr)=>{"use strict";var oe=v(),En=nr(),xn=or(),kn=ut(),Sn=pt(),Rn=pr(),_n=yr(),An=lt(),q=M(),On=ie(),Tn=Cr();wr.exports=function(e){return new Promise(function(s,n){var i=e.data,o=e.headers,c=e.responseType,l;function y(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}oe.isFormData(i)&&oe.isStandardBrowserEnv()&&delete o["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var u=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(u+":"+h)}var g=Sn(e.baseURL,e.url);a.open(e.method.toUpperCase(),kn(g,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function re(){if(a){var b="getAllResponseHeaders"in a?Rn(a.getAllResponseHeaders()):null,P=!c||c==="text"||c==="json"?a.responseText:a.response,F={data:P,status:a.status,statusText:a.statusText,headers:b,config:e,request:a};En(function(ge){s(ge),y()},function(ge){n(ge),y()},F),a=null}}if("onloadend"in a?a.onloadend=re:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(re)},a.onabort=function(){a&&(n(new q("Request aborted",q.ECONNABORTED,e,a)),a=null)},a.onerror=function(){n(new q("Network Error",q.ERR_NETWORK,e,a,a)),a=null},a.ontimeout=function(){var P=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",F=e.transitional||An;e.timeoutErrorMessage&&(P=e.timeoutErrorMessage),n(new q(P,F.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,a)),a=null},oe.isStandardBrowserEnv()){var S=(e.withCredentials||_n(g))&&e.xsrfCookieName?xn.read(e.xsrfCookieName):void 0;S&&(o[e.xsrfHeaderName]=S)}"setRequestHeader"in a&&oe.forEach(o,function(P,F){typeof i>"u"&&F.toLowerCase()==="content-type"?delete o[F]:a.setRequestHeader(F,P)}),oe.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),c&&c!=="json"&&(a.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&a.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(l=function(b){a&&(n(!b||b&&b.type?new On:b),a.abort(),a=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l))),i||(i=null);var w=Tn(g);if(w&&["http","https","file"].indexOf(w)===-1){n(new q("Unsupported protocol "+w+":",q.ERR_BAD_REQUEST,e));return}a.send(i)})}});var xr=f((Gi,Er)=>{Er.exports=null});var xe=f((Zi,_r)=>{"use strict";var C=v(),kr=Yt(),Sr=M(),Pn=lt(),Bn=ht(),Nn={"Content-Type":"application/x-www-form-urlencoded"};function Rr(r,e){!C.isUndefined(r)&&C.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Fn(){var r;return typeof XMLHttpRequest<"u"?r=yt():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=yt()),r}function qn(r,e,t){if(C.isString(r))try{return(e||JSON.parse)(r),C.trim(r)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(r)}var Ee={transitional:Pn,adapter:Fn(),transformRequest:[function(e,t){if(kr(t,"Accept"),kr(t,"Content-Type"),C.isFormData(e)||C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e))return e;if(C.isArrayBufferView(e))return e.buffer;if(C.isURLSearchParams(e))return Rr(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var s=C.isObject(e),n=t&&t["Content-Type"],i;if((i=C.isFileList(e))||s&&n==="multipart/form-data"){var o=this.env&&this.env.FormData;return Bn(i?{"files[]":e}:e,o&&new o)}else if(s||n==="application/json")return Rr(t,"application/json"),qn(e);return e}],transformResponse:[function(e){var t=this.transitional||Ee.transitional,s=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!s&&this.responseType==="json";if(i||n&&C.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?Sr.from(o,Sr.ERR_BAD_RESPONSE,this,null,this.response):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xr()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};C.forEach(["delete","get","head"],function(e){Ee.headers[e]={}});C.forEach(["post","put","patch"],function(e){Ee.headers[e]=C.merge(Nn)});_r.exports=Ee});var Or=f((eo,Ar)=>{"use strict";var In=v(),Ln=xe();Ar.exports=function(e,t,s){var n=this||Ln;return In.forEach(s,function(o){e=o.call(n,e,t)}),e}});var gt=f((to,Tr)=>{"use strict";Tr.exports=function(e){return!!(e&&e.__CANCEL__)}});var Nr=f((ro,Br)=>{"use strict";var Pr=v(),bt=Or(),Dn=gt(),Un=xe(),Mn=ie();function vt(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Mn}Br.exports=function(e){vt(e),e.headers=e.headers||{},e.data=bt.call(e,e.data,e.headers,e.transformRequest),e.headers=Pr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Pr.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||Un.adapter;return t(e).then(function(n){return vt(e),n.data=bt.call(e,n.data,n.headers,e.transformResponse),n},function(n){return Dn(n)||(vt(e),n&&n.response&&(n.response.data=bt.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var Ct=f((so,Fr)=>{"use strict";var R=v();Fr.exports=function(e,t){t=t||{};var s={};function n(a,u){return R.isPlainObject(a)&&R.isPlainObject(u)?R.merge(a,u):R.isPlainObject(u)?R.merge({},u):R.isArray(u)?u.slice():u}function i(a){if(R.isUndefined(t[a])){if(!R.isUndefined(e[a]))return n(void 0,e[a])}else return n(e[a],t[a])}function o(a){if(!R.isUndefined(t[a]))return n(void 0,t[a])}function c(a){if(R.isUndefined(t[a])){if(!R.isUndefined(e[a]))return n(void 0,e[a])}else return n(void 0,t[a])}function l(a){if(a in t)return n(e[a],t[a]);if(a in e)return n(void 0,e[a])}var y={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:l};return R.forEach(Object.keys(e).concat(Object.keys(t)),function(u){var h=y[u]||i,g=h(u);R.isUndefined(g)&&h!==l||(s[u]=g)}),s}});var wt=f((no,qr)=>{qr.exports={version:"0.27.2"}});var Dr=f((io,Lr)=>{"use strict";var $n=wt().version,D=M(),Et={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){Et[r]=function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r}});var Ir={};Et.transitional=function(e,t,s){function n(i,o){return"[Axios v"+$n+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return function(i,o,c){if(e===!1)throw new D(n(o," has been removed"+(t?" in "+t:"")),D.ERR_DEPRECATED);return t&&!Ir[o]&&(Ir[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}};function Wn(r,e,t){if(typeof r!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);for(var s=Object.keys(r),n=s.length;n-- >0;){var i=s[n],o=e[i];if(o){var c=r[i],l=c===void 0||o(c,i,r);if(l!==!0)throw new D("option "+i+" must be "+l,D.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new D("Unknown option "+i,D.ERR_BAD_OPTION)}}Lr.exports={assertOptions:Wn,validators:Et}});var Kr=f((oo,jr)=>{"use strict";var $r=v(),jn=ut(),Ur=zt(),Mr=Nr(),ke=Ct(),Kn=pt(),Wr=Dr(),J=Wr.validators;function z(r){this.defaults=r,this.interceptors={request:new Ur,response:new Ur}}z.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ke(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var s=t.transitional;s!==void 0&&Wr.assertOptions(s,{silentJSONParsing:J.transitional(J.boolean),forcedJSONParsing:J.transitional(J.boolean),clarifyTimeoutError:J.transitional(J.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var o=[];this.interceptors.response.forEach(function(g){o.push(g.fulfilled,g.rejected)});var c;if(!i){var l=[Mr,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(o),c=Promise.resolve(t);l.length;)c=c.then(l.shift(),l.shift());return c}for(var y=t;n.length;){var a=n.shift(),u=n.shift();try{y=a(y)}catch(h){u(h);break}}try{c=Mr(y)}catch(h){return Promise.reject(h)}for(;o.length;)c=c.then(o.shift(),o.shift());return c};z.prototype.getUri=function(e){e=ke(this.defaults,e);var t=Kn(e.baseURL,e.url);return jn(t,e.params,e.paramsSerializer)};$r.forEach(["delete","get","head","options"],function(e){z.prototype[e]=function(t,s){return this.request(ke(s||{},{method:e,url:t,data:(s||{}).data}))}});$r.forEach(["post","put","patch"],function(e){function t(s){return function(i,o,c){return this.request(ke(c||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}z.prototype[e]=t(),z.prototype[e+"Form"]=t(!0)});jr.exports=z});var Hr=f((ao,Vr)=>{"use strict";var Vn=ie();function Q(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(n){e=n});var t=this;this.promise.then(function(s){if(t._listeners){var n,i=t._listeners.length;for(n=0;n<i;n++)t._listeners[n](s);t._listeners=null}}),this.promise.then=function(s){var n,i=new Promise(function(o){t.subscribe(o),n=o}).then(s);return i.cancel=function(){t.unsubscribe(n)},i},r(function(n){t.reason||(t.reason=new Vn(n),e(t.reason))})}Q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Q.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};Q.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};Q.source=function(){var e,t=new Q(function(n){e=n});return{token:t,cancel:e}};Vr.exports=Q});var zr=f((co,Jr)=>{"use strict";Jr.exports=function(e){return function(s){return e.apply(null,s)}}});var Yr=f((uo,Qr)=>{"use strict";var Hn=v();Qr.exports=function(e){return Hn.isObject(e)&&e.isAxiosError===!0}});var Zr=f((lo,xt)=>{"use strict";var Xr=v(),Jn=rt(),Se=Kr(),zn=Ct(),Qn=xe();function Gr(r){var e=new Se(r),t=Jn(Se.prototype.request,e);return Xr.extend(t,Se.prototype,e),Xr.extend(t,e),t.create=function(n){return Gr(zn(r,n))},t}var k=Gr(Qn);k.Axios=Se;k.CanceledError=ie();k.CancelToken=Hr();k.isCancel=gt();k.VERSION=wt().version;k.toFormData=ht();k.AxiosError=M();k.Cancel=k.CanceledError;k.all=function(e){return Promise.all(e)};k.spread=zr();k.isAxiosError=Yr();xt.exports=k;xt.exports.default=k});var ts=f((ho,es)=>{es.exports=Zr()});var ss=f((fo,rs)=>{var Y=1e3,X=Y*60,G=X*60,$=G*24,Yn=$*7,Xn=$*365.25;rs.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Gn(r);if(t==="number"&&isFinite(r))return e.long?ei(r):Zn(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Gn(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*Xn;case"weeks":case"week":case"w":return t*Yn;case"days":case"day":case"d":return t*$;case"hours":case"hour":case"hrs":case"hr":case"h":return t*G;case"minutes":case"minute":case"mins":case"min":case"m":return t*X;case"seconds":case"second":case"secs":case"sec":case"s":return t*Y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Zn(r){var e=Math.abs(r);return e>=$?Math.round(r/$)+"d":e>=G?Math.round(r/G)+"h":e>=X?Math.round(r/X)+"m":e>=Y?Math.round(r/Y)+"s":r+"ms"}function ei(r){var e=Math.abs(r);return e>=$?Re(r,e,$,"day"):e>=G?Re(r,e,G,"hour"):e>=X?Re(r,e,X,"minute"):e>=Y?Re(r,e,Y,"second"):r+" ms"}function Re(r,e,t,s){var n=e>=t*1.5;return Math.round(r/t)+" "+s+(n?"s":"")}});var is=f((po,ns)=>{function ti(r){t.debug=t,t.default=t,t.coerce=l,t.disable=i,t.enable=n,t.enabled=o,t.humanize=ss(),t.destroy=y,Object.keys(r).forEach(a=>{t[a]=r[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let h=0;h<a.length;h++)u=(u<<5)-u+a.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,h=null,g,re;function S(...w){if(!S.enabled)return;let b=S,P=Number(new Date),F=P-(u||P);b.diff=F,b.prev=u,b.curr=P,u=P,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let K=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(et,Ls)=>{if(et==="%%")return"%";K++;let qt=t.formatters[Ls];if(typeof qt=="function"){let Ds=w[K];et=qt.call(b,Ds),w.splice(K,1),K--}return et}),t.formatArgs.call(b,w),(b.log||t.log).apply(b,w)}return S.namespace=a,S.useColors=t.useColors(),S.color=t.selectColor(a),S.extend=s,S.destroy=t.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(g!==t.namespaces&&(g=t.namespaces,re=t.enabled(a)),re),set:w=>{h=w}}),typeof t.init=="function"&&t.init(S),S}function s(a,u){let h=t(this.namespace+(typeof u>"u"?":":u)+a);return h.log=this.log,h}function n(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u,h=(typeof a=="string"?a:"").split(/[\s,]+/),g=h.length;for(u=0;u<g;u++)h[u]&&(a=h[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function i(){let a=[...t.names.map(c),...t.skips.map(c).map(u=>"-"+u)].join(",");return t.enable(""),a}function o(a){if(a[a.length-1]==="*")return!0;let u,h;for(u=0,h=t.skips.length;u<h;u++)if(t.skips[u].test(a))return!1;for(u=0,h=t.names.length;u<h;u++)if(t.names[u].test(a))return!0;return!1}function c(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function l(a){return a instanceof Error?a.stack||a.message:a}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ns.exports=ti});var os=f((_,_e)=>{_.formatArgs=si;_.save=ni;_.load=ii;_.useColors=ri;_.storage=oi();_.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ri(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function si(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+_e.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,s=0;r[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(s=t))}),r.splice(s,0,e)}_.log=console.debug||console.log||(()=>{});function ni(r){try{r?_.storage.setItem("debug",r):_.storage.removeItem("debug")}catch(e){}}function ii(){let r;try{r=_.storage.getItem("debug")}catch(e){}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function oi(){try{return localStorage}catch(r){}}_e.exports=is()(_);var{formatters:ai}=_e.exports;ai.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var cs=f((Qo,as)=>{as.exports=typeof self=="object"?self.FormData:window.FormData});var Bi={};Ut(Bi,{BaseEndpoints:()=>d,Client:()=>Ft,FlowEngineError:()=>I,WebSocketChannel:()=>Fs,WebSocketGateway:()=>ye});var qs=tt(ts()),Is=tt(os());var d=class{constructor(e,t){this.client=e;this.resourcePath=t}get resourceEndpoint(){return`/api/v1/${this.resourcePath}`}list(e){if(e!=null&&e.filter){let t=e.filter;Object.keys(t).forEach(s=>{e[`filter[${s}]`]=t[s]}),delete e.filter}return this.client._get(this.resourceEndpoint,{params:e})}get(e,t={}){return this.client._get(`${this.resourceEndpoint}/${e}`,{params:t})}create(e,t={}){return this.client._post(`${this.resourceEndpoint}`,e,{params:t})}update(e,t,s={}){return this.client._put(`${this.resourceEndpoint}/${e}`,t,{params:s})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}getMetadata(e,t,s={}){let n=t?`${this.resourceEndpoint}/${e}/metadata/${t}`:`${this.resourceEndpoint}/${e}/metadata`;return this.client._get(n,{params:s})}setMetadata(e,t,s,n={}){return(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&(s={value:s}),this.client._put(`${this.resourceEndpoint}/${e}/metadata/${t}`,s,{headers:{"Content-Type":"application/json"},params:n})}deleteMetadata(e,t,s={}){return this.client._delete(`${this.resourceEndpoint}/${e}/metadata/${t}`,{headers:{"Content-Type":"application/json"},params:s})}};var Ae=class extends d{constructor(e){super(e,"apikeys")}};var Oe=class{constructor(e){this.client=e}get resourceEndpoint(){return"/api/v1/appconfig"}get(e,t={}){return this.client._get(e?`${this.resourceEndpoint}/${e}`:this.resourceEndpoint,{params:t})}set(e,t,s={}){return(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null||Array.isArray(t))&&(t={value:t}),this.client._put(e?`${this.resourceEndpoint}/${e}`:this.resourceEndpoint,t,{headers:{"Content-Type":"application/json"},params:s})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}subscribe(e){return this.client._subscribe("appconfig",e)}};var Te=class extends d{constructor(e){super(e,"applications")}};var Pe=class extends d{constructor(e){super(e,"auth/users")}me(e){return this.client._get(`${this.resourceEndpoint}/me`,{headers:{Authorization:`Bearer ${e}`}})}};var Be=class{constructor(e){this.client=e;this.users=new Pe(this.client)}login(e,t,s){return this.client._post("/api/v1/auth/login",{email:e,password:t,applicationId:s})}logout(e,t){return this.client._post("/api/v1/auth/logout",{refreshToken:t},{headers:{Authorization:`Bearer ${e}`}})}refresh(e,t){return this.client._post("/api/v1/auth/refresh",{refreshToken:e,applicationId:t})}changePassword(e,t,s){return this.client._post("/api/v1/auth/changepassword",{password:e,newPassword:t},{headers:{Authorization:`Bearer ${s}`}})}signUp(e,t,s,n,i,o,c){return c||(c=o,o=`${this.client.baseUrl}/api/v1/auth/confirmsignup`),this.client._post("/api/v1/auth/signup",{firstName:e,lastName:t,email:s,password:n,applicationId:i,confirmUrl:o,redirectUrl:c})}confirmSignUp(e,t,s){return this.client._get("/api/v1/auth/confirmsignup",{params:{email:e,token:t,redirect:s}})}requestPasswordReset(e,t,s){return this.client._post("/api/v1/auth/requestpasswordreset",{email:e,applicationId:t,redirectUrl:s})}resetPassword(e,t,s,n){return this.client._post("/api/v1/auth/resetpassword",{email:e,password:t,applicationId:s,token:n})}};var Ne=class extends d{constructor(e){super(e,"databases")}drivers(){return this.client._get("/api/v1/databases/drivers").catch(e=>{if(e.status===404)return["postgis","postgis-mapnik"]})}};var Fe=class extends d{constructor(e){super(e,"datasets")}query(e,t={},s={}){typeof e=="object"&&(s=ne(x({},e.params),{format:e.format||"json"}),t=e,e=t.datasetId,delete t.datasetId,delete t.format),typeof s=="string"&&(s={format:s});let n=null;return s.abortController&&(n=s.abortController,delete s.abortController),this.client._post(`/api/v1/datasets/${e}/query`,t,{params:ne(x({},s),{format:s.format||"json",explain:s.explain||!1}),signal:n==null?void 0:n.signal}).catch(i=>{throw i.message==="Network Error"?new Error("Query timed out"):i})}ingest(e,t={}){return this.client._post(`/api/v1/datasets/${e.datasetId}/ingest`,e,t)}getExportUrl(e,t){let s=this.client.accessToken?`accesstoken=${this.client.accessToken}`:`apikey=${this.client.apiKey}`;return`${this.client.baseUrl}/api/v1/datasets/${e}/export?format=${t}&${s}`}subscribe(e,t){return this.client._subscribe(`dataset/${e}`,t)}};var I=class extends Error{constructor(t,s=null,n=500){super(t||"Unknown Error");Object.setPrototypeOf(this,I.prototype),this.statusCode=n,this.error=s}};var qe=class extends d{constructor(e){super(e,"jobs")}submit(e){return this.client._post("/api/v1/jobs/submit",e)}getStatus(e){return this.client._get(`/api/v1/jobs/${e}/status`)}setStatus(e,t){return this.client._post(`/api/v1/jobs/${e}/status`,t)}cancel(e){return this.client._post(`/api/v1/jobs/${e}/cancel`,{})}request(e){return this.client._post("/api/v1/jobs/request",{type:e})}};var Ie=class{constructor(e){this.client=e}get(e,t={}){return this.client._get(`/maps/${e}.json`,{params:t})}};var Le=class extends d{constructor(e){super(e,"maplayers")}subscribe(e){return this.client._subscribe("maplayers",e)}};var De=class extends d{constructor(e,t,s){super(e,`pipelines/${t}/components/${s}/metrics`)}};var Ue=class extends d{constructor(t,s){super(t,`pipelines/${s}/components`);this.pipelineId=s}metrics(t){return new De(this.client,this.pipelineId,t)}};var Me=class extends d{constructor(e){super(e,"pipelines")}components(e){return new Ue(this.client,e)}async heartbeat(e,t={}){return this.client._post(`${this.resourceEndpoint}/${e}/heartbeat`,{params:t})}async publishMetrics(e,t={}){return this.client._post(`${this.resourceEndpoint}/publish-metrics`,e,{params:t})}};var $e=class extends d{constructor(e){super(e,"styles")}};var We=class extends d{constructor(e){super(e,"tilesources")}drivers(){return this.client._get("/api/v1/tilesources/drivers").catch(e=>{if(e.statusCode===404)return["tilelive","dataset"]})}};var je=class{constructor(e){this.client=e}getTileSpec(e,t={}){return this.client._get(`/tiles/${e}/index.json`,{params:t})}getPreviewStyle(e,t={}){return this.client._get(`/tiles/${e}/style.json`,{params:t})}};var us=tt(cs());var Ke=class extends d{constructor(e){super(e,"uploads")}async upload(e,t={}){var i,o,c;let s=new us.default;return e.datasetName&&s.append("name",e.datasetName),e.datasetDescription&&s.append("description",e.datasetDescription),e.attribution&&s.append("attribution",e.attribution),e.datasetId&&s.append("datasetId",e.datasetId),e.sourceSrid&&s.append("sourceSrid",e.sourceSrid),e.targetSrid&&s.append("targetSrid",e.targetSrid),e.schema&&s.append("schema",e.schema),e.metadata&&s.append("metadata",JSON.stringify(e.metadata)),s.append("file",e.data,e.filename),await this.client._post(this.resourceEndpoint,s,{headers:(o=(i=s.getHeaders)==null?void 0:i.call(s))!=null?o:{"Content-Type":"multipart/form-data"},signal:(c=e.abortController)==null?void 0:c.signal,params:t,onUploadProgress:e.progress})}};var N=Object.create(null);N.open="0";N.close="1";N.ping="2";N.pong="3";N.message="4";N.upgrade="5";N.noop="6";var ae=Object.create(null);Object.keys(N).forEach(r=>{ae[N[r]]=r});var ls={type:"error",data:"parser error"};var ci=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ui=typeof ArrayBuffer=="function",li=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,hi=({type:r,data:e},t,s)=>ci&&e instanceof Blob?t?s(e):hs(e,s):ui&&(e instanceof ArrayBuffer||li(e))?t?s(e):hs(new Blob([e]),s):s(N[r]+(e||"")),hs=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)},Ve=hi;var fs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ce=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<fs.length;r++)ce[fs.charCodeAt(r)]=r;var ps=r=>{let e=r.length*.75,t=r.length,s,n=0,i,o,c,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let y=new ArrayBuffer(e),a=new Uint8Array(y);for(s=0;s<t;s+=4)i=ce[r.charCodeAt(s)],o=ce[r.charCodeAt(s+1)],c=ce[r.charCodeAt(s+2)],l=ce[r.charCodeAt(s+3)],a[n++]=i<<2|o>>4,a[n++]=(o&15)<<4|c>>2,a[n++]=(c&3)<<6|l&63;return y};var fi=typeof ArrayBuffer=="function",pi=(r,e)=>{if(typeof r!="string")return{type:"message",data:ds(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:di(r.substring(1),e)}:ae[t]?r.length>1?{type:ae[t],data:r.substring(1)}:{type:ae[t]}:ls},di=(r,e)=>{if(fi){let t=ps(r);return ds(t,e)}else return{base64:!0,data:r}},ds=(r,e)=>{switch(e){case"blob":return r instanceof ArrayBuffer?new Blob([r]):r;case"arraybuffer":default:return r}},He=pi;var ms=String.fromCharCode(30),ys=(r,e)=>{let t=r.length,s=new Array(t),n=0;r.forEach((i,o)=>{Ve(i,!1,c=>{s[o]=c,++n===t&&e(s.join(ms))})})},gs=(r,e)=>{let t=r.split(ms),s=[];for(let n=0;n<t.length;n++){let i=He(t[n],e);if(s.push(i),i.type==="error")break}return s},kt=4;function m(r){if(r)return mi(r)}function mi(r){for(var e in m.prototype)r[e]=m.prototype[e];return r}m.prototype.on=m.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};m.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};m.prototype.off=m.prototype.removeListener=m.prototype.removeAllListeners=m.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,n=0;n<t.length;n++)if(s=t[n],s===e||s.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+r],this};m.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,n=t.length;s<n;++s)t[s].apply(this,e)}return this};m.prototype.emitReserved=m.prototype.emit;m.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};m.prototype.hasListeners=function(r){return!!this.listeners(r).length};var E=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Je(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var yi=E.setTimeout,gi=E.clearTimeout;function L(r,e){e.useNativeTimers?(r.setTimeoutFn=yi.bind(E),r.clearTimeoutFn=gi.bind(E)):(r.setTimeoutFn=E.setTimeout.bind(E),r.clearTimeoutFn=E.clearTimeout.bind(E))}var bi=1.33;function bs(r){return typeof r=="string"?vi(r):Math.ceil((r.byteLength||r.size)*bi)}function vi(r){let e=0,t=0;for(let s=0,n=r.length;s<n;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}var St=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},W=class extends m{constructor(e){super(),this.writable=!1,L(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,s){return super.emitReserved("error",new St(e,t,s)),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)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=He(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}};var Es="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Rt=64,Ci={},vs=0,ze=0,Cs;function ws(r){let e="";do e=Es[r%Rt]+e,r=Math.floor(r/Rt);while(r>0);return e}function Qe(){let r=ws(+new Date);return r!==Cs?(vs=0,Cs=r):r+"."+ws(vs++)}for(;ze<Rt;ze++)Ci[Es[ze]]=ze;function Ye(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function xs(r){let e={},t=r.split("&");for(let s=0,n=t.length;s<n;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}var ks=!1;try{ks=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(r){}var Ss=ks;function _t(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ss))return new XMLHttpRequest}catch(t){}if(!e)try{return new E[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}function wi(){}var Ei=function(){return new _t({xdomain:!1}).responseType!=null}(),Xe=class extends W{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){let s=location.protocol==="https:",n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==s}let t=e&&e.forceBase64;this.supportsBinary=Ei&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};gs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ys(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{},t=this.opts.secure?"https":"http",s="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Qe()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(s=":"+this.opts.port);let n=Ye(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(n.length?"?"+n:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new T(this.uri(),e)}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(n,i)=>{this.onError("xhr post error",n,i)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},T=class extends m{constructor(e,t){super(),L(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){let e=Je(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;let t=this.xhr=new _t(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&t.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{t.setRequestHeader("Accept","*/*")}catch(s){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(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>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=wi,e)try{this.xhr.abort()}catch(t){}typeof document<"u"&&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()}};T.requestsCount=0;T.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rs);else if(typeof addEventListener=="function"){let r="onpagehide"in E?"pagehide":"unload";addEventListener(r,Rs,!1)}}function Rs(){for(let r in T.requests)T.requests.hasOwnProperty(r)&&T.requests[r].abort()}var ue=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),le=E.WebSocket||E.MozWebSocket,Ge=!0,_s="arraybuffer";var As=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ze=class extends W{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,s=As?{}:Je(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=Ge&&!As?t?new le(e,t):new le(e):new le(e,t,s)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType||_s,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],n=t===e.length-1;Ve(s,this.supportsBinary,i=>{let o={};Ge||(s.options&&(o.compress=s.options.compress),this.opts.perMessageDeflate&&(typeof i=="string"?Buffer.byteLength(i):i.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Ge?this.ws.send(i):this.ws.send(i,o)}catch(c){}n&&ue(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{},t=this.opts.secure?"wss":"ws",s="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(s=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Qe()),this.supportsBinary||(e.b64=1);let n=Ye(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+s+this.opts.path+(n.length?"?"+n:"")}check(){return!!le}};var At={websocket:Ze,polling:Xe};var xi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ki=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Z(r){let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let n=xi.exec(r||""),i={},o=14;for(;o--;)i[ki[o]]=n[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Si(i,i.path),i.queryKey=Ri(i,i.query),i}function Si(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ri(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,n,i){n&&(t[n]=i)}),t}var A=class extends m{constructor(e,t={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Z(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Z(t.host).host),L(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=xs(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=kt,t.transport=e,this.id&&(t.sid=this.id);let s=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new At[e](s)}open(){let e;if(this.opts.rememberUpgrade&&A.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),s=!1;A.priorWebsocketSuccess=!1;let n=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!s)if(u.type==="pong"&&u.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;A.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(a(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let h=new Error("probe error");h.transport=t.name,this.emitReserved("upgradeError",h)}}))};function i(){s||(s=!0,a(),t.close(),t=null)}let o=u=>{let h=new Error("probe error: "+u);h.transport=t.name,i(),this.emitReserved("upgradeError",h)};function c(){o("transport closed")}function l(){o("socket closed")}function y(u){t&&u.name!==t.name&&i()}let a=()=>{t.removeListener("open",n),t.removeListener("error",o),t.removeListener("close",c),this.off("close",l),this.off("upgrading",y)};t.once("open",n),t.once("error",o),t.once("close",c),this.once("close",l),this.once("upgrading",y),t.open()}onOpen(){if(this.readyState="open",A.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,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();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 t=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(t+=bs(n)),s>0&&t>this.maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}write(e,t,s){return this.sendPacket("message",e,t,s),this}send(e,t,s){return this.sendPacket("message",e,t,s),this}sendPacket(e,t,s,n){if(typeof t=="function"&&(n=t,t=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){A.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],s=0,n=e.length;for(;s<n;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}};A.protocol=kt;var Ga=A.protocol;function Os(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=Z(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}var Nt={};Ut(Nt,{Decoder:()=>pe,Encoder:()=>Pt,PacketType:()=>p,protocol:()=>Ns});var _i=typeof ArrayBuffer=="function",Ai=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ts=Object.prototype.toString,Oi=typeof Blob=="function"||typeof Blob<"u"&&Ts.call(Blob)==="[object BlobConstructor]",Ti=typeof File=="function"||typeof File<"u"&&Ts.call(File)==="[object FileConstructor]";function fe(r){return _i&&(r instanceof ArrayBuffer||Ai(r))||Oi&&r instanceof Blob||Ti&&r instanceof File}function he(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(he(r[t]))return!0;return!1}if(fe(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return he(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&he(r[t]))return!0;return!1}function Ps(r){let e=[],t=r.data,s=r;return s.data=Ot(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Ot(r,e){if(!r)return r;if(fe(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=Ot(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=Ot(r[s],e));return t}return r}function Bs(r,e){return r.data=Tt(r.data,e),delete r.attachments,r}function Tt(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=Tt(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Tt(r[t],e));return r}var Ns=5,p;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(p||(p={}));var Pt=class{constructor(e){this.replacer=e}encode(e){return(e.type===p.EVENT||e.type===p.ACK)&&he(e)?this.encodeAsBinary({type:e.type===p.EVENT?p.BINARY_EVENT:p.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===p.BINARY_EVENT||e.type===p.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ps(e),s=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(s),n}},pe=class extends m{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===p.BINARY_EVENT;s||t.type===p.BINARY_ACK?(t.type=s?p.EVENT:p.ACK,this.reconstructor=new Bt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(fe(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(p[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===p.BINARY_EVENT||s.type===p.BINARY_ACK){let i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";let n=e.charAt(t+1);if(n!==""&&Number(n)==n){let i=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){let i=this.tryParse(e.substr(t));if(pe.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case p.CONNECT:return typeof t=="object";case p.DISCONNECT:return t===void 0;case p.CONNECT_ERROR:return typeof t=="string"||typeof t=="object";case p.EVENT:case p.BINARY_EVENT:return Array.isArray(t)&&t.length>0;case p.ACK:case p.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Bt=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 t=Bs(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function O(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var Pi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ee=class extends m{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[O(e,"open",this.onopen.bind(this)),O(e,"packet",this.onpacket.bind(this)),O(e,"error",this.onerror.bind(this)),O(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,...t){if(Pi.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let s={type:p.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++,c=t.pop();this._registerAckCallback(o,c),s.id=o}let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var s;let n=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},n);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...o])}}emitWithAck(e,...t){let s=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((n,i)=>{t.push((o,c)=>s?o?i(o):n(c):n(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...i)=>s!==this._queue[0]?void 0:(n!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(n)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:p.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case p.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 p.EVENT:case p.BINARY_EVENT:this.onevent(e);break;case p.ACK:case p.BINARY_ACK:this.onack(e);break;case p.DISCONNECT:this.ondisconnect();break;case p.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.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 t=this,s=!1;return function(...n){s||(s=!0,t.packet({type:p.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:p.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 t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function j(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}j.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=Math.floor(e*10)&1?r+t:r-t}return Math.min(r,this.max)|0};j.prototype.reset=function(){this.attempts=0};j.prototype.setMin=function(r){this.ms=r};j.prototype.setMax=function(r){this.max=r};j.prototype.setJitter=function(r){this.jitter=r};var te=class extends m{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,L(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new j({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let n=t.parser||Nt;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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(~this._readyState.indexOf("open"))return this;this.engine=new A(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let n=O(t,"open",function(){s.onopen(),e&&e()}),i=O(t,"error",o=>{s.cleanup(),s._readyState="closed",this.emitReserved("error",o),e?e(o):s.maybeReconnectOnOpen()});if(this._timeout!==!1){let o=this._timeout;o===0&&n();let c=this.setTimeoutFn(()=>{n(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(n),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(O(e,"ping",this.onping.bind(this)),O(e,"data",this.ondata.bind(this)),O(e,"error",this.onerror.bind(this)),O(e,"close",this.onclose.bind(this)),O(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ue(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ee(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(function(){clearTimeout(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var de={};function me(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Os(r,e.path||"/socket.io"),s=t.source,n=t.id,i=t.path,o=de[n]&&i in de[n].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,l;return c?l=new te(s,e):(de[n]||(de[n]=new te(s,e)),l=de[n]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(me,{Manager:te,Socket:ee,io:me,connect:me});var Fs=(s=>(s.System="system",s.AppConfig="appconfig",s.Dataset="dataset/",s))(Fs||{}),ye=class{constructor(e,t){this.client=e;this.options=t;this.connected=!1;this.subscribedChannels=new Set}get isConnected(){return this.connected}connect(){return this.isConnected?Promise.resolve():new Promise((e,t)=>{let s=me(this.client.baseUrl,ne(x({},this.options),{autoConnect:!1,auth:n=>{let i={};this.client.apiKey&&(i["x-api-key"]=this.client.apiKey),this.client.accessToken&&(i["x-socket-token"]=`Bearer ${this.client.accessToken}`),n(i)}}));s.on("connect",()=>{this.client.debug(`Socket connected: ${s.id}`),this.subscribedChannels.size&&this.subscribedChannels.forEach(n=>{s.emit("subscribe",{channel:n},i=>{i.status==="error"?console.error(`Error re-subscribing to channel '${n}`,i):this.client.debug(`Re-subscribed to channel '${n}`)})})}),s.io.on("reconnect_attempt",n=>{this.client.debug(`Socket reconnect attempt: ${n}`)}),s.io.on("reconnect_error",n=>{this.client.debug(`Socket reconnect error: ${n.message}`)}),s.io.on("reconnect_failed",()=>{this.client.debug("Socket reconnect failed")}),s.io.on("reconnect",()=>{this.client.debug("Socket reconnected")}),s.on("disconnect",n=>{this.client.debug(`Socket disconnected: ${n}`)}),s.on("error",n=>{this.client.debug(`Socket error: ${n.messaage}`)}),this.socket=s,this.connected=!0,s.on("connect",()=>{e()}),s.connect()})}disconnect(){return this.isConnected?new Promise(e=>{this.socket.once("disconnect",()=>{this.connected=!1,e()}),this.socket.disconnect()}):Promise.resolve()}subscribe(e,t){if(!this.isConnected)throw new Error("WebSocketGateway is not initialized");this.client.debug(`Subscribing to channel '${e}`);let s=i=>{i.channel===e&&t(null,i)},n=i=>{this.socket.off("message",s),this.unsubscribe(e,i)};return this.socket.emit("subscribe",{channel:e},i=>{if(i.status==="error")return this.client.debug(`Error subscribed to channel '${e}`,i),t(new Error(i.message));this.subscribedChannels.add(e),this.client.debug(`Subscribed to channel '${e}`),this.socket.on("message",s)}),n}unsubscribe(e,t){if(!this.isConnected)throw new Error("WebSocketGateway is not initialized");this.client.debug(`Unsubscribing from channel '${e}`),this.socket.emit("unsubscribe",{channel:e},s=>{s.status==="error"?(this.client.debug(`Error unsubscribing from channel '${e}`,s),t&&t(new Error(s.message))):(this.subscribedChannels.delete(e),this.client.debug(`Unsubscribed from channel '${e}`),t&&t(null))})}};var Ft=class{constructor(e,t=null,s){this.baseUrl=e;this.apiKey=t;this.debug=(0,Is.default)("flow-engine-client");this.accessToken=null;this.auth=new Be(this);this.tiles=new je(this);this.maps=new Ie(this);this.apiKeys=new Ae(this);this.applications=new Te(this);this.appconfig=new Oe(this);this.databases=new Ne(this);this.datasets=new Fe(this);this.styles=new $e(this);this.tileSources=new We(this);this.uploads=new Ke(this);this.jobs=new qe(this);this.maplayers=new Le(this);this.pipelines=new Me(this);this.axios=qs.default.create({baseURL:e,maxContentLength:524288e3,transformResponse:[function(i,o){var c;return(c=o==null?void 0:o["content-type"])!=null&&c.startsWith("application/json")?JSON.parse(i):i}]}),this.webSocketGateway=new ye(this,s)}useRequestInterceptor(e){return this.axios.interceptors.request.use(e)}ejectRequestInterceptor(e){this.axios.interceptors.request.eject(e)}connect(){return this.webSocketGateway.connect()}disconnect(){return this.webSocketGateway.disconnect()}config(){return this._get("/api/v1/config")}_get(e,t={}){var s;return(s=t.params)!=null&&s.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios(x(x({method:"get",url:e},t),this.headers(t))).then(n=>n.data).catch(this.handleError)}_post(e,t,s={}){var n;return(n=s.params)!=null&&n.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios(x(x({method:"post",url:e,data:t,maxContentLength:1/0,maxBodyLength:1/0},s),this.headers(s))).then(i=>i.data).catch(this.handleError)}_put(e,t,s={}){var n;return(n=s.params)!=null&&n.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios(x(x({method:"put",url:e,data:t},s),this.headers(s))).then(i=>i.data).catch(this.handleError)}_delete(e,t={}){var s;return(s=t.params)!=null&&s.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios(x(x({method:"delete",url:e},t),this.headers(t))).then(n=>n.data).catch(this.handleError)}_subscribe(e,t){return this.webSocketGateway.isConnected||this.webSocketGateway.connect(),this.webSocketGateway.subscribe(e,t)}_unsubscribe(e,t){this.webSocketGateway.isConnected||this.webSocketGateway.connect(),this.webSocketGateway.unsubscribe(e,t)}handleError(e){if(e.response&&e.response.data){if(typeof e.response.data=="object"){let s=e.response.data;throw new I(s.message||s.error,s.error,e.response.status)}else if(typeof e.response.data=="string")throw new I(e.response.data,null,e.response.status)}let t=e;throw delete t.config,delete t.request,delete t.response,new I(t.message,t)}headers(e){let t=e.headers||{};return(e.apiKey||this.apiKey)&&(t["X-Api-Key"]=e.apiKey||this.apiKey),this.accessToken&&(t.Authorization=t.Authorization||`Bearer ${this.accessToken}`),{headers:t}}};return Hs(Bi);})();
3
3
  //# sourceMappingURL=bundle.js.map