@swyger/client-database
Version:
Swyger Database Client JS library is used for Swyger Server as consumer Rest API for CRUD operation in realtime! Visit the master branch: https://github.com/coorise/swyger-js-client-database.git
1 lines • 329 kB
JavaScript
var La=Object.defineProperty,Da=Object.defineProperties;var Ua=Object.getOwnPropertyDescriptors;var Ci=Object.getOwnPropertySymbols;var Fa=Object.prototype.hasOwnProperty,Ma=Object.prototype.propertyIsEnumerable;var sr=(r,e,t)=>e in r?La(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,U=(r,e)=>{for(var t in e||(e={}))Fa.call(e,t)&&sr(r,t,e[t]);if(Ci)for(var t of Ci(e))Ma.call(e,t)&&sr(r,t,e[t]);return r},fe=(r,e)=>Da(r,Ua(e));var $i=(r,e,t)=>(sr(r,typeof e!="symbol"?e+"":e,t),t),Bi=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var Y=(r,e,t)=>(Bi(r,e,"read from private field"),t?t.call(r):e.get(r)),et=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},Je=(r,e,t,n)=>(Bi(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var P=(r,e,t)=>new Promise((n,i)=>{var s=c=>{try{a(t.next(c))}catch(u){i(u)}},o=c=>{try{a(t.throw(c))}catch(u){i(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,o);a((t=t.apply(r,e)).next())});const rt=Object.create(null);rt.open="0";rt.close="1";rt.ping="2";rt.pong="3";rt.message="4";rt.upgrade="5";rt.noop="6";const wn=Object.create(null);Object.keys(rt).forEach(r=>{wn[rt[r]]=r});const Ka={type:"error",data:"parser error"},Va=typeof Blob=="function"||typeof Blob!="undefined"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",qa=typeof ArrayBuffer=="function",za=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,Os=({type:r,data:e},t,n)=>Va&&e instanceof Blob?t?n(e):ji(e,n):qa&&(e instanceof ArrayBuffer||za(e))?t?n(e):ji(new Blob([e]),n):n(rt[r]+(e||"")),ji=(r,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(r)},Li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yt=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(let r=0;r<Li.length;r++)Yt[Li.charCodeAt(r)]=r;const Wa=r=>{let e=r.length*.75,t=r.length,n,i=0,s,o,a,c;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const u=new ArrayBuffer(e),l=new Uint8Array(u);for(n=0;n<t;n+=4)s=Yt[r.charCodeAt(n)],o=Yt[r.charCodeAt(n+1)],a=Yt[r.charCodeAt(n+2)],c=Yt[r.charCodeAt(n+3)],l[i++]=s<<2|o>>4,l[i++]=(o&15)<<4|a>>2,l[i++]=(a&3)<<6|c&63;return u},Ha=typeof ArrayBuffer=="function",Ts=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ps(r,e)};const t=r.charAt(0);return t==="b"?{type:"message",data:Ja(r.substring(1),e)}:wn[t]?r.length>1?{type:wn[t],data:r.substring(1)}:{type:wn[t]}:Ka},Ja=(r,e)=>{if(Ha){const t=Wa(r);return Ps(t,e)}else return{base64:!0,data:r}},Ps=(r,e)=>{switch(e){case"blob":return r instanceof ArrayBuffer?new Blob([r]):r;case"arraybuffer":default:return r}},Is=String.fromCharCode(30),Ya=(r,e)=>{const t=r.length,n=new Array(t);let i=0;r.forEach((s,o)=>{Os(s,!1,a=>{n[o]=a,++i===t&&e(n.join(Is))})})},Ga=(r,e)=>{const t=r.split(Is),n=[];for(let i=0;i<t.length;i++){const s=Ts(t[i],e);if(n.push(s),s.type==="error")break}return n},Rs=4;function ge(r){if(r)return Qa(r)}function Qa(r){for(var e in ge.prototype)r[e]=ge.prototype[e];return r}ge.prototype.on=ge.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};ge.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};ge.prototype.off=ge.prototype.removeListener=ge.prototype.removeAllListeners=ge.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,i=0;i<t.length;i++)if(n=t[i],n===e||n.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};ge.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,i=t.length;n<i;++n)t[n].apply(this,e)}return this};ge.prototype.emitReserved=ge.prototype.emit;ge.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};ge.prototype.hasListeners=function(r){return!!this.listeners(r).length};const ze=(()=>typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")())();function Ns(r,...e){return e.reduce((t,n)=>(r.hasOwnProperty(n)&&(t[n]=r[n]),t),{})}const Xa=ze.setTimeout,Za=ze.clearTimeout;function Fn(r,e){e.useNativeTimers?(r.setTimeoutFn=Xa.bind(ze),r.clearTimeoutFn=Za.bind(ze)):(r.setTimeoutFn=ze.setTimeout.bind(ze),r.clearTimeoutFn=ze.clearTimeout.bind(ze))}const ec=1.33;function tc(r){return typeof r=="string"?nc(r):Math.ceil((r.byteLength||r.size)*ec)}function nc(r){let e=0,t=0;for(let n=0,i=r.length;n<i;n++)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}class rc extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Cs extends ge{constructor(e){super(),this.writable=!1,Fn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new rc(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){const t=Ts(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const $s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Ar=64,ic={};let Di=0,hn=0,Ui;function Fi(r){let e="";do e=$s[r%Ar]+e,r=Math.floor(r/Ar);while(r>0);return e}function Bs(){const r=Fi(+new Date);return r!==Ui?(Di=0,Ui=r):r+"."+Fi(Di++)}for(;hn<Ar;hn++)ic[$s[hn]]=hn;function js(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function sc(r){let e={},t=r.split("&");for(let n=0,i=t.length;n<i;n++){let s=t[n].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}let Ls=!1;try{Ls=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(r){}const oc=Ls;function Ds(r){const e=r.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||oc))return new XMLHttpRequest}catch(t){}if(!e)try{return new ze[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(t){}}function ac(){}const cc=function(){return new Ds({xdomain:!1}).responseType!=null}();class uc extends Cs{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){const n=location.protocol==="https:";let i=location.port;i||(i=n?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port,this.xs=e.secure!==n}const t=e&&e.forceBase64;this.supportsBinary=cc&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const 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){const 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)};Ga(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ya(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let n="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bs()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(n=":"+this.opts.port);const i=js(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new nt(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const 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}}class nt extends ge{constructor(e,t){super(),Fn(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(){const e=Ns(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new Ds(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let n in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this.opts.extraHeaders[n])}}catch(n){}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{t.setRequestHeader("Accept","*/*")}catch(n){}"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(n){this.setTimeoutFn(()=>{this.onError(n)},0);return}typeof document!="undefined"&&(this.index=nt.requestsCount++,nt.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=ac,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete nt.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}nt.requestsCount=0;nt.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Mi);else if(typeof addEventListener=="function"){const r="onpagehide"in ze?"pagehide":"unload";addEventListener(r,Mi,!1)}}function Mi(){for(let r in nt.requests)nt.requests.hasOwnProperty(r)&&nt.requests[r].abort()}const Us=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),dn=ze.WebSocket||ze.MozWebSocket,Ki=!0,lc="arraybuffer",Vi=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fc extends Cs{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=Vi?{}:Ns(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=Ki&&!Vi?t?new dn(e,t):new dn(e):new dn(e,t,n)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||lc,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;Os(n,this.supportsBinary,s=>{const o={};try{Ki&&this.ws.send(s)}catch(a){}i&&Us(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let n="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(n=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bs()),this.supportsBinary||(e.b64=1);const i=js(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(i.length?"?"+i:"")}check(){return!!dn}}const hc={websocket:fc,polling:uc},dc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,pc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _r(r){const 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 i=dc.exec(r||""),s={},o=14;for(;o--;)s[pc[o]]=i[o]||"";return t!=-1&&n!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=yc(s,s.path),s.queryKey=mc(s,s.query),s}function yc(r,e){const 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 mc(r,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,i,s){i&&(t[i]=s)}),t}class mt extends ge{constructor(e,t={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=_r(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=_r(t.host).host),Fn(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&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=sc(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){const t=Object.assign({},this.opts.query);t.EIO=Rs,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new hc[e](n)}open(){let e;if(this.opts.rememberUpgrade&&mt.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),n=!1;mt.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",f=>{if(!n)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;mt.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=t.name,this.emitReserved("upgradeError",p)}}))};function s(){n||(n=!0,l(),t.close(),t=null)}const o=f=>{const p=new Error("probe error: "+f);p.transport=t.name,s(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function c(){o("socket closed")}function u(f){t&&f.name!==t.name&&s()}const l=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",i),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),t.open()}onOpen(){if(this.readyState="open",mt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const 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":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);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){const 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++){const i=this.writeBuffer[n].data;if(i&&(t+=tc(i)),n>0&&t>this.maxPayload)return this.writeBuffer.slice(0,n);t+=2}return this.writeBuffer}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,i){if(typeof t=="function"&&(i=t,t=void 0),typeof n=="function"&&(i=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(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){mt.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){const t=[];let n=0;const i=e.length;for(;n<i;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}mt.protocol=Rs;function gc(r,e="",t){let n=r;t=t||typeof location!="undefined"&&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!="undefined"?r=t.protocol+"//"+r:r="https://"+r),n=_r(r)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const s=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port+e,n.href=n.protocol+"://"+s+(t&&t.port===n.port?"":":"+n.port),n}const vc=typeof ArrayBuffer=="function",wc=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Fs=Object.prototype.toString,bc=typeof Blob=="function"||typeof Blob!="undefined"&&Fs.call(Blob)==="[object BlobConstructor]",xc=typeof File=="function"||typeof File!="undefined"&&Fs.call(File)==="[object FileConstructor]";function Wr(r){return vc&&(r instanceof ArrayBuffer||wc(r))||bc&&r instanceof Blob||xc&&r instanceof File}function bn(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,n=r.length;t<n;t++)if(bn(r[t]))return!0;return!1}if(Wr(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return bn(r.toJSON(),!0);for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&bn(r[t]))return!0;return!1}function Ec(r){const e=[],t=r.data,n=r;return n.data=Sr(t,e),n.attachments=e.length,{packet:n,buffers:e}}function Sr(r,e){if(!r)return r;if(Wr(r)){const t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){const t=new Array(r.length);for(let n=0;n<r.length;n++)t[n]=Sr(r[n],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){const t={};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=Sr(r[n],e));return t}return r}function kc(r,e){return r.data=Or(r.data,e),delete r.attachments,r}function Or(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]=Or(r[t],e);else if(typeof r=="object")for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Or(r[t],e));return r}const Ac=5;var ee;(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"})(ee||(ee={}));class _c{constructor(e){this.replacer=e}encode(e){return(e.type===ee.EVENT||e.type===ee.ACK)&&bn(e)?this.encodeAsBinary({type:e.type===ee.EVENT?ee.BINARY_EVENT:ee.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ee.BINARY_EVENT||e.type===ee.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){const t=Ec(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}}class Hr extends ge{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);const n=t.type===ee.BINARY_EVENT;n||t.type===ee.BINARY_ACK?(t.type=n?ee.EVENT:ee.ACK,this.reconstructor=new Sc(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Wr(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;const n={type:Number(e.charAt(0))};if(ee[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===ee.BINARY_EVENT||n.type===ee.BINARY_ACK){const s=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(s,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");n.attachments=Number(o)}if(e.charAt(t+1)==="/"){const s=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(s,t)}else n.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const s=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}n.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){const s=this.tryParse(e.substr(t));if(Hr.isPayloadValid(n.type,s))n.data=s;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case ee.CONNECT:return typeof t=="object";case ee.DISCONNECT:return t===void 0;case ee.CONNECT_ERROR:return typeof t=="string"||typeof t=="object";case ee.EVENT:case ee.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="string"||typeof t[0]=="number");case ee.ACK:case ee.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Sc{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=kc(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Oc=Object.freeze(Object.defineProperty({__proto__:null,protocol:Ac,get PacketType(){return ee},Encoder:_c,Decoder:Hr},Symbol.toStringTag,{value:"Module"}));function Ge(r,e,t){return r.on(e,t),function(){r.off(e,t)}}const Tc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ms extends ge{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ge(e,"open",this.onopen.bind(this)),Ge(e,"packet",this.onpacket.bind(this)),Ge(e,"error",this.onerror.bind(this)),Ge(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(Tc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:ee.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,a=t.pop();this._registerAckCallback(o,a),n.id=o}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const i=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const s=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"))},i);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...o])}}emitWithAck(e,...t){const n=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,s)=>{t.push((o,a)=>n?o?s(o):i(a):i(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...s)=>n!==this._queue[0]?void 0:(i!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...s)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ee.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 ee.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 ee.EVENT:case ee.BINARY_EVENT:this.onevent(e);break;case ee.ACK:case ee.BINARY_ACK:this.onack(e);break;case ee.DISCONNECT:this.ondisconnect();break;case ee.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const 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){const t=this._anyListeners.slice();for(const 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){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:ee.ACK,id:e,data:i}))}}onack(e){const 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:ee.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Vt(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}Vt.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};Vt.prototype.reset=function(){this.attempts=0};Vt.prototype.setMin=function(r){this.ms=r};Vt.prototype.setMax=function(r){this.max=r};Vt.prototype.setJitter=function(r){this.jitter=r};class Tr extends ge{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,Fn(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 Vt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Oc;this.encoder=new i.Encoder,this.decoder=new i.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 mt(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=Ge(t,"open",function(){n.onopen(),e&&e()}),s=Ge(t,"error",o=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",o),e?e(o):n.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&i();const a=this.setTimeoutFn(()=>{i(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ge(e,"ping",this.onping.bind(this)),Ge(e,"data",this.ondata.bind(this)),Ge(e,"error",this.onerror.bind(this)),Ge(e,"close",this.onclose.bind(this)),Ge(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){Us(()=>{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 Ms(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),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;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(function(){clearTimeout(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Wt={};function xn(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};const t=gc(r,e.path||"/socket.io"),n=t.source,i=t.id,s=t.path,o=Wt[i]&&s in Wt[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new Tr(n,e):(Wt[i]||(Wt[i]=new Tr(n,e)),c=Wt[i]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(xn,{Manager:Tr,Socket:Ms,io:xn,connect:xn});const Pc={init:({API_KEY:r,HOST_SERVER:e,CURRENT:t,ENV:n,API_VERSION:i})=>{var a,c;let s={};const o=localStorage.getItem("accessToken");try{const u={Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Key":r,"Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, HEAD,PATCH","Access-Control-Allow-Headers":"X-PINGOTHER, Origin, X-Requested-With, Content-Type, Accept","Access-Control-Max-Age":"1728000"};return o&&(u.Authorization="Bearer "+o),s.database=xn(e.DATABASE,{extraHeaders:u}),(a=s==null?void 0:s.database)==null||a.on("connect",()=>{n==="dev"&&console.log("Swyger Database Client JS is connected with Swyger Server!!!")}),(c=s==null?void 0:s.database)==null||c.on("disconnect",l=>{n==="dev"&&console.log("The device is disconnected from Database server!")}),s}catch(u){}}};function Pr(r){this.message=r}Pr.prototype=new Error,Pr.prototype.name="InvalidCharacterError";var qi=typeof window!="undefined"&&window.atob&&window.atob.bind(window)||function(r){var e=String(r).replace(/=+$/,"");if(e.length%4==1)throw new Pr("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,n,i=0,s=0,o="";n=e.charAt(s++);~n&&(t=i%4?64*t+n:n,i++%4)?o+=String.fromCharCode(255&t>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function Ic(r){var e=r.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(qi(t).replace(/(.)/g,function(n,i){var s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch(t){return qi(e)}}function Rn(r){this.message=r}function Rc(r,e){if(typeof r!="string")throw new Rn("Invalid token specified");var t=(e=e||{}).header===!0?0:1;try{return JSON.parse(Ic(r.split(".")[t]))}catch(n){throw new Rn("Invalid token specified: "+n.message)}}Rn.prototype=new Error,Rn.prototype.name="InvalidTokenError";function Ks(r,e){return function(){return r.apply(e,arguments)}}const{toString:Nc}=Object.prototype,{getPrototypeOf:Jr}=Object,Mn=(r=>e=>{const t=Nc.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),it=r=>(r=r.toLowerCase(),e=>Mn(e)===r),Kn=r=>e=>typeof e===r,{isArray:qt}=Array,Gt=Kn("undefined");function Cc(r){return r!==null&&!Gt(r)&&r.constructor!==null&&!Gt(r.constructor)&&We(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const Vs=it("ArrayBuffer");function $c(r){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Vs(r.buffer),e}const Bc=Kn("string"),We=Kn("function"),qs=Kn("number"),Vn=r=>r!==null&&typeof r=="object",jc=r=>r===!0||r===!1,En=r=>{if(Mn(r)!=="object")return!1;const e=Jr(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},Lc=it("Date"),Dc=it("File"),Uc=it("Blob"),Fc=it("FileList"),Mc=r=>Vn(r)&&We(r.pipe),Kc=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||We(r.append)&&((e=Mn(r))==="formdata"||e==="object"&&We(r.toString)&&r.toString()==="[object FormData]"))},Vc=it("URLSearchParams"),qc=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function sn(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r=="undefined")return;let n,i;if(typeof r!="object"&&(r=[r]),qt(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{const s=t?Object.getOwnPropertyNames(r):Object.keys(r),o=s.length;let a;for(n=0;n<o;n++)a=s[n],e.call(null,r[a],a,r)}}function zs(r,e){e=e.toLowerCase();const t=Object.keys(r);let n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}const Ws=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Hs=r=>!Gt(r)&&r!==Ws;function Ir(){const{caseless:r}=Hs(this)&&this||{},e={},t=(n,i)=>{const s=r&&zs(e,i)||i;En(e[s])&&En(n)?e[s]=Ir(e[s],n):En(n)?e[s]=Ir({},n):qt(n)?e[s]=n.slice():e[s]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&sn(arguments[n],t);return e}const zc=(r,e,t,{allOwnKeys:n}={})=>(sn(e,(i,s)=>{t&&We(i)?r[s]=Ks(i,t):r[s]=i},{allOwnKeys:n}),r),Wc=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Hc=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Jc=(r,e,t,n)=>{let i,s,o;const a={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),s=i.length;s-- >0;)o=i[s],(!n||n(o,r,e))&&!a[o]&&(e[o]=r[o],a[o]=!0);r=t!==!1&&Jr(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},Yc=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const n=r.indexOf(e,t);return n!==-1&&n===t},Gc=r=>{if(!r)return null;if(qt(r))return r;let e=r.length;if(!qs(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},Qc=(r=>e=>r&&e instanceof r)(typeof Uint8Array!="undefined"&&Jr(Uint8Array)),Xc=(r,e)=>{const n=(r&&r[Symbol.iterator]).call(r);let i;for(;(i=n.next())&&!i.done;){const s=i.value;e.call(r,s[0],s[1])}},Zc=(r,e)=>{let t;const n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},eu=it("HTMLFormElement"),tu=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),zi=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),nu=it("RegExp"),Js=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),n={};sn(t,(i,s)=>{e(i,s,r)!==!1&&(n[s]=i)}),Object.defineProperties(r,n)},ru=r=>{Js(r,(e,t)=>{if(We(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const n=r[t];if(!!We(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+"'")})}})},iu=(r,e)=>{const t={},n=i=>{i.forEach(s=>{t[s]=!0})};return qt(r)?n(r):n(String(r).split(e)),t},su=()=>{},ou=(r,e)=>(r=+r,Number.isFinite(r)?r:e),or="abcdefghijklmnopqrstuvwxyz",Wi="0123456789",Ys={DIGIT:Wi,ALPHA:or,ALPHA_DIGIT:or+or.toUpperCase()+Wi},au=(r=16,e=Ys.ALPHA_DIGIT)=>{let t="";const{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function cu(r){return!!(r&&We(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const uu=r=>{const e=new Array(10),t=(n,i)=>{if(Vn(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;const s=qt(n)?[]:{};return sn(n,(o,a)=>{const c=t(o,i+1);!Gt(c)&&(s[a]=c)}),e[i]=void 0,s}}return n};return t(r,0)},lu=it("AsyncFunction"),fu=r=>r&&(Vn(r)||We(r))&&We(r.then)&&We(r.catch),B={isArray:qt,isArrayBuffer:Vs,isBuffer:Cc,isFormData:Kc,isArrayBufferView:$c,isString:Bc,isNumber:qs,isBoolean:jc,isObject:Vn,isPlainObject:En,isUndefined:Gt,isDate:Lc,isFile:Dc,isBlob:Uc,isRegExp:nu,isFunction:We,isStream:Mc,isURLSearchParams:Vc,isTypedArray:Qc,isFileList:Fc,forEach:sn,merge:Ir,extend:zc,trim:qc,stripBOM:Wc,inherits:Hc,toFlatObject:Jc,kindOf:Mn,kindOfTest:it,endsWith:Yc,toArray:Gc,forEachEntry:Xc,matchAll:Zc,isHTMLForm:eu,hasOwnProperty:zi,hasOwnProp:zi,reduceDescriptors:Js,freezeMethods:ru,toObjectSet:iu,toCamelCase:tu,noop:su,toFiniteNumber:ou,findKey:zs,global:Ws,isContextDefined:Hs,ALPHABET:Ys,generateString:au,isSpecCompliantForm:cu,toJSONObject:uu,isAsyncFn:lu,isThenable:fu};function ne(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i)}B.inherits(ne,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:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Gs=ne.prototype,Qs={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{Qs[r]={value:r}});Object.defineProperties(ne,Qs);Object.defineProperty(Gs,"isAxiosError",{value:!0});ne.from=(r,e,t,n,i,s)=>{const o=Object.create(Gs);return B.toFlatObject(r,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),ne.call(o,r.message,e,t,n,i),o.cause=r,o.name=r.name,s&&Object.assign(o,s),o};const hu=null;function Rr(r){return B.isPlainObject(r)||B.isArray(r)}function Xs(r){return B.endsWith(r,"[]")?r.slice(0,-2):r}function Hi(r,e,t){return r?r.concat(e).map(function(i,s){return i=Xs(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function du(r){return B.isArray(r)&&!r.some(Rr)}const pu=B.toFlatObject(B,{},null,function(e){return/^is[A-Z]/.test(e)});function qn(r,e,t){if(!B.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=B.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!B.isUndefined(b[y])});const n=t.metaTokens,i=t.visitor||l,s=t.dots,o=t.indexes,c=(t.Blob||typeof Blob!="undefined"&&Blob)&&B.isSpecCompliantForm(e);if(!B.isFunction(i))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(B.isDate(h))return h.toISOString();if(!c&&B.isBlob(h))throw new ne("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(h)||B.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function l(h,y,b){let _=h;if(h&&!b&&typeof h=="object"){if(B.endsWith(y,"{}"))y=n?y:y.slice(0,-2),h=JSON.stringify(h);else if(B.isArray(h)&&du(h)||(B.isFileList(h)||B.endsWith(y,"[]"))&&(_=B.toArray(h)))return y=Xs(y),_.forEach(function($,L){!(B.isUndefined($)||$===null)&&e.append(o===!0?Hi([y],L,s):o===null?y:y+"[]",u($))}),!1}return Rr(h)?!0:(e.append(Hi(b,y,s),u(h)),!1)}const f=[],p=Object.assign(pu,{defaultVisitor:l,convertValue:u,isVisitable:Rr});function d(h,y){if(!B.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(h),B.forEach(h,function(_,j){(!(B.isUndefined(_)||_===null)&&i.call(e,_,B.isString(j)?j.trim():j,y,p))===!0&&d(_,y?y.concat(j):[j])}),f.pop()}}if(!B.isObject(r))throw new TypeError("data must be an object");return d(r),e}function Ji(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Yr(r,e){this._pairs=[],r&&qn(r,this,e)}const Zs=Yr.prototype;Zs.append=function(e,t){this._pairs.push([e,t])};Zs.toString=function(e){const t=e?function(n){return e.call(this,n,Ji)}:Ji;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function yu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function eo(r,e,t){if(!e)return r;const n=t&&t.encode||yu,i=t&&t.serialize;let s;if(i?s=i(e,t):s=B.isURLSearchParams(e)?e.toString():new Yr(e,t).toString(n),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class mu{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){B.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Yi=mu,to={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gu=typeof URLSearchParams!="undefined"?URLSearchParams:Yr,vu