@emuanalytics/flow-engine-client 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +9 -3
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +668 -0
- package/dist/index.d.mts +668 -0
- package/dist/index.d.ts +668 -0
- package/dist/index.mjs +1 -0
- package/package.json +33 -40
- package/dist/bundle.js.map +0 -7
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/lib/__mocks__/client.js +0 -57
- package/dist/cjs/lib/__mocks__/client.js.map +0 -1
- package/dist/cjs/lib/api-interfaces.js +0 -6
- package/dist/cjs/lib/api-interfaces.js.map +0 -1
- package/dist/cjs/lib/apikey.endpoints.js +0 -31
- package/dist/cjs/lib/apikey.endpoints.js.map +0 -1
- package/dist/cjs/lib/appconfig.endpoints.js +0 -49
- package/dist/cjs/lib/appconfig.endpoints.js.map +0 -1
- package/dist/cjs/lib/application.endpoints.js +0 -31
- package/dist/cjs/lib/application.endpoints.js.map +0 -1
- package/dist/cjs/lib/auth.edpoints.js +0 -60
- package/dist/cjs/lib/auth.edpoints.js.map +0 -1
- package/dist/cjs/lib/base.endpoints.js +0 -78
- package/dist/cjs/lib/base.endpoints.js.map +0 -1
- package/dist/cjs/lib/client.js +0 -198
- package/dist/cjs/lib/client.js.map +0 -1
- package/dist/cjs/lib/contact-point.endpoints.js +0 -46
- package/dist/cjs/lib/contact-point.endpoints.js.map +0 -1
- package/dist/cjs/lib/database.endpoints.js +0 -39
- package/dist/cjs/lib/database.endpoints.js.map +0 -1
- package/dist/cjs/lib/dataset.endpoints.js +0 -88
- package/dist/cjs/lib/dataset.endpoints.js.map +0 -1
- package/dist/cjs/lib/errors.js +0 -36
- package/dist/cjs/lib/errors.js.map +0 -1
- package/dist/cjs/lib/job.endpoints.js +0 -46
- package/dist/cjs/lib/job.endpoints.js.map +0 -1
- package/dist/cjs/lib/map.endoints.js +0 -18
- package/dist/cjs/lib/map.endoints.js.map +0 -1
- package/dist/cjs/lib/maplayer.endpoints.js +0 -34
- package/dist/cjs/lib/maplayer.endpoints.js.map +0 -1
- package/dist/cjs/lib/media.endpoints.js +0 -106
- package/dist/cjs/lib/media.endpoints.js.map +0 -1
- package/dist/cjs/lib/pipeline-component.endpoints.js +0 -37
- package/dist/cjs/lib/pipeline-component.endpoints.js.map +0 -1
- package/dist/cjs/lib/pipeline-metric.endpoint.js +0 -31
- package/dist/cjs/lib/pipeline-metric.endpoint.js.map +0 -1
- package/dist/cjs/lib/pipeline.endpoints.js +0 -87
- package/dist/cjs/lib/pipeline.endpoints.js.map +0 -1
- package/dist/cjs/lib/style.endpoint.js +0 -31
- package/dist/cjs/lib/style.endpoint.js.map +0 -1
- package/dist/cjs/lib/tile-source.endpoints.js +0 -39
- package/dist/cjs/lib/tile-source.endpoints.js.map +0 -1
- package/dist/cjs/lib/tile.endpoints.js +0 -22
- package/dist/cjs/lib/tile.endpoints.js.map +0 -1
- package/dist/cjs/lib/upload.endpoints.js +0 -121
- package/dist/cjs/lib/upload.endpoints.js.map +0 -1
- package/dist/cjs/lib/user.endpoints.js +0 -36
- package/dist/cjs/lib/user.endpoints.js.map +0 -1
- package/dist/cjs/lib/web-socket-gateway.js +0 -160
- package/dist/cjs/lib/web-socket-gateway.js.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/__mocks__/client.js +0 -54
- package/dist/esm/lib/__mocks__/client.js.map +0 -1
- package/dist/esm/lib/api-interfaces.js +0 -5
- package/dist/esm/lib/api-interfaces.js.map +0 -1
- package/dist/esm/lib/apikey.endpoints.js +0 -28
- package/dist/esm/lib/apikey.endpoints.js.map +0 -1
- package/dist/esm/lib/appconfig.endpoints.js +0 -46
- package/dist/esm/lib/appconfig.endpoints.js.map +0 -1
- package/dist/esm/lib/application.endpoints.js +0 -28
- package/dist/esm/lib/application.endpoints.js.map +0 -1
- package/dist/esm/lib/auth.edpoints.js +0 -57
- package/dist/esm/lib/auth.edpoints.js.map +0 -1
- package/dist/esm/lib/base.endpoints.js +0 -75
- package/dist/esm/lib/base.endpoints.js.map +0 -1
- package/dist/esm/lib/client.js +0 -192
- package/dist/esm/lib/client.js.map +0 -1
- package/dist/esm/lib/contact-point.endpoints.js +0 -43
- package/dist/esm/lib/contact-point.endpoints.js.map +0 -1
- package/dist/esm/lib/database.endpoints.js +0 -36
- package/dist/esm/lib/database.endpoints.js.map +0 -1
- package/dist/esm/lib/dataset.endpoints.js +0 -85
- package/dist/esm/lib/dataset.endpoints.js.map +0 -1
- package/dist/esm/lib/errors.js +0 -33
- package/dist/esm/lib/errors.js.map +0 -1
- package/dist/esm/lib/job.endpoints.js +0 -43
- package/dist/esm/lib/job.endpoints.js.map +0 -1
- package/dist/esm/lib/map.endoints.js +0 -15
- package/dist/esm/lib/map.endoints.js.map +0 -1
- package/dist/esm/lib/maplayer.endpoints.js +0 -31
- package/dist/esm/lib/maplayer.endpoints.js.map +0 -1
- package/dist/esm/lib/media.endpoints.js +0 -100
- package/dist/esm/lib/media.endpoints.js.map +0 -1
- package/dist/esm/lib/pipeline-component.endpoints.js +0 -34
- package/dist/esm/lib/pipeline-component.endpoints.js.map +0 -1
- package/dist/esm/lib/pipeline-metric.endpoint.js +0 -28
- package/dist/esm/lib/pipeline-metric.endpoint.js.map +0 -1
- package/dist/esm/lib/pipeline.endpoints.js +0 -84
- package/dist/esm/lib/pipeline.endpoints.js.map +0 -1
- package/dist/esm/lib/style.endpoint.js +0 -28
- package/dist/esm/lib/style.endpoint.js.map +0 -1
- package/dist/esm/lib/tile-source.endpoints.js +0 -36
- package/dist/esm/lib/tile-source.endpoints.js.map +0 -1
- package/dist/esm/lib/tile.endpoints.js +0 -19
- package/dist/esm/lib/tile.endpoints.js.map +0 -1
- package/dist/esm/lib/upload.endpoints.js +0 -115
- package/dist/esm/lib/upload.endpoints.js.map +0 -1
- package/dist/esm/lib/user.endpoints.js +0 -33
- package/dist/esm/lib/user.endpoints.js.map +0 -1
- package/dist/esm/lib/web-socket-gateway.js +0 -157
- package/dist/esm/lib/web-socket-gateway.js.map +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/__mocks__/client.d.ts +0 -3
- package/dist/types/lib/__mocks__/client.d.ts.map +0 -1
- package/dist/types/lib/api-interfaces.d.ts +0 -314
- package/dist/types/lib/api-interfaces.d.ts.map +0 -1
- package/dist/types/lib/apikey.endpoints.d.ts +0 -10
- package/dist/types/lib/apikey.endpoints.d.ts.map +0 -1
- package/dist/types/lib/appconfig.endpoints.d.ts +0 -15
- package/dist/types/lib/appconfig.endpoints.d.ts.map +0 -1
- package/dist/types/lib/application.endpoints.d.ts +0 -10
- package/dist/types/lib/application.endpoints.d.ts.map +0 -1
- package/dist/types/lib/auth.edpoints.d.ts +0 -20
- package/dist/types/lib/auth.edpoints.d.ts.map +0 -1
- package/dist/types/lib/base.endpoints.d.ts +0 -20
- package/dist/types/lib/base.endpoints.d.ts.map +0 -1
- package/dist/types/lib/client.d.ts +0 -68
- package/dist/types/lib/client.d.ts.map +0 -1
- package/dist/types/lib/contact-point.endpoints.d.ts +0 -20
- package/dist/types/lib/contact-point.endpoints.d.ts.map +0 -1
- package/dist/types/lib/database.endpoints.d.ts +0 -11
- package/dist/types/lib/database.endpoints.d.ts.map +0 -1
- package/dist/types/lib/dataset.endpoints.d.ts +0 -26
- package/dist/types/lib/dataset.endpoints.d.ts.map +0 -1
- package/dist/types/lib/errors.d.ts +0 -9
- package/dist/types/lib/errors.d.ts.map +0 -1
- package/dist/types/lib/job.endpoints.d.ts +0 -15
- package/dist/types/lib/job.endpoints.d.ts.map +0 -1
- package/dist/types/lib/map.endoints.d.ts +0 -11
- package/dist/types/lib/map.endoints.d.ts.map +0 -1
- package/dist/types/lib/maplayer.endpoints.d.ts +0 -12
- package/dist/types/lib/maplayer.endpoints.d.ts.map +0 -1
- package/dist/types/lib/media.endpoints.d.ts +0 -20
- package/dist/types/lib/media.endpoints.d.ts.map +0 -1
- package/dist/types/lib/pipeline-component.endpoints.d.ts +0 -13
- package/dist/types/lib/pipeline-component.endpoints.d.ts.map +0 -1
- package/dist/types/lib/pipeline-metric.endpoint.d.ts +0 -10
- package/dist/types/lib/pipeline-metric.endpoint.d.ts.map +0 -1
- package/dist/types/lib/pipeline.endpoints.d.ts +0 -14
- package/dist/types/lib/pipeline.endpoints.d.ts.map +0 -1
- package/dist/types/lib/style.endpoint.d.ts +0 -10
- package/dist/types/lib/style.endpoint.d.ts.map +0 -1
- package/dist/types/lib/tile-source.endpoints.d.ts +0 -11
- package/dist/types/lib/tile-source.endpoints.d.ts.map +0 -1
- package/dist/types/lib/tile.endpoints.d.ts +0 -12
- package/dist/types/lib/tile.endpoints.d.ts.map +0 -1
- package/dist/types/lib/upload.endpoints.d.ts +0 -22
- package/dist/types/lib/upload.endpoints.d.ts.map +0 -1
- package/dist/types/lib/user.endpoints.d.ts +0 -11
- package/dist/types/lib/user.endpoints.d.ts.map +0 -1
- package/dist/types/lib/web-socket-gateway.d.ts +0 -42
- package/dist/types/lib/web-socket-gateway.d.ts.map +0 -1
package/dist/bundle.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
"use strict";var FlowEngineClient=(()=>{var Ws=Object.create;var se=Object.defineProperty,js=Object.defineProperties,Ks=Object.getOwnPropertyDescriptor,Hs=Object.getOwnPropertyDescriptors,Vs=Object.getOwnPropertyNames,Ut=Object.getOwnPropertySymbols,Js=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable;var Mt=(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={}))$t.call(e,t)&&Mt(r,t,e[t]);if(Ut)for(var t of Ut(e))zs.call(e,t)&&Mt(r,t,e[t]);return r},ne=(r,e)=>js(r,Hs(e));var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Wt=(r,e)=>{for(var t in e)se(r,t,{get:e[t],enumerable:!0})},jt=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Vs(e))!$t.call(r,n)&&n!==t&&se(r,n,{get:()=>e[n],enumerable:!(s=Ks(e,n))||s.enumerable});return r};var be=(r,e,t)=>(t=r!=null?Ws(Js(r)):{},jt(e||!r||!r.__esModule?se(t,"default",{value:r,enumerable:!0}):t,r)),Qs=r=>jt(se({},"__esModule",{value:!0}),r);var nt=f((Li,Kt)=>{"use strict";Kt.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((Di,Jt)=>{"use strict";var Ys=nt(),ot=Object.prototype.toString,at=function(r){return function(e){var t=ot.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 at(t)===r}}function ct(r){return Array.isArray(r)}function Ce(r){return typeof r>"u"}function Xs(r){return r!==null&&!Ce(r)&&r.constructor!==null&&!Ce(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Ht=U("ArrayBuffer");function Gs(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Ht(r.buffer),e}function Zs(r){return typeof r=="string"}function en(r){return typeof r=="number"}function Vt(r){return r!==null&&typeof r=="object"}function ve(r){if(at(r)!=="object")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}var tn=U("Date"),rn=U("File"),sn=U("Blob"),nn=U("FileList");function ut(r){return ot.call(r)==="[object Function]"}function on(r){return Vt(r)&&ut(r.pipe)}function an(r){var e="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||ot.call(r)===e||ut(r.toString)&&r.toString()===e)}var cn=U("URLSearchParams");function un(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function ln(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function lt(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),ct(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 it(){var r={};function e(n,i){ve(r[i])&&ve(n)?r[i]=it(r[i],n):ve(n)?r[i]=it({},n):ct(n)?r[i]=n.slice():r[i]=n}for(var t=0,s=arguments.length;t<s;t++)lt(arguments[t],e);return r}function hn(r,e,t){return lt(e,function(n,i){t&&typeof n=="function"?r[i]=Ys(n,t):r[i]=n}),r}function fn(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function pn(r,e,t,s){r.prototype=Object.create(e.prototype,s),r.prototype.constructor=r,t&&Object.assign(r.prototype,t)}function dn(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 mn(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 yn(r){if(!r)return null;var e=r.length;if(Ce(e))return null;for(var t=new Array(e);e-- >0;)t[e]=r[e];return t}var gn=function(r){return function(e){return r&&e instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));Jt.exports={isArray:ct,isArrayBuffer:Ht,isBuffer:Xs,isFormData:an,isArrayBufferView:Gs,isString:Zs,isNumber:en,isObject:Vt,isPlainObject:ve,isUndefined:Ce,isDate:tn,isFile:rn,isBlob:sn,isFunction:ut,isStream:on,isURLSearchParams:cn,isStandardBrowserEnv:ln,forEach:lt,merge:it,extend:hn,trim:un,stripBOM:fn,inherits:pn,toFlatObject:dn,kindOf:at,kindOfTest:U,endsWith:mn,toArray:yn,isTypedArray:gn,isFileList:nn}});var ht=f((Ui,Qt)=>{"use strict";var H=v();function zt(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Qt.exports=function(e,t,s){if(!t)return e;var n;if(s)n=s(t);else if(H.isURLSearchParams(t))n=t.toString();else{var i=[];H.forEach(t,function(l,y){l===null||typeof l>"u"||(H.isArray(l)?y=y+"[]":l=[l],H.forEach(l,function(u){H.isDate(u)?u=u.toISOString():H.isObject(u)&&(u=JSON.stringify(u)),i.push(zt(y)+"="+zt(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 Xt=f((Mi,Yt)=>{"use strict";var bn=v();function we(){this.handlers=[]}we.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};we.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};we.prototype.forEach=function(e){bn.forEach(this.handlers,function(s){s!==null&&e(s)})};Yt.exports=we});var Zt=f(($i,Gt)=>{"use strict";var vn=v();Gt.exports=function(e,t){vn.forEach(e,function(n,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[i])})}});var M=f((Wi,sr)=>{"use strict";var er=v();function V(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)}er.inherits(V,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 tr=V.prototype,rr={};["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){rr[r]={value:r}});Object.defineProperties(V,rr);Object.defineProperty(tr,"isAxiosError",{value:!0});V.from=function(r,e,t,s,n,i){var o=Object.create(tr);return er.toFlatObject(r,o,function(l){return l!==Error.prototype}),V.call(o,r.message,e,t,s,n),o.name=r.name,i&&Object.assign(o,i),o};sr.exports=V});var ft=f((ji,nr)=>{"use strict";nr.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var pt=f((Ki,ir)=>{"use strict";var B=v();function Cn(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}ir.exports=Cn});var ar=f((Hi,or)=>{"use strict";var dt=M();or.exports=function(e,t,s){var n=s.config.validateStatus;!s.status||!n||n(s.status)?e(s):t(new dt("Request failed with status code "+s.status,[dt.ERR_BAD_REQUEST,dt.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}});var ur=f((Vi,cr)=>{"use strict";var Ee=v();cr.exports=Ee.isStandardBrowserEnv()?function(){return{write:function(t,s,n,i,o,c){var l=[];l.push(t+"="+encodeURIComponent(s)),Ee.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),Ee.isString(i)&&l.push("path="+i),Ee.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 hr=f((Ji,lr)=>{"use strict";lr.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}});var pr=f((zi,fr)=>{"use strict";fr.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var mt=f((Qi,dr)=>{"use strict";var wn=hr(),En=pr();dr.exports=function(e,t){return e&&!wn(t)?En(e,t):t}});var yr=f((Yi,mr)=>{"use strict";var yt=v(),xn=["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"];mr.exports=function(e){var t={},s,n,i;return e&&yt.forEach(e.split(`
|
|
2
|
-
`),function(c){if(i=c.indexOf(":"),s=yt.trim(c.substr(0,i)).toLowerCase(),n=yt.trim(c.substr(i+1)),s){if(t[s]&&xn.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 vr=f((Xi,br)=>{"use strict";var gr=v();br.exports=gr.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=gr.isString(o)?n(o):o;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}()});var ie=f((Gi,wr)=>{"use strict";var gt=M(),kn=v();function Cr(r){gt.call(this,r==null?"canceled":r,gt.ERR_CANCELED),this.name="CanceledError"}kn.inherits(Cr,gt,{__CANCEL__:!0});wr.exports=Cr});var xr=f((Zi,Er)=>{"use strict";Er.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}});var bt=f((eo,kr)=>{"use strict";var oe=v(),Sn=ar(),Rn=ur(),_n=ht(),An=mt(),On=yr(),Tn=vr(),Pn=ft(),q=M(),Bn=ie(),Nn=xr();kr.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=An(e.baseURL,e.url);a.open(e.method.toUpperCase(),_n(g,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function re(){if(a){var b="getAllResponseHeaders"in a?On(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};Sn(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||Pn;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||Tn(g))&&e.xsrfCookieName?Rn.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 Bn: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=Nn(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 Rr=f((to,Sr)=>{Sr.exports=null});var ke=f((ro,Tr)=>{"use strict";var C=v(),_r=Zt(),Ar=M(),Fn=ft(),qn=pt(),In={"Content-Type":"application/x-www-form-urlencoded"};function Or(r,e){!C.isUndefined(r)&&C.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Ln(){var r;return typeof XMLHttpRequest<"u"?r=bt():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=bt()),r}function Dn(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 xe={transitional:Fn,adapter:Ln(),transformRequest:[function(e,t){if(_r(t,"Accept"),_r(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 Or(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 qn(i?{"files[]":e}:e,o&&new o)}else if(s||n==="application/json")return Or(t,"application/json"),Dn(e);return e}],transformResponse:[function(e){var t=this.transitional||xe.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"?Ar.from(o,Ar.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:Rr()},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};C.forEach(["delete","get","head"],function(e){xe.headers[e]={}});C.forEach(["post","put","patch"],function(e){xe.headers[e]=C.merge(In)});Tr.exports=xe});var Br=f((so,Pr)=>{"use strict";var Un=v(),Mn=ke();Pr.exports=function(e,t,s){var n=this||Mn;return Un.forEach(s,function(o){e=o.call(n,e,t)}),e}});var vt=f((no,Nr)=>{"use strict";Nr.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ir=f((io,qr)=>{"use strict";var Fr=v(),Ct=Br(),$n=vt(),Wn=ke(),jn=ie();function wt(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new jn}qr.exports=function(e){wt(e),e.headers=e.headers||{},e.data=Ct.call(e,e.data,e.headers,e.transformRequest),e.headers=Fr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Fr.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||Wn.adapter;return t(e).then(function(n){return wt(e),n.data=Ct.call(e,n.data,n.headers,e.transformResponse),n},function(n){return $n(n)||(wt(e),n&&n.response&&(n.response.data=Ct.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})}});var Et=f((oo,Lr)=>{"use strict";var R=v();Lr.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 xt=f((ao,Dr)=>{Dr.exports={version:"0.27.2"}});var $r=f((co,Mr)=>{"use strict";var Kn=xt().version,D=M(),kt={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){kt[r]=function(s){return typeof s===r||"a"+(e<1?"n ":" ")+r}});var Ur={};kt.transitional=function(e,t,s){function n(i,o){return"[Axios v"+Kn+"] 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&&!Ur[o]&&(Ur[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 Hn(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)}}Mr.exports={assertOptions:Hn,validators:kt}});var Jr=f((uo,Vr)=>{"use strict";var Kr=v(),Vn=ht(),Wr=Xt(),jr=Ir(),Se=Et(),Jn=mt(),Hr=$r(),J=Hr.validators;function z(r){this.defaults=r,this.interceptors={request:new Wr,response:new Wr}}z.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Se(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&&Hr.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=[jr,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=jr(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=Se(this.defaults,e);var t=Jn(e.baseURL,e.url);return Vn(t,e.params,e.paramsSerializer)};Kr.forEach(["delete","get","head","options"],function(e){z.prototype[e]=function(t,s){return this.request(Se(s||{},{method:e,url:t,data:(s||{}).data}))}});Kr.forEach(["post","put","patch"],function(e){function t(s){return function(i,o,c){return this.request(Se(c||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}z.prototype[e]=t(),z.prototype[e+"Form"]=t(!0)});Vr.exports=z});var Qr=f((lo,zr)=>{"use strict";var zn=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 zn(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}};zr.exports=Q});var Xr=f((ho,Yr)=>{"use strict";Yr.exports=function(e){return function(s){return e.apply(null,s)}}});var Zr=f((fo,Gr)=>{"use strict";var Qn=v();Gr.exports=function(e){return Qn.isObject(e)&&e.isAxiosError===!0}});var rs=f((po,St)=>{"use strict";var es=v(),Yn=nt(),Re=Jr(),Xn=Et(),Gn=ke();function ts(r){var e=new Re(r),t=Yn(Re.prototype.request,e);return es.extend(t,Re.prototype,e),es.extend(t,e),t.create=function(n){return ts(Xn(r,n))},t}var k=ts(Gn);k.Axios=Re;k.CanceledError=ie();k.CancelToken=Qr();k.isCancel=vt();k.VERSION=xt().version;k.toFormData=pt();k.AxiosError=M();k.Cancel=k.CanceledError;k.all=function(e){return Promise.all(e)};k.spread=Xr();k.isAxiosError=Zr();St.exports=k;St.exports.default=k});var ns=f((mo,ss)=>{ss.exports=rs()});var os=f((yo,is)=>{var Y=1e3,X=Y*60,G=X*60,$=G*24,Zn=$*7,ei=$*365.25;is.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return ti(r);if(t==="number"&&isFinite(r))return e.long?si(r):ri(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ti(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*ei;case"weeks":case"week":case"w":return t*Zn;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 ri(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 si(r){var e=Math.abs(r);return e>=$?_e(r,e,$,"day"):e>=G?_e(r,e,G,"hour"):e>=X?_e(r,e,X,"minute"):e>=Y?_e(r,e,Y,"second"):r+" ms"}function _e(r,e,t,s){var n=e>=t*1.5;return Math.round(r/t)+" "+s+(n?"s":"")}});var cs=f((go,as)=>{function ni(r){t.debug=t,t.default=t,t.coerce=l,t.disable=i,t.enable=n,t.enabled=o,t.humanize=os(),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,(st,Ms)=>{if(st==="%%")return"%";K++;let Dt=t.formatters[Ms];if(typeof Dt=="function"){let $s=w[K];st=Dt.call(b,$s),w.splice(K,1),K--}return st}),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}as.exports=ni});var us=f((_,Ae)=>{_.formatArgs=oi;_.save=ai;_.load=ci;_.useColors=ii;_.storage=ui();_.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 ii(){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 oi(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Ae.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 ai(r){try{r?_.storage.setItem("debug",r):_.storage.removeItem("debug")}catch(e){}}function ci(){let r;try{r=_.storage.getItem("debug")}catch(e){}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function ui(){try{return localStorage}catch(r){}}Ae.exports=cs()(_);var{formatters:li}=Ae.exports;li.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Rt=f(($o,ls)=>{ls.exports=typeof self=="object"?self.FormData:window.FormData});var qi={};Wt(qi,{BaseEndpoints:()=>d,Client:()=>Lt,FlowEngineError:()=>I,WebSocketChannel:()=>Ls,WebSocketGateway:()=>ye});var Ds=be(ns()),Us=be(us());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 Oe=class extends d{constructor(e){super(e,"apikeys")}};var Te=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 Pe=class extends d{constructor(e){super(e,"applications")}};var Be=class extends d{constructor(e){super(e,"auth/users")}me(e){return this.client._get(`${this.resourceEndpoint}/me`,{headers:{Authorization:`Bearer ${e}`}})}};var Ne=class{constructor(e){this.client=e;this.users=new Be(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 Fe=class extends d{constructor(e){super(e,"contactpoints")}send(e,t={}){return this.client._post(`${this.resourceEndpoint}/${e}/send`,t)}drivers(){return this.client._get(`${this.resourceEndpoint}/drivers`)}};var qe=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 Ie=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 Le=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 De=class{constructor(e){this.client=e}get(e,t={}){return this.client._get(`/maps/${e}.json`,{params:t})}};var Ue=class extends d{constructor(e){super(e,"maplayers")}subscribe(e){return this.client._subscribe("maplayers",e)}};var hs=be(Rt());var Me=class extends d{constructor(e){super(e,"media")}async upload(e,t,s={}){var o,c;let n=new hs.default;return n.append("id",e),t.type&&n.append("type",t.type),t.mimeType&&n.append("mimeType",t.mimeType),t.metadata&&n.append("metadata",JSON.stringify(t.metadata)),n.append("file",t.data,t.fileName),await this.client._post(this.resourceEndpoint,n,{headers:(c=(o=n.getHeaders)==null?void 0:o.call(n))!=null?c:{"Content-Type":"multipart/form-data"},params:s})}content(e){return this.client._get(`${this.resourceEndpoint}/${e}/content`,{responseType:"stream"})}};var $e=class extends d{constructor(e,t,s){super(e,`pipelines/${t}/components/${s}/metrics`)}};var We=class extends d{constructor(t,s){super(t,`pipelines/${s}/components`);this.pipelineId=s}metrics(t){return new $e(this.client,this.pipelineId,t)}};var je=class extends d{constructor(e){super(e,"pipelines")}components(e){return new We(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 Ke=class extends d{constructor(e){super(e,"styles")}};var He=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 Ve=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 fs=be(Rt());var Je=class extends d{constructor(e){super(e,"uploads")}async upload(e,t={}){var i,o,c;let s=new fs.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 ps={type:"error",data:"parser error"};var hi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",fi=typeof ArrayBuffer=="function",pi=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,di=({type:r,data:e},t,s)=>hi&&e instanceof Blob?t?s(e):ds(e,s):fi&&(e instanceof ArrayBuffer||pi(e))?t?s(e):ds(new Blob([e]),s):s(N[r]+(e||"")),ds=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)},ze=di;var ms="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ce=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<ms.length;r++)ce[ms.charCodeAt(r)]=r;var ys=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 mi=typeof ArrayBuffer=="function",yi=(r,e)=>{if(typeof r!="string")return{type:"message",data:gs(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:gi(r.substring(1),e)}:ae[t]?r.length>1?{type:ae[t],data:r.substring(1)}:{type:ae[t]}:ps},gi=(r,e)=>{if(mi){let t=ys(r);return gs(t,e)}else return{base64:!0,data:r}},gs=(r,e)=>{switch(e){case"blob":return r instanceof ArrayBuffer?new Blob([r]):r;case"arraybuffer":default:return r}},Qe=yi;var bs=String.fromCharCode(30),vs=(r,e)=>{let t=r.length,s=new Array(t),n=0;r.forEach((i,o)=>{ze(i,!1,c=>{s[o]=c,++n===t&&e(s.join(bs))})})},Cs=(r,e)=>{let t=r.split(bs),s=[];for(let n=0;n<t.length;n++){let i=Qe(t[n],e);if(s.push(i),i.type==="error")break}return s},_t=4;function m(r){if(r)return bi(r)}function bi(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 Ye(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var vi=E.setTimeout,Ci=E.clearTimeout;function L(r,e){e.useNativeTimers?(r.setTimeoutFn=vi.bind(E),r.clearTimeoutFn=Ci.bind(E)):(r.setTimeoutFn=E.setTimeout.bind(E),r.clearTimeoutFn=E.clearTimeout.bind(E))}var wi=1.33;function ws(r){return typeof r=="string"?Ei(r):Math.ceil((r.byteLength||r.size)*wi)}function Ei(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 At=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 At(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=Qe(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 Ss="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Ot=64,xi={},Es=0,Xe=0,xs;function ks(r){let e="";do e=Ss[r%Ot]+e,r=Math.floor(r/Ot);while(r>0);return e}function Ge(){let r=ks(+new Date);return r!==xs?(Es=0,xs=r):r+"."+ks(Es++)}for(;Xe<Ot;Xe++)xi[Ss[Xe]]=Xe;function Ze(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Rs(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 _s=!1;try{_s=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(r){}var As=_s;function Tt(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||As))return new XMLHttpRequest}catch(t){}if(!e)try{return new E[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}function ki(){}var Si=function(){return new Tt({xdomain:!1}).responseType!=null}(),et=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=Si&&!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)};Cs(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,vs(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]=Ge()),!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=Ze(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=Ye(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 Tt(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=ki,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",Os);else if(typeof addEventListener=="function"){let r="onpagehide"in E?"pagehide":"unload";addEventListener(r,Os,!1)}}function Os(){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,tt=!0,Ts="arraybuffer";var Ps=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",rt=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=Ps?{}:Ye(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=tt&&!Ps?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||Ts,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;ze(s,this.supportsBinary,i=>{let o={};tt||(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{tt?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]=Ge()),this.supportsBinary||(e.b64=1);let n=Ze(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 Pt={websocket:rt,polling:et};var Ri=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_i=["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=Ri.exec(r||""),i={},o=14;for(;o--;)i[_i[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=Ai(i,i.path),i.queryKey=Oi(i,i.query),i}function Ai(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 Oi(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=Rs(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=_t,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 Pt[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+=ws(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=_t;var ic=A.protocol;function Bs(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 It={};Wt(It,{Decoder:()=>pe,Encoder:()=>Ft,PacketType:()=>p,protocol:()=>Is});var Ti=typeof ArrayBuffer=="function",Pi=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ns=Object.prototype.toString,Bi=typeof Blob=="function"||typeof Blob<"u"&&Ns.call(Blob)==="[object BlobConstructor]",Ni=typeof File=="function"||typeof File<"u"&&Ns.call(File)==="[object FileConstructor]";function fe(r){return Ti&&(r instanceof ArrayBuffer||Pi(r))||Bi&&r instanceof Blob||Ni&&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 Fs(r){let e=[],t=r.data,s=r;return s.data=Bt(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Bt(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]=Bt(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]=Bt(r[s],e));return t}return r}function qs(r,e){return r.data=Nt(r.data,e),delete r.attachments,r}function Nt(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]=Nt(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Nt(r[t],e));return r}var Is=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 Ft=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=Fs(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 qt(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)}},qt=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=qs(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 Fi=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(Fi.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||It;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=Bs(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 Ls=(s=>(s.System="system",s.AppConfig="appconfig",s.Dataset="dataset/",s))(Ls||{}),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 Lt=class{constructor(e,t=null,s){this.baseUrl=e;this.apiKey=t;this.debug=(0,Us.default)("flow-engine-client");this.accessToken=null;this.auth=new Ne(this);this.tiles=new Ve(this);this.maps=new De(this);this.apiKeys=new Oe(this);this.applications=new Pe(this);this.appconfig=new Te(this);this.contactpoints=new Fe(this);this.databases=new qe(this);this.datasets=new Ie(this);this.styles=new Ke(this);this.tileSources=new He(this);this.uploads=new Je(this);this.jobs=new Le(this);this.maplayers=new Ue(this);this.media=new Me(this);this.pipelines=new je(this);this.axios=Ds.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 Qs(qi);})();
|
|
3
|
-
//# sourceMappingURL=bundle.js.map
|
|
1
|
+
"use strict";var FlowEngineClient=(()=>{var gs=Object.create;var ot=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var Es=Object.getPrototypeOf,_s=Object.prototype.hasOwnProperty;var it=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Zt=(r,e)=>{for(var t in e)ot(r,t,{get:e[t],enumerable:!0})},Jr=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ws(e))!_s.call(r,s)&&s!==t&&ot(r,s,{get:()=>e[s],enumerable:!(n=bs(e,s))||n.enumerable});return r};var er=(r,e,t)=>(t=r!=null?gs(Es(r)):{},Jr(e||!r||!r.__esModule?ot(t,"default",{value:r,enumerable:!0}):t,r)),Cs=r=>Jr(ot({},"__esModule",{value:!0}),r);var Pn=it((tl,Tn)=>{var Ce=1e3,xe=Ce*60,Re=xe*60,ae=Re*24,Go=ae*7,Qo=ae*365.25;Tn.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Yo(r);if(t==="number"&&isFinite(r))return e.long?ei(r):Zo(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Yo(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]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Qo;case"weeks":case"week":case"w":return t*Go;case"days":case"day":case"d":return t*ae;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Re;case"minutes":case"minute":case"mins":case"min":case"m":return t*xe;case"seconds":case"second":case"secs":case"sec":case"s":return t*Ce;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Zo(r){var e=Math.abs(r);return e>=ae?Math.round(r/ae)+"d":e>=Re?Math.round(r/Re)+"h":e>=xe?Math.round(r/xe)+"m":e>=Ce?Math.round(r/Ce)+"s":r+"ms"}function ei(r){var e=Math.abs(r);return e>=ae?Ct(r,e,ae,"day"):e>=Re?Ct(r,e,Re,"hour"):e>=xe?Ct(r,e,xe,"minute"):e>=Ce?Ct(r,e,Ce,"second"):r+" ms"}function Ct(r,e,t,n){var s=e>=t*1.5;return Math.round(r/t)+" "+n+(s?"s":"")}});var Nn=it((rl,vn)=>{function ti(r){t.debug=t,t.default=t,t.coerce=l,t.disable=i,t.enable=s,t.enabled=a,t.humanize=Pn(),t.destroy=f,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let p=0;for(let y=0;y<u.length;y++)p=(p<<5)-p+u.charCodeAt(y),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(u){let p,y=null,b,w;function d(...h){if(!d.enabled)return;let m=d,x=Number(new Date),R=x-(p||x);m.diff=R,m.prev=p,m.curr=x,p=x,h[0]=t.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let _=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(q,ne)=>{if(q==="%%")return"%";_++;let fe=t.formatters[ne];if(typeof fe=="function"){let tt=h[_];q=fe.call(m,tt),h.splice(_,1),_--}return q}),t.formatArgs.call(m,h),(m.log||t.log).apply(m,h)}return d.namespace=u,d.useColors=t.useColors(),d.color=t.selectColor(u),d.extend=n,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(b!==t.namespaces&&(b=t.namespaces,w=t.enabled(u)),w),set:h=>{y=h}}),typeof t.init=="function"&&t.init(d),d}function n(u,p){let y=t(this.namespace+(typeof p>"u"?":":p)+u);return y.log=this.log,y}function s(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let p=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let y of p)y[0]==="-"?t.skips.push(y.slice(1)):t.names.push(y)}function o(u,p){let y=0,b=0,w=-1,d=0;for(;y<u.length;)if(b<p.length&&(p[b]===u[y]||p[b]==="*"))p[b]==="*"?(w=b,d=y,b++):(y++,b++);else if(w!==-1)b=w+1,d++,y=d;else return!1;for(;b<p.length&&p[b]==="*";)b++;return b===p.length}function i(){let u=[...t.names,...t.skips.map(p=>"-"+p)].join(",");return t.enable(""),u}function a(u){for(let p of t.skips)if(o(u,p))return!1;for(let p of t.names)if(o(u,p))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function f(){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}vn.exports=ti});var Fn=it((B,xt)=>{B.formatArgs=ni;B.save=si;B.load=oi;B.useColors=ri;B.storage=ii();B.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`."))}})();B.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 ni(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+xt.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(n=t))}),r.splice(n,0,e)}B.log=console.debug||console.log||(()=>{});function si(r){try{r?B.storage.setItem("debug",r):B.storage.removeItem("debug")}catch{}}function oi(){let r;try{r=B.storage.getItem("debug")||B.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function ii(){try{return localStorage}catch{}}xt.exports=Nn()(B);var{formatters:ai}=xt.exports;ai.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var kr=it((Sl,Bn)=>{"use strict";Bn.exports=typeof self=="object"?self.FormData:window.FormData});var vi={};Zt(vi,{BaseEndpoints:()=>C,Client:()=>Hr,FlowEngineError:()=>ce,WebSocketChannel:()=>hs,WebSocketGateway:()=>et});function Ne(r,e){return function(){return r.apply(e,arguments)}}var{toString:xs}=Object.prototype,{getPrototypeOf:ct}=Object,{iterator:ut,toStringTag:Qr}=Symbol,lt=(r=>e=>{let t=xs.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),M=r=>(r=r.toLowerCase(),e=>lt(e)===r),ft=r=>e=>typeof e===r,{isArray:de}=Array,he=ft("undefined");function Fe(r){return r!==null&&!he(r)&&r.constructor!==null&&!he(r.constructor)&&F(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var Yr=M("ArrayBuffer");function Rs(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Yr(r.buffer),e}var Ss=ft("string"),F=ft("function"),Zr=ft("number"),Be=r=>r!==null&&typeof r=="object",As=r=>r===!0||r===!1,at=r=>{if(lt(r)!=="object")return!1;let e=ct(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Qr in r)&&!(ut in r)},Os=r=>{if(!Be(r)||Fe(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},ks=M("Date"),Ts=M("File"),Ps=r=>!!(r&&typeof r.uri<"u"),vs=r=>r&&typeof r.getParts<"u",Ns=M("Blob"),Fs=M("FileList"),Bs=r=>Be(r)&&F(r.pipe);function Ls(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var Xr=Ls(),Gr=typeof Xr.FormData<"u"?Xr.FormData:void 0,Ds=r=>{if(!r)return!1;if(Gr&&r instanceof Gr)return!0;let e=ct(r);if(!e||e===Object.prototype||!F(r.append))return!1;let t=lt(r);return t==="formdata"||t==="object"&&F(r.toString)&&r.toString()==="[object FormData]"},Is=M("URLSearchParams"),[Us,qs,Ms,js]=["ReadableStream","Request","Response","Headers"].map(M),$s=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Le(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),de(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{if(Fe(r))return;let o=t?Object.getOwnPropertyNames(r):Object.keys(r),i=o.length,a;for(n=0;n<i;n++)a=o[n],e.call(null,r[a],a,r)}}function en(r,e){if(Fe(r))return null;e=e.toLowerCase();let t=Object.keys(r),n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}var ie=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tn=r=>!he(r)&&r!==ie;function tr(...r){let{caseless:e,skipUndefined:t}=tn(this)&&this||{},n={},s=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;let a=e&&en(n,i)||i,l=rr(n,a)?n[a]:void 0;at(l)&&at(o)?n[a]=tr(l,o):at(o)?n[a]=tr({},o):de(o)?n[a]=o.slice():(!t||!he(o))&&(n[a]=o)};for(let o=0,i=r.length;o<i;o++)r[o]&&Le(r[o],s);return n}var Hs=(r,e,t,{allOwnKeys:n}={})=>(Le(e,(s,o)=>{t&&F(s)?Object.defineProperty(r,o,{__proto__:null,value:Ne(s,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,o,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),r),Ws=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Vs=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),Object.defineProperty(r.prototype,"constructor",{__proto__:null,value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{__proto__:null,value:e.prototype}),t&&Object.assign(r.prototype,t)},Ks=(r,e,t,n)=>{let s,o,i,a={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),o=s.length;o-- >0;)i=s[o],(!n||n(i,r,e))&&!a[i]&&(e[i]=r[i],a[i]=!0);r=t!==!1&&ct(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},zs=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},Js=r=>{if(!r)return null;if(de(r))return r;let e=r.length;if(!Zr(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Xs=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&ct(Uint8Array)),Gs=(r,e)=>{let n=(r&&r[ut]).call(r),s;for(;(s=n.next())&&!s.done;){let o=s.value;e.call(r,o[0],o[1])}},Qs=(r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},Ys=M("HTMLFormElement"),Zs=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,s){return n.toUpperCase()+s}),rr=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),eo=M("RegExp"),rn=(r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};Le(t,(s,o)=>{let i;(i=e(s,o,r))!==!1&&(n[o]=i||s)}),Object.defineProperties(r,n)},to=r=>{rn(r,(e,t)=>{if(F(r)&&["arguments","caller","callee"].includes(t))return!1;let n=r[t];if(F(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},ro=(r,e)=>{let t={},n=s=>{s.forEach(o=>{t[o]=!0})};return de(r)?n(r):n(String(r).split(e)),t},no=()=>{},so=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function oo(r){return!!(r&&F(r.append)&&r[Qr]==="FormData"&&r[ut])}var io=r=>{let e=new Array(10),t=(n,s)=>{if(Be(n)){if(e.indexOf(n)>=0)return;if(Fe(n))return n;if(!("toJSON"in n)){e[s]=n;let o=de(n)?[]:{};return Le(n,(i,a)=>{let l=t(i,s+1);!he(l)&&(o[a]=l)}),e[s]=void 0,o}}return n};return t(r,0)},ao=M("AsyncFunction"),co=r=>r&&(Be(r)||F(r))&&F(r.then)&&F(r.catch),nn=((r,e)=>r?setImmediate:e?((t,n)=>(ie.addEventListener("message",({source:s,data:o})=>{s===ie&&o===t&&n.length&&n.shift()()},!1),s=>{n.push(s),ie.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",F(ie.postMessage)),uo=typeof queueMicrotask<"u"?queueMicrotask.bind(ie):typeof process<"u"&&process.nextTick||nn,lo=r=>r!=null&&F(r[ut]),c={isArray:de,isArrayBuffer:Yr,isBuffer:Fe,isFormData:Ds,isArrayBufferView:Rs,isString:Ss,isNumber:Zr,isBoolean:As,isObject:Be,isPlainObject:at,isEmptyObject:Os,isReadableStream:Us,isRequest:qs,isResponse:Ms,isHeaders:js,isUndefined:he,isDate:ks,isFile:Ts,isReactNativeBlob:Ps,isReactNative:vs,isBlob:Ns,isRegExp:eo,isFunction:F,isStream:Bs,isURLSearchParams:Is,isTypedArray:Xs,isFileList:Fs,forEach:Le,merge:tr,extend:Hs,trim:$s,stripBOM:Ws,inherits:Vs,toFlatObject:Ks,kindOf:lt,kindOfTest:M,endsWith:zs,toArray:Js,forEachEntry:Gs,matchAll:Qs,isHTMLForm:Ys,hasOwnProperty:rr,hasOwnProp:rr,reduceDescriptors:rn,freezeMethods:to,toObjectSet:ro,toCamelCase:Zs,noop:no,toFiniteNumber:so,findKey:en,global:ie,isContextDefined:tn,isSpecCompliantForm:oo,toJSONObject:io,isAsyncFn:ao,isThenable:co,setImmediate:nn,asap:uo,isIterable:lo};var fo=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sn=r=>{let e={},t,n,s;return r&&r.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),t=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!t||e[t]&&fo[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e};var on=Symbol("internals"),po=/[^\x09\x20-\x7E\x80-\xFF]/g;function ho(r){let e=0,t=r.length;for(;e<t;){let n=r.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;t>e;){let n=r.charCodeAt(t-1);if(n!==9&&n!==32)break;t-=1}return e===0&&t===r.length?r:r.slice(e,t)}function De(r){return r&&String(r).trim().toLowerCase()}function mo(r){return ho(r.replace(po,""))}function pt(r){return r===!1||r==null?r:c.isArray(r)?r.map(pt):mo(String(r))}function yo(r){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}var go=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function nr(r,e,t,n,s){if(c.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function bo(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function wo(r,e){let t=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{__proto__:null,value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}var me=class{constructor(e){e&&this.set(e)}set(e,t,n){let s=this;function o(a,l,f){let u=De(l);if(!u)throw new Error("header name must be a non-empty string");let p=c.findKey(s,u);(!p||s[p]===void 0||f===!0||f===void 0&&s[p]!==!1)&&(s[p||l]=pt(a))}let i=(a,l)=>c.forEach(a,(f,u)=>o(f,u,l));if(c.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(c.isString(e)&&(e=e.trim())&&!go(e))i(sn(e),t);else if(c.isObject(e)&&c.isIterable(e)){let a={},l,f;for(let u of e){if(!c.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[f=u[0]]=(l=a[f])?c.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}i(a,t)}else e!=null&&o(t,e,n);return this}get(e,t){if(e=De(e),e){let n=c.findKey(this,e);if(n){let s=this[n];if(!t)return s;if(t===!0)return yo(s);if(c.isFunction(t))return t.call(this,s,n);if(c.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=De(e),e){let n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||nr(this,this[n],n,t)))}return!1}delete(e,t){let n=this,s=!1;function o(i){if(i=De(i),i){let a=c.findKey(n,i);a&&(!t||nr(n,n[a],a,t))&&(delete n[a],s=!0)}}return c.isArray(e)?e.forEach(o):o(e),s}clear(e){let t=Object.keys(this),n=t.length,s=!1;for(;n--;){let o=t[n];(!e||nr(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){let t=this,n={};return c.forEach(this,(s,o)=>{let i=c.findKey(n,o);if(i){t[i]=pt(s),delete t[o];return}let a=e?bo(o):String(o).trim();a!==o&&delete t[o],t[a]=pt(s),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return c.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&c.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){let n=(this[on]=this[on]={accessors:{}}).accessors,s=this.prototype;function o(i){let a=De(i);n[a]||(wo(s,i),n[a]=!0)}return c.isArray(e)?e.forEach(o):o(e),this}};me.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(me.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}});c.freezeMethods(me);var k=me;var Eo="[REDACTED ****]";function _o(r){if(c.hasOwnProp(r,"toJSON"))return!0;let e=Object.getPrototypeOf(r);for(;e&&e!==Object.prototype;){if(c.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Co(r,e){let t=new Set(e.map(o=>String(o).toLowerCase())),n=[],s=o=>{if(o===null||typeof o!="object"||c.isBuffer(o))return o;if(n.indexOf(o)!==-1)return;o instanceof k&&(o=o.toJSON()),n.push(o);let i;if(c.isArray(o))i=[],o.forEach((a,l)=>{let f=s(a);c.isUndefined(f)||(i[l]=f)});else{if(!c.isPlainObject(o)&&_o(o))return n.pop(),o;i=Object.create(null);for(let[a,l]of Object.entries(o)){let f=t.has(a.toLowerCase())?Eo:s(l);c.isUndefined(f)||(i[a]=f)}}return n.pop(),i};return s(r)}var P=class r extends Error{static from(e,t,n,s,o,i){let a=new r(e.message,t||e.code,n,s,o);return a.cause=e,a.name=e.name,e.status!=null&&a.status==null&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,s,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){let e=this.config,t=e&&c.hasOwnProp(e,"redact")?e.redact:void 0,n=c.isArray(t)&&t.length>0?Co(e,t):c.toJSONObject(e);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:n,code:this.code,status:this.status}}};P.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";P.ERR_BAD_OPTION="ERR_BAD_OPTION";P.ECONNABORTED="ECONNABORTED";P.ETIMEDOUT="ETIMEDOUT";P.ECONNREFUSED="ECONNREFUSED";P.ERR_NETWORK="ERR_NETWORK";P.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";P.ERR_DEPRECATED="ERR_DEPRECATED";P.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";P.ERR_BAD_REQUEST="ERR_BAD_REQUEST";P.ERR_CANCELED="ERR_CANCELED";P.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";P.ERR_INVALID_URL="ERR_INVALID_URL";P.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var g=P;var ht=null;function or(r){return c.isPlainObject(r)||c.isArray(r)}function an(r){return c.endsWith(r,"[]")?r.slice(0,-2):r}function sr(r,e,t){return r?r.concat(e).map(function(s,o){return s=an(s),!t&&o?"["+s+"]":s}).join(t?".":""):e}function xo(r){return c.isArray(r)&&!r.some(or)}var Ro=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function So(r,e,t){if(!c.isObject(r))throw new TypeError("target must be an object");e=e||new(ht||FormData),t=c.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,m){return!c.isUndefined(m[h])});let n=t.metaTokens,s=t.visitor||p,o=t.dots,i=t.indexes,a=t.Blob||typeof Blob<"u"&&Blob,l=t.maxDepth===void 0?100:t.maxDepth,f=a&&c.isSpecCompliantForm(e);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(c.isDate(d))return d.toISOString();if(c.isBoolean(d))return d.toString();if(!f&&c.isBlob(d))throw new g("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(d)||c.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function p(d,h,m){let x=d;if(c.isReactNative(e)&&c.isReactNativeBlob(d))return e.append(sr(m,h,o),u(d)),!1;if(d&&!m&&typeof d=="object"){if(c.endsWith(h,"{}"))h=n?h:h.slice(0,-2),d=JSON.stringify(d);else if(c.isArray(d)&&xo(d)||(c.isFileList(d)||c.endsWith(h,"[]"))&&(x=c.toArray(d)))return h=an(h),x.forEach(function(_,L){!(c.isUndefined(_)||_===null)&&e.append(i===!0?sr([h],L,o):i===null?h:h+"[]",u(_))}),!1}return or(d)?!0:(e.append(sr(m,h,o),u(d)),!1)}let y=[],b=Object.assign(Ro,{defaultVisitor:p,convertValue:u,isVisitable:or});function w(d,h,m=0){if(!c.isUndefined(d)){if(m>l)throw new g("Object is too deeply nested ("+m+" levels). Max depth: "+l,g.ERR_FORM_DATA_DEPTH_EXCEEDED);if(y.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));y.push(d),c.forEach(d,function(R,_){(!(c.isUndefined(R)||R===null)&&s.call(e,R,c.isString(_)?_.trim():_,h,b))===!0&&w(R,h?h.concat(_):[_],m+1)}),y.pop()}}if(!c.isObject(r))throw new TypeError("data must be an object");return w(r),e}var Z=So;function cn(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,function(n){return e[n]})}function un(r,e){this._pairs=[],r&&Z(r,this,e)}var ln=un.prototype;ln.append=function(e,t){this._pairs.push([e,t])};ln.toString=function(e){let t=e?function(n){return e.call(this,n,cn)}:cn;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};var dt=un;function Ao(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ie(r,e,t){if(!e)return r;let n=t&&t.encode||Ao,s=c.isFunction(t)?{serialize:t}:t,o=s&&s.serialize,i;if(o?i=o(e,s):i=c.isURLSearchParams(e)?e.toString():new dt(e,s).toString(n),i){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+i}return r}var ir=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}},ar=ir;var ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var fn=typeof URLSearchParams<"u"?URLSearchParams:dt;var pn=typeof FormData<"u"?FormData:null;var hn=typeof Blob<"u"?Blob:null;var dn={isBrowser:!0,classes:{URLSearchParams:fn,FormData:pn,Blob:hn},protocols:["http","https","file","blob","url","data"]};var lr={};Zt(lr,{hasBrowserEnv:()=>ur,hasStandardBrowserEnv:()=>Oo,hasStandardBrowserWebWorkerEnv:()=>ko,navigator:()=>cr,origin:()=>To});var ur=typeof window<"u"&&typeof document<"u",cr=typeof navigator=="object"&&navigator||void 0,Oo=ur&&(!cr||["ReactNative","NativeScript","NS"].indexOf(cr.product)<0),ko=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",To=ur&&window.location.href||"http://localhost";var O={...lr,...dn};function fr(r,e){return Z(r,new O.classes.URLSearchParams,{visitor:function(t,n,s,o){return O.isNode&&c.isBuffer(t)?(this.append(n,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Po(r){return c.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function vo(r){let e={},t=Object.keys(r),n,s=t.length,o;for(n=0;n<s;n++)o=t[n],e[o]=r[o];return e}function No(r){function e(t,n,s,o){let i=t[o++];if(i==="__proto__")return!0;let a=Number.isFinite(+i),l=o>=t.length;return i=!i&&c.isArray(s)?s.length:i,l?(c.hasOwnProp(s,i)?s[i]=c.isArray(s[i])?s[i].concat(n):[s[i],n]:s[i]=n,!a):((!s[i]||!c.isObject(s[i]))&&(s[i]=[]),e(t,n,s[i],o)&&c.isArray(s[i])&&(s[i]=vo(s[i])),!a)}if(c.isFormData(r)&&c.isFunction(r.entries)){let t={};return c.forEachEntry(r,(n,s)=>{e(Po(n),s,t,0)}),t}return null}var mt=No;var ge=(r,e)=>r!=null&&c.hasOwnProp(r,e)?r[e]:void 0;function Fo(r,e,t){if(c.isString(r))try{return(e||JSON.parse)(r),c.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var pr={transitional:ye,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let n=t.getContentType()||"",s=n.indexOf("application/json")>-1,o=c.isObject(e);if(o&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return s?JSON.stringify(mt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e)||c.isReadableStream(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){let l=ge(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return fr(e,l).toString();if((a=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){let f=ge(this,"env"),u=f&&f.FormData;return Z(a?{"files[]":e}:e,u&&new u,l)}}return o||s?(t.setContentType("application/json",!1),Fo(e)):e}],transformResponse:[function(e){let t=ge(this,"transitional")||pr.transitional,n=t&&t.forcedJSONParsing,s=ge(this,"responseType"),o=s==="json";if(c.isResponse(e)||c.isReadableStream(e))return e;if(e&&c.isString(e)&&(n&&!s||o)){let a=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,ge(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?g.from(l,g.ERR_BAD_RESPONSE,this,null,ge(this,"response")):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:O.classes.FormData,Blob:O.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch","query"],r=>{pr.headers[r]={}});var be=pr;function Ue(r,e){let t=this||be,n=e||t,s=k.from(n.headers),o=n.data;return c.forEach(r,function(a){o=a.call(t,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function qe(r){return!!(r&&r.__CANCEL__)}var hr=class extends g{constructor(e,t,n){super(e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}},V=hr;function Me(r,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new g("Request failed with status code "+t.status,t.status>=400&&t.status<500?g.ERR_BAD_REQUEST:g.ERR_BAD_RESPONSE,t.config,t.request,t))}function dr(r){let e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(r);return e&&e[1]||""}function Bo(r,e){r=r||10;let t=new Array(r),n=new Array(r),s=0,o=0,i;return e=e!==void 0?e:1e3,function(l){let f=Date.now(),u=n[o];i||(i=f),t[s]=l,n[s]=f;let p=o,y=0;for(;p!==s;)y+=t[p++],p=p%r;if(s=(s+1)%r,s===o&&(o=(o+1)%r),f-i<e)return;let b=u&&f-u;return b?Math.round(y*1e3/b):void 0}}var mn=Bo;function Lo(r,e){let t=0,n=1e3/e,s,o,i=(f,u=Date.now())=>{t=u,s=null,o&&(clearTimeout(o),o=null),r(...f)};return[(...f)=>{let u=Date.now(),p=u-t;p>=n?i(f,u):(s=f,o||(o=setTimeout(()=>{o=null,i(s)},n-p)))},()=>s&&i(s)]}var yn=Lo;var we=(r,e,t=3)=>{let n=0,s=mn(50,250);return yn(o=>{let i=o.loaded,a=o.lengthComputable?o.total:void 0,l=a!=null?Math.min(i,a):i,f=Math.max(0,l-n),u=s(f);n=Math.max(n,l);let p={loaded:l,total:a,progress:a?l/a:void 0,bytes:f,rate:u||void 0,estimated:u&&a?(a-l)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};r(p)},t)},mr=(r,e)=>{let t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},yr=r=>(...e)=>c.asap(()=>r(...e));var gn=O.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,O.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(O.origin),O.navigator&&/(msie|trident)/i.test(O.navigator.userAgent)):()=>!0;var bn=O.hasStandardBrowserEnv?{write(r,e,t,n,s,o,i){if(typeof document>"u")return;let a=[`${r}=${encodeURIComponent(e)}`];c.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),c.isString(n)&&a.push(`path=${n}`),c.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),c.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(r){if(typeof document>"u")return null;let e=document.cookie.split(";");for(let t=0;t<e.length;t++){let n=e[t].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===r)return decodeURIComponent(n.slice(s+1))}return null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function gr(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function br(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function je(r,e,t){let n=!gr(e);return r&&(n||t===!1)?br(r,e):e}var wn=r=>r instanceof k?{...r}:r;function j(r,e){e=e||{};let t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,u,p,y){return c.isPlainObject(f)&&c.isPlainObject(u)?c.merge.call({caseless:y},f,u):c.isPlainObject(u)?c.merge({},u):c.isArray(u)?u.slice():u}function s(f,u,p,y){if(c.isUndefined(u)){if(!c.isUndefined(f))return n(void 0,f,p,y)}else return n(f,u,p,y)}function o(f,u){if(!c.isUndefined(u))return n(void 0,u)}function i(f,u){if(c.isUndefined(u)){if(!c.isUndefined(f))return n(void 0,f)}else return n(void 0,u)}function a(f,u,p){if(c.hasOwnProp(e,p))return n(f,u);if(c.hasOwnProp(r,p))return n(void 0,f)}let l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:a,headers:(f,u,p)=>s(wn(f),wn(u),p,!0)};return c.forEach(Object.keys({...r,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let p=c.hasOwnProp(l,u)?l[u]:s,y=c.hasOwnProp(r,u)?r[u]:void 0,b=c.hasOwnProp(e,u)?e[u]:void 0,w=p(y,b,u);c.isUndefined(w)&&p!==a||(t[u]=w)}),t}var Do=["content-type","content-length"];function Io(r,e,t){if(t!=="content-only"){r.set(e);return}Object.entries(e).forEach(([n,s])=>{Do.includes(n.toLowerCase())&&r.set(n,s)})}var Uo=r=>encodeURIComponent(r).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),yt=r=>{let e=j({},r),t=y=>c.hasOwnProp(e,y)?e[y]:void 0,n=t("data"),s=t("withXSRFToken"),o=t("xsrfHeaderName"),i=t("xsrfCookieName"),a=t("headers"),l=t("auth"),f=t("baseURL"),u=t("allowAbsoluteUrls"),p=t("url");if(e.headers=a=k.from(a),e.url=Ie(je(f,p,u),r.params,r.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?Uo(l.password):""))),c.isFormData(n)&&(O.hasStandardBrowserEnv||O.hasStandardBrowserWebWorkerEnv?a.setContentType(void 0):c.isFunction(n.getHeaders)&&Io(a,n.getHeaders(),t("formDataHeaderPolicy"))),O.hasStandardBrowserEnv&&(c.isFunction(s)&&(s=s(e)),s===!0||s==null&&gn(e.url))){let b=o&&i&&bn.read(i);b&&a.set(o,b)}return e};var qo=typeof XMLHttpRequest<"u",En=qo&&function(r){return new Promise(function(t,n){let s=yt(r),o=s.data,i=k.from(s.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:f}=s,u,p,y,b,w;function d(){b&&b(),w&&w(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function m(){if(!h)return;let R=k.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:R,config:r,request:h};Me(function(ne){t(ne),d()},function(ne){n(ne),d()},L),h=null}"onloadend"in h?h.onloadend=m:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(m)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,r,h)),d(),h=null)},h.onerror=function(_){let L=_&&_.message?_.message:"Network Error",q=new g(L,g.ERR_NETWORK,r,h);q.event=_||null,n(q),d(),h=null},h.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",L=s.transitional||ye;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),n(new g(_,L.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,r,h)),d(),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&c.forEach(i.toJSON(),function(_,L){h.setRequestHeader(L,_)}),c.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),f&&([y,w]=we(f,!0),h.addEventListener("progress",y)),l&&h.upload&&([p,b]=we(l),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",b)),(s.cancelToken||s.signal)&&(u=R=>{h&&(n(!R||R.type?new V(null,r,h):R),h.abort(),d(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));let x=dr(s.url);if(x&&!O.protocols.includes(x)){n(new g("Unsupported protocol "+x+":",g.ERR_BAD_REQUEST,r));return}h.send(o||null)})};var Mo=(r,e)=>{let{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s,o=function(f){if(!s){s=!0,a();let u=f instanceof Error?f:this.reason;n.abort(u instanceof g?u:new V(u instanceof Error?u.message:u))}},i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e),a=()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),r=null)};r.forEach(f=>f.addEventListener("abort",o));let{signal:l}=n;return l.unsubscribe=()=>c.asap(a),l}},_n=Mo;var jo=function*(r,e){let t=r.byteLength;if(!e||t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},$o=async function*(r,e){for await(let t of Ho(r))yield*jo(t,e)},Ho=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},wr=(r,e,t,n)=>{let s=$o(r,e),o=0,i,a=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{let{done:f,value:u}=await s.next();if(f){a(),l.close();return}let p=u.byteLength;if(t){let y=o+=p;t(y)}l.enqueue(new Uint8Array(u))}catch(f){throw a(f),f}},cancel(l){return a(l),s.return()}},{highWaterMark:2})};function Er(r){if(!r||typeof r!="string"||!r.startsWith("data:"))return 0;let e=r.indexOf(",");if(e<0)return 0;let t=r.slice(5,e),n=r.slice(e+1);if(/;base64/i.test(t)){let i=n.length,a=n.length;for(let b=0;b<a;b++)if(n.charCodeAt(b)===37&&b+2<a){let w=n.charCodeAt(b+1),d=n.charCodeAt(b+2);(w>=48&&w<=57||w>=65&&w<=70||w>=97&&w<=102)&&(d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102)&&(i-=2,b+=2)}let l=0,f=a-1,u=b=>b>=2&&n.charCodeAt(b-2)===37&&n.charCodeAt(b-1)===51&&(n.charCodeAt(b)===68||n.charCodeAt(b)===100);f>=0&&(n.charCodeAt(f)===61?(l++,f--):u(f)&&(l++,f-=3)),l===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&l++;let y=Math.floor(i/4)*3-(l||0);return y>0?y:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(n,"utf8");let o=0;for(let i=0,a=n.length;i<a;i++){let l=n.charCodeAt(i);if(l<128)o+=1;else if(l<2048)o+=2;else if(l>=55296&&l<=56319&&i+1<a){let f=n.charCodeAt(i+1);f>=56320&&f<=57343?(o+=4,i++):o+=3}else o+=3}return o}var Ee="1.16.0";var Cn=64*1024,{isFunction:gt}=c,xn=(r,...e)=>{try{return!!r(...e)}catch{return!1}},Wo=r=>{let e=c.global??globalThis,{ReadableStream:t,TextEncoder:n}=e;r=c.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},r);let{fetch:s,Request:o,Response:i}=r,a=s?gt(s):typeof fetch=="function",l=gt(o),f=gt(i);if(!a)return!1;let u=a&>(t),p=a&&(typeof n=="function"?(m=>x=>m.encode(x))(new n):async m=>new Uint8Array(await new o(m).arrayBuffer())),y=l&&u&&xn(()=>{let m=!1,x=new o(O.origin,{body:new t,method:"POST",get duplex(){return m=!0,"half"}}),R=x.headers.has("Content-Type");return x.body!=null&&x.body.cancel(),m&&!R}),b=f&&u&&xn(()=>c.isReadableStream(new i("").body)),w={stream:b&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!w[m]&&(w[m]=(x,R)=>{let _=x&&x[m];if(_)return _.call(x);throw new g(`Response type '${m}' is not supported`,g.ERR_NOT_SUPPORT,R)})});let d=async m=>{if(m==null)return 0;if(c.isBlob(m))return m.size;if(c.isSpecCompliantForm(m))return(await new o(O.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(c.isArrayBufferView(m)||c.isArrayBuffer(m))return m.byteLength;if(c.isURLSearchParams(m)&&(m=m+""),c.isString(m))return(await p(m)).byteLength},h=async(m,x)=>{let R=c.toFiniteNumber(m.getContentLength());return R??d(x)};return async m=>{let{url:x,method:R,data:_,signal:L,cancelToken:q,timeout:ne,onDownloadProgress:fe,onUploadProgress:tt,responseType:G,headers:se,withCredentials:rt="same-origin",fetchOptions:Wr,maxContentLength:H,maxBodyLength:Qt}=yt(m),Pe=c.isNumber(H)&&H>-1,ms=c.isNumber(Qt)&&Qt>-1,Vr=s||fetch;G=G?(G+"").toLowerCase():"text";let Q=_n([L,q&&q.toAbortSignal()],ne),I=null,oe=Q&&Q.unsubscribe&&(()=>{Q.unsubscribe()}),Kr;try{if(Pe&&typeof x=="string"&&x.startsWith("data:")&&Er(x)>H)throw new g("maxContentLength size of "+H+" exceeded",g.ERR_BAD_RESPONSE,m,I);if(ms&&R!=="get"&&R!=="head"){let S=await h(se,_);if(typeof S=="number"&&isFinite(S)&&S>Qt)throw new g("Request body larger than maxBodyLength limit",g.ERR_BAD_REQUEST,m,I)}if(tt&&y&&R!=="get"&&R!=="head"&&(Kr=await h(se,_))!==0){let S=new o(x,{method:"POST",body:_,duplex:"half"}),pe;if(c.isFormData(_)&&(pe=S.headers.get("content-type"))&&se.setContentType(pe),S.body){let[nt,st]=mr(Kr,we(yr(tt)));_=wr(S.body,Cn,nt,st)}}c.isString(rt)||(rt=rt?"include":"omit");let v=l&&"credentials"in o.prototype;if(c.isFormData(_)){let S=se.getContentType();S&&/^multipart\/form-data/i.test(S)&&!/boundary=/i.test(S)&&se.delete("content-type")}se.set("User-Agent","axios/"+Ee,!1);let Y={...Wr,signal:Q,method:R.toUpperCase(),headers:se.normalize().toJSON(),body:_,duplex:"half",credentials:v?rt:void 0};I=l&&new o(x,Y);let W=await(l?Vr(I,Wr):Vr(x,Y));if(Pe){let S=c.toFiniteNumber(W.headers.get("content-length"));if(S!=null&&S>H)throw new g("maxContentLength size of "+H+" exceeded",g.ERR_BAD_RESPONSE,m,I)}let Yt=b&&(G==="stream"||G==="response");if(b&&W.body&&(fe||Pe||Yt&&oe)){let S={};["status","statusText","headers"].forEach(ve=>{S[ve]=W[ve]});let pe=c.toFiniteNumber(W.headers.get("content-length")),[nt,st]=fe&&mr(pe,we(yr(fe),!0))||[],zr=0,ys=ve=>{if(Pe&&(zr=ve,zr>H))throw new g("maxContentLength size of "+H+" exceeded",g.ERR_BAD_RESPONSE,m,I);nt&&nt(ve)};W=new i(wr(W.body,Cn,ys,()=>{st&&st(),oe&&oe()}),S)}G=G||"text";let K=await w[c.findKey(w,G)||"text"](W,m);if(Pe&&!b&&!Yt){let S;if(K!=null&&(typeof K.byteLength=="number"?S=K.byteLength:typeof K.size=="number"?S=K.size:typeof K=="string"&&(S=typeof n=="function"?new n().encode(K).byteLength:K.length)),typeof S=="number"&&S>H)throw new g("maxContentLength size of "+H+" exceeded",g.ERR_BAD_RESPONSE,m,I)}return!Yt&&oe&&oe(),await new Promise((S,pe)=>{Me(S,pe,{data:K,headers:k.from(W.headers),status:W.status,statusText:W.statusText,config:m,request:I})})}catch(v){if(oe&&oe(),Q&&Q.aborted&&Q.reason instanceof g){let Y=Q.reason;throw Y.config=m,I&&(Y.request=I),v!==Y&&(Y.cause=v),Y}throw v&&v.name==="TypeError"&&/Load failed|fetch/i.test(v.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,m,I,v&&v.response),{cause:v.cause||v}):g.from(v,v&&v.code,m,I,v&&v.response)}}},Vo=new Map,_r=r=>{let e=r&&r.env||{},{fetch:t,Request:n,Response:s}=e,o=[n,s,t],i=o.length,a=i,l,f,u=Vo;for(;a--;)l=o[a],f=u.get(l),f===void 0&&u.set(l,f=a?new Map:Wo(e)),u=f;return f},Mc=_r();var Cr={http:ht,xhr:En,fetch:{get:_r}};c.forEach(Cr,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(r,"adapterName",{__proto__:null,value:e})}});var Rn=r=>`- ${r}`,zo=r=>c.isFunction(r)||r===null||r===!1;function Jo(r,e){r=c.isArray(r)?r:[r];let{length:t}=r,n,s,o={};for(let i=0;i<t;i++){n=r[i];let a;if(s=n,!zo(n)&&(s=Cr[(a=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${a}'`);if(s&&(c.isFunction(s)||(s=s.get(e))))break;o[a||"#"+i]=s}if(!s){let i=Object.entries(o).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build")),a=t?i.length>1?`since :
|
|
4
|
+
`+i.map(Rn).join(`
|
|
5
|
+
`):" "+Rn(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}var bt={getAdapter:Jo,adapters:Cr};function xr(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new V(null,r)}function wt(r){return xr(r),r.headers=k.from(r.headers),r.data=Ue.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),bt.getAdapter(r.adapter||be.adapter,r)(r).then(function(n){xr(r),r.response=n;try{n.data=Ue.call(r,r.transformResponse,n)}finally{delete r.response}return n.headers=k.from(n.headers),n},function(n){if(!qe(n)&&(xr(r),n&&n.response)){r.response=n.response;try{n.response.data=Ue.call(r,r.transformResponse,n.response)}finally{delete r.response}n.response.headers=k.from(n.response.headers)}return Promise.reject(n)})}var Et={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{Et[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var Sn={};Et.transitional=function(e,t,n){function s(o,i){return"[Axios v"+Ee+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,a)=>{if(e===!1)throw new g(s(i," has been removed"+(t?" in "+t:"")),g.ERR_DEPRECATED);return t&&!Sn[i]&&(Sn[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,i,a):!0}};Et.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Xo(r,e,t){if(typeof r!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);let n=Object.keys(r),s=n.length;for(;s-- >0;){let o=n[s],i=Object.prototype.hasOwnProperty.call(e,o)?e[o]:void 0;if(i){let a=r[o],l=a===void 0||i(a,o,r);if(l!==!0)throw new g("option "+o+" must be "+l,g.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}var $e={assertOptions:Xo,validators:Et};var U=$e.validators,_e=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ar,response:new ar}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;let o=(()=>{if(!s.stack)return"";let i=s.stack.indexOf(`
|
|
6
|
+
`);return i===-1?"":s.stack.slice(i+1)})();try{if(!n.stack)n.stack=o;else if(o){let i=o.indexOf(`
|
|
7
|
+
`),a=i===-1?-1:o.indexOf(`
|
|
8
|
+
`,i+1),l=a===-1?"":o.slice(a+1);String(n.stack).endsWith(l)||(n.stack+=`
|
|
9
|
+
`+o)}}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=j(this.defaults,t);let{transitional:n,paramsSerializer:s,headers:o}=t;n!==void 0&&$e.assertOptions(n,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean),legacyInterceptorReqResOrdering:U.transitional(U.boolean)},!1),s!=null&&(c.isFunction(s)?t.paramsSerializer={serialize:s}:$e.assertOptions(s,{encode:U.function,serialize:U.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),$e.assertOptions(t,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[t.method]);o&&c.forEach(["delete","get","head","post","put","patch","query","common"],w=>{delete o[w]}),t.headers=k.concat(i,o);let a=[],l=!0;this.interceptors.request.forEach(function(d){if(typeof d.runWhen=="function"&&d.runWhen(t)===!1)return;l=l&&d.synchronous;let h=t.transitional||ye;h&&h.legacyInterceptorReqResOrdering?a.unshift(d.fulfilled,d.rejected):a.push(d.fulfilled,d.rejected)});let f=[];this.interceptors.response.forEach(function(d){f.push(d.fulfilled,d.rejected)});let u,p=0,y;if(!l){let w=[wt.bind(this),void 0];for(w.unshift(...a),w.push(...f),y=w.length,u=Promise.resolve(t);p<y;)u=u.then(w[p++],w[p++]);return u}y=a.length;let b=t;for(;p<y;){let w=a[p++],d=a[p++];try{b=w(b)}catch(h){d.call(this,h);break}}try{u=wt.call(this,b)}catch(w){return Promise.reject(w)}for(p=0,y=f.length;p<y;)u=u.then(f[p++],f[p++]);return u}getUri(e){e=j(this.defaults,e);let t=je(e.baseURL,e.url,e.allowAbsoluteUrls);return Ie(t,e.params,e.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(e){_e.prototype[e]=function(t,n){return this.request(j(n||{},{method:e,url:t,data:(n||{}).data}))}});c.forEach(["post","put","patch","query"],function(e){function t(n){return function(o,i,a){return this.request(j(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}_e.prototype[e]=t(),e!=="query"&&(_e.prototype[e+"Form"]=t(!0))});var He=_e;var Rr=class r{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});let n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o,i=new Promise(a=>{n.subscribe(a),o=a}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,a){n.reason||(n.reason=new V(o,i,a),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=n=>{e.abort(n)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new r(function(s){e=s}),cancel:e}}},An=Rr;function Sr(r){return function(t){return r.apply(null,t)}}function Ar(r){return c.isObject(r)&&r.isAxiosError===!0}var Or={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Or).forEach(([r,e])=>{Or[e]=r});var On=Or;function kn(r){let e=new He(r),t=Ne(He.prototype.request,e);return c.extend(t,He.prototype,e,{allOwnKeys:!0}),c.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return kn(j(r,s))},t}var T=kn(be);T.Axios=He;T.CanceledError=V;T.CancelToken=An;T.isCancel=qe;T.VERSION=Ee;T.toFormData=Z;T.AxiosError=g;T.Cancel=T.CanceledError;T.all=function(e){return Promise.all(e)};T.spread=Sr;T.isAxiosError=Ar;T.mergeConfig=j;T.AxiosHeaders=k;T.formToJSON=r=>mt(c.isHTMLForm(r)?new FormData(r):r);T.getAdapter=bt.getAdapter;T.HttpStatusCode=On;T.default=T;var _t=T;var{Axios:Iu,AxiosError:Uu,CanceledError:qu,isCancel:Mu,CancelToken:ju,VERSION:$u,all:Hu,Cancel:Wu,isAxiosError:Vu,spread:Ku,toFormData:zu,AxiosHeaders:Ju,HttpStatusCode:Xu,formToJSON:Gu,getAdapter:Qu,mergeConfig:Yu,create:Zu}=_t;var ds=er(Fn(),1);var C=class{constructor(e,t){this.client=e;this.resourcePath=t}get resourceEndpoint(){return`/api/v1/${this.resourcePath}`}list(e){if(e?.filter){let t=e.filter;Object.keys(t).forEach(n=>{e[`filter[${n}]`]=t[n]}),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,n={}){return this.client._put(`${this.resourceEndpoint}/${e}`,t,{params:n})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}getMetadata(e,t,n={}){let s=t?`${this.resourceEndpoint}/${e}/metadata/${t}`:`${this.resourceEndpoint}/${e}/metadata`;return this.client._get(s,{params:n})}setMetadata(e,t,n,s={}){return(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&(n={value:n}),this.client._put(`${this.resourceEndpoint}/${e}/metadata/${t}`,n,{headers:{"Content-Type":"application/json"},params:s})}deleteMetadata(e,t,n={}){return this.client._delete(`${this.resourceEndpoint}/${e}/metadata/${t}`,{headers:{"Content-Type":"application/json"},params:n})}};var Rt=class extends C{constructor(e){super(e,"apikeys")}};var St=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,n={}){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:n})}delete(e,t={}){return this.client._delete(`${this.resourceEndpoint}/${e}`,{params:t})}subscribe(e){return this.client._subscribe("appconfig",e)}};var At=class extends C{constructor(e){super(e,"applications")}};var Ot=class extends C{constructor(e){super(e,"auth/users")}me(e){return this.client._get(`${this.resourceEndpoint}/me`,{headers:{Authorization:`Bearer ${e}`}})}};var kt=class{constructor(e){this.client=e;this.users=new Ot(this.client)}login(e,t,n){return this.client._post("/api/v1/auth/login",{email:e,password:t,applicationId:n})}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,n){return this.client._post("/api/v1/auth/changepassword",{password:e,newPassword:t},{headers:{Authorization:`Bearer ${n}`}})}signUp(e,t,n,s,o,i,a){return a||(a=i,i=`${this.client.baseUrl}/api/v1/auth/confirmsignup`),this.client._post("/api/v1/auth/signup",{firstName:e,lastName:t,email:n,password:s,applicationId:o,confirmUrl:i,redirectUrl:a})}confirmSignUp(e,t,n){return this.client._get("/api/v1/auth/confirmsignup",{params:{email:e,token:t,redirect:n}})}requestPasswordReset(e,t,n){return this.client._post("/api/v1/auth/requestpasswordreset",{email:e,applicationId:t,redirectUrl:n})}resetPassword(e,t,n,s){return this.client._post("/api/v1/auth/resetpassword",{email:e,password:t,applicationId:n,token:s})}};var Tt=class extends C{constructor(e){super(e,"contactpoints")}send(e,t={}){return this.client._post(`${this.resourceEndpoint}/${e}/send`,t)}drivers(){return this.client._get(`${this.resourceEndpoint}/drivers`)}};var Pt=class extends C{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 vt=class extends C{constructor(e){super(e,"datasets")}query(e,t={},n={}){typeof e=="object"&&(n={...e.params,format:e.format||"json"},t=e,e=t.datasetId,delete t.datasetId,delete t.format),typeof n=="string"&&(n={format:n});let s=null;return n.abortController&&(s=n.abortController,delete n.abortController),this.client._post(`/api/v1/datasets/${e}/query`,t,{params:{...n,format:n.format||"json",explain:n.explain||!1},signal:s?.signal}).catch(o=>{throw o.message==="Network Error"?new Error("Query timed out"):o})}ingest(e,t={}){return this.client._post(`/api/v1/datasets/${e.datasetId}/ingest`,e,t)}getExportUrl(e,t){let n=this.client.accessToken?`accesstoken=${this.client.accessToken}`:`apikey=${this.client.apiKey}`;return`${this.client.baseUrl}/api/v1/datasets/${e}/export?format=${t}&${n}`}subscribe(e,t){return this.client._subscribe(`dataset/${e}`,t)}};var ce=class r extends Error{constructor(e,t=null,n=500){super(e||"Unknown Error"),Object.setPrototypeOf(this,r.prototype),this.statusCode=n,this.error=t}};var Nt=class extends C{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 Ft=class{constructor(e){this.client=e}get(e,t={}){return this.client._get(`/maps/${e}.json`,{params:t})}};var Bt=class extends C{constructor(e){super(e,"maplayers")}subscribe(e){return this.client._subscribe("maplayers",e)}};var Ln=er(kr(),1);var Lt=class extends C{constructor(e){super(e,"media")}async upload(e,t,n={}){let s=new Ln.default;return s.append("id",e),t.type&&s.append("type",t.type),t.mimeType&&s.append("mimeType",t.mimeType),t.metadata&&s.append("metadata",JSON.stringify(t.metadata)),s.append("file",t.data,t.fileName),await this.client._post(this.resourceEndpoint,s,{headers:s.getHeaders?.()??{"Content-Type":"multipart/form-data"},params:n})}content(e){return this.client._get(`${this.resourceEndpoint}/${e}/content`,{responseType:"stream"})}};var Dt=class extends C{constructor(e,t,n){super(e,`pipelines/${t}/components/${n}/metrics`)}};var It=class extends C{constructor(t,n){super(t,`pipelines/${n}/components`);this.pipelineId=n}metrics(t){return new Dt(this.client,this.pipelineId,t)}};var Ut=class extends C{constructor(e){super(e,"pipelines")}components(e){return new It(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 qt=class extends C{constructor(e){super(e,"styles")}};var Mt=class extends C{constructor(e){super(e,"tilesources")}drivers(){return this.client._get("/api/v1/tilesources/drivers").catch(e=>{if(e.statusCode===404)return["tilelive","dataset"]})}};var jt=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 Dn=er(kr(),1);var $t=class extends C{constructor(e){super(e,"uploads")}async upload(e,t={}){let n=new Dn.default;return e.datasetName&&n.append("name",e.datasetName),e.datasetDescription&&n.append("description",e.datasetDescription),e.attribution&&n.append("attribution",e.attribution),e.datasetId&&n.append("datasetId",e.datasetId),e.sourceSrid&&n.append("sourceSrid",e.sourceSrid),e.targetSrid&&n.append("targetSrid",e.targetSrid),e.schema&&n.append("schema",e.schema),e.metadata&&n.append("metadata",JSON.stringify(e.metadata)),n.append("file",e.data,e.filename),await this.client._post(this.resourceEndpoint,n,{headers:n.getHeaders?.()??{"Content-Type":"multipart/form-data"},signal:e.abortController?.signal,params:t,onUploadProgress:e.progress})}};var $=Object.create(null);$.open="0";$.close="1";$.ping="2";$.pong="3";$.message="4";$.upgrade="5";$.noop="6";var We=Object.create(null);Object.keys($).forEach(r=>{We[$[r]]=r});var Ve={type:"error",data:"parser error"};var qn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mn=typeof ArrayBuffer=="function",jn=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Ke=({type:r,data:e},t,n)=>qn&&e instanceof Blob?t?n(e):In(e,n):Mn&&(e instanceof ArrayBuffer||jn(e))?t?n(e):In(new Blob([e]),n):n($[r]+(e||"")),In=(r,e)=>{let t=new FileReader;return t.onload=function(){let n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(r)};function Un(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Tr;function $n(r,e){if(qn&&r.data instanceof Blob)return r.data.arrayBuffer().then(Un).then(e);if(Mn&&(r.data instanceof ArrayBuffer||jn(r.data)))return e(Un(r.data));Ke(r,!1,t=>{Tr||(Tr=new TextEncoder),e(Tr.encode(t))})}var Hn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ze=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Hn.length;r++)ze[Hn.charCodeAt(r)]=r;var Wn=r=>{let e=r.length*.75,t=r.length,n,s=0,o,i,a,l;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let f=new ArrayBuffer(e),u=new Uint8Array(f);for(n=0;n<t;n+=4)o=ze[r.charCodeAt(n)],i=ze[r.charCodeAt(n+1)],a=ze[r.charCodeAt(n+2)],l=ze[r.charCodeAt(n+3)],u[s++]=o<<2|i>>4,u[s++]=(i&15)<<4|a>>2,u[s++]=(a&3)<<6|l&63;return f};var ci=typeof ArrayBuffer=="function",Je=(r,e)=>{if(typeof r!="string")return{type:"message",data:Vn(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:ui(r.substring(1),e)}:We[t]?r.length>1?{type:We[t],data:r.substring(1)}:{type:We[t]}:Ve},ui=(r,e)=>{if(ci){let t=Wn(r);return Vn(t,e)}else return{base64:!0,data:r}},Vn=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Kn="",zn=(r,e)=>{let t=r.length,n=new Array(t),s=0;r.forEach((o,i)=>{Ke(o,!1,a=>{n[i]=a,++s===t&&e(n.join(Kn))})})},Jn=(r,e)=>{let t=r.split(Kn),n=[];for(let s=0;s<t.length;s++){let o=Je(t[s],e);if(n.push(o),o.type==="error")break}return n};function Xn(){return new TransformStream({transform(r,e){$n(r,t=>{let n=t.length,s;if(n<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,n);else if(n<65536){s=new Uint8Array(3);let o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{s=new Uint8Array(9);let o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}r.data&&typeof r.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Pr;function Ht(r){return r.reduce((e,t)=>e+t.length,0)}function Wt(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),n=0;for(let s=0;s<e;s++)t[s]=r[0][n++],n===r[0].length&&(r.shift(),n=0);return r.length&&n<r[0].length&&(r[0]=r[0].slice(n)),t}function Gn(r,e){Pr||(Pr=new TextDecoder);let t=[],n=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(t.push(i);;){if(n===0){if(Ht(t)<1)break;let l=Wt(t,1);o=(l[0]&128)===128,s=l[0]&127,s<126?n=3:s===126?n=1:n=2}else if(n===1){if(Ht(t)<2)break;let l=Wt(t,2);s=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),n=3}else if(n===2){if(Ht(t)<8)break;let l=Wt(t,8),f=new DataView(l.buffer,l.byteOffset,l.length),u=f.getUint32(0);if(u>Math.pow(2,21)-1){a.enqueue(Ve);break}s=u*Math.pow(2,32)+f.getUint32(4),n=3}else{if(Ht(t)<s)break;let l=Wt(t,s);a.enqueue(Je(o?l:Pr.decode(l),e)),n=0}if(s===0||s>r){a.enqueue(Ve);break}}}})}var vr=4;function A(r){if(r)return li(r)}function li(r){for(var e in A.prototype)r[e]=A.prototype[e];return r}A.prototype.on=A.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};A.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};A.prototype.off=A.prototype.removeListener=A.prototype.removeAllListeners=A.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 n,s=0;s<t.length;s++)if(n=t[s],n===e||n.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+r],this};A.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t){t=t.slice(0);for(var n=0,s=t.length;n<s;++n)t[n].apply(this,e)}return this};A.prototype.emitReserved=A.prototype.emit;A.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};A.prototype.hasListeners=function(r){return!!this.listeners(r).length};var z=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),N=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qn="arraybuffer";function Vt(r,...e){return e.reduce((t,n)=>(r.hasOwnProperty(n)&&(t[n]=r[n]),t),{})}var fi=N.setTimeout,pi=N.clearTimeout;function J(r,e){e.useNativeTimers?(r.setTimeoutFn=fi.bind(N),r.clearTimeoutFn=pi.bind(N)):(r.setTimeoutFn=N.setTimeout.bind(N),r.clearTimeoutFn=N.clearTimeout.bind(N))}var hi=1.33;function Yn(r){return typeof r=="string"?di(r):Math.ceil((r.byteLength||r.size)*hi)}function di(r){let e=0,t=0;for(let n=0,s=r.length;n<s;n++)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}function Kt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Zn(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function es(r){let e={},t=r.split("&");for(let n=0,s=t.length;n<s;n++){let o=t[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}var zt=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}},X=class extends A{constructor(e){super(),this.writable=!1,J(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new zt(e,t,n)),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=Je(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Zn(e);return t.length?"?"+t:""}};var Xe=class extends X{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};Jn(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,zn(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Kt()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var ts=!1;try{ts=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var rs=ts;function mi(){}var Nr=class extends Xe{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",n=location.port;n||(n=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}},ee=class r extends A{constructor(e,t,n){super(),this.createRequest=e,J(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;let t=Vt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&n.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var s;n.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.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=mi,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.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()}};ee.requestsCount=0;ee.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ns);else if(typeof addEventListener=="function"){let r="onpagehide"in N?"pagehide":"unload";addEventListener(r,ns,!1)}}function ns(){for(let r in ee.requests)ee.requests.hasOwnProperty(r)&&ee.requests[r].abort()}var yi=(function(){let r=ss({xdomain:!1});return r&&r.responseType!==null})(),te=class extends Nr{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=yi&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ee(ss,this.uri(),e)}};function ss(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||rs))return new XMLHttpRequest}catch{}if(!e)try{return new N[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var os=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Br=class extends X{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,n=os?{}:Vt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],s=t===e.length-1;Ke(n,this.supportsBinary,o=>{try{this.doWrite(n,o)}catch{}s&&z(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Kt()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Fr=N.WebSocket||N.MozWebSocket,re=class extends Br{createSocket(e,t,n){return os?new Fr(e,t,n):t?new Fr(e,t):new Fr(e)}doWrite(e,t){this.ws.send(t)}};var Se=class extends X{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Gn(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),s=Xn();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();let o=()=>{n.read().then(({done:a,value:l})=>{a||(this.onPacket(l),o())}).catch(a=>{})};o();let i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],s=t===e.length-1;this._writer.write(n).then(()=>{s&&z(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var Lr={websocket:re,webtransport:Se,polling:te};var gi=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,bi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ae(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),n=r.indexOf("]");t!=-1&&n!=-1&&(r=r.substring(0,t)+r.substring(t,n).replace(/:/g,";")+r.substring(n,r.length));let s=gi.exec(r||""),o={},i=14;for(;i--;)o[bi[i]]=s[i]||"";return t!=-1&&n!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=wi(o,o.path),o.queryKey=Ei(o,o.query),o}function wi(r,e){let t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Ei(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,s,o){s&&(t[s]=o)}),t}var Dr=typeof addEventListener=="function"&&typeof removeEventListener=="function",Jt=[];Dr&&addEventListener("offline",()=>{Jt.forEach(r=>r())},!1);var ue=class r extends A{constructor(e,t){if(super(),this.binaryType=Qn,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){let n=Ae(e);t.hostname=n.host,t.secure=n.protocol==="https"||n.protocol==="wss",t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Ae(t.host).host);J(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=[],this._transportsByName={},t.transports.forEach(n=>{let s=n.prototype.name;this.transports.push(s),this._transportsByName[s]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=es(this.opts.query)),Dr&&(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"})},Jt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=vr,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_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._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();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._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();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 n=0;n<this.writeBuffer.length;n++){let s=this.writeBuffer[n].data;if(s&&(t+=Yn(s)),n>0&&t>this._maxPayload)return this.writeBuffer.slice(0,n);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,z(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,s){if(typeof t=="function"&&(s=t,t=void 0),typeof n=="function"&&(s=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;let o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Dr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let n=Jt.indexOf(this._offlineEventListener);n!==-1&&Jt.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}};ue.protocol=vr;var Xt=class extends ue{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;ue.priorWebsocketSuccess=!1;let s=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",p=>{if(!n)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ue.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function o(){n||(n=!0,u(),t.close(),t=null)}let i=p=>{let y=new Error("probe error: "+p);y.transport=t.name,o(),this.emitReserved("upgradeError",y)};function a(){i("transport closed")}function l(){i("socket closed")}function f(p){t&&p.name!==t.name&&o()}let u=()=>{t.removeListener("open",s),t.removeListener("error",i),t.removeListener("close",a),this.off("close",l),this.off("upgrading",f)};t.once("open",s),t.once("error",i),t.once("close",a),this.once("close",l),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},Oe=class extends Xt{constructor(e,t={}){let n=typeof e=="object"?e:t;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(s=>Lr[s]).filter(s=>!!s)),super(e,n)}};var Jf=Oe.protocol;function is(r,e="",t){let n=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),n=Ae(r)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";let o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+e,n.href=n.protocol+"://"+o+(t&&t.port===n.port?"":":"+n.port),n}var $r={};Zt($r,{Decoder:()=>Mr,Encoder:()=>qr,PacketType:()=>E,isPacketValid:()=>Ti,protocol:()=>fs});var Ci=typeof ArrayBuffer=="function",xi=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,as=Object.prototype.toString,Ri=typeof Blob=="function"||typeof Blob<"u"&&as.call(Blob)==="[object BlobConstructor]",Si=typeof File=="function"||typeof File<"u"&&as.call(File)==="[object FileConstructor]";function Qe(r){return Ci&&(r instanceof ArrayBuffer||xi(r))||Ri&&r instanceof Blob||Si&&r instanceof File}function Ge(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,n=r.length;t<n;t++)if(Ge(r[t]))return!0;return!1}if(Qe(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return Ge(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&Ge(r[t]))return!0;return!1}function cs(r){let e=[],t=r.data,n=r;return n.data=Ir(t,e),n.attachments=e.length,{packet:n,buffers:e}}function Ir(r,e){if(!r)return r;if(Qe(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 n=0;n<r.length;n++)t[n]=Ir(r[n],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=Ir(r[n],e));return t}return r}function us(r,e){return r.data=Ur(r.data,e),delete r.attachments,r}function Ur(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]=Ur(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Ur(r[t],e));return r}var ls=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],fs=5,E;(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"})(E||(E={}));var qr=class{constructor(e){this.replacer=e}encode(e){return(e.type===E.EVENT||e.type===E.ACK)&&Ge(e)?this.encodeAsBinary({type:e.type===E.EVENT?E.BINARY_EVENT:E.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===E.BINARY_EVENT||e.type===E.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=cs(e),n=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(n),s}},Mr=class r extends A{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}: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 n=t.type===E.BINARY_EVENT;n||t.type===E.BINARY_ACK?(t.type=n?E.EVENT:E.ACK,this.reconstructor=new jr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Qe(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,n={type:Number(e.charAt(0))};if(E[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===E.BINARY_EVENT||n.type===E.BINARY_ACK){let o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let i=e.substring(o,t);if(i!=Number(i)||e.charAt(t)!=="-")throw new Error("Illegal attachments");let a=Number(i);if(!ps(a)||a<0)throw new Error("Illegal attachments");if(a>this.opts.maxAttachments)throw new Error("too many attachments");n.attachments=a}if(e.charAt(t+1)==="/"){let o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(o,t)}else n.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let o=t+1;for(;++t;){let i=e.charAt(t);if(i==null||Number(i)!=i){--t;break}if(t===e.length)break}n.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){let o=this.tryParse(e.substr(t));if(r.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case E.CONNECT:return Gt(t);case E.DISCONNECT:return t===void 0;case E.CONNECT_ERROR:return typeof t=="string"||Gt(t);case E.EVENT:case E.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ls.indexOf(t[0])===-1);case E.ACK:case E.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},jr=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=us(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Ai(r){return typeof r=="string"}var ps=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Oi(r){return r===void 0||ps(r)}function Gt(r){return Object.prototype.toString.call(r)==="[object Object]"}function ki(r,e){switch(r){case E.CONNECT:return e===void 0||Gt(e);case E.DISCONNECT:return e===void 0;case E.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&ls.indexOf(e[0])===-1);case E.ACK:return Array.isArray(e);case E.CONNECT_ERROR:return typeof e=="string"||Gt(e);default:return!1}}function Ti(r){return Ai(r.nsp)&&Oi(r.id)&&ki(r.type,r.data)}function D(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}),ke=class extends A{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[D(e,"open",this.onopen.bind(this)),D(e,"packet",this.onpacket.bind(this)),D(e,"error",this.onerror.bind(this)),D(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){var n,s,o;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 i={type:E.EVENT,data:t};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let u=this.ids++,p=t.pop();this._registerAckCallback(u,p),i.id=u}let a=(s=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||s===void 0?void 0:s.writable,l=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;let s=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},s),i=(...a)=>{this.io.clearTimeoutFn(o),t.apply(this,a)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,s)=>{let o=(i,a)=>i?s(i):n(a);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...o)=>(this._queue[0],s!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),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:E.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){let n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case E.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case E.EVENT:case E.BINARY_EVENT:this.onevent(e);break;case E.ACK:case E.BINARY_ACK:this.onack(e);break;case E.DISCONNECT:this.ondisconnect();break;case E.CONNECT_ERROR:this.destroy();let n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);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 n of t)n.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,n=!1;return function(...s){n||(n=!0,t.packet({type:E.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:E.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function le(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}le.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)==0?r-t:r+t}return Math.min(r,this.max)|0};le.prototype.reset=function(){this.attempts=0};le.prototype.setMin=function(r){this.ms=r};le.prototype.setMax=function(r){this.max=r};le.prototype.setJitter=function(r){this.jitter=r};var Te=class extends A{constructor(e,t){var n;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,J(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((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new le({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||$r;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var 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 Oe(this.uri,this.opts);let t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;let s=D(t,"open",function(){n.onopen(),e&&e()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},i=D(t,"error",o);if(this._timeout!==!1){let a=this._timeout,l=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),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(D(e,"ping",this.onping.bind(this)),D(e,"data",this.ondata.bind(this)),D(e,"error",this.onerror.bind(this)),D(e,"close",this.onclose.bind(this)),D(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){z(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new ke(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let n of t)if(this.nsps[n].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;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 n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var Ye={};function Ze(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=is(r,e.path||"/socket.io"),n=t.source,s=t.id,o=t.path,i=Ye[s]&&o in Ye[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||i,l;return a?l=new Te(n,e):(Ye[s]||(Ye[s]=new Te(n,e)),l=Ye[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Ze,{Manager:Te,Socket:ke,io:Ze,connect:Ze});var hs=(n=>(n.System="system",n.AppConfig="appconfig",n.Dataset="dataset/",n))(hs||{}),et=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 n=Ze(this.client.baseUrl,{...this.options,autoConnect:!1,auth:s=>{let o={};this.client.apiKey&&(o["x-api-key"]=this.client.apiKey),this.client.accessToken&&(o["x-socket-token"]=`Bearer ${this.client.accessToken}`),s(o)}});n.on("connect",()=>{this.client.debug(`Socket connected: ${n.id}`),this.subscribedChannels.size&&this.subscribedChannels.forEach(s=>{n.emit("subscribe",{channel:s},o=>{o.status==="error"?console.error(`Error re-subscribing to channel '${s}`,o):this.client.debug(`Re-subscribed to channel '${s}`)})})}),n.io.on("reconnect_attempt",s=>{this.client.debug(`Socket reconnect attempt: ${s}`)}),n.io.on("reconnect_error",s=>{this.client.debug(`Socket reconnect error: ${s.message}`)}),n.io.on("reconnect_failed",()=>{this.client.debug("Socket reconnect failed")}),n.io.on("reconnect",()=>{this.client.debug("Socket reconnected")}),n.on("disconnect",s=>{this.client.debug(`Socket disconnected: ${s}`)}),n.on("error",s=>{this.client.debug(`Socket error: ${s.messaage}`)}),this.socket=n,this.connected=!0,n.on("connect",()=>{e()}),n.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 n=o=>{o.channel===e&&t(null,o)},s=o=>{this.socket.off("message",n),this.unsubscribe(e,o)};return this.socket.emit("subscribe",{channel:e},o=>{if(o.status==="error")return this.client.debug(`Error subscribed to channel '${e}`,o),t(new Error(o.message));this.subscribedChannels.add(e),this.client.debug(`Subscribed to channel '${e}`),this.socket.on("message",n)}),s}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},n=>{n.status==="error"?(this.client.debug(`Error unsubscribing from channel '${e}`,n),t&&t(new Error(n.message))):(this.subscribedChannels.delete(e),this.client.debug(`Unsubscribed from channel '${e}`),t&&t(null))})}};var Hr=class{constructor(e,t=null,n){this.baseUrl=e;this.apiKey=t;this.debug=(0,ds.default)("flow-engine-client");this.accessToken=null;this.auth=new kt(this);this.tiles=new jt(this);this.maps=new Ft(this);this.apiKeys=new Rt(this);this.applications=new At(this);this.appconfig=new St(this);this.contactpoints=new Tt(this);this.databases=new Pt(this);this.datasets=new vt(this);this.styles=new qt(this);this.tileSources=new Mt(this);this.uploads=new $t(this);this.jobs=new Nt(this);this.maplayers=new Bt(this);this.media=new Lt(this);this.pipelines=new Ut(this);this.axios=_t.create({baseURL:e,maxContentLength:524288e3,transformResponse:[function(o,i){return i?.["content-type"]?.toString().startsWith("application/json")?JSON.parse(o):o}]}),this.webSocketGateway=new et(this,n)}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={}){return t.params?.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios({method:"get",url:e,...t,...this.headers(t)}).then(n=>n.data).catch(this.handleError)}_post(e,t,n={}){return n.params?.apiKey&&(n.apiKey=n.params.apiKey,delete n.params.apiKey),this.axios({method:"post",url:e,data:t,maxContentLength:1/0,maxBodyLength:1/0,...n,...this.headers(n)}).then(s=>s.data).catch(this.handleError)}_put(e,t,n={}){return n.params?.apiKey&&(n.apiKey=n.params.apiKey,delete n.params.apiKey),this.axios({method:"put",url:e,data:t,...n,...this.headers(n)}).then(s=>s.data).catch(this.handleError)}_delete(e,t={}){return t.params?.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios({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 n=e.response.data;throw new ce(n.message||n.error,n.error,e.response.status)}else if(typeof e.response.data=="string")throw new ce(e.response.data,null,e.response.status)}let t=e;throw delete t.config,delete t.request,delete t.response,new ce(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 Cs(vi);})();
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("axios"),p=require("debug"),n=require("form-data"),socket_ioClient=require("socket.io-client");function _interopDefaultCompat(i){return i&&typeof i=="object"&&"default"in i?i.default:i}const o__default=_interopDefaultCompat(o),p__default=_interopDefaultCompat(p),n__default=_interopDefaultCompat(n);class BaseEndpoints{constructor(e,t){this.client=e,this.resourcePath=t}get resourceEndpoint(){return`/api/v1/${this.resourcePath}`}list(e){if(e?.filter){const 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={}){const r=t?`${this.resourceEndpoint}/${e}/metadata/${t}`:`${this.resourceEndpoint}/${e}/metadata`;return this.client._get(r,{params:s})}setMetadata(e,t,s,r={}){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:r})}deleteMetadata(e,t,s={}){return this.client._delete(`${this.resourceEndpoint}/${e}/metadata/${t}`,{headers:{"Content-Type":"application/json"},params:s})}}class ApiKeyEndpoints extends BaseEndpoints{constructor(e){super(e,"apikeys")}}class AppConfigEndpoints{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)}}class ApplicationEndpoints extends BaseEndpoints{constructor(e){super(e,"applications")}}class UserEndpoint extends BaseEndpoints{constructor(e){super(e,"auth/users")}me(e){return this.client._get(`${this.resourceEndpoint}/me`,{headers:{Authorization:`Bearer ${e}`}})}}class AuthEndpoints{constructor(e){this.client=e}users=new UserEndpoint(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,r,a,c,u){return u||(u=c,c=`${this.client.baseUrl}/api/v1/auth/confirmsignup`),this.client._post("/api/v1/auth/signup",{firstName:e,lastName:t,email:s,password:r,applicationId:a,confirmUrl:c,redirectUrl:u})}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,r){return this.client._post("/api/v1/auth/resetpassword",{email:e,password:t,applicationId:s,token:r})}}class ContactPointEndpoints extends BaseEndpoints{constructor(e){super(e,"contactpoints")}send(e,t={}){return this.client._post(`${this.resourceEndpoint}/${e}/send`,t)}drivers(){return this.client._get(`${this.resourceEndpoint}/drivers`)}}class DatabaseEndpoints extends BaseEndpoints{constructor(e){super(e,"databases")}drivers(){return this.client._get("/api/v1/databases/drivers").catch(e=>{if(e.status===404)return["postgis","postgis-mapnik"]})}}class DatasetEndpoints extends BaseEndpoints{constructor(e){super(e,"datasets")}query(e,t={},s={}){typeof e=="object"&&(s={...e.params,format:e.format||"json"},t=e,e=t.datasetId,delete t.datasetId,delete t.format),typeof s=="string"&&(s={format:s});let r=null;return s.abortController&&(r=s.abortController,delete s.abortController),this.client._post(`/api/v1/datasets/${e}/query`,t,{params:{...s,format:s.format||"json",explain:s.explain||!1},signal:r?.signal}).catch(a=>{throw a.message==="Network Error"?new Error("Query timed out"):a})}ingest(e,t={}){return this.client._post(`/api/v1/datasets/${e.datasetId}/ingest`,e,t)}getExportUrl(e,t){const 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)}}class FlowEngineError extends Error{error;statusCode;constructor(e,t=null,s=500){super(e||"Unknown Error"),Object.setPrototypeOf(this,FlowEngineError.prototype),this.statusCode=s,this.error=t}}class JobEndpoints extends BaseEndpoints{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})}}class MapEndpoints{constructor(e){this.client=e}get(e,t={}){return this.client._get(`/maps/${e}.json`,{params:t})}}class MapLayerEndpoints extends BaseEndpoints{constructor(e){super(e,"maplayers")}subscribe(e){return this.client._subscribe("maplayers",e)}}class MediaEndpoints extends BaseEndpoints{constructor(e){super(e,"media")}async upload(e,t,s={}){const r=new n__default;return r.append("id",e),t.type&&r.append("type",t.type),t.mimeType&&r.append("mimeType",t.mimeType),t.metadata&&r.append("metadata",JSON.stringify(t.metadata)),r.append("file",t.data,t.fileName),await this.client._post(this.resourceEndpoint,r,{headers:r.getHeaders?.()??{"Content-Type":"multipart/form-data"},params:s})}content(e){return this.client._get(`${this.resourceEndpoint}/${e}/content`,{responseType:"stream"})}}class PipelineMetricEndpoints extends BaseEndpoints{constructor(e,t,s){super(e,`pipelines/${t}/components/${s}/metrics`)}}class PipelineComponentEndpoints extends BaseEndpoints{constructor(e,t){super(e,`pipelines/${t}/components`),this.pipelineId=t}metrics(e){return new PipelineMetricEndpoints(this.client,this.pipelineId,e)}}class PipelineEndpoints extends BaseEndpoints{constructor(e){super(e,"pipelines")}components(e){return new PipelineComponentEndpoints(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})}}class StyleEndpoints extends BaseEndpoints{constructor(e){super(e,"styles")}}class TileSourceEndpoints extends BaseEndpoints{constructor(e){super(e,"tilesources")}drivers(){return this.client._get("/api/v1/tilesources/drivers").catch(e=>{if(e.statusCode===404)return["tilelive","dataset"]})}}class TileEndpoints{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})}}class UploadEndpoints extends BaseEndpoints{constructor(e){super(e,"uploads")}async upload(e,t={}){const s=new n__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:s.getHeaders?.()??{"Content-Type":"multipart/form-data"},signal:e.abortController?.signal,params:t,onUploadProgress:e.progress})}}var WebSocketChannel=(i=>(i.System="system",i.AppConfig="appconfig",i.Dataset="dataset/",i))(WebSocketChannel||{});class WebSocketGateway{constructor(e,t){this.client=e,this.options=t}connected=!1;subscribedChannels=new Set;socket;get isConnected(){return this.connected}connect(){return this.isConnected?Promise.resolve():new Promise((e,t)=>{const s=socket_ioClient.io(this.client.baseUrl,{...this.options,autoConnect:!1,auth:r=>{const a={};this.client.apiKey&&(a["x-api-key"]=this.client.apiKey),this.client.accessToken&&(a["x-socket-token"]=`Bearer ${this.client.accessToken}`),r(a)}});s.on("connect",()=>{this.client.debug(`Socket connected: ${s.id}`),this.subscribedChannels.size&&this.subscribedChannels.forEach(r=>{s.emit("subscribe",{channel:r},a=>{a.status==="error"?console.error(`Error re-subscribing to channel '${r}`,a):this.client.debug(`Re-subscribed to channel '${r}`)})})}),s.io.on("reconnect_attempt",r=>{this.client.debug(`Socket reconnect attempt: ${r}`)}),s.io.on("reconnect_error",r=>{this.client.debug(`Socket reconnect error: ${r.message}`)}),s.io.on("reconnect_failed",()=>{this.client.debug("Socket reconnect failed")}),s.io.on("reconnect",()=>{this.client.debug("Socket reconnected")}),s.on("disconnect",r=>{this.client.debug(`Socket disconnected: ${r}`)}),s.on("error",r=>{this.client.debug(`Socket error: ${r.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}`);const s=a=>{a.channel===e&&t(null,a)},r=a=>{this.socket.off("message",s),this.unsubscribe(e,a)};return this.socket.emit("subscribe",{channel:e},a=>{if(a.status==="error")return this.client.debug(`Error subscribed to channel '${e}`,a),t(new Error(a.message));this.subscribedChannels.add(e),this.client.debug(`Subscribed to channel '${e}`),this.socket.on("message",s)}),r}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))})}}class Client{constructor(e,t=null,s){this.baseUrl=e,this.apiKey=t,this.axios=o__default.create({baseURL:e,maxContentLength:524288e3,transformResponse:[function(r,a){return a?.["content-type"]?.toString().startsWith("application/json")?JSON.parse(r):r}]}),this.webSocketGateway=new WebSocketGateway(this,s)}axios;debug=p__default("flow-engine-client");webSocketGateway;accessToken=null;auth=new AuthEndpoints(this);tiles=new TileEndpoints(this);maps=new MapEndpoints(this);apiKeys=new ApiKeyEndpoints(this);applications=new ApplicationEndpoints(this);appconfig=new AppConfigEndpoints(this);contactpoints=new ContactPointEndpoints(this);databases=new DatabaseEndpoints(this);datasets=new DatasetEndpoints(this);styles=new StyleEndpoints(this);tileSources=new TileSourceEndpoints(this);uploads=new UploadEndpoints(this);jobs=new JobEndpoints(this);maplayers=new MapLayerEndpoints(this);media=new MediaEndpoints(this);pipelines=new PipelineEndpoints(this);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={}){return t.params?.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios({method:"get",url:e,...t,...this.headers(t)}).then(s=>s.data).catch(this.handleError)}_post(e,t,s={}){return s.params?.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios({method:"post",url:e,data:t,maxContentLength:1/0,maxBodyLength:1/0,...s,...this.headers(s)}).then(r=>r.data).catch(this.handleError)}_put(e,t,s={}){return s.params?.apiKey&&(s.apiKey=s.params.apiKey,delete s.params.apiKey),this.axios({method:"put",url:e,data:t,...s,...this.headers(s)}).then(r=>r.data).catch(this.handleError)}_delete(e,t={}){return t.params?.apiKey&&(t.apiKey=t.params.apiKey,delete t.params.apiKey),this.axios({method:"delete",url:e,...t,...this.headers(t)}).then(s=>s.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"){const s=e.response.data;throw new FlowEngineError(s.message||s.error,s.error,e.response.status)}else if(typeof e.response.data=="string")throw new FlowEngineError(e.response.data,null,e.response.status)}const t=e;throw delete t.config,delete t.request,delete t.response,new FlowEngineError(t.message,t)}headers(e){const 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}}}exports.BaseEndpoints=BaseEndpoints,exports.Client=Client,exports.FlowEngineError=FlowEngineError,exports.WebSocketChannel=WebSocketChannel,exports.WebSocketGateway=WebSocketGateway;
|