1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="a626fedc-ad78-56ae-eec3-585ffe423b29")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,910376,(e,t,r)=>{"use strict";let n,i,o,s;var a,l,u,c,d=e.i(261955),f=e.i(769202);function h(e,t){return function(){return e.apply(t,arguments)}}let{toString:p}=Object.prototype,{getPrototypeOf:g}=Object,{iterator:y,toStringTag:b}=Symbol,v=(n=Object.create(null),e=>{let t=p.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())}),m=e=>(e=e.toLowerCase(),t=>v(t)===e),_=e=>t=>typeof t===e,{isArray:S}=Array,O=_("undefined");function E(e){return null!==e&&!O(e)&&null!==e.constructor&&!O(e.constructor)&&R(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}let w=m("ArrayBuffer"),P=_("string"),R=_("function"),T=_("number"),A=e=>null!==e&&"object"==typeof e,x=e=>{if("object"!==v(e))return!1;let t=g(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(b in e)&&!(y in e)},C=m("Date"),k=m("File"),I=m("Blob"),j=m("FileList"),M=m("URLSearchParams"),[N,D,L,U]=["ReadableStream","Request","Response","Headers"].map(m);function W(e,t){let r,n,{allOwnKeys:i=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=e)if("object"!=typeof e&&(e=[e]),S(e))for(r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else{let n;if(E(e))return;let o=i?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;for(r=0;r<s;r++)n=o[r],t.call(null,e[n],n,e)}}function F(e,t){let r;if(E(e))return null;t=t.toLowerCase();let n=Object.keys(e),i=n.length;for(;i-- >0;)if(t===(r=n[i]).toLowerCase())return r;return null}let B="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g,q=e=>!O(e)&&e!==B,K=(i="u">typeof Uint8Array&&g(Uint8Array),e=>i&&e instanceof i),V=m("HTMLFormElement"),G=(e=>{let{hasOwnProperty:t}=e;return(e,r)=>t.call(e,r)})(Object.prototype),H=m("RegExp"),$=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};W(r,(r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)}),Object.defineProperties(e,n)},Y=m("AsyncFunction"),Q=(a="function"==typeof setImmediate,l=R(B.postMessage),a?setImmediate:l?(u=`axios@${Math.random()}`,c=[],B.addEventListener("message",e=>{let{source:t,data:r}=e;t===B&&r===u&&c.length&&c.shift()()},!1),e=>{c.push(e),B.postMessage(u,"*")}):e=>setTimeout(e)),z="u">typeof queueMicrotask?queueMicrotask.bind(B):void 0!==d.default&&d.default.nextTick||Q;var J={isArray:S,isArrayBuffer:w,isBuffer:E,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||R(e.append)&&("formdata"===(t=v(e))||"object"===t&&R(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"u">typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&w(e.buffer)},isString:P,isNumber:T,isBoolean:e=>!0===e||!1===e,isObject:A,isPlainObject:x,isEmptyObject:e=>{if(!A(e)||E(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:N,isRequest:D,isResponse:L,isHeaders:U,isUndefined:O,isDate:C,isFile:k,isBlob:I,isRegExp:H,isFunction:R,isStream:e=>A(e)&&R(e.pipe),isURLSearchParams:M,isTypedArray:K,isFileList:j,forEach:W,merge:function e(){let{caseless:t,skipUndefined:r}=q(this)&&this||{},n={},i=(i,o)=>{let s=t&&F(n,o)||o;x(n[s])&&x(i)?n[s]=e(n[s],i):x(i)?n[s]=e({},i):S(i)?n[s]=i.slice():r&&O(i)||(n[s]=i)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&W(arguments[e],i);return n},extend:function(e,t,r){let{allOwnKeys:n}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return W(t,(t,n)=>{r&&R(t)?e[n]=h(t,r):e[n]=t},{allOwnKeys:n}),e},trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},null==e)return t;do{for(o=(i=Object.getOwnPropertyNames(e)).length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=!1!==r&&g(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype)return t},kindOf:v,kindOfTest:m,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return -1!==n&&n===r},toArray:e=>{if(!e)return null;if(S(e))return e;let t=e.length;if(!T(t))return null;let r=Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{let r,n=(e&&e[y]).call(e);for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>
2{let r,n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:V,hasOwnProperty:G,hasOwnProp:G,reduceDescriptors:$,freezeMethods:e=>{$(e,(t,r)=>{if(R(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;if(R(e[r])){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},toObjectSet:(e,t)=>{let r={};return(S(e)?e:String(e).split(t)).forEach(e=>{r[e]=!0}),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e*=1)?e:t,findKey:F,global:B,isContextDefined:q,isSpecCompliantForm:function(e){return!!(e&&R(e.append)&&"FormData"===e[b]&&e[y])},toJSONObject:e=>{let t=Array(10),r=(e,n)=>{if(A(e)){if(t.indexOf(e)>=0)return;if(E(e))return e;if(!("toJSON"in e)){t[n]=e;let i=S(e)?[]:{};return W(e,(e,t)=>{let o=r(e,n+1);O(o)||(i[t]=o)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Y,isThenable:e=>e&&(A(e)||R(e))&&R(e.then)&&R(e.catch),setImmediate:Q,asap:z,isIterable:e=>null!=e&&R(e[y])};function X(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}J.inherits(X,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:J.toJSONObject(this.config),code:this.code,status:this.status}}});let Z=X.prototype,ee={};function et(e){return J.isPlainObject(e)||J.isArray(e)}function er(e){return J.endsWith(e,"[]")?e.slice(0,-2):e}function en(e,t,r){return e?e.concat(t).map(function(e,t){return e=er(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ee[e]={value:e}}),Object.defineProperties(X,ee),Object.defineProperty(Z,"isAxiosError",{value:!0}),X.from=(e,t,r,n,i,o)=>{let s=Object.create(Z);J.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);let a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return X.call(s,a,l,r,n,i),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};let ei=J.toFlatObject(J,{},null,function(e){return/^is[A-Z]/.test(e)});function eo(e,t,r){if(!J.isObject(e))throw TypeError("target must be an object");t=t||new FormData;let n=(r=J.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!J.isUndefined(t[e])})).metaTokens,i=r.visitor||u,o=r.dots,s=r.indexes,a=(r.Blob||"u">typeof Blob&&Blob)&&J.isSpecCompliantForm(t);if(!J.isFunction(i))throw TypeError("visitor must be a function");function l(e){if(null===e)return"";if(J.isDate(e))return e.toISOString();if(J.isBoolean(e))return e.toString();if(!a&&J.isBlob(e))throw new X("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(e)||J.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):f.Buffer.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(J.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else{var u;if(J.isArray(e)&&(u=e,J.isArray(u)&&!u.some(et))||(J.isFileList(e)||J.endsWith(r,"[]"))&&(a=J.toArray(e)))return r=er(r),a.forEach(function(e,n){J.isUndefined(e)||null===e||t.append(!0===s?en([r],n,o):null===s?r:r+"[]",l(e))}),!1}return!!et(e)||(t.append(en(i,r,o),l(e)),!1)}let c=[],d=Object.assign(ei,{defaultVisitor:u,convertValue:l,isVisitable:et});if(!J.isObject(e))throw TypeError("data must be an object");return!function e(r,n){if(!J.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),J.forEach(r,function(r,o){!0===(!(J.isUndefined(r)||null===r)&&i.call(t,r,J.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])}),c.pop()}}(e),t}
2function es(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ea(e,t){this._pairs=[],e&&eo(e,this,t)}let el=ea.prototype;function eu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ec(e,t,r){let n;if(!t)return e;let i=r&&r.encode||eu;J.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize;if(n=o?o(t,r):J.isURLSearchParams(t)?t.toString():new ea(t,r).toString(i)){let t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}el.append=function(e,t){this._pairs.push([e,t])},el.toString=function(e){let t=e?function(t){return e.call(this,t,es)}:es;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ed=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,function(t){null!==t&&e(t)})}},ef={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},eh="u">typeof URLSearchParams?URLSearchParams:ea,ep="u">typeof FormData?FormData:null,eg="u">typeof Blob?Blob:null;let ey="u">typeof window&&"u">typeof document,eb="object"==typeof navigator&&navigator||void 0,ev=ey&&(!eb||0>["ReactNative","NativeScript","NS"].indexOf(eb.product)),em="u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,e_=ey&&window.location.href||"http://localhost";var eS={...Object.freeze({__proto__:null,hasBrowserEnv:ey,hasStandardBrowserWebWorkerEnv:em,hasStandardBrowserEnv:ev,navigator:eb,origin:e_}),isBrowser:!0,classes:{URLSearchParams:eh,FormData:ep,Blob:eg},protocols:["http","https","file","blob","url","data"]};function eO(e){if(J.isFormData(e)&&J.isFunction(e.entries)){let t={};return J.forEachEntry(e,(e,r)=>{!function e(t,r,n,i){let o=t[i++];if("__proto__"===o)return!0;let s=Number.isFinite(+o),a=i>=t.length;return(o=!o&&J.isArray(n)?n.length:o,a)?J.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r:(n[o]&&J.isObject(n[o])||(n[o]=[]),e(t,r,n[o],i)&&J.isArray(n[o])&&(n[o]=function(e){let t,r,n={},i=Object.keys(e),o=i.length;for(t=0;t<o;t++)n[r=i[t]]=e[r];return n}(n[o]))),!s}(J.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0]),r,t,0)}),t}return null}let eE={transitional:ef,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r,n=t.getContentType()||"",i=n.indexOf("application/json")>-1,o=J.isObject(e);if(o&&J.isHTMLForm(e)&&(e=new FormData(e)),J.isFormData(e))return i?JSON.stringify(eO(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1){var s,a;return(s=e,a=this.formSerializer,eo(s,new eS.classes.URLSearchParams,{visitor:function(e,t,r,n){return eS.isNode&&J.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...a})).toString()}if((r=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){let t=this.env&&this.env.FormData;return eo(r?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(o||i){t.setContentType("application/json",!1);var l=e;if(J.isString(l))try{return(0,JSON.parse)(l),J.trim(l)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(l)}return e}],transformResponse:[function(e){let t=this.transitional||eE.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(r&&!this.responseType||n)){let r=t&&t.silentJSONParsing;try{return JSON.parse(e,this.parseReviver)}catch(e){if(!r&&n){if("SyntaxError"===e.name)throw X.from(e,X.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:eS.classes.FormData,Blob:eS.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],e=>{eE.headers[e]={}});let ew=J.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"]),eP=Symbol("internals");function eR(e){return e&&String(e).trim().toLowerCase()}function eT(e){return!1===e||null==e?e:J.isArray(e)?e.map(eT):String(e)}function eA(e,t,r,n,i){if(J.isFunction(n))return n.call(this,t,r);if(i&&(t=r),J.isString(t)){if(J.isString(n))return -1!==t.indexOf(n);if(J.isRegExp(n))return n.test(t)}}class ex{constructor(e){e&&this.set(e)}set(e,t,r){let n=this;function i(e,t,r){let i=eR(t);if(!i)throw Error("header name must be a non-empty string");
2let o=J.findKey(n,i);o&&void 0!==n[o]&&!0!==r&&(void 0!==r||!1===n[o])||(n[o||t]=eT(e))}let o=(e,t)=>J.forEach(e,(e,r)=>i(e,r,t));if(J.isPlainObject(e)||e instanceof this.constructor)o(e,t);else{let n;if(J.isString(e)&&(e=e.trim())&&(n=e,!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim()))){var s;let r,n,i,a;o((a={},(s=e)&&s.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||a[r]&&ew[r]||("set-cookie"===r?a[r]?a[r].push(n):a[r]=[n]:a[r]=a[r]?a[r]+", "+n:n)}),a),t)}else if(J.isObject(e)&&J.isIterable(e)){let r={},n,i;for(let t of e){if(!J.isArray(t))throw TypeError("Object iterator must return a key-value pair");r[i=t[0]]=(n=r[i])?J.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(r,t)}else null!=e&&i(t,e,r)}return this}get(e,t){if(e=eR(e)){let r=J.findKey(this,e);if(r){let e=this[r];if(!t)return e;if(!0===t){let t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;for(;t=n.exec(e);)r[t[1]]=t[2];return r}if(J.isFunction(t))return t.call(this,e,r);if(J.isRegExp(t))return t.exec(e);throw TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=eR(e)){let r=J.findKey(this,e);return!!(r&&void 0!==this[r]&&(!t||eA(this,this[r],r,t)))}return!1}delete(e,t){let r=this,n=!1;function i(e){if(e=eR(e)){let i=J.findKey(r,e);i&&(!t||eA(r,r[i],i,t))&&(delete r[i],n=!0)}}return J.isArray(e)?e.forEach(i):i(e),n}clear(e){let t=Object.keys(this),r=t.length,n=!1;for(;r--;){let i=t[r];(!e||eA(this,this[i],i,e,!0))&&(delete this[i],n=!0)}return n}normalize(e){let t=this,r={};return J.forEach(this,(n,i)=>{let o=J.findKey(r,i);if(o){t[o]=eT(n),delete t[i];return}let s=e?i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r):String(i).trim();s!==i&&delete t[i],t[s]=eT(n),r[s]=!0}),this}concat(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.constructor.concat(this,...t)}toJSON(e){let t=Object.create(null);return J.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&J.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(e=>{let[t,r]=e;return t+": "+r}).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let i=new this(e);return r.forEach(e=>i.set(e)),i}static accessor(e){let t=(this[eP]=this[eP]={accessors:{}}).accessors,r=this.prototype;function n(e){let n=eR(e);if(!t[n]){let i;i=J.toCamelCase(" "+e),["get","set","has"].forEach(t=>{Object.defineProperty(r,t+i,{value:function(r,n,i){return this[t].call(this,e,r,n,i)},configurable:!0})}),t[n]=!0}}return J.isArray(e)?e.forEach(n):n(e),this}}function eC(e,t){let r=this||eE,n=t||r,i=ex.from(n.headers),o=n.data;return J.forEach(e,function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function ek(e){return!!(e&&e.__CANCEL__)}function eI(e,t,r){X.call(this,null==e?"canceled":e,X.ERR_CANCELED,t,r),this.name="CanceledError"}function ej(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new X("Request failed with status code "+r.status,[X.ERR_BAD_REQUEST,X.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}ex.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(ex.prototype,(e,t)=>{let{value:r}=e,n=t[0].toUpperCase()+t.slice(1);return{get:()=>r,set(e){this[n]=e}}}),J.freezeMethods(ex),J.inherits(eI,X,{__CANCEL__:!0});let eM=function(e,t){var r,n,i;let o,s,a,l,u,c,d,f,h,p,g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,y=0,b=(n=250,s=Array(r=r=50),a=Array(r),l=0,u=0,n=void 0!==n?n:1e3,function(e){let t=Date.now(),i=a[u];o||(o=t),s[l]=e,a[l]=t;let c=u,d=0;for(;c!==l;)d+=s[c++],c%=r;if((l=(l+1)%r)===u&&(u=(u+1)%r),t-o<n)return;let f=i&&t-i;return f?Math.round(1e3*d/f):void 0});return i=r=>{let n=r.loaded,i=r.lengthComputable?r.total:void 0,o=n-y,s=b(o);y=n,e({loaded:n,total:i,progress:i?n/i:void 0,bytes:o,rate:s||void 0,estimated:s&&i&&n<=i?(i-n)/s:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},f=0,h=1e3/g,p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();f=t,c=null,d&&(clearTimeout(d),d=null),i(...e)},[function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=Date.now(),i=n-f;i>=h?p(t,n):(c=t,d||(d=setTimeout(()=>{d=null,p(c)},h-i)))},()=>c&&p(c)]},eN=(e,t)=>{let r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},eD=e=>function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return J.asap(()=>e(...r))};var eL=eS.hasStandardBrowserEnv?(o=new URL(eS.origin),s=eS.navigator&&/(msie|trident)/i.test(eS.navigator.userAgent),e=>
2(e=new URL(e,eS.origin),o.protocol===e.protocol&&o.host===e.host&&(s||o.port===e.port))):()=>!0,eU=eS.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];J.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),J.isString(n)&&s.push("path="+n),J.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function eW(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||!1==r)?t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e:t}let eF=e=>e instanceof ex?{...e}:e;function eB(e,t){t=t||{};let r={};function n(e,t,r,n){return J.isPlainObject(e)&&J.isPlainObject(t)?J.merge.call({caseless:n},e,t):J.isPlainObject(t)?J.merge({},t):J.isArray(t)?t.slice():t}function i(e,t,r,i){return J.isUndefined(t)?J.isUndefined(e)?void 0:n(void 0,e,r,i):n(e,t,r,i)}function o(e,t){if(!J.isUndefined(t))return n(void 0,t)}function s(e,t){return J.isUndefined(t)?J.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}let l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>i(eF(e),eF(t),r,!0)};return J.forEach(Object.keys({...e,...t}),function(n){let o=l[n]||i,s=o(e[n],t[n],n);J.isUndefined(s)&&o!==a||(r[n]=s)}),r}var eq=e=>{let t=eB({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=ex.from(s),t.url=ec(eW(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),J.isFormData(r)){if(eS.hasStandardBrowserEnv||eS.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(J.isFunction(r.getHeaders)){let e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(e=>{let[r,n]=e;t.includes(r.toLowerCase())&&s.set(r,n)})}}if(eS.hasStandardBrowserEnv&&(n&&J.isFunction(n)&&(n=n(t)),n||!1!==n&&eL(t.url))){let e=i&&o&&eU.read(o);e&&s.set(i,e)}return t},eK="u">typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){var n;let i,o,s,a,l,u,c=eq(e),d=c.data,f=ex.from(c.headers).normalize(),{responseType:h,onUploadProgress:p,onDownloadProgress:g}=c;function y(){a&&a(),l&&l(),c.cancelToken&&c.cancelToken.unsubscribe(i),c.signal&&c.signal.removeEventListener("abort",i)}let b=new XMLHttpRequest;function v(){if(!b)return;let n=ex.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders());ej(function(e){t(e),y()},function(e){r(e),y()},{data:h&&"text"!==h&&"json"!==h?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:n,config:e,request:b}),b=null}b.open(c.method.toUpperCase(),c.url,!0),b.timeout=c.timeout,"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||4!==b.readyState||(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(v)},b.onabort=function(){b&&(r(new X("Request aborted",X.ECONNABORTED,e,b)),b=null)},b.onerror=function(t){let n=new X(t&&t.message?t.message:"Network Error",X.ERR_NETWORK,e,b);n.event=t||null,r(n),b=null},b.ontimeout=function(){let t=c.timeout?"timeout of "+c.timeout+"ms exceeded":"timeout exceeded",n=c.transitional||ef;c.timeoutErrorMessage&&(t=c.timeoutErrorMessage),r(new X(t,n.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,b)),b=null},void 0===d&&f.setContentType(null),"setRequestHeader"in b&&J.forEach(f.toJSON(),function(e,t){b.setRequestHeader(t,e)}),J.isUndefined(c.withCredentials)||(b.withCredentials=!!c.withCredentials),h&&"json"!==h&&(b.responseType=c.responseType),g&&([s,l]=eM(g,!0),b.addEventListener("progress",s)),p&&b.upload&&([o,a]=eM(p),b.upload.addEventListener("progress",o),b.upload.addEventListener("loadend",a)),(c.cancelToken||c.signal)&&(i=t=>{b&&(r(!t||t.type?new eI(null,e,b):t),b.abort(),b=null)},c.cancelToken&&c.cancelToken.subscribe(i),c.signal&&(c.signal.aborted?i():c.signal.addEventListener("abort",i)));let m=(n=c.url,(u=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n))&&u[1]||"");m&&-1===eS.protocols.indexOf(m)?r(new X("Unsupported protocol "+m+":",X.ERR_BAD_REQUEST,e)):b.send(d||null)})};let eV=function*(e,t){let r,n=e.byteLength;if(!t||n<t)return void(yield e);let i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},eG=async function*(e,t){for await(let r of eH(e))yield*eV(r,t)},eH=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);let t=e.getReader();try{for(;;){let{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},e$=(e,t,r,n)=>{let i,o=eG(e,t),s=0,a=e=>{!i&&(i=!0,n&&n(e))};return new ReadableStream({async pull(e){try{let{done:t,value:n}=await o.next();if(t){a(),e.close();return}let i=n.byteLength;if(r){let e=s+=i;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:eY}=J,eQ=(e=>{let{Request:t,Response:r}=e;return{Request:t,Response:r}})(J.global),{ReadableStream:ez,TextEncoder:eJ}=J.global,eX=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];try{return!!e(...r)}catch(e){return!1}},eZ=e=>{let t,{fetch:r,Request:n,Response:i}=e=J.merge.call({skipUndefined:!0},eQ,e),o=r?eY(r):"function"==typeof fetch,s=eY(n),a=eY(i);if(!o)return!1;
2let l=o&&eY(ez),u=o&&("function"==typeof eJ?(t=new eJ,e=>t.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=s&&l&&eX(()=>{let e=!1,t=new n(eS.origin,{body:new ez,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&l&&eX(()=>J.isReadableStream(new i("").body)),f={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{f[e]||(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new X(`Response type '${e}' is not supported`,X.ERR_NOT_SUPPORT,r)})});let h=async e=>{if(null==e)return 0;if(J.isBlob(e))return e.size;if(J.isSpecCompliantForm(e)){let t=new n(eS.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return J.isArrayBufferView(e)||J.isArrayBuffer(e)?e.byteLength:(J.isURLSearchParams(e)&&(e+=""),J.isString(e))?(await u(e)).byteLength:void 0},p=async(e,t)=>{let r=J.toFiniteNumber(e.getContentLength());return null==r?h(t):r};return async e=>{let t,{url:o,method:a,data:l,signal:u,cancelToken:h,timeout:g,onDownloadProgress:y,onUploadProgress:b,responseType:v,headers:m,withCredentials:_="same-origin",fetchOptions:S}=eq(e),O=r||fetch;v=v?(v+"").toLowerCase():"text";let E=((e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController,i=function(e){if(!r){r=!0,s();let t=e instanceof Error?e:this.reason;n.abort(t instanceof X?t:new eI(t instanceof Error?t.message:t))}},o=t&&setTimeout(()=>{o=null,i(new X(`timeout ${t} of ms exceeded`,X.ETIMEDOUT))},t),s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));let{signal:a}=n;return a.unsubscribe=()=>J.asap(s),a}})([u,h&&h.toAbortSignal()],g),w=null,P=E&&E.unsubscribe&&(()=>{E.unsubscribe()});try{if(b&&c&&"get"!==a&&"head"!==a&&0!==(t=await p(m,l))){let e,r=new n(o,{method:"POST",body:l,duplex:"half"});if(J.isFormData(l)&&(e=r.headers.get("content-type"))&&m.setContentType(e),r.body){let[e,n]=eN(t,eM(eD(b)));l=e$(r.body,65536,e,n)}}J.isString(_)||(_=_?"include":"omit");let r=s&&"credentials"in n.prototype,u={...S,signal:E,method:a.toUpperCase(),headers:m.normalize().toJSON(),body:l,duplex:"half",credentials:r?_:void 0};w=s&&new n(o,u);let h=await (s?O(w,S):O(o,u)),g=d&&("stream"===v||"response"===v);if(d&&(y||g&&P)){let e={};["status","statusText","headers"].forEach(t=>{e[t]=h[t]});let t=J.toFiniteNumber(h.headers.get("content-length")),[r,n]=y&&eN(t,eM(eD(y),!0))||[];h=new i(e$(h.body,65536,r,()=>{n&&n(),P&&P()}),e)}v=v||"text";let R=await f[J.findKey(f,v)||"text"](h,e);return!g&&P&&P(),await new Promise((t,r)=>{ej(t,r,{data:R,headers:ex.from(h.headers),status:h.status,statusText:h.statusText,config:e,request:w})})}catch(t){if(P&&P(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new X("Network Error",X.ERR_NETWORK,e,w),{cause:t.cause||t});throw X.from(t,t&&t.code,e,w)}}},e0=new Map,e1=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,o=[n,i,r],s=o.length,a,l,u=e0;for(;s--;)a=o[s],void 0===(l=u.get(a))&&u.set(a,l=s?new Map:eZ(t)),u=l;return l};e1();let e5={http:null,xhr:eK,fetch:{get:e1}};J.forEach(e5,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});let e2=e=>`- ${e}`,e3=e=>J.isFunction(e)||null===e||!1===e;var e6=(e,t)=>{let r,n,{length:i}=e=J.isArray(e)?e:[e],o={};for(let s=0;s<i;s++){let i;if(n=r=e[s],!e3(r)&&void 0===(n=e5[(i=String(r)).toLowerCase()]))throw new X(`Unknown adapter '${i}'`);if(n&&(J.isFunction(n)||(n=n.get(t))))break;o[i||"#"+s]=n}if(!n){let e=Object.entries(o).map(e=>{let[t,r]=e;return`adapter ${t} `+(!1===r?"is not supported by the environment":"is not available in the build")});throw new X("There is no suitable adapter to dispatch the request "+(i?e.length>1?"since :\n"+e.map(e2).join("\n"):" "+e2(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function e4(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new eI(null,e)}function e8(e){return e4(e),e.headers=ex.from(e.headers),e.data=eC.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),e6(e.adapter||eE.adapter,e)(e).then(function(t){return e4(e),t.data=eC.call(e,e.transformResponse,t),t.headers=ex.from(t.headers),t},function(t){return!ek(t)&&(e4(e),t&&t.response&&(t.response.data=eC.call(e,e.transformResponse,t.response),t.response.headers=ex.from(t.response.headers))),Promise.reject(t)})}let e7="1.12.2",e9={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{e9[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});let te={};e9.transitional=function(e,t,r){function n(e,t){return"[Axios v"+e7+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>
2{if(!1===e)throw new X(n(i," has been removed"+(t?" in "+t:"")),X.ERR_DEPRECATED);return t&&!te[i]&&(te[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}},e9.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var tt=function(e,t,r){if("object"!=typeof e)throw new X("options must be an object",X.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let o=n[i],s=t[o];if(s){let t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new X("option "+o+" must be "+r,X.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new X("Unknown option "+o,X.ERR_BAD_OPTION)}};class tr{constructor(e){this.defaults=e||{},this.interceptors={request:new ed,response:new ed}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){let r,n;"string"==typeof e?(t=t||{}).url=e:t=e||{};let{transitional:i,paramsSerializer:o,headers:s}=t=eB(this.defaults,t);void 0!==i&&tt(i,{silentJSONParsing:e9.transitional(e9.boolean),forcedJSONParsing:e9.transitional(e9.boolean),clarifyTimeoutError:e9.transitional(e9.boolean)},!1),null!=o&&(J.isFunction(o)?t.paramsSerializer={serialize:o}:tt(o,{encode:e9.function,serialize:e9.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),tt(t,{baseUrl:e9.spelling("baseURL"),withXsrfToken:e9.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=s&&J.merge(s.common,s[t.method]);s&&J.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=ex.concat(a,s);let l=[],u=!0;this.interceptors.request.forEach(function(e){("function"!=typeof e.runWhen||!1!==e.runWhen(t))&&(u=u&&e.synchronous,l.unshift(e.fulfilled,e.rejected))});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d=0;if(!u){let e=[e8.bind(this),void 0];for(e.unshift(...l),e.push(...c),n=e.length,r=Promise.resolve(t);d<n;)r=r.then(e[d++],e[d++]);return r}n=l.length;let f=t;for(;d<n;){let e=l[d++],t=l[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{r=e8.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,n=c.length;d<n;)r=r.then(c[d++],c[d++]);return r}getUri(e){return ec(eW((e=eB(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}J.forEach(["delete","get","head","options"],function(e){tr.prototype[e]=function(t,r){return this.request(eB(r||{},{method:e,url:t,data:(r||{}).data}))}}),J.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(eB(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}tr.prototype[e]=t(),tr.prototype[e+"Form"]=t(!0)});var tn=class e{constructor(e){let t;if("function"!=typeof e)throw TypeError("executor must be a function.");this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t,n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,i){r.reason||(r.reason=new eI(e,n,i),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};let ti={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,Re
2setContent: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};Object.entries(ti).forEach(e=>{let[t,r]=e;ti[r]=t});let to=function e(t){let r=new tr(t),n=h(tr.prototype.request,r);return J.extend(n,tr.prototype,r,{allOwnKeys:!0}),J.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(eB(t,r))},n}(eE);to.Axios=tr,to.CanceledError=eI,to.CancelToken=tn,to.isCancel=ek,to.VERSION=e7,to.toFormData=eo,to.AxiosError=X,to.Cancel=to.CanceledError,to.all=function(e){return Promise.all(e)},to.spread=function(e){return function(t){return e.apply(null,t)}},to.isAxiosError=function(e){return J.isObject(e)&&!0===e.isAxiosError},to.mergeConfig=eB,to.AxiosHeaders=ex,to.formToJSON=e=>eO(J.isHTMLForm(e)?new FormData(e):e),to.getAdapter=e6,to.HttpStatusCode=ti,to.default=to,t.exports=to},87855,(e,t,r)=>{"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),r.LinearPositionIdx=r.API_ERROR_CODE=r.positionTpSlModeEnum=r.linearPositionModeEnum=void 0,r.linearPositionModeEnum={OneWayMode:"MergedSingle",HedgeMode:"BothSide"},r.positionTpSlModeEnum={Full:"Full",Partial:"Partial"},r.API_ERROR_CODE={BALANCE_INSUFFICIENT_SPOT:-1131,ORDER_NOT_FOUND_OR_TOO_LATE_SPOT:-2013,SUCCESS:0,PARAMS_MISSING_OR_WRONG:10001,INVALID_API_KEY_OR_PERMISSIONS:10003,SIGNATURE_NOT_VALID:10004,INCORRECT_API_KEY_PERMISSIONS:10005,INCORRECT_API_REQUEST_IP:10010,DB_ERROR_WRONG_CURSOR:10016,ACCOUNT_NOT_UNIFIED:10020,UNKNOWN_ERROR:12e3,BALANCE_INSUFFICIENT_SPOT_V3:12131,ORDER_NOT_FOUND_SPOT_V3:12213,ORDER_NOT_FOUND_LEVERAGED_TOKEN:12407,EXCEEDED_UPPER_LIMIT_LEVERAGED_TOKEN:12409,QUERY_ACCOUNT_INFO_ERROR:12602,CROSS_MARGIN_USER_NOT_FOUND:12607,CROSS_MARGIN_REPAYMENT_NOT_REQUIRED:12616,CROSS_MARGIN_NOT_ENABLED:12640,ORDER_NOT_FOUND_OR_TOO_LATE:20001,POSITION_STATUS_NOT_NORMAL:30013,CANNOT_SET_TRADING_STOP_FOR_ZERO_POS:30024,INSUFFICIENT_BALANCE_FOR_ORDER_COST:30031,POSITION_IDX_NOT_MATCH_POSITION_MODE:30041,INSUFFICIENT_BALANCE:30042,POSITION_IS_CROSS_MARGIN:30056,POSITION_MODE_NOT_MODIFIED:30083,ISOLATED_NOT_MODIFIED:30084,RISK_LIMIT_NOT_EXISTS:30090,SUB_USER_ALREADY_EXISTS:31005,LEVERAGE_NOT_MODIFIED:34036,SAME_SLTP_MODE:37002,COPY_TRADE_NOT_OPEN_ORDER:39426,V5_ORDER_NOT_FOUND:110001,V5_INSUFFICIENT_BALANCE:110007,V5_API_KEY_PERMISSION_DENIED:10005,V5_CROSS_ISOLATED_MARGIN_NOT_CHANGED:110026,V5_LEVERAGE_NOT_CHANGED:110043,V5_MARGIN_MODE_NOT_CHANGED:110073,V5_TPSL_NOT_CHANGED:10001,V5_RISK_ID_NOT_CHANGED:10001,V5_AUTO_ADD_MARGIN_NOT_CHANGED:10001,V5_TPSL_ERROR_NO_POSITION:10001,V5_RISK_ID_NOT_MODIFIED:110075,QTY_EXCEEDS_MAX_LIMIT:130006,ORDER_NOT_FOUND_OR_TOO_LATE_LINEAR:130010,ORDER_COST_NOT_AVAILABLE:130021,CANNOT_SET_LINEAR_TRADING_STOP_FOR_ZERO_POS:130024,ISOLATED_NOT_MODIFIED_LINEAR:130056,POSITION_SIZE_IS_ZERO:130057,AUTO_ADD_MARGIN_NOT_MODIFIED:130060,INSUFFICIENT_BALANCE_FOR_ORDER_COST_LINEAR:130080,SAME_SLTP_MODE_LINEAR:130150,NOT_SUPPORTED_FOR_SUBACCOUNTS:131003,TRANSFER_ID_EXISTS:131214,RISK_ID_NOT_MODIFIED:134026,CONTRACT_ORDER_NOT_EXISTS:140001,CONTRACT_INSUFFICIENT_BALANCE:140007,CONTRACT_POSITION_MODE_NOT_MODIFIED:140025,CONTRACT_MARGIN_MODE_NOT_MODIFIED:140026,CONTRACT_RISK_
2LIMIT_INFO_NOT_EXISTS:140031,CONTRACT_SET_LEVERAGE_NOT_MODIFIED:140043,SUB_USER_NOT_FOUND:141009,SPOT_LEVERAGE_TOKEN_INSUFFICIENT_BALANCE:175006,SPOT_LEVERAGE_TOKEN_ORDER_NOT_FOUND:175007,SPOT_LEVERAGE_QUIZ_REQUIRED:175010,SPOT_MARGIN_NOT_ENABLED:176008,SPOT_MARGIN_QUESTIONNAIRE_NOT_SUBMIT:176037,CONTRACT_NAME_NOT_EXIST:3100111,ORDER_NOT_EXIST:3100136,NO_ACTIVE_ORDER:3100205,ACCOUNT_NOT_EXIST:3200200,INCORRECT_PRIVATE_OPERATIONS:3303001,SET_MARGIN_MODE_FAILED_USDC:3400045,INCORRECT_MMP_PARAMETERS:3500712,INSTITION_MMP_PROFILE_NOT_FOUND:3500713},(i=n||(r.LinearPositionIdx=n={}))[i.OneWayMode=0]="OneWayMode",i[i.BuySide=1]="BuySide",i[i.SellSide=2]="SellSide"},679877,(e,t,r)=>{"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(e,t){return new Promise(function(r,n){var i,o,s;function a(r){e.removeListener(t,l),n(r)}function l(){"function"==typeof e.removeListener&&e.removeListener("error",a),r([].slice.call(arguments))}b(e,t,l,{once:!0}),"error"!==t&&(i=e,o=a,s={once:!0},"function"==typeof i.on&&b(i,"error",o,s))})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function u(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function d(e,t,r,n){if(u(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var i,o,s,a=Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,console&&console.warn&&console.warn(a)}return e}function f(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function b(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(o){n.once&&e.removeEventListener(t,i),r(o)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||s(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");l=e}}),a.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var s,a=Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)o(l,this,t);else for(var u=l.length,c=y(l,u),r=0;r<u;++r)o(c[r],this,t);return!0},a.prototype.addListener=function(e,t){return d(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return d(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,o,s;if(u(t),void 0===(n=this._events)||void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit
2("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},29607,(e,t,r)=>{var n=e.i(769202),i=e.i(261955),o={7492:function(e){e.exports=function(e,r,n){if(e.filter)return e.filter(r,n);if(null==e||"function"!=typeof r)throw TypeError();for(var i=[],o=0;o<e.length;o++)if(t.call(e,o)){var s=e[o];r.call(n,s,o,e)&&i.push(s)}return i};var t=Object.prototype.hasOwnProperty},1648:function(e,t,r){"use strict";var n=r(7797),i=r(4834),o=r(8772);e.exports=r(9095)||n.call(o,i)},4757:function(e,t,r){"use strict";var n=r(7797),i=r(4834),o=r(1648);e.exports=function(){return o(n,i,arguments)}},4834:function(e){"use strict";e.exports=Function.prototype.apply},8772:function(e){"use strict";e.exports=Function.prototype.call},2462:function(e,t,r){"use strict";var n=r(7797),i=r(4785),o=r(8772),s=r(1648);e.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new i("a function is required");return s(n,o,e)}},9095:function(e){"use strict";e.exports="u">typeof Reflect&&Reflect&&Reflect.apply},2982:function(e,t,r){"use strict";var n=r(1893),i=r(5494),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},5494:function(e,t,r){"use strict";var n=r(3798),i=r(871),o=r(2462),s=r(4757);e.exports=function(e){var t=o(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},i?i(e.exports,"apply",{value:s}):e.exports.apply=s},2071:function(e,t,r){"use strict";var n=r(871),i=r(9546),o=r(4785),s=r(8322);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],d=!!s&&s(e,t);if(n)n(e,t,{configurable:null===u&&d?d.configurable:!u,enumerable:null===a&&d?d.enumerable:!a,value:r,writable:null===l&&d?d.writable:!l});else if(!c&&(a||l||u))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");else e[t]=r}},3859:function(e,t,r){"use strict";var n,i=r(2462),o=r(8322);try{n=[].__proto__===Array.prototype}
2catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var s=!!n&&o&&o(Object.prototype,"__proto__"),a=Object,l=a.getPrototypeOf;e.exports=s&&"function"==typeof s.get?i([s.get]):"function"==typeof l&&function(e){return l(null==e?e:a(e))}},871:function(e){"use strict";var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch(e){t=!1}e.exports=t},1247:function(e){"use strict";e.exports=EvalError},6621:function(e){"use strict";e.exports=Error},6136:function(e){"use strict";e.exports=RangeError},252:function(e){"use strict";e.exports=ReferenceError},9546:function(e){"use strict";e.exports=SyntaxError},4785:function(e){"use strict";e.exports=TypeError},1223:function(e){"use strict";e.exports=URIError},8300:function(e){"use strict";e.exports=Object},4680:function(e){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s<o;s++)n.call(i,e[s],s,e);else for(var a in e)t.call(e,a)&&n.call(i,e[a],a,e)}},6555:function(e){"use strict";var t=Object.prototype.toString,r=Math.max,n=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r},i=function(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r},o=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};e.exports=function(e){var s,a=this;if("function"!=typeof a||"[object Function]"!==t.apply(a))throw TypeError("Function.prototype.bind called on incompatible "+a);for(var l=i(arguments,1),u=r(0,a.length-l.length),c=[],d=0;d<u;d++)c[d]="$"+d;if(s=Function("binder","return function ("+o(c,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof s){var t=a.apply(this,n(l,arguments));return Object(t)===t?t:this}return a.apply(e,n(l,arguments))}),a.prototype){var f=function(){};f.prototype=a.prototype,s.prototype=new f,f.prototype=null}return s}},7797:function(e,t,r){"use strict";var n=r(6555);e.exports=Function.prototype.bind||n},1893:function(e,t,r){"use strict";var n,i=r(8300),o=r(6621),s=r(1247),a=r(6136),l=r(252),u=r(9546),c=r(4785),d=r(1223),f=r(4197),h=r(4455),p=r(1295),g=r(6949),y=r(2943),b=r(1721),v=r(3536),m=Function,_=function(e){try{return m('"use strict"; return ('+e+").constructor;")()}catch(e){}},S=r(8322),O=r(871),E=function(){throw new c},w=S?function(){try{return arguments.callee,E}catch(e){try{return S(arguments,"callee").get}catch(e){return E}}}():E,P=r(9131)(),R=r(9717),T=r(45),A=r(7767),x=r(4834),C=r(8772),k={},I="u">typeof Uint8Array&&R?R(Uint8Array):n,j={__proto__:null,"%AggregateError%":"u"<typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"u"<typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":P&&R?R([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%Atomics%":"u"<typeof Atomics?n:Atomics,"%BigInt%":"u"<typeof BigInt?n:BigInt,"%BigInt64Array%":"u"<typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"u"<typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"u"<typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":s,"%Float16Array%":"u"<typeof Float16Array?n:Float16Array,"%Float32Array%":"u"<typeof Float32Array?n:Float32Array,"%Float64Array%":"u"<typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"u"<typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":m,"%GeneratorFunction%":k,"%Int8Array%":"u"<typeof Int8Array?n:Int8Array,"%Int16Array%":"u"<typeof Int16Array?n:Int16Array,"%Int32Array%":"u"<typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%
2IteratorPrototype%":P&&R?R(R([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"u"<typeof Map?n:Map,"%MapIteratorPrototype%":"u">typeof Map&&P&&R?R((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":S,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"u"<typeof Promise?n:Promise,"%Proxy%":"u"<typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":l,"%Reflect%":"u"<typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"u"<typeof Set?n:Set,"%SetIteratorPrototype%":"u">typeof Set&&P&&R?R((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"u"<typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P&&R?R(""[Symbol.iterator]()):n,"%Symbol%":P?Symbol:n,"%SyntaxError%":u,"%ThrowTypeError%":w,"%TypedArray%":I,"%TypeError%":c,"%Uint8Array%":"u"<typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"u"<typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"u"<typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"u"<typeof Uint32Array?n:Uint32Array,"%URIError%":d,"%WeakMap%":"u"<typeof WeakMap?n:WeakMap,"%WeakRef%":"u"<typeof WeakRef?n:WeakRef,"%WeakSet%":"u"<typeof WeakSet?n:WeakSet,"%Function.prototype.call%":C,"%Function.prototype.apply%":x,"%Object.defineProperty%":O,"%Object.getPrototypeOf%":T,"%Math.abs%":f,"%Math.floor%":h,"%Math.max%":p,"%Math.min%":g,"%Math.pow%":y,"%Math.round%":b,"%Math.sign%":v,"%Reflect.getPrototypeOf%":A};if(R)try{null.error}catch(e){var M=R(R(e));j["%Error.prototype%"]=M}var N=function e(t){var r;if("%AsyncFunction%"===t)r=_("async function () {}");else if("%GeneratorFunction%"===t)r=_("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=_("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&R&&(r=R(i.prototype))}return j[t]=r,r},D={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},L=r(7797),U=r(3383),W=L.call(C,Array.prototype.concat),F=L.call(x,Array.prototype.splice),B=L.call(C,String.prototype.replace),q=L.call(C,String.prototype.slice),K=L.call(C,RegExp.prototype.exec),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G=/\\(\\)?/g,H=function(e){var t=q(e,0,1),r=q(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var n=[];return B(e,V,function(e,t,r,i){n[n.length]=r?B(i,G,"$1"):t||e}),n},$=function(e,t){var r,n=e;if(U(D,n)&&(n="%"+(r=D[n])[0]+"%"),U(j,n)){var i=j[n];if(i===k&&(i=N(n)),void 0===i&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new u("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===K(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=H(e),n=r.length>0?r[0]:"",i=$("%"+n+"%",t),o=i.name,s=i.value,a=!1,l=i.alias;l&&(n=l[0],F(r,W([0,1],l)));for(var d=1,f=!0;d<r.length;d+=1){var h=r[d],p=q(h,0,1),g=q(h,-1);if(('"'===p||"'"===p||"`"===p||'"'===g||"'"===g||"`"===g)&&p!==g)throw new u("property names with quotes must have matching quotes");if("constructor"!==h&&f||(a=!0),n+="."+h,U(j,o="%"+n+"%"))s=j[o];else if(null!=s){if(!(h in s)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(S&&d+1>=r.length){var y=S(s,h);s=(f=!!y)&&"get"in y&&!("originalValue"in y.get)?y.get:s[h]}else f=U(s,h),s=s[h];f&&!a&&(j[o]=s)}}return s}},45:function(e,t,r){"use strict";e.exports=r(8300).getPrototypeOf||null},7767:function(e){"use strict";e.exports="u">typeof Reflect&&Reflect.getPrototypeOf||null},9717:function(e,t,r){"use strict";var n=r(7767),i=r(45),o=r(3859);e.exports=n?function(e){return n(e)}:i?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw TypeError("getProto: not an object");return i(e)}:o?function(e){return o(e)}:null},8422:function(e){"use strict";e.exports=Object.getOwnPropertyDescriptor},8322:function(e,t,r){"use strict";var n=r(8422);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},8122:function(e,t,r){"use strict";var n=r(871),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},8564:function(e,t,r){"use strict";var n="u">typeof Symbol&&Symbol,i=r(9094);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},9094:function(e){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t||"[object Symbol]"!==Object.prototype.toString.call(t)||"[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length||"function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},9131:function(e,t,r){"use strict";var n="u">typeof Symbol&&Symbol,i=r(6313);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},6313:function(e){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t||"[object Symbol]"!==Object.prototype.toString.call(t)||"[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var n in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length||"function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},3383:function(e,t,r){"use strict";var n=Function.prototype.call,i=Object.prototype.hasOwnProperty;e.exports=r(7797).call(n,i)},1638:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},6960:function(e){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,r=Object.prototype.toString,n=function(e){return(!t||!e||"object"!=typeof e||!(Symbol.toStringTag in e))&&"[object Arguments]"===r.call(e)},i=function(e){return!!n(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==r.call(e)&&"[object Function]"===r.call(e.callee)},o=function(){return n(arguments)}();n.isLegacyArguments=i,e.exports=o?n:i},8979:function(e){"use strict";var t=Object.prototype.toString,r=Function.prototype.toString,n=/^\s*(?:function)?\*/,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,o=Object.getPrototypeOf,s=function(){if(!i)return!1;try{return Function("return function*() {}")()}catch(e){}}(),a=s?o(s):{};e.exports=function(e){return"function"==typeof e&&(!!n.test(r.call(e))||(i?o(e)===a:"[object GeneratorFunction]"===t.call(e)))}},9572:function(t,r,n){"use strict";var i=n(4680),o=n(3147),s=n(2982),a=s("Object.prototype.toString"),l=n(8564)()&&"symbol"==typeof Symbol.toStringTag,u=o(),c=s("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return -1},d=s("String.prototype.slice"),f={},h=n(9745),p=Object.getPrototypeOf;l&&h&&p&&i(u,function(t){var r=new e.g[t];if(!(Symbol.toStringTag in r))throw EvalError("this engine has support for Symbol.toStringTag, but "+t+" does not have the property! Please report this.");var n=p(r),i=h(n,Symbol.toStringTag);i||(i=h(p(n),Symbol.toStringTag)),f[t]=i.get});var g=function(e){var t=!1;return i(f,function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}}),t};t.exports=function(e){return!!e&&"object"==typeof e&&(l?!!h&&g(e):c(u,d(a(e),8,-1))>-1)}},4197:function(e){"use strict";e.exports=Math.abs},4455:function(e){"use strict";e.exports=Math.floor},6128:function(e){"use strict";e.exports=Number.isNaN||function(e){return e!=e}},1295:function(e){"use strict";e.exports=Math.max},6949:function(e){"use strict";e.exports=Math.min},2943:function(e){"use strict";e.exports=Math.pow},1721:function(e){"use strict";e.exports=Math.round},3536:function(e,t,r){"use strict";var n=r(6128);e.exports=function(e){return n(e)||0===e?e:e<0?-1:1}},3798:function(e,t,r){"use strict";var n=r(1893),i=r(2071),o=r(8122)(),s=r(8322),a=r(4785),l=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");if("number"!=typeof t||t<0||t>0xffffffff||l(t)!==t)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(n=!1),c&&!c.writable&&(u=!1)}return(n||u||!r)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},3614:function(e){e.exports=function(e){return e instanceof n.Buffer}},7551:function(e,t,r){"use strict";var n=r(6960),i=r(8979),o=r(3051),s=r(9572);function a(e){return e.call.bind(e)}var l="u">typeof BigInt,u="u">typeof Symbol,c=a(Object.prototype.toString),d=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),h=a(Boolean.prototype.valueOf);if(l)var p=a(BigInt.prototype.valueOf);if(u)var g=a(Symbol.prototype.valueOf);function y(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function b(e){return"[object Map]"===c(e)}function v(e){return"[object Set]"===c(e)}function m(e){return"[object WeakMap]"===c(e)}function _(e){return"[object WeakSet]"===c(e)}function S(e){return"[object ArrayBuffer]"===c(e)}function O(e){return!("u"<typeof ArrayBuffer)&&(S.working?S(e):e instanceof ArrayBuffer)}function E(e){return"[object DataView]"===c(e)}function w(e){return!("u"<typeof DataView)&&(E.working?E(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=s,t.isPromise=function(e){return"u">typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"u">typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):s(e)||w(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},b.working="u">typeof Map&&b(new Map),t.isMap=function(e){return!("u"<typeof Map)&&(b.working?b(e):e instanceof Map)}
2,v.working="u">typeof Set&&v(new Set),t.isSet=function(e){return!("u"<typeof Set)&&(v.working?v(e):e instanceof Set)},m.working="u">typeof WeakMap&&m(new WeakMap),t.isWeakMap=function(e){return!("u"<typeof WeakMap)&&(m.working?m(e):e instanceof WeakMap)},_.working="u">typeof WeakSet&&_(new WeakSet),t.isWeakSet=function(e){return _(e)},S.working="u">typeof ArrayBuffer&&S(new ArrayBuffer),t.isArrayBuffer=O,E.working="u">typeof ArrayBuffer&&"u">typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=w;var P="u">typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function R(e){return"[object SharedArrayBuffer]"===c(e)}function T(e){return void 0!==P&&(void 0===R.working&&(R.working=R(new P)),R.working?R(e):e instanceof P)}function A(e){return y(e,d)}function x(e){return y(e,f)}function C(e){return y(e,h)}function k(e){return l&&y(e,p)}function I(e){return u&&y(e,g)}t.isSharedArrayBuffer=T,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},t.isGeneratorObject=function(e){return"[object Generator]"===c(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},t.isNumberObject=A,t.isStringObject=x,t.isBooleanObject=C,t.isBigIntObject=k,t.isSymbolObject=I,t.isBoxedPrimitive=function(e){return A(e)||x(e)||C(e)||k(e)||I(e)},t.isAnyArrayBuffer=function(e){return"u">typeof Uint8Array&&(O(e)||T(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw Error(e+" is not supported in userland")}})})},4268:function(e,t,r){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!m(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(u(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,i=n.length,s=String(e).replace(o,function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),a=n[r];r<i;a=n[++r])b(a)||!O(a)?s+=" "+a:s+=" "+u(a);return s},t.deprecate=function(e,r){if(void 0!==i.default&&!0===i.default.noDeprecation)return e;if(void 0===i.default)return function(){return t.deprecate(e,r).apply(this,arguments)};var n=!1;return function(){if(!n){if(i.default.throwDeprecation)throw Error(r);i.default.traceDeprecation?console.trace(r):console.error(r),n=!0}return e.apply(this,arguments)}};var s={},a=/^$/;if(i.default.env.NODE_DEBUG){var l=i.default.env.NODE_DEBUG;a=RegExp("^"+(l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase())+"$","i")}function u(e,r){var n={seen:[],stylize:d};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&t._extend(n,r),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),f(n,e,n.depth)}function c(e,t){var r=u.styles[t];return r?"\x1b["+u.colors[r][0]+"m"+e+"\x1b["+u.colors[r][1]+"m":e}function d(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&P(r.inspect)&&r.inspect!==t.inspect&&!(r.constructor&&r.constructor.prototype===r)){var i,o,s,a,l,u,c=r.inspect(n,e);return m(c)||(c=f(e,c,n)),c}var d=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(m(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):y(t)?e.stylize(""+t,"boolean"):b(t)?e.stylize("null","null"):void 0}(e,r);if(d)return d;var O=Object.keys(r),R=(l={},O.forEach(function(e,t){l[e]=!0}),l);if(e.showHidden&&(O=Object.getOwnPropertyNames(r)),w(r)&&(O.indexOf("message")>=0||O.indexOf("description")>=0))return h(r);if(0===O.length){if(P(r)){var T=r.name?": "+r.name:"";return e.stylize("[Function"+T+"]","special")}if(S(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return e.stylize(Date.prototype.toString.call(r),"date");if(w(r))return h(r)}var A="",C=!1,k=["{","}"];if(g(r)&&(C=!0,k=["[","]"]),P(r)&&(A=" [Function"+(r.name?": "+r.name:"")+"]"),S(r)&&(A=" "+RegExp.prototype.toString.call(r)),E(r)&&(A=" "+Date.prototype.toUTCString.call(r)),w(r)&&(A=" "+h(r)),0===O.length&&(!C||0==r.length))return k[0]+A+k[1];if(n<0)if(S(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");else return e.stylize("[Object]","special");return e.seen.push(r),u=C?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)x(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");
2return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))}),o}(e,r,n,R,O):O.map(function(t){return p(e,r,n,R,t,C)}),e.seen.pop(),i=u,o=A,s=k,a=0,i.reduce(function(e,t){return a++,t.indexOf("\n")>=0&&a++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?s[0]+(""===o?"":o+"\n ")+" "+i.join(",\n ")+" "+s[1]:s[0]+o+" "+i.join(", ")+" "+s[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),x(n,i)||(s="["+i+"]"),!a&&(0>e.seen.indexOf(l.value)?(a=b(r)?f(e,l.value,null):f(e,l.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),_(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function g(e){return Array.isArray(e)}function y(e){return"boolean"==typeof e}function b(e){return null===e}function v(e){return"number"==typeof e}function m(e){return"string"==typeof e}function _(e){return void 0===e}function S(e){return O(e)&&"[object RegExp]"===R(e)}function O(e){return"object"==typeof e&&null!==e}function E(e){return O(e)&&"[object Date]"===R(e)}function w(e){return O(e)&&("[object Error]"===R(e)||e instanceof Error)}function P(e){return"function"==typeof e}function R(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(!s[e=e.toUpperCase()])if(a.test(e)){var r=i.default.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(7551),t.isArray=g,t.isBoolean=y,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=v,t.isString=m,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=S,t.types.isRegExp=S,t.isObject=O,t.isDate=E,t.types.isDate=E,t.isError=w,t.types.isNativeError=w,t.isFunction=P,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(3614);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(r=[T((e=new Date).getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":"),[e.getDate(),A[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(1638),t._extend=function(e,t){if(!t||!O(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var C="u">typeof Symbol?Symbol("util.promisify.custom"):void 0;function k(e,t){if(!e){var r=Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');if(C&&e[C]){var t=e[C];if("function"!=typeof t)throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise(function(e,n){t=e,r=n}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,n){e?r(e):t(n)});try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),C&&Object.defineProperty(t,C,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},t.promisify.custom=C,t.callbackify=function(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw TypeError("The last argument must be of type Function");var o=this,s=function(){return n.apply(o,arguments)};e.apply(this,t).then(function(e){i.default.nextTick(s.bind(null,null,e))},function(e){i.default.nextTick(k.bind(null,e,s))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,n(e)),t}},3051:function(t,r,n){"use strict";var i=n(4680),o=n(3147),s=n(2982),a=s("Object.prototype.toString"),l=n(8564)()&&"symbol"==typeof Symbol.toStringTag,u=o(),c=s("String.prototype.slice"),d={},f=n(9745),h=Object.getPrototypeOf;l&&f&&h&&i(u,function(t){if("function"==typeof e.g[t]){var r=new e.g[t];if(!(Symbol.toStringTag in r))throw EvalError("this engine has support for Symbol.toStringTag, but "+t+" does not have the property! Please report this.");var n=h(r),i=f(n,Symbol.toStringTag);i||(i=f(h(n),Symbol.toStringTag)),d[t]=i.get}});var p=function(e){var t=!1;return i(d,function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(e){}}),t},g=n(9572);t.exports=function(e){return!!g(e)&&(l?p(e):c(a(e),8,-1))}},3147:function(t,r,n){"use strict";var i=n(7492);t.exports=function(){return i(["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],function(t){return"function"==typeof e.g[t]})}},9745:function(e,t,r){"use strict";e.exports=r(8322)}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}},n=!0;try{o[e](r,r.exports,a),n=!1}finally{n&&delete s[e]}
2return r.exports}a.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/util/",t.exports=a(4268)},928299,(e,t,r)=>{var n=e.i(261955),i={638:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},329:function(e){"use strict";let t={};function r(e,r,n){n||(n=Error);class i extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(e,t,n))}}i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(!Array.isArray(e))return`of ${t} ${String(e)}`;{let r=e.length;return(e=e.map(e=>String(e)),r>2)?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:2===r?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}}r("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,r){var i,o,s,a;let l,u;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(l="must not be",t=t.replace(/^not /,"")):l="must be",o=" argument",(void 0===s||s>e.length)&&(s=e.length),e.substring(s-o.length,s)===o)u=`The ${e} ${l} ${n(t,"type")}`;else{let r=("number"!=typeof a&&(a=0),a+1>e.length||-1===e.indexOf(".",a))?"argument":"property";u=`The "${e}" ${r} ${l} ${n(t,"type")}`}return u+`. Received type ${typeof r}`},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},686:function(e,t,r){"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(276),s=r(732);r(638)(c,o);for(var a=i(s.prototype),l=0;l<a.length;l++){var u=a[l];c.prototype[u]||(c.prototype[u]=s.prototype[u])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||n.default.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},512:function(e,t,r){"use strict";e.exports=i;var n=r(586);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(638)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},276:function(t,r,i){"use strict";t.exports=R,R.ReadableState=P,i(434).EventEmitter;var o,s,a,l,u,c=function(e,t){return e.listeners(t).length},d=i(120),f=i(181).Buffer,h=e.g.Uint8Array||function(){},p=i(23);s=p&&p.debuglog?p.debuglog("stream"):function(){};var g=i(137),y=i(528),b=i(771).getHighWaterMark,v=i(329).F,m=v.ER
2R_INVALID_ARG_TYPE,_=v.ERR_STREAM_PUSH_AFTER_EOF,S=v.ERR_METHOD_NOT_IMPLEMENTED,O=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(638)(R,d);var E=y.errorOrDestroy,w=["error","close","destroy","pause","resume"];function P(e,t,r){o=o||i(686),e=e||{},"boolean"!=typeof r&&(r=t instanceof o),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",r),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=i(319).I),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function R(e){if(o=o||i(686),!(this instanceof R))return new R(e);var t=this instanceof o;this._readableState=new P(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),d.call(this)}function T(e,t,r,n,i){s("readableAddChunk",t);var o,a,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(s("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,k(e)))}}(e,l);else if(i||(a=function(e,t){var r;return f.isBuffer(t)||t instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(l,t)),a)E(e,a);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===f.prototype||(o=t,t=f.from(o)),n)l.endEmitted?E(e,new O):A(e,l,t,!0);else if(l.ended)E(e,new _);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(t=l.decoder.write(t),l.objectMode||0!==t.length?A(e,l,t,!1):I(e,l)):A(e,l,t,!1)}else n||(l.reading=!1,I(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function A(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&C(e)),I(e,t)}function x(e,t){var r;if(e<=0||0===t.length&&t.ended)return 0;if(t.objectMode)return 1;if(e!=e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;return(e>t.highWaterMark&&((r=e)>=0x40000000?r=0x40000000:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),t.highWaterMark=r),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function C(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,n.default.nextTick(k,e))}function k(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function I(e,t){t.readingMore||(t.readingMore=!0,n.default.nextTick(j,e,t))}function j(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(s("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){s("readable nexttick read 0"),e.read(0)}function D(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function W(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.default.nextTick(F,t,e))}function F(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function B(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return -1}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=y.destroy,R.prototype._undestroy=y.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=f.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},R.prototype.unshift=function(e){return T(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){a||(a=i(319).I);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;
2for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this},R.prototype.read=function(e){s("read",e),e=parseInt(e,10);var t,r=this._readableState,n=e;if(0!==e&&(r.emittedReadable=!1),0===e&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return s("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?W(this):C(this),null;if(0===(e=x(e,r))&&r.ended)return 0===r.length&&W(this),null;var i=r.needReadable;return s("need readable",i),(0===r.length||r.length-e<r.highWaterMark)&&s("length less than watermark",i=!0),r.ended||r.reading?s("reading or ended",i=!1):i&&(s("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(e=x(n,r))),null===(t=e>0?U(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),n!==e&&r.ended&&W(this)),null!==t&&this.emit("data",t),t},R.prototype._read=function(e){E(this,new S("_read()"))},R.prototype.pipe=function(e,t){var r,i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,s("pipe count=%d opts=%j",o.pipesCount,t);var a=t&&!1===t.end||e===n.default.stdout||e===n.default.stderr?y:l;function l(){s("onend"),e.end()}o.endEmitted?n.default.nextTick(a):i.once("end",a),e.on("unpipe",function t(r,n){s("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,s("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",h),e.removeListener("unpipe",t),i.removeListener("end",l),i.removeListener("end",y),i.removeListener("data",f),d=!0,o.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u())});var u=(r=i,function(){var e=r._readableState;s("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&c(r,"data")&&(e.flowing=!0,L(r))});e.on("drain",u);var d=!1;function f(t){s("ondata");var r=e.write(t);s("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!d&&(s("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function h(t){s("onerror",t),y(),e.removeListener("error",h),0===c(e,"error")&&E(e,t)}function p(){e.removeListener("finish",g),y()}function g(){s("onfinish"),e.removeListener("close",p),y()}function y(){s("unpipe"),i.unpipe(e)}return i.on("data",f),!function(e,t,r){if("function"==typeof e.prependListener)return e.prepe
2ndListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",i),o.flowing||(s("pipe resume"),i.resume()),e},R.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=B(t.pipes,e);return -1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},R.prototype.on=function(e,t){var r=d.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"!==e||i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?C(this):i.reading||n.default.nextTick(N,this)),r},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var r=d.prototype.removeListener.call(this,e,t);return"readable"===e&&n.default.nextTick(M,this),r},R.prototype.removeAllListeners=function(e){var t=d.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.default.nextTick(M,this),t},R.prototype.resume=function(){var e,t,r=this._readableState;return r.flowing||(s("resume"),r.flowing=!r.readableListening,e=this,(t=r).resumeScheduled||(t.resumeScheduled=!0,n.default.nextTick(D,e,t))),r.paused=!1,this},R.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(s("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<w.length;o++)e.on(w[o],this.emit.bind(this,w[o]));return this._read=function(t){s("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=i(531)),l(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=U,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,t){return void 0===u&&(u=i(812)),u(R,e,t)})},586:function(e,t,r){"use strict";e.exports=c;var n=r(329).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=r(686);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);l.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function d(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush(function(t,r){f(e,t,r)})}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}r(638)(c,l),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},732:function(t,r,i){"use strict";function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var r=t,n=e,i=r.entry;for(r.entry=null;i;){var o=i.callback;n.pendingcb--,o(void 0),i=i.next}n.corkedRequestsFree.next=r}}t.exports=R,R.WritableState=P;var s,a,l={deprecate:i(774)},u=i(120),c=i(181).Buffer,d=e.g.Uint8Array||function(){},f=i(528),h=i(771).getHighWaterMark,p=i(329).F,g=p.ERR_INVALID_ARG_TYPE,y=p.ERR_METHOD_NOT_IMPLEMENT
2ED,b=p.ERR_MULTIPLE_CALLBACK,v=p.ERR_STREAM_CANNOT_PIPE,m=p.ERR_STREAM_DESTROYED,_=p.ERR_STREAM_NULL_VALUES,S=p.ERR_STREAM_WRITE_AFTER_END,O=p.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function w(){}function P(e,t,r){s=s||i(686),e=e||{},"boolean"!=typeof r&&(r=t instanceof s),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new b;if(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t)--r.pendingcb,i?(n.default.nextTick(o,t),n.default.nextTick(I,e,r),e._writableState.errorEmitted=!0,E(e,t)):(o(t),e._writableState.errorEmitted=!0,E(e,t),I(e,r));else{var s=C(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||x(e,r),i?n.default.nextTick(A,e,r,s,o):A(e,r,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}i(638)(R,u),P.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(P.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function R(e){var t=this instanceof(s=s||i(686));if(!t&&!a.call(R,this))return new R(e);this._writableState=new P(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function T(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function A(e,t,r,n){var i,o;r||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,n(),I(e,t)}function x(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=Array(t.bufferedRequestCount),i=t.corkedRequestsFree;i.entry=r;for(var s=0,a=!0;r;)n[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;n.allBuffers=a,T(e,t,!0,t.length,n,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback,d=t.objectMode?1:l.length;if(T(e,t,!1,d,l,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function C(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var r=C(t);if(r&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.default.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===R&&e&&e._writableState instanceof P}})):a=function(e){return e instanceof this},R.prototype.pipe=function(){E(this,new v)},R.prototype.write=function(e,t,r){var i,o,s,a,l,u,f,h=this._writableState,p=!1,y=!h.objectMode&&(i=e,c.isBuffer(i)||i instanceof d);return(y&&!c.isBuffer(e)&&(o=e,e=c.from(o)),"function"==typeof t&&(r=t,t=null),y?t="buffer":t||(t=h.defaultEncoding),"function"!=typeof r&&(r=w),h.ending)?(s=r,E(this,a=new S),n.default.nextTick(s,a)):(y||(l=e,u=r,null===l?f=new _:"string"==typeof l||h.objectMode||(f=new g("chunk",["string","Buffer"],l)),!f||(E(this,f),n.default.nextTick(u,f),0)))&&(h.pendingcb++,p=function(e,t,r,n,i,o){if(!r){var s,a,l=(s=n,a=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=c.from(s,a)),s);n!==l&&(r=!0,i="buffer",n=l)}var u=t.objectMode?1:n.length;t.length+=u;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,u,n,i,o);return d}(this,h,y,e,t,r)),p},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||x(this,e))},R.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new O(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(e,t,r){r(new y("_write()"))},R.prototype._writev=null,R.prototype.end=function(e,t,r){var i,o,s,a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||(i=this,o=a,s=r,o.ending=!0,I(i,o),s&&(o.finished?n.default.nextTick(s):i.once("finish",s)),o.ended=!0,i.writable=!1),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),R.prototype.destroy=f.destroy,R.prototype._undestroy=f.undestroy,R.prototype._destroy=function(e,t){t(e)}},531:function(e,t,r){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,s=r(134),a=Symbol("lastResolve"),l=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[h].read();null!==r&&(e[d]=null,e[a]=null,e[l]=null,t(p(r,!1)))}}function y(e){n.default.nextTick(g,e)}var b=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((i(o={get stream(){return this[h]},next:function(){var e,t,r=this,i=this[u];if(null!==i)return Promise.reject(i);if(this[c])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise(function(e,t){n.default.nextTick(function(){r[u]?t(r[u]):e(p(void 0,!0))})});var o=this[d];if(o)t=new Promise((e=this,function(t,r){o.then(function(){e[c]?t(p(void 0,!0)):e[f](t,r)},r)}));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));t=new Promise(this[f])}return this[d]=t,t}},Symbol.asyncIterator,function(){return this}),i(o,"return",function(){var e=this;return new Promise(function(t,r){e[h].destroy(null,function(e){e?r(e):t(p(void 0,!0))})})}),o),b);e.exports=function(e){var t,r=Object.create(v,(i(t={},h,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,l,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,f,{value:function(e,t){var n=r[h].read();n?(r[d]=null,r[a]=null,r[l]=null,e(p(n,!1))):(r[a]=e,r[l]=t)},writable:!0}),t));
2return r[d]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];null!==t&&(r[d]=null,r[a]=null,r[l]=null,t(e)),r[u]=e;return}var n=r[a];null!==n&&(r[d]=null,r[a]=null,r[l]=null,n(p(void 0,!0))),r[c]=!0}),e.on("readable",y.bind(null,r)),r}},137:function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var i=r(181).Buffer,o=r(23).inspect,s=o&&o.custom||"inspect";e.exports=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,n=i.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=s,i.prototype.copy.call(t,n,r),s+=o.data.length,o=o.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,t}},{key:s,value:function(e,t){return o(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n,i,o;n=e,i=t,o=r[t],i in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),t}()},528:function(e){"use strict";function t(e,t){i(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,o){var s=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.default.nextTick(i,this,e)):n.default.nextTick(i,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!o&&e?s._writableState?s._writableState.errorEmitted?n.default.nextTick(r,s):(s._writableState.errorEmitted=!0,n.default.nextTick(t,s,e)):n.default.nextTick(t,s,e):o?(n.default.nextTick(r,s),o(e)):n.default.nextTick(r,s)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},134:function(e,t,r){"use strict";var n=r(329).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),s=o||i,a=!1,o=function(){if(!a){a=!0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];s.apply(this,t)}};var s,a,l=r.readable||!1!==r.readable&&t.readable,u=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||f()},d=t._writableState&&t._writableState.finished,f=function(){u=!1,d=!0,l||o.call(t)},h=t._readableState&&t._readableState.endEmitted,p=function(){l=!1,h=!0,u||o.call(t)},g=function(e){o.call(t,e)},y=function(){var e;return l&&!h?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):u&&!d?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},b=function(){t.req.on("finish",f)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",f),t.on("abort",y),t.req?b():t.on("request",b)):u&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",p),t.on("finish",f),!1!==r.error&&t.on("error",g),t.on("close",y),function(){t.removeListener("complete",f),t.removeListener("abort",y),t.removeListener("request",b),t.req&&t.req.removeListener("finish",f),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",f),t.removeListener("end",p),t.removeListener("error",g),t.removeListener("close",y)}}},812:function(e,t,r){"use strict";function n(e,t,r,n,i,o,s){try{var a=e[o](s),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,i)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var o=r(329).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,r){if(t&&"function"==typeof t.next)s=t;else if(t&&t[Symbol.asyncIterator])s=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])s=t[Symbol.iterator]();else throw new o("iterable",["Iterable"],t);var s,a=new e(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
2t%2?i(Object(r),!0).forEach(function(t){var n,i,o;n=e,i=t,o=r[t],i in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({objectMode:!0},r)),l=!1;function u(){return c.apply(this,arguments)}function c(){var e;return e=function*(){try{var e=yield s.next(),t=e.value;e.done?a.push(null):a.push((yield t))?u():l=!1}catch(e){a.destroy(e)}},(c=function(){var t=this,r=arguments;return new Promise(function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,l,"next",e)}function l(e){n(s,i,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return a._read=function(){l||(l=!0,u())},a}},694:function(e,t,r){"use strict";var n,i=r(329).F,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e,t,i=arguments.length,c=Array(i),d=0;d<i;d++)c[d]=arguments[d];var f=(e=c).length&&"function"==typeof e[e.length-1]?e.pop():a;if(Array.isArray(c[0])&&(c=c[0]),c.length<2)throw new o("streams");var h=c.map(function(e,i){var o,a,u,d,p,g,y=i<c.length-1;return o=i>0,u=a=function(e){t||(t=e),e&&h.forEach(l),y||(h.forEach(l),f(t))},d=!1,a=function(){d||(d=!0,u.apply(void 0,arguments))},p=!1,e.on("close",function(){p=!0}),void 0===n&&(n=r(134)),n(e,{readable:y,writable:o},function(e){if(e)return a(e);p=!0,a()}),g=!1,function(t){if(!p&&!g){if(g=!0,e.setHeader&&"function"==typeof e.abort)return e.abort();if("function"==typeof e.destroy)return e.destroy();a(t||new s("pipe"))}}});return c.reduce(u)}},771:function(e,t,r){"use strict";var n=r(329).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=null!=t.highWaterMark?t.highWaterMark:i?t[r]:null;if(null!=o){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},120:function(e,t,r){e.exports=r(203)},56:function(e,t,r){var n=r(181),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},854:function(e,t,r){e.exports=i;var n=r(434).EventEmitter;function i(){n.call(this)}r(638)(i,n),i.Readable=r(276),i.Writable=r(732),i.Duplex=r(686),i.Transform=r(586),i.PassThrough=r(512),i.finished=r(134),i.pipeline=r(694),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",l));var s=!1;function a(){s||(s=!0,e.end())}function l(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",l),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",u),e.on("error",u),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},319:function(e,t,r){"use strict";var n=r(56).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";
2case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=d,t=3;break;default:this.write=f,this.end=h;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},774:function(t){t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function r(t){try{if(!e.g.localStorage)return!1}catch(e){return!1}var r=e.g.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}},181:function(t){"use strict";t.exports=e.r(259390)},434:function(t){"use strict";t.exports=e.r(679877)},203:function(t){"use strict";t.exports=e.r(679877).EventEmitter},23:function(t){"use strict";t.exports=e.r(29607)}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}},n=!0;try{i[e](r,r.exports,s),n=!1}finally{n&&delete o[e]}return r.exports}s.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/stream-browserify/",t.exports=s(854)},788971,(e,t,r)=>{!function(){"use strict";var e={922:function(e){e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var s=/\+/g;e=e.split(r);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var l=e.length;a>0&&l>a&&(l=a);for(var u=0;u<l;++u){var c,d,f,h,p=e[u].replace(s,"%20"),g=p.indexOf(n);(g>=0?(c=p.substr(0,g),d=p.substr(g+1)):(c=p,d=""),f=decodeURIComponent(c),h=decodeURIComponent(d),Object.prototype.hasOwnProperty.call(o,f))?t(o[f])?o[f].push(h):o[f]=[o[f],h]:o[f]=h}return o};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},790:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,o,s,a){return(o=o||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var a=encodeURIComponent(t(i))+s;return r(e[i])?n(e[i],function(e){return a+encodeURIComponent(t(e))}
2).join(o):a+encodeURIComponent(t(e[i]))}).join(o):a?encodeURIComponent(t(a))+s+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}}},r={};function n(t){var i=r[t];if(void 0!==i)return i.exports;var o=r[t]={exports:{}},s=!0;try{e[t](o,o.exports,n),s=!1}finally{s&&delete r[t]}return o.exports}n.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/querystring-es3/";var i={};i.decode=i.parse=n(922),i.encode=i.stringify=n(790),t.exports=i}()},992227,(e,t,r)=>{var n={221:function(t){"use strict";t.exports=e.r(788971)}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},s=!0;try{n[e](r,r.exports,o),s=!1}finally{s&&delete i[e]}return r.exports}o.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/native-url/";var s={};!function(){var e,t=(e=o(221))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=b(e));var n,i,o,s,a,l,u,c,d,f=(i=(n=e).auth,o=n.hostname,s=n.protocol||"",a=n.pathname||"",l=n.hash||"",u=n.query||"",c=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?c=i+n.host:o&&(c=i+(~o.indexOf(":")?"["+o+"]":o),n.port&&(c+=":"+n.port)),u&&"object"==typeof u&&(u=t.encode(u)),d=n.search||u&&"?"+u||"",s&&":"!==s.substr(-1)&&(s+=":"),n.slashes||(!s||r.test(s))&&!1!==c?(c="//"+(c||""),a&&"/"!==a[0]&&(a="/"+a)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),d&&"?"!==d[0]&&(d="?"+d),{protocol:s,host:c,pathname:a=a.replace(/[?#]/g,encodeURIComponent),search:d=d.replace("#","%23"),hash:l});return""+f.protocol+f.host+f.pathname+f.search+f.hash}var i="http://",a=i+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,u=/https?|ftp|gopher|file/;function c(e,t){var r="string"==typeof e?b(e):e;e="object"==typeof e?n(e):e;var o=b(t),s="";r.protocol&&!r.slashes&&(s=r.protocol,e=e.replace(r.protocol,""),s+="/"===t[0]||"/"===e[0]?"/":""),s&&o.protocol&&(s="",o.slashes||(s=o.protocol,t=t.replace(o.protocol,"")));var c=e.match(l);c&&!o.protocol&&(e=e.substr((s=c[1]+(c[2]||"")).length),/^\/\/[^/]/.test(t)&&(s=s.slice(0,-1)));var d=new URL(e,a+"/"),f=new URL(t,d).toString().replace(a,""),h=o.protocol||r.protocol;return h+=r.slashes||o.slashes?"//":"",!s&&h?f=f.replace(i,h):s&&(f=f.replace(i,"")),u.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),s&&(f=s+("/"===f[0]?f.substr(1):f)),f}function d(){}d.prototype.parse=b,d.prototype.format=n,d.prototype.resolve=c,d.prototype.resolveObject=c;var f=/^https?|ftp|gopher|file/,h=/^(.*?)([#?].*)/,p=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,g=/^([a-z0-9.+-]*:)?\/\/\/*/i,y=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function b(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof d)return e;var o=(e=e.trim()).match(h);e=o?o[1].replace(/\\/g,"/")+o[2]:e.replace(/\\/g,"/"),y.test(e)&&"/"!==e.slice(-1)&&(e+="/");var s=!/(^javascript)/.test(e)&&e.match(p),l=g.test(e),u="";s&&(f.test(s[1])||(u=s[1].toLowerCase(),e=""+s[2]+s[3]),s[2]||(l=!1,f.test(s[1])?(u=s[1],e=""+s[3]):e="//"+s[3]),3!==s[2].length&&1!==s[2].length||(u=s[1],e="/"+s[3]));var c,b=(o?o[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),v=b&&b[1],m=new d,_="",S="";try{c=new URL(e)}catch(t){_=t,u||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(S="/",e=e.substr(1));try{c=new URL(e,a)}catch(e){return m.protocol=u,m.href=u,m}}m.slashes=l&&!S,m.host="w.w"===c.host?"":c.host,m.hostname="w.w"===c.hostname?"":c.hostname.replace(/(\[|\])/g,""),m.protocol=_?u||null:c.protocol,m.search=c.search.replace(/\\/g,"%5C"),m.hash=c.hash.replace(/\\/g,"%5C");var O=e.split("#");!m.search&&~O[0].indexOf("?")&&(m.search="?"),m.hash||""!==O[1]||(m.hash="#"),m.query=r?t.decode(c.search.substr(1)):m.search.substr(1),m.pathname=S+(s?c.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):c.pathname),"about:"===m.protocol&&"blank"===m.pathname&&(m.protocol="",m.pathname=""),_&&"/"!==e[0]&&(m.pathname=m.pathname.substr(1)),u&&!f.test(u)&&"/"!==e.slice(-1)&&"/"===m.pathname&&(m.pathname=""),m.path=m.pathname+m.search,m.auth=[c.username,c.password].map(decodeURIComponent).filter(
2Boolean).join(":"),m.port=c.port,v&&!m.host.endsWith(v)&&(m.host+=v,m.port=v.slice(1)),m.href=S?""+m.pathname+m.search+m.hash:n(m);var E=/^(file)/.test(m.href)?["host","hostname"]:[];return Object.keys(m).forEach(function(e){~E.indexOf(e)||(m[e]=m[e]||null)}),m}s.parse=b,s.format=n,s.resolve=c,s.resolveObject=function(e,t){return b(c(e,t))},s.Url=d}(),t.exports=s},870604,(e,t,r)=>{var n=e.i(261955),i=e.i(769202),o={514:function(e){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},638:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},329:function(e){"use strict";let t={};function r(e,r,n){n||(n=Error);class i extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(e,t,n))}}i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(!Array.isArray(e))return`of ${t} ${String(e)}`;{let r=e.length;return(e=e.map(e=>String(e)),r>2)?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:2===r?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}}r("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(e,t,r){var i,o,s,a;let l,u;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(l="must not be",t=t.replace(/^not /,"")):l="must be",o=" argument",(void 0===s||s>e.length)&&(s=e.length),e.substring(s-o.length,s)===o)u=`The ${e} ${l} ${n(t,"type")}`;else{let r=("number"!=typeof a&&(a=0),a+1>e.length||-1===e.indexOf(".",a))?"argument":"property";u=`The "${e}" ${r} ${l} ${n(t,"type")}`}return u+`. Received type ${typeof r}`},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},686:function(e,t,r){"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(276),s=r(732);r(638)(c,o);for(var a=i(s.prototype),l=0;l<a.length;l++){var u=a[l];c.prototype[u]||(c.prototype[u]=s.prototype[u])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",d)))}function d(){this._writableState.ended||n.default.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},512:function(e,t,r){"use strict";e.exports=i;var n=r(586);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(638)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},276:function(t,r,i){"use strict";
2t.exports=R,R.ReadableState=P,i(434).EventEmitter;var o,s,a,l,u,c=function(e,t){return e.listeners(t).length},d=i(120),f=i(181).Buffer,h=e.g.Uint8Array||function(){},p=i(23);s=p&&p.debuglog?p.debuglog("stream"):function(){};var g=i(137),y=i(528),b=i(771).getHighWaterMark,v=i(329).F,m=v.ERR_INVALID_ARG_TYPE,_=v.ERR_STREAM_PUSH_AFTER_EOF,S=v.ERR_METHOD_NOT_IMPLEMENTED,O=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(638)(R,d);var E=y.errorOrDestroy,w=["error","close","destroy","pause","resume"];function P(e,t,r){o=o||i(686),e=e||{},"boolean"!=typeof r&&(r=t instanceof o),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=b(this,e,"readableHighWaterMark",r),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=i(319).I),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function R(e){if(o=o||i(686),!(this instanceof R))return new R(e);var t=this instanceof o;this._readableState=new P(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),d.call(this)}function T(e,t,r,n,i){s("readableAddChunk",t);var o,a,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(s("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,k(e)))}}(e,l);else if(i||(a=function(e,t){var r;return f.isBuffer(t)||t instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(l,t)),a)E(e,a);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===f.prototype||(o=t,t=f.from(o)),n)l.endEmitted?E(e,new O):A(e,l,t,!0);else if(l.ended)E(e,new _);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(t=l.decoder.write(t),l.objectMode||0!==t.length?A(e,l,t,!1):I(e,l)):A(e,l,t,!1)}else n||(l.reading=!1,I(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function A(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&C(e)),I(e,t)}function x(e,t){var r;if(e<=0||0===t.length&&t.ended)return 0;if(t.objectMode)return 1;if(e!=e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;return(e>t.highWaterMark&&((r=e)>=0x40000000?r=0x40000000:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),t.highWaterMark=r),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function C(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,n.default.nextTick(k,e))}function k(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function I(e,t){t.readingMore||(t.readingMore=!0,n.default.nextTick(j,e,t))}function j(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(s("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){s("readable nexttick read 0"),e.read(0)}function D(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function U(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function W(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.default.nextTick(F,t,e))}function F(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function B(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return -1}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=y.destroy,R.prototype._undestroy=y.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=f.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},R.prototype.unshift=function(e){return T(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){a||(a=i(319).I);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;
2for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this},R.prototype.read=function(e){s("read",e),e=parseInt(e,10);var t,r=this._readableState,n=e;if(0!==e&&(r.emittedReadable=!1),0===e&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return s("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?W(this):C(this),null;if(0===(e=x(e,r))&&r.ended)return 0===r.length&&W(this),null;var i=r.needReadable;return s("need readable",i),(0===r.length||r.length-e<r.highWaterMark)&&s("length less than watermark",i=!0),r.ended||r.reading?s("reading or ended",i=!1):i&&(s("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(e=x(n,r))),null===(t=e>0?U(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),n!==e&&r.ended&&W(this)),null!==t&&this.emit("data",t),t},R.prototype._read=function(e){E(this,new S("_read()"))},R.prototype.pipe=function(e,t){var r,i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,s("pipe count=%d opts=%j",o.pipesCount,t);var a=t&&!1===t.end||e===n.default.stdout||e===n.default.stderr?y:l;function l(){s("onend"),e.end()}o.endEmitted?n.default.nextTick(a):i.once("end",a),e.on("unpipe",function t(r,n){s("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,s("cleanup"),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",h),e.removeListener("unpipe",t),i.removeListener("end",l),i.removeListener("end",y),i.removeListener("data",f),d=!0,o.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u())});var u=(r=i,function(){var e=r._readableState;s("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&c(r,"data")&&(e.flowing=!0,L(r))});e.on("drain",u);var d=!1;function f(t){s("ondata");var r=e.write(t);s("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!d&&(s("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function h(t){s("onerror",t),y(),e.removeListener("error",h),0===c(e,"error")&&E(e,t)}function p(){e.removeListener("finish",g),y()}function g(){s("onfinish"),e.removeListener("close",p),y()}function y(){s("unpipe"),i.unpipe(e)}return i.on("data",f),!function(e,t,r){if("function"==typeof e.prependListener)return e.prepe
2ndListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",p),e.once("finish",g),e.emit("pipe",i),o.flowing||(s("pipe resume"),i.resume()),e},R.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=B(t.pipes,e);return -1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},R.prototype.on=function(e,t){var r=d.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"!==e||i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?C(this):i.reading||n.default.nextTick(N,this)),r},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(e,t){var r=d.prototype.removeListener.call(this,e,t);return"readable"===e&&n.default.nextTick(M,this),r},R.prototype.removeAllListeners=function(e){var t=d.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&n.default.nextTick(M,this),t},R.prototype.resume=function(){var e,t,r=this._readableState;return r.flowing||(s("resume"),r.flowing=!r.readableListening,e=this,(t=r).resumeScheduled||(t.resumeScheduled=!0,n.default.nextTick(D,e,t))),r.paused=!1,this},R.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(s("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<w.length;o++)e.on(w[o],this.emit.bind(this,w[o]));return this._read=function(t){s("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=i(531)),l(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),R._fromList=U,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(R.from=function(e,t){return void 0===u&&(u=i(812)),u(R,e,t)})},586:function(e,t,r){"use strict";e.exports=c;var n=r(329).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=r(686);function u(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);l.call(this,e),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function d(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush(function(t,r){f(e,t,r)})}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}r(638)(c,l),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},732:function(t,r,i){"use strict";function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var r=t,n=e,i=r.entry;for(r.entry=null;i;){var o=i.callback;n.pendingcb--,o(void 0),i=i.next}n.corkedRequestsFree.next=r}}t.exports=R,R.WritableState=P;var s,a,l={deprecate:i(774)},u=i(120),c=i(181).Buffer,d=e.g.Uint8Array||function(){},f=i(528),h=i(771).getHighWaterMark,p=i(329).F,g=p.ERR_INVALID_ARG_TYPE,y=p.ERR_METHOD_NOT_IMPLEMENT
2ED,b=p.ERR_MULTIPLE_CALLBACK,v=p.ERR_STREAM_CANNOT_PIPE,m=p.ERR_STREAM_DESTROYED,_=p.ERR_STREAM_NULL_VALUES,S=p.ERR_STREAM_WRITE_AFTER_END,O=p.ERR_UNKNOWN_ENCODING,E=f.errorOrDestroy;function w(){}function P(e,t,r){s=s||i(686),e=e||{},"boolean"!=typeof r&&(r=t instanceof s),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new b;if(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t)--r.pendingcb,i?(n.default.nextTick(o,t),n.default.nextTick(I,e,r),e._writableState.errorEmitted=!0,E(e,t)):(o(t),e._writableState.errorEmitted=!0,E(e,t),I(e,r));else{var s=C(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||x(e,r),i?n.default.nextTick(A,e,r,s,o):A(e,r,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}i(638)(R,u),P.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(P.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function R(e){var t=this instanceof(s=s||i(686));if(!t&&!a.call(R,this))return new R(e);this._writableState=new P(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function T(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function A(e,t,r,n){var i,o;r||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,n(),I(e,t)}function x(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=Array(t.bufferedRequestCount),i=t.corkedRequestsFree;i.entry=r;for(var s=0,a=!0;r;)n[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;n.allBuffers=a,T(e,t,!0,t.length,n,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback,d=t.objectMode?1:l.length;if(T(e,t,!1,d,l,u,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function C(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var r=C(t);if(r&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.default.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===R&&e&&e._writableState instanceof P}})):a=function(e){return e instanceof this},R.prototype.pipe=function(){E(this,new v)},R.prototype.write=function(e,t,r){var i,o,s,a,l,u,f,h=this._writableState,p=!1,y=!h.objectMode&&(i=e,c.isBuffer(i)||i instanceof d);return(y&&!c.isBuffer(e)&&(o=e,e=c.from(o)),"function"==typeof t&&(r=t,t=null),y?t="buffer":t||(t=h.defaultEncoding),"function"!=typeof r&&(r=w),h.ending)?(s=r,E(this,a=new S),n.default.nextTick(s,a)):(y||(l=e,u=r,null===l?f=new _:"string"==typeof l||h.objectMode||(f=new g("chunk",["string","Buffer"],l)),!f||(E(this,f),n.default.nextTick(u,f),0)))&&(h.pendingcb++,p=function(e,t,r,n,i,o){if(!r){var s,a,l=(s=n,a=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=c.from(s,a)),s);n!==l&&(r=!0,i="buffer",n=l)}var u=t.objectMode?1:n.length;t.length+=u;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,u,n,i,o);return d}(this,h,y,e,t,r)),p},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||x(this,e))},R.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new O(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(e,t,r){r(new y("_write()"))},R.prototype._writev=null,R.prototype.end=function(e,t,r){var i,o,s,a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||(i=this,o=a,s=r,o.ending=!0,I(i,o),s&&(o.finished?n.default.nextTick(s):i.once("finish",s)),o.ended=!0,i.writable=!1),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),R.prototype.destroy=f.destroy,R.prototype._undestroy=f.undestroy,R.prototype._destroy=function(e,t){t(e)}},531:function(e,t,r){"use strict";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o,s=r(134),a=Symbol("lastResolve"),l=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),d=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[h].read();null!==r&&(e[d]=null,e[a]=null,e[l]=null,t(p(r,!1)))}}function y(e){n.default.nextTick(g,e)}var b=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((i(o={get stream(){return this[h]},next:function(){var e,t,r=this,i=this[u];if(null!==i)return Promise.reject(i);if(this[c])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise(function(e,t){n.default.nextTick(function(){r[u]?t(r[u]):e(p(void 0,!0))})});var o=this[d];if(o)t=new Promise((e=this,function(t,r){o.then(function(){e[c]?t(p(void 0,!0)):e[f](t,r)},r)}));else{var s=this[h].read();if(null!==s)return Promise.resolve(p(s,!1));t=new Promise(this[f])}return this[d]=t,t}},Symbol.asyncIterator,function(){return this}),i(o,"return",function(){var e=this;return new Promise(function(t,r){e[h].destroy(null,function(e){e?r(e):t(p(void 0,!0))})})}),o),b);e.exports=function(e){var t,r=Object.create(v,(i(t={},h,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,l,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,f,{value:function(e,t){var n=r[h].read();n?(r[d]=null,r[a]=null,r[l]=null,e(p(n,!1))):(r[a]=e,r[l]=t)},writable:!0}),t));
2return r[d]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];null!==t&&(r[d]=null,r[a]=null,r[l]=null,t(e)),r[u]=e;return}var n=r[a];null!==n&&(r[d]=null,r[a]=null,r[l]=null,n(p(void 0,!0))),r[c]=!0}),e.on("readable",y.bind(null,r)),r}},137:function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var i=r(181).Buffer,o=r(23).inspect,s=o&&o.custom||"inspect";e.exports=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,r,n=i.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=s,i.prototype.copy.call(t,n,r),s+=o.data.length,o=o.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0==(e-=s)){s===o.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=o.slice(s));break}++n}return this.length-=n,t}},{key:s,value:function(e,t){return o(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){var n,i,o;n=e,i=t,o=r[t],i in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),t}()},528:function(e){"use strict";function t(e,t){i(e,t),r(e)}function r(e){e._writableState&&!e._writableState.emitClose||(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,o){var s=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?o?o(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.default.nextTick(i,this,e)):n.default.nextTick(i,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!o&&e?s._writableState?s._writableState.errorEmitted?n.default.nextTick(r,s):(s._writableState.errorEmitted=!0,n.default.nextTick(t,s,e)):n.default.nextTick(t,s,e):o?(n.default.nextTick(r,s),o(e)):n.default.nextTick(r,s)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},134:function(e,t,r){"use strict";var n=r(329).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),s=o||i,a=!1,o=function(){if(!a){a=!0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];s.apply(this,t)}};var s,a,l=r.readable||!1!==r.readable&&t.readable,u=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||f()},d=t._writableState&&t._writableState.finished,f=function(){u=!1,d=!0,l||o.call(t)},h=t._readableState&&t._readableState.endEmitted,p=function(){l=!1,h=!0,u||o.call(t)},g=function(e){o.call(t,e)},y=function(){var e;return l&&!h?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):u&&!d?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},b=function(){t.req.on("finish",f)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",f),t.on("abort",y),t.req?b():t.on("request",b)):u&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",p),t.on("finish",f),!1!==r.error&&t.on("error",g),t.on("close",y),function(){t.removeListener("complete",f),t.removeListener("abort",y),t.removeListener("request",b),t.req&&t.req.removeListener("finish",f),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",f),t.removeListener("end",p),t.removeListener("error",g),t.removeListener("close",y)}}},812:function(e,t,r){"use strict";function n(e,t,r,n,i,o,s){try{var a=e[o](s),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(n,i)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var o=r(329).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,r){if(t&&"function"==typeof t.next)s=t;else if(t&&t[Symbol.asyncIterator])s=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])s=t[Symbol.iterator]();else throw new o("iterable",["Iterable"],t);var s,a=new e(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
2t%2?i(Object(r),!0).forEach(function(t){var n,i,o;n=e,i=t,o=r[t],i in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({objectMode:!0},r)),l=!1;function u(){return c.apply(this,arguments)}function c(){var e;return e=function*(){try{var e=yield s.next(),t=e.value;e.done?a.push(null):a.push((yield t))?u():l=!1}catch(e){a.destroy(e)}},(c=function(){var t=this,r=arguments;return new Promise(function(i,o){var s=e.apply(t,r);function a(e){n(s,i,o,a,l,"next",e)}function l(e){n(s,i,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return a._read=function(){l||(l=!0,u())},a}},694:function(e,t,r){"use strict";var n,i=r(329).F,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function u(e,t){return e.pipe(t)}e.exports=function(){for(var e,t,i=arguments.length,c=Array(i),d=0;d<i;d++)c[d]=arguments[d];var f=(e=c).length&&"function"==typeof e[e.length-1]?e.pop():a;if(Array.isArray(c[0])&&(c=c[0]),c.length<2)throw new o("streams");var h=c.map(function(e,i){var o,a,u,d,p,g,y=i<c.length-1;return o=i>0,u=a=function(e){t||(t=e),e&&h.forEach(l),y||(h.forEach(l),f(t))},d=!1,a=function(){d||(d=!0,u.apply(void 0,arguments))},p=!1,e.on("close",function(){p=!0}),void 0===n&&(n=r(134)),n(e,{readable:y,writable:o},function(e){if(e)return a(e);p=!0,a()}),g=!1,function(t){if(!p&&!g){if(g=!0,e.setHeader&&"function"==typeof e.abort)return e.abort();if("function"==typeof e.destroy)return e.destroy();a(t||new s("pipe"))}}});return c.reduce(u)}},771:function(e,t,r){"use strict";var n=r(329).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=null!=t.highWaterMark?t.highWaterMark:i?t[r]:null;if(null!=o){if(!(isFinite(o)&&Math.floor(o)===o)||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},120:function(e,t,r){e.exports=r(203)},486:function(e,t,r){var i=r(203);"disable"===n.default.env.READABLE_STREAM&&i?(e.exports=i.Readable,Object.assign(e.exports,i),e.exports.Stream=i):((t=e.exports=r(276)).Stream=i||t,t.Readable=t,t.Writable=r(732),t.Duplex=r(686),t.Transform=r(586),t.PassThrough=r(512),t.finished=r(134),t.pipeline=r(694))},56:function(e,t,r){var n=r(181),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},534:function(t,r,n){var i=n(291),o=n(935),s=n(663),a=n(514),l=n(16);r.request=function(t,r){t="string"==typeof t?l.parse(t):s(t);var n=-1===e.g.location.protocol.search(/^https?:$/)?"http:":"",o=t.protocol||n,a=t.hostname||t.host,u=t.port,c=t.path||"/";a&&-1!==a.indexOf(":")&&(a="["+a+"]"),t.url=(a?o+"//"+a:"")+(u?":"+u:"")+c,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var d=new i(t);return r&&d.on("response",r),d},r.get=function(e,t){var n=r.request(e,t);return n.end(),n},r.ClientRequest=i,r.IncomingMessage=o.IncomingMessage,r.Agent=function(){},r.Agent.defaultMaxSockets=4,r.globalAgent=new r.Agent,r.STATUS_CODES=a,r.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]},102:function(t,r){var n;function i(){if(void 0!==n)return n;if(e.g.XMLHttpRequest){n=new e.g.XMLHttpRequest;try{n.open("GET",e.g.XDomainRequest?"/":"https://example.com")}catch(e){n=null}}else n=null;return n}function o(e){var t=i();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}function s(e){return"function"==typeof e}r.fetch=s(e.g.fetch)&&s(e.g.ReadableStream),r.writableStream=s(e.g.WritableStream),r.abortController=s(e.g.AbortController),r.arraybuffer=r.fetch||o("arraybuffer"),r.msstream=!r.fetch&&o("ms-stream"),r.mozchunkedarraybuffer=!r.fetch&&o("moz-chunked-arraybuffer"),r.overrideMimeType=r.fetch||!!i()&&s(i().overrideMimeType),n=null},291:function(t,r,o){var s=o(102),a=o(638),l=o(935),u=o(486),c=l.IncomingMessage,d=l.readyStates,f=t.exports=function(e){var t,r,n,o=this;u.Writable.call(o),o._opts=e,o._body=[],o._headers={},e.auth&&o.setHeader("Authorization","Basic "+i.Buffer.from(e.auth).toString("base64")),Object.keys(e.headers).forEac
2h(function(t){o.setHeader(t,e.headers[t])});var a=!0;if("disable-fetch"===e.mode||"requestTimeout"in e&&!s.abortController)a=!1,n=!0;else if("prefer-streaming"===e.mode)n=!1;else if("allow-wrong-content-type"===e.mode)n=!s.overrideMimeType;else if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw Error("Invalid value for opts.mode");else n=!0;t=n,r=a,o._mode=s.fetch&&r?"fetch":s.mozchunkedarraybuffer?"moz-chunked-arraybuffer":s.msstream?"ms-stream":s.arraybuffer&&t?"arraybuffer":"text",o._fetchTimer=null,o.on("finish",function(){o._onFinish()})};a(f,u.Writable),f.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===h.indexOf(r)&&(this._headers[r]={name:e,value:t})},f.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},f.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},f.prototype._onFinish=function(){var t=this;if(!t._destroyed){var r=t._opts,i=t._headers,o=null;"GET"!==r.method&&"HEAD"!==r.method&&(o=new Blob(t._body,{type:(i["content-type"]||{}).value||""}));var a=[];
2if(Object.keys(i).forEach(function(e){var t=i[e].name,r=i[e].value;Array.isArray(r)?r.forEach(function(e){a.push([t,e])}):a.push([t,r])}),"fetch"===t._mode){var l=null;if(s.abortController){var u=new AbortController;l=u.signal,t._fetchAbortController=u,"requestTimeout"in r&&0!==r.requestTimeout&&(t._fetchTimer=e.g.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},r.requestTimeout))}e.g.fetch(t._opts.url,{method:t._opts.method,headers:a,body:o||void 0,mode:"cors",credentials:r.withCredentials?"include":"same-origin",signal:l}).then(function(e){t._fetchResponse=e,t._connect()},function(r){e.g.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",r)})}else{var c=t._xhr=new e.g.XMLHttpRequest;try{c.open(t._opts.method,t._opts.url,!0)}catch(e){n.default.nextTick(function(){t.emit("error",e)});return}"responseType"in c&&(c.responseType=t._mode),"withCredentials"in c&&(c.withCredentials=!!r.withCredentials),"text"===t._mode&&"overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(c.timeout=r.requestTimeout,c.ontimeout=function(){t.emit("requestTimeout")}),a.forEach(function(e){c.setRequestHeader(e[0],e[1])}),t._response=null,c.onreadystatechange=function(){switch(c.readyState){case d.LOADING:case d.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(c.onprogress=function(){t._onXHRProgress()}),c.onerror=function(){t._destroyed||t.emit("error",Error("XHR error"))};try{c.send(o)}catch(e){n.default.nextTick(function(){t.emit("error",e)});return}}}},f.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},f.prototype._connect=function(){var e=this;e._destroyed||(e._response=new c(e._xhr,e._fetchResponse,e._mode,e._fetchTimer),e._response.on("error",function(t){e.emit("error",t)}),e.emit("response",e._response))},f.prototype._write=function(e,t,r){this._body.push(e),r()},f.prototype.abort=f.prototype.destroy=function(){this._destroyed=!0,e.g.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},f.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),u.Writable.prototype.end.call(this,e,t,r)},f.prototype.flushHeaders=function(){},f.prototype.setTimeout=function(){},f.prototype.setNoDelay=function(){},f.prototype.setSocketKeepAlive=function(){};var h=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]},935:function(t,r,o){var s=o(102),a=o(638),l=o(486),u=r.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},c=r.IncomingMessage=function(t,r,o,a){var u=this;if(l.Readable.call(u),u._mode=o,u.headers={},u.rawHeaders=[],u.trailers={},u.rawTrailers=[],u.on("end",function(){n.default.nextTick(function(){u.emit("close")})}),"fetch"===o){if(u._fetchResponse=r,u.url=r.url,u.statusCode=r.status,u.statusMessage=r.statusText,r.headers.forEach(function(e,t){u.headers[t.toLowerCase()]=e,u.rawHeaders.push(t,e)}),s.writableStream){var c=new WritableStream({write:function(e){return new Promise(function(t,r){u._destroyed?r():u.push(i.Buffer.from(e))?t():u._resumeFetch=t})},close:function(){e.g.clearTimeout(a),u._destroyed||u.push(null)},abort:function(e){u._destroyed||u.emit("error",e)}});try{r.body.pipeTo(c).catch(function(t){e.g.clearTimeout(a),u._destroyed||u.emit("error",t)});return}catch(e){}}var d=r.body.getReader();!function t(){d.read().then(function(r){if(!u._destroyed){if(r.done){e.g.clearTimeout(a),u.push(null);return}u.push(i.Buffer.from(r.value)),t()}}).catch(function(t){e.g.clearTimeout(a),u._destroyed||u.emit("error",t)})}()}else if(u._xhr=t,u._pos=0,u.url=t.responseURL,u.statusCode=t.status,u.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).forEac
2h(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===u.headers[r]&&(u.headers[r]=[]),u.headers[r].push(t[2])):void 0!==u.headers[r]?u.headers[r]+=", "+t[2]:u.headers[r]=t[2],u.rawHeaders.push(t[1],t[2])}}),u._charset="x-user-defined",!s.overrideMimeType){var f=u.rawHeaders["mime-type"];if(f){var h=f.match(/;\s*charset=([^;])(;|$)/);h&&(u._charset=h[1].toLowerCase())}u._charset||(u._charset="utf-8")}};a(c,l.Readable),c.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},c.prototype._onXHRProgress=function(){var t=this,r=t._xhr,n=null;switch(t._mode){case"text":if((n=r.responseText).length>t._pos){var o=n.substr(t._pos);if("x-user-defined"===t._charset){for(var s=i.Buffer.alloc(o.length),a=0;a<o.length;a++)s[a]=255&o.charCodeAt(a);t.push(s)}else t.push(o,t._charset);t._pos=n.length}break;case"arraybuffer":if(r.readyState!==u.DONE||!r.response)break;n=r.response,t.push(i.Buffer.from(new Uint8Array(n)));break;case"moz-chunked-arraybuffer":if(n=r.response,r.readyState!==u.LOADING||!n)break;t.push(i.Buffer.from(new Uint8Array(n)));break;case"ms-stream":if(n=r.response,r.readyState!==u.LOADING)break;var l=new e.g.MSStreamReader;l.onprogress=function(){l.result.byteLength>t._pos&&(t.push(i.Buffer.from(new Uint8Array(l.result.slice(t._pos)))),t._pos=l.result.byteLength)},l.onload=function(){t.push(null)},l.readAsArrayBuffer(n)}t._xhr.readyState===u.DONE&&"ms-stream"!==t._mode&&t.push(null)}},319:function(e,t,r){"use strict";var n=r(56).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=d,t=3;break;default:this.write=f,this.end=h;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},774:function(t){t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;
2return function(){if(!n){if(r("throwDeprecation"))throw Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function r(t){try{if(!e.g.localStorage)return!1}catch(e){return!1}var r=e.g.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}},663:function(e){e.exports=function(){for(var e={},r=0;r<arguments.length;r++){var n=arguments[r];for(var i in n)t.call(n,i)&&(e[i]=n[i])}return e};var t=Object.prototype.hasOwnProperty},181:function(t){"use strict";t.exports=e.r(259390)},434:function(t){"use strict";t.exports=e.r(679877)},203:function(t){"use strict";t.exports=e.r(928299)},16:function(t){"use strict";t.exports=e.r(992227)},23:function(t){"use strict";t.exports=e.r(29607)}},s={};function a(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}},n=!0;try{o[e](r,r.exports,a),n=!1}finally{n&&delete s[e]}return r.exports}a.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/stream-http/",t.exports=a(534)},902367,(e,t,r)=>{var n={572:function(e,t,r){var n=r(611),i=r(16),o=e.exports;for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);function a(e){if("string"==typeof e&&(e=i.parse(e)),e.protocol||(e.protocol="https:"),"https:"!==e.protocol)throw Error('Protocol "'+e.protocol+'" not supported. Expected "https:"');return e}o.request=function(e,t){return e=a(e),n.request.call(this,e,t)},o.get=function(e,t){return e=a(e),n.get.call(this,e,t)}},611:function(t){"use strict";t.exports=e.r(870604)},16:function(t){"use strict";t.exports=e.r(992227)}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},s=!0;try{n[e](r,r.exports,o),s=!1}finally{s&&delete i[e]}return r.exports}o.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_b70400fe2677c30e9bd511906bc8bd5b/node_modules/next/dist/compiled/https-browserify/",t.exports=o(572)},72229,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.REST_CLIENT_TYPE_ENUM=r.APIID=void 0,r.serializeParams=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return(r?Object.keys(e).sort():Object.keys(e)).map(r=>{let i=n?encodeURIComponent(e[r]):e[r];if(!0===t&&void 0===i)throw Error("Failed to sign API request due to undefined parameter");return`${r}=${i}`}).join("&")},r.getRestBaseUrl=function(e,t){let r={default:"https://api.bybit.com",bytick:"https://api.bytick.com",NL:"https://api.bybit.nl",HK:"https://api.byhkbit.com",TK:"https://api.bybit-tr.com"};if(t.baseUrl)return t.baseUrl;if(t.demoTrading)return"https://api-demo.bybit.com";if(e)return"https://api-testnet.bybit.com";if(t.apiRegion){let e=r[t.apiRegion];if(!e)throw Error(`No base URL found for region "${t.apiRegion}". Check that your "apiRegion" value is valid.`);return e}return r.default},r.isWsPong=function(e){return!!e&&(!!e.pong||!!e.ping||"pong"===e.op||"pong"===e.ret_msg||e.request&&"ping"===e.request.op&&"pong"===e.ret_msg&&!0===e.success)},r.parseRateLimitHeaders=function(e,t){try{if(!e||"object"!=typeof e)return;let t=e["x-bapi-limit-status"],r=e["x-bapi-limit"],n=e["x-bapi-limit-reset-timestamp"];if(void 0===t||void 0===r||void 0===n)return;let i={remainingRequests:Number(t),maxRequests:Number(r),resetAtTimestamp:Number(n)};if(isNaN(i.remainingRequests)||isNaN(i.maxRequests)||isNaN(i.resetAtTimestamp))return;return i}catch(r){if(t)throw console.log(new Date,"parseRateLimitHeaders()","Failed to parse rate limit headers",{headers:e,exception:r}),r}},r.APIID="bybitapinode",r.REST_CLIENT_TYPE_ENUM={v5:"v5"}},848424,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WS_API_Operations=void 0,e.r(552718),r.WS_API_Operations=["order.create","order.amend","order.cancel","order.create-batch","order.amend-batch","order.cancel-batch"]},25258,(e,t,r)=>{"use strict";
2Object.defineProperty(r,"__esModule",{value:!0}),r.isWsEventV5=i,r.isWsOrderbookEventV5=function(e){return"object"==typeof e&&!!e&&"string"==typeof e.topic&&"string"==typeof e.type&&["delta","snapshot"].includes(e.type)&&e.topic.startsWith("orderbook")},r.isWsPositionEventV5=function(e){return"object"==typeof e&&!!e&&"string"==typeof e.topic&&"position"===e.topic},r.isWsAccountOrderEventV5=function(e){return"object"==typeof e&&!!e&&"string"==typeof e.topic&&"order"===e.topic},r.isWsExecutionEventV5=function(e){return"object"==typeof e&&!!e&&"string"==typeof e.topic&&"execution"===e.topic},r.neverGuard=function(e,t){return Error(`Unhandled value exception "${e}", ${t}`)},r.isWSAPIResponse=function(e){return"object"==typeof e&&!!e&&"string"==typeof e.op&&n.WS_API_Operations.includes(e.op)},r.isTopicSubscriptionSuccess=function(e){return!!o(e)&&!0===e.success},r.isTopicSubscriptionConfirmation=o,r.isWsAllLiquidationEvent=function(e){return!!i(e)&&!!e.topic.startsWith("allLiquidation")};let n=e.r(848424);function i(e){return"object"==typeof e&&!!e&&"string"==typeof e.topic&&"string"==typeof e.type}function o(e){return"object"==typeof e&&!!e&&"string"==typeof e.op&&"subscribe"===e.op}},216538,(e,t,r)=>{"use strict";var n=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.getSignKeyType=s,r.hashMessage=function(e,t,r){return n(this,void 0,void 0,function*(){let n=new TextEncoder,s=yield globalThis.crypto.subtle.digest(r,n.encode(e));switch(t){case"hex":return Array.from(new Uint8Array(s)).map(e=>e.toString(16).padStart(2,"0")).join("");case"base64":return o(s);default:throw(0,i.neverGuard)(t,`Unhandled sign method: "${t}"`)}})},r.signMessage=function(e,t,r){return n(this,arguments,void 0,function*(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"SHA-256",l=new TextEncoder,u=s(t),c=r||("RSASSA-PKCS1-v1_5"===u?"base64":"hex"),d=yield function(e,t,r,o){return n(this,void 0,void 0,function*(){switch(t){case"RSASSA-PKCS1-v1_5":{let n=e.replace(/(?:-----BEGIN RSA PRIVATE KEY-----|-----BEGIN PRIVATE KEY-----|-----END RSA PRIVATE KEY-----|-----END PRIVATE KEY-----|\s+)/g,""),i=Uint8Array.from(atob(n),e=>e.charCodeAt(0));return crypto.subtle.importKey("pkcs8",i.buffer,{name:t,hash:{name:r}},!1,["sign"])}case"HMAC":return globalThis.crypto.subtle.importKey("raw",o.encode(e),{name:t,hash:r},!1,["sign"]);default:throw(0,i.neverGuard)(t,`Unhandled key type: "${t}"`)}})}(t,u,a,l),f=yield globalThis.crypto.subtle.sign({name:u},d,l.encode(e));switch(c){case"hex":return Array.from(new Uint8Array(f)).map(e=>e.toString(16).padStart(2,"0")).join("");case"base64":return o(f);default:throw(0,i.neverGuard)(c,`Unhandled sign method: "${c}"`)}})},r.checkWebCryptoAPISupported=function(){if(!globalThis.crypto)throw Error(`Web Crypto API unavailable. Authentication will not work. 3 4Are you using an old Node.js release? Refer to the current Node.js LTS version. Node.js v18 reached end of life in April 2025! You should be using Node LTS or newer (v22 or above)! 5 6If you prefer to continue using an outdated Node.js version, check github for an example on using the node:crypto module for sign instead: 7https://github.com/tiagosiebler/bybit-api/blob/master/examples/fasterHmacSign.ts 8`)};let i=e.r(25258);function o(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let e=0;e<n;e++)t+=String.fromCharCode(r[e]);return globalThis.btoa(t)}function s(e){return e.includes("PRIVATE KEY")?"RSASSA-PKCS1-v1_5":"HMAC"}},530600,(e,t,r)=>{"use strict";var n=e.i(261955),i=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}
8,o=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});let s=o(e.r(910376)),a=o(e.r(902367)),l=e.r(72229),u=e.r(216538),c="object"==typeof n.default&&"object"==typeof n.default.env&&n.default.env.BYBITTRACE;c&&s.default.interceptors.response.use(e=>(console.log(new Date,"Response:",{request:{url:e.config.url,method:e.config.method,data:e.config.data,headers:e.config.headers,params:e.config.params},response:{status:e.status,statusText:e.statusText,headers:e.headers,data:e.data}}),e)),r.default=class{constructor(e={},t={}){if(this.timeOffset=null,this.syncTimePromise=null,this.clientType=this.getClientType(),this.options=Object.assign({recv_window:5e3,strict_param_validation:!1,enable_time_sync:!1,sync_interval_ms:36e5,syncTimeBeforePrivateRequests:!1,encodeSerialisedValues:!0},e),this.globalRequestOptions=Object.assign(Object.assign({timeout:3e5},t),{headers:Object.assign(Object.assign({},t.headers),{"x-referer":l.APIID})}),this.options.keepAlive){const e=this.globalRequestOptions.httpsAgent,t=(null==e?void 0:e.options)||{};this.globalRequestOptions.httpsAgent=new a.default.Agent(Object.assign(Object.assign({},t),{keepAlive:!0,keepAliveMsecs:this.options.keepAliveMsecs}))}if(this.baseUrl=(0,l.getRestBaseUrl)(!!this.options.testnet,e),this.key=this.options.key,this.secret=this.options.secret,this.key&&!this.secret)throw Error("API Key & Secret are both required for private endpoints");this.key&&this.secret&&!this.options.customSignMessageFn&&(0,u.checkWebCryptoAPISupported)(),this.options.enable_time_sync&&(this.syncTime(),setInterval(this.syncTime.bind(this),+this.options.sync_interval_ms))}get(e,t){return this._call("GET",e,t,!0)}getPrivate(e,t){return this._call("GET",e,t,!1)}post(e,t){return this._call("POST",e,t,!0)}postPrivate(e,t){return this._call("POST",e,t,!1)}deletePrivate(e,t){return this._call("DELETE",e,t,!1)}prepareSignParams(e,t,r,n){return i(this,void 0,void 0,function*(){if(n)return{originalParams:r,paramsWithSign:r};if(!this.key||!this.secret)throw Error("Private endpoints require api and private keys set");return null===this.timeOffset&&(yield this.syncTime()),this.options.syncTimeBeforePrivateRequests&&(this.timeOffset=yield this.fetchTimeOffset()),this.signRequest(r||{},e,t)})}buildRequest(e,t,r,n){return i(this,void 0,void 0,function*(){let i=Object.assign(Object.assign({},this.globalRequestOptions),{url:t,method:e});for(let e in r)void 0===r[e]&&delete r[e];if(n)return Object.assign(Object.assign({},i),{params:r});let o=yield this.prepareSignParams(e,"v5auth",r,n),s=Object.assign({"X-BAPI-SIGN-TYPE":2,"X-BAPI-API-KEY":this.key,"X-BAPI-TIMESTAMP":o.timestamp,"X-BAPI-SIGN":o.sign,"X-BAPI-RECV-WINDOW":o.recvWindow},i.headers);return"GET"===e?Object.assign(Object.assign({},i),{headers:s,url:o.serializedParams?i.url+"?"+o.serializedParams:i.url}):Object.assign(Object.assign({},i),{headers:s,data:o.originalParams})})}_call(e,t,r,n){return i(this,void 0,void 0,function*(){let i=[this.baseUrl,t].join(t.startsWith("/")?"":"/"),o=yield this.buildRequest(e,i,r,n);return c&&console.log("full request: ",o),(0,s.default)(o).then(e=>{if(200==e.status)return Object.assign({rateLimitApi:this.options.parseAPIRateLimits?(0,l.parseRateLimitHeaders)(e.headers,!0===this.options.throwOnFailedRateLimitParse):void 0},e.data);throw e}).catch(e=>this.parseException(e))})}parseException(e){if(!1===this.options.parse_exceptions)throw e;if(!e.response){if(!e.request)throw e.message;throw e}let t=e.response;throw{code:t.status,message:t.statusText,body:t.data,headers:t.headers,requestOptions:this.options}}signMessage(e,t,r){return i(this,arguments,void 0,function*(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"SHA-256";return"function"==typeof this.options.customSignMessageFn?this.options.customSignMessageFn(e,t):yield(0,u.signMessage)(e,t,r,n)})}signRequest(e,t,r){return i(this,void 0,void 0,function*(){let n=Date.now()+(this.timeOffset||0),i={originalParams:Object.assign({},e),sign:"",timestamp:n,recvWindow:0,serializedParams:""};if(!this.key||!this.secret)return i;let o=this.key,s=i.originalParams.recv_window||this.options.recv_window||5e3,a=this.options.strict_param_validation,u=this.options.encodeSerialisedValues;if(i.recvWindow=s,"v5auth"===r){let e="GET"===t?(0,l.serializeParams)(i.originalParams,a,!1,u):JSON.stringify(i.originalParams);
8i.sign=yield this.signMessage(n+o+s+e,this.secret,void 0,"SHA-256"),i.serializedParams=e}return i})}syncTime(e){return e||this.options.enable_time_sync?(null!==this.syncTimePromise||(this.syncTimePromise=this.fetchTimeOffset().then(e=>{this.timeOffset=e,this.syncTimePromise=null})),this.syncTimePromise):(this.timeOffset=0,Promise.resolve(!1))}fetchTimeOffset(){return i(this,void 0,void 0,function*(){try{let e=Date.now(),t=yield this.fetchServerTime();if(!t||isNaN(t))throw Error(`fetchServerTime() returned non-number: "${t}" typeof(${typeof t})`);let r=Date.now();return Math.ceil(1e3*t-r+(r-e)/2)}catch(e){return console.error("Failed to fetch get time offset: ",e),0}})}}},801484,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DefaultLogger=void 0,r.DefaultLogger={trace:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r]},info:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];console.info(t)},error:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];console.error(t)}}},955680,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WS_ERROR_ENUM=r.WS_BASE_URL_MAP=r.PUBLIC_WS_KEYS=r.WS_AUTH_ON_CONNECT_KEYS=r.WS_KEY_MAP=r.WS_LOGGER_CATEGORY=void 0,r.isPrivateWsTopic=function(e){return i.includes(e)},r.getWsKeyForTopic=o,r.getWsUrl=function(e,t,i){let o=t.wsUrl;if(o)return o;let s="wss://stream-demo.bybit.com/v5/private",a=t.demoTrading,l=t.testnet?"testnet":"livenet";switch(e){case r.WS_KEY_MAP.v5Private:if(a)return s;return r.WS_BASE_URL_MAP.v5.private[l];case r.WS_KEY_MAP.v5PrivateTrade:if(a)return s;return r.WS_BASE_URL_MAP[e].private[l];case r.WS_KEY_MAP.v5SpotPublic:return r.WS_BASE_URL_MAP.v5SpotPublic.public[l];case r.WS_KEY_MAP.v5LinearPublic:return r.WS_BASE_URL_MAP.v5LinearPublic.public[l];case r.WS_KEY_MAP.v5InversePublic:return r.WS_BASE_URL_MAP.v5InversePublic.public[l];case r.WS_KEY_MAP.v5OptionPublic:return r.WS_BASE_URL_MAP.v5OptionPublic.public[l];default:throw i.error("getWsUrl(): Unhandled wsKey: ",{category:"bybit-ws",wsKey:e}),(0,n.neverGuard)(e,"getWsUrl(): Unhandled wsKey")}},r.getMaxTopicsPerSubscribeEvent=function(e,t){if("v5"===e)return t===r.WS_KEY_MAP.v5SpotPublic?10:null;throw(0,n.neverGuard)(e,"getWsKeyForTopic(): Unhandled market")},r.safeTerminateWs=function(e,t){return!!e&&("function"==typeof e.terminate?(e.terminate(),!0):(t&&e.close(),!1))},r.getPromiseRefForWSAPIRequest=function(e){return[e.op,e.reqId].join("_")},r.getNormalisedTopicRequests=function(e){let t=[];for(let r of e){if("string"==typeof r){let e={topic:r,payload:void 0};t.push(e);continue}t.push(r)}return t},r.getTopicsPerWSKey=function(e,t,r,n){let i={};for(let s of t){let t=r||o(e,s.topic,n,s.category);i[t]&&Array.isArray(i[t])||(i[t]=[]),i[t].push(s)}return i};let n=e.r(25258);r.WS_LOGGER_CATEGORY={category:"bybit-ws"},r.WS_KEY_MAP={v5SpotPublic:"v5SpotPublic",v5LinearPublic:"v5LinearPublic",v5InversePublic:"v5InversePublic",v5OptionPublic:"v5OptionPublic",v5Private:"v5Private",v5PrivateTrade:"v5PrivateTrade"},r.WS_AUTH_ON_CONNECT_KEYS=[r.WS_KEY_MAP.v5Private,r.WS_KEY_MAP.v5PrivateTrade],r.PUBLIC_WS_KEYS=[r.WS_KEY_MAP.v5SpotPublic,r.WS_KEY_MAP.v5LinearPublic,r.WS_KEY_MAP.v5InversePublic,r.WS_KEY_MAP.v5OptionPublic];let i=["stop_order","outboundAccountInfo","executionReport","ticketInfo","copyTradePosition","copyTradeOrder","copyTradeExecution","copyTradeWallet","user.openapi.option.position","user.openapi.option.trade","user.order","user.openapi.option.order","user.service","user.openapi.greeks","user.mmp.event","user.openapi.perp.position","user.openapi.perp.trade","user.openapi.perp.order","user.service","user.position.unifiedAccount","user.execution.unifiedAccount","user.order.unifiedAccount","user.wallet.unifiedAccount","user.greeks.unifiedAccount","user.position.contractAccount","user.execution.contractAccount","user.order.contractAccount","user.wallet.contractAccount","position","execution","order","wallet","greeks","execution.fast","execution.fast.linear","execution.fast.inverse","execution.fast.spot"];function o(e,t,o,s){let a=!0===o||i.includes(t);if("v5"===e){if(a)return r.WS_KEY_MAP.v5Private;switch(s){case"spot":return r.WS_KEY_MAP.v5SpotPublic;case"linear":return r.WS_KEY_MAP.v5LinearPublic;case"inverse":return r.WS_KEY_MAP.v5InversePublic;case"option":return r.WS_KEY_MAP.v5OptionPublic;case void 0:throw Error("Category cannot be undefined");default:throw(0,n.neverGuard)(s,"getWsKeyForTopic(v5): Unhandled v5 category")}}throw(0,n.neverGuard)(e,"getWsKeyForTopic(): Unhandled market")}r.WS_BASE_URL_MAP={v5:{public:{livenet:"public topics are routed internally via the public wskeys",testnet:"public topics are routed internally via the public wskeys"},private:{livenet:"wss://stream.bybit.com/v5/private",testnet:"wss://stream-testnet.bybit.com/v5/private"}},v5PrivateTrade:{public:{livenet:"public topics are routed internally via the public wskeys",testnet:"public topics are routed internally via the public wskeys"},private:{livenet:"wss://stream.bybit.com/v5/trade",testnet:"wss://stream-testnet.bybit.com/v5/trade"}},v5SpotPublic:{public:{livenet:"wss://stream.bybit.com/v5/public/sp
8ot",testnet:"wss://stream-testnet.bybit.com/v5/public/spot"}},v5LinearPublic:{public:{livenet:"wss://stream.bybit.com/v5/public/linear",testnet:"wss://stream-testnet.bybit.com/v5/public/linear"}},v5InversePublic:{public:{livenet:"wss://stream.bybit.com/v5/public/inverse",testnet:"wss://stream-testnet.bybit.com/v5/public/inverse"}},v5OptionPublic:{public:{livenet:"wss://stream.bybit.com/v5/public/option",testnet:"wss://stream-testnet.bybit.com/v5/public/option"}}},r.WS_ERROR_ENUM={NOT_AUTHENTICATED_SPOT_V3:"-1004",API_ERROR_GENERIC:"10001",API_SIGN_AUTH_FAILED:"10003",USDC_OPTION_AUTH_FAILED:"3303006"}},838679,(e,t,r)=>{"use strict";var n,i;Object.defineProperty(r,"__esModule",{value:!0}),r.WsConnectionStateEnum=void 0,(i=n||(r.WsConnectionStateEnum=n={}))[i.INITIAL=0]="INITIAL",i[i.CONNECTING=1]="CONNECTING",i[i.CONNECTED=2]="CONNECTED",i[i.CLOSING=3]="CLOSING",i[i.RECONNECTING=4]="RECONNECTING",i[i.ERROR=5]="ERROR"},475912,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WsStore=r.DEFERRED_PROMISE_REF=void 0,r.isDeepObjectMatch=o;let n=e.r(801484),i=e.r(838679);function o(e,t){if("string"==typeof e&&"string"==typeof t)return e===t;if("object"!=typeof e||"object"!=typeof t)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}r.DEFERRED_PROMISE_REF={CONNECTION_IN_PROGRESS:"CONNECTION_IN_PROGRESS",AUTHENTICATION_IN_PROGRESS:"AUTHENTICATION_IN_PROGRESS"},r.WsStore=class{constructor(e){this.wsState={},this.logger=e||n.DefaultLogger}get(e,t){return this.wsState[e]?this.wsState[e]:t?this.create(e):void 0}getKeys(){return Object.keys(this.wsState)}create(e){return this.hasExistingActiveConnection(e)&&this.logger.info("WsStore setConnection() overwriting existing open connection: ",this.getWs(e)),this.wsState[e]={subscribedTopics:new Set,connectionState:i.WsConnectionStateEnum.INITIAL,deferredPromiseStore:{}},this.get(e)}delete(e){if(this.hasExistingActiveConnection(e)){let t=this.getWs(e);this.logger.info("WsStore deleting state for connection still open: ",t),null==t||t.close()}delete this.wsState[e]}hasExistingActiveConnection(e){return this.get(e)&&this.isWsOpen(e)}getWs(e){var t;return null==(t=this.get(e))?void 0:t.ws}setWs(e,t){return this.isWsOpen(e)&&this.logger.info("WsStore setConnection() overwriting existing open connection: ",this.getWs(e)),this.get(e,!0).ws=t,t}getDeferredPromise(e,t){let r=this.get(e);if(r)return r.deferredPromiseStore[t]}createDeferredPromise(e,t,r){let n=this.getDeferredPromise(e,t);if(n)if(!r)return n;else throw Error(`Promise exists for "${e}"`);let i=this.get(e,!0),o={};return o.promise=new Promise((e,t)=>{o.resolve=e,o.reject=t}),i.deferredPromiseStore[t]=o,o}resolveDeferredPromise(e,t,r,n){let i=this.getDeferredPromise(e,t);(null==i?void 0:i.resolve)&&i.resolve(r),n&&this.removeDeferredPromise(e,t)}rejectDeferredPromise(e,t,r,n){let i=this.getDeferredPromise(e,t);(null==i?void 0:i.reject)&&(this.logger.trace(`rejectDeferredPromise(): rejecting ${e}/${t}`,r),"string"==typeof r?i.reject(Error(r)):i.reject(r)),n&&this.removeDeferredPromise(e,t)}removeDeferredPromise(e,t){let r=this.get(e);if(!r)return;let n=r.deferredPromiseStore[t];n&&(n.resolve&&n.resolve("promiseRemoved"),delete r.deferredPromiseStore[t])}rejectAllDeferredPromises(e,t){let n=this.get(e),i=n.deferredPromiseStore;if(!n||!i)return;let o=Object.values(r.DEFERRED_PROMISE_REF);for(let r in i)if(!o.includes(r))try{this.logger.trace(`rejectAllDeferredPromises(): rejecting ${e}/${r}/${t}`),this.rejectDeferredPromise(e,r,t,!0)}catch(n){this.logger.error("rejectAllDeferredPromises(): Exception rejecting deferred promise",{wsKey:e,reason:t,promiseRef:r,exception:n})}}getConnectionInProgressPromise(e){return this.getDeferredPromise(e,r.DEFERRED_PROMISE_REF.CONNECTION_IN_PROGRESS)}getAuthenticationInProgressPromise(e){return this.getDeferredPromise(e,r.DEFERRED_PROMISE_REF.AUTHENTICATION_IN_PROGRESS)}createConnectionInProgressPromise(e,t){return this.createDeferredPromise(e,r.DEFERRED_PROMISE_REF.CONNECTION_IN_PROGRESS,t)}createAuthenticationInProgressPromise(e,t){return this.createDeferredPromise(e,r.DEFERRED_PROMISE_REF.AUTHENTICATION_IN_PROGRESS,t)}
8removeConnectingInProgressPromise(e){return this.removeDeferredPromise(e,r.DEFERRED_PROMISE_REF.CONNECTION_IN_PROGRESS)}removeAuthenticationInProgressPromise(e){return this.removeDeferredPromise(e,r.DEFERRED_PROMISE_REF.AUTHENTICATION_IN_PROGRESS)}isWsOpen(e){let t=this.getWs(e);return!!t&&t.readyState===t.OPEN}getConnectionState(e){return this.get(e,!0).connectionState}setConnectionState(e,t){this.get(e,!0).connectionState=t,this.get(e,!0).connectionStateChangedAt=new Date}isConnectionState(e,t){return this.getConnectionState(e)===t}isConnectionAttemptInProgress(e){let t=this.isConnectionState(e,i.WsConnectionStateEnum.CONNECTING)||this.isConnectionState(e,i.WsConnectionStateEnum.RECONNECTING);if(t){let t=this.get(e,!0),r=null==t?void 0:t.connectionStateChangedAt,n=null==r?void 0:r.getTime();n&&new Date().getTime()-n>=15e3&&(this.logger.error("State change timed out, reconnect workflow stuck?",{key:e,wsState:t}),this.setConnectionState(e,i.WsConnectionStateEnum.ERROR))}return t}getTopics(e){return this.get(e,!0).subscribedTopics}getTopicsByKey(){let e={};for(let t in this.wsState)e[t]=this.getTopics(t);return e}getMatchingTopic(e,t){for(let r of this.getTopics(e).values())if(o(t,r))return r}addTopic(e,t){return this.getMatchingTopic(e,t)?this.getTopics(e):this.getTopics(e).add(t)}deleteTopic(e,t){let r=this.getMatchingTopic(e,t);return r&&this.getTopics(e).delete(r),this.getTopics(e)}}},531737,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(955680),r),i(e.r(475912),r),i(e.r(838679),r)},552718,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(530600),r),i(e.r(801484),r),i(e.r(72229),r),i(e.r(25258),r),i(e.r(531737),r)},369297,(e,t,r)=>{"use strict";var n=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.RestClientV5=void 0;let o=e.r(552718),s=i(e.r(530600));class a extends s.default{fetchLatencySummary(){return n(this,void 0,void 0,function*(){let e=Date.now(),t=yield this.getServerTime(),r=Date.now(),n=t.time,i=r-e,o=Math.floor(i/2),s=n+o,a=s-r,l={localTime:r,serverTime:n,roundTripTime:i,estimatedOneWayLatency:o,adjustedServerTime:s,timeDifference:a};return console.log("Time synchronization results:"),console.log(l),console.log(`Your approximate latency to exchange server: 9 One way: ${o}ms. 10 Round trip: ${i}ms. 11 `),Math.abs(a)>500?console.warn(`WARNING! Time difference between server and client clock is greater than 500ms. It is currently ${a}ms. 12 Consider adjusting your system clock to avoid unwanted clock sync errors! 13 Visit https://github.com/tiagosiebler/awesome-crypto-examples/wiki/Timestamp-for-this-request-is-outside-of-the-recvWindow for more information`):console.log(`Time difference between server and client clock is within acceptable range of 500ms. It is currently ${a}ms.`),l})}getSystemStatus(e){return this.getPrivate("/v5/system/status",e)}getClientType(){return o.REST_CLIENT_TYPE_ENUM.v5}fetchServerTime(){return n(this,void 0,void 0,function*(){return Number((yield this.get
13ServerTime()).time)/1e3})}getServerTime(){return this.get("/v5/market/time")}requestDemoTradingFunds(e){return this.postPrivate("/v5/account/demo-apply-money",e)}createDemoAccount(){return this.postPrivate("/v5/user/create-demo-member")}getSpreadInstrumentsInfo(e){return this.get("/v5/spread/instrument",e)}getSpreadOrderbook(e){return this.get("/v5/spread/orderbook",e)}getSpreadTickers(e){return this.get("/v5/spread/tickers",e)}getSpreadRecentTrades(e){return this.get("/v5/spread/recent-trade",e)}submitSpreadOrder(e){return this.postPrivate("/v5/spread/order/create",e)}amendSpreadOrder(e){return this.postPrivate("/v5/spread/order/amend",e)}cancelSpreadOrder(e){return this.postPrivate("/v5/spread/order/cancel",e)}cancelAllSpreadOrders(e){return this.postPrivate("/v5/spread/order/cancel-all",e)}getSpreadOpenOrders(e){return this.getPrivate("/v5/spread/order/realtime",e)}getSpreadOrderHistory(e){return this.getPrivate("/v5/spread/order/history",e)}getSpreadTradeHistory(e){return this.getPrivate("/v5/spread/execution/list",e)}getKline(e){return this.get("/v5/market/kline",e)}getMarkPriceKline(e){return this.get("/v5/market/mark-price-kline",e)}getIndexPriceKline(e){return this.get("/v5/market/index-price-kline",e)}getPremiumIndexPriceKline(e){return this.get("/v5/market/premium-index-price-kline",e)}getInstrumentsInfo(e){return this.get("/v5/market/instruments-info",e)}getOrderbook(e){return this.get("/v5/market/orderbook",e)}getTickers(e){return this.get("/v5/market/tickers",e)}getFundingRateHistory(e){return this.get("/v5/market/funding/history",e)}getPublicTradingHistory(e){return this.get("/v5/market/recent-trade",e)}getOpenInterest(e){return this.get("/v5/market/open-interest",e)}getHistoricalVolatility(e){return this.get("/v5/market/historical-volatility",e)}getInsurance(e){return this.get("/v5/market/insurance",e)}getRiskLimit(e){return this.get("/v5/market/risk-limit",e)}getOptionDeliveryPrice(e){return this.get("/v5/market/delivery-price",e)}getDeliveryPrice(e){return this.get("/v5/market/delivery-price",e)}getLongShortRatio(e){return this.get("/v5/market/account-ratio",e)}getOrderPriceLimit(e){return this.get("/v5/order/price-limit",e)}submitOrder(e){return this.postPrivate("/v5/order/create",e)}amendOrder(e){return this.postPrivate("/v5/order/amend",e)}cancelOrder(e){return this.postPrivate("/v5/order/cancel",e)}getActiveOrders(e){return this.getPrivate("/v5/order/realtime",e)}cancelAllOrders(e){return this.postPrivate("/v5/order/cancel-all",e)}getHistoricOrders(e){return this.getPrivate("/v5/order/history",e)}getExecutionList(e){return this.getPrivate("/v5/execution/list",e)}batchSubmitOrders(e,t){return this.postPrivate("/v5/order/create-batch",{category:e,request:t})}batchAmendOrders(e,t){return this.postPrivate("/v5/order/amend-batch",{category:e,request:t})}batchCancelOrders(e,t){return this.postPrivate("/v5/order/cancel-batch",{category:e,request:t})}getSpotBorrowCheck(e,t){return this.getPrivate("/v5/order/spot-borrow-check",{category:"spot",symbol:e,side:t})}setDisconnectCancelAllWindow(e,t){return this.postPrivate("/v5/order/disconnected-cancel-all",{category:e,timeWindow:t})}setDisconnectCancelAllWindowV2(e){return this.postPrivate("/v5/order/disconnected-cancel-all",e)}preCheckOrder(e){return this.postPrivate("/v5/order/pre-check",e)}getPositionInfo(e){return this.getPrivate("/v5/position/list",e)}setLeverage(e){return this.postPrivate("/v5/position/set-leverage",e)}switchIsolatedMargin(e){return this.postPrivate("/v5/position/switch-isolated",e)}setTPSLMode(e){return this.postPrivate("/v5/position/set-tpsl-mode",e)}switchPositionMode(e){return this.postPrivate("/v5/position/switch-mode",e)}setRiskLimit(e){return this.postPrivate("/v5/position/set-risk-limit",e)}setTradingStop(e){return this.postPrivate("/v5/position/trading-stop",e)}setAutoAddMargin(e){return this.postPrivate("/v5/position/set-auto-add-margin",e)}addOrReduceMargin(e){return this.postPrivate("/v5/position/add-margin",e)}getClosedPnL(e){return this.getPrivate("/v5/position/closed-pnl",e)}getClosedOptionsPositions(e){return this.getPrivate("/v5/position/get-closed-positions",e)}movePosition(e){return this.postPrivate("/v5/position/move-positions",e)}getMovePositionHistory(e){return this.getPrivate("/v5/position/move-history",e)}confirmNewRiskLimit(e){return this.postPrivate("/v5/position/confirm-pending-mmr",e)}getPreUpgradeOrderHistory(e){return this.getPrivate("/v5/pre-upgrade/order/history",e)}getPreUpgradeTradeHistory(e){return this.getPrivate("/v5/pre-upgrade/execution/list",e)}getPreUpgradeClosedPnl(e){return this.getPrivate("/v5/pre-upgrade/position/closed-pnl",e)}getPreUpgradeTransactions(e){return this.getPrivate("/v5/pre-upgrade/account/transaction-log",e)}getPreUpgradeOptionDeliveryRecord(e){return this.getPrivate("/v5/pre-upgrade/asset/delivery-record",e)}getPreUpgradeUSDCSessionSettlements(e){return this.getPrivate("/v5/pre-upgrade/asset/settlement-record",e)}getWalletBalance(e){return this.getPrivate("/v5/account/wallet-balance",e)}
13getTransferableAmount(e){return this.getPrivate("/v5/account/withdrawal",e)}upgradeToUnifiedAccount(){return this.postPrivate("/v5/account/upgrade-to-uta")}getBorrowHistory(e){return this.getPrivate("/v5/account/borrow-history",e)}repayLiability(e){return this.postPrivate("/v5/account/quick-repayment",e)}setCollateralCoin(e){return this.postPrivate("/v5/account/set-collateral-switch",e)}batchSetCollateralCoin(e){return this.postPrivate("/v5/account/set-collateral-switch-batch",e)}getCollateralInfo(e){return this.getPrivate("/v5/account/collateral-info",{currency:e})}getCoinGreeks(e){return this.getPrivate("/v5/asset/coin-greeks",e?{baseCoin:e}:void 0)}getFeeRate(e){return this.getPrivate("/v5/account/fee-rate",e)}getAccountInfo(){return this.getPrivate("/v5/account/info")}getDCPInfo(){return this.getPrivate("/v5/account/query-dcp-info")}getTransactionLog(e){return this.getPrivate("/v5/account/transaction-log",e)}getClassicTransactionLogs(e){return this.getPrivate("/v5/account/contract-transaction-log",e)}getSMPGroup(){return this.getPrivate("/v5/account/smp-group")}setMarginMode(e){return this.postPrivate("/v5/account/set-margin-mode",{setMarginMode:e})}setSpotHedging(e){return this.postPrivate("/v5/account/set-hedging-mode",e)}setLimitPriceAction(e){return this.postPrivate("/v5/account/set-limit-px-action",e)}setMMP(e){return this.postPrivate("/v5/account/mmp-modify",e)}resetMMP(e){return this.postPrivate("/v5/account/mmp-reset",{baseCoin:e})}getMMPState(e){return this.getPrivate("/v5/account/mmp-state",{baseCoin:e})}getDeliveryRecord(e){return this.getPrivate("/v5/asset/delivery-record",e)}getSettlementRecords(e){return this.getPrivate("/v5/asset/settlement-record",e)}getCoinExchangeRecords(e){return this.getPrivate("/v5/asset/exchange/order-record",e)}getCoinInfo(e){return this.getPrivate("/v5/asset/coin/query-info",e?{coin:e}:void 0)}getSubUID(){return this.getPrivate("/v5/asset/transfer/query-sub-member-list")}getAssetInfo(e){return this.getPrivate("/v5/asset/transfer/query-asset-info",e)}getAllCoinsBalance(e){return this.getPrivate("/v5/asset/transfer/query-account-coins-balance",e)}getCoinBalance(e){return this.getPrivate("/v5/asset/transfer/query-account-coin-balance",e)}getWithdrawableAmount(e){return this.getPrivate("/v5/asset/withdraw/withdrawable-amount",e)}getTransferableCoinList(e,t){return this.getPrivate("/v5/asset/transfer/query-transfer-coin-list",{fromAccountType:e,toAccountType:t})}createInternalTransfer(e,t,r,n,i){return this.postPrivate("/v5/asset/transfer/inter-transfer",{transferId:e,coin:t,amount:r,fromAccountType:n,toAccountType:i})}getInternalTransferRecords(e){return this.getPrivate("/v5/asset/transfer/query-inter-transfer-list",e)}enableUniversalTransferForSubUIDs(e){return this.postPrivate("/v5/asset/transfer/save-transfer-sub-member",{subMemberIds:e})}createUniversalTransfer(e){return this.postPrivate("/v5/asset/transfer/universal-transfer",e)}getUniversalTransferRecords(e){return this.getPrivate("/v5/asset/transfer/query-universal-transfer-list",e)}getAllowedDepositCoinInfo(e){return this.getPrivate("/v5/asset/deposit/query-allowed-list",e)}setDepositAccount(e){return this.postPrivate("/v5/asset/deposit/deposit-to-account",e)}getDepositRecords(e){return this.getPrivate("/v5/asset/deposit/query-record",e)}getSubAccountDepositRecords(e){return this.getPrivate("/v5/asset/deposit/query-sub-member-record",e)}getInternalDepositRecords(e){return this.getPrivate("/v5/asset/deposit/query-internal-record",e)}getMasterDepositAddress(e,t){return this.getPrivate("/v5/asset/deposit/query-address",{coin:e,chainType:t})}getSubDepositAddress(e,t,r){return this.getPrivate("/v5/asset/deposit/query-sub-member-address",{coin:e,chainType:t,subMemberId:r})}querySubMemberAddress(e,t,r){return this.getPrivate("/v5/asset/deposit/query-sub-member-address",{coin:e,chainType:t,subMemberId:r})}getWithdrawalRecords(e){return this.getPrivate("/v5/asset/withdraw/query-record",e)}getExchangeEntities(){return this.getPrivate("/v5/asset/withdraw/vasp/list")}submitWithdrawal(e){return this.postPrivate("/v5/asset/withdraw/create",e)}cancelWithdrawal(e){return this.postPrivate("/v5/asset/withdraw/cancel",{id:e})}getConvertCoins(e){return this.getPrivate("/v5/asset/exchange/query-coin-list",e)}requestConvertQuote(e){return this.postPrivate("/v5/asset/exchange/quote-apply",e)}confirmConvertQuote(e){return this.postPrivate("/v5/asset/exchange/convert-execute",e)}getConvertStatus(e){return this.getPrivate("/v5/asset/exchange/convert-result-query",e)}getConvertHistory(e){return this.getPrivate("/v5/asset/exchange/query-convert-history",e)}createSubMember(e){return this.postPrivate("/v5/user/create-sub-member",e)}createSubUIDAPIKey(e){return this.postPrivate("/v5/user/create-sub-api",e)}getSubUIDList(){return this.getPrivate("/v5/user/query-sub-members")}getSubUIDListUnlimited(e){return this.getPrivate("/v5/user/submembers",e)}setSubUIDFrozenState(e,t){return this.postPrivate("/v5/user/frozen-sub-member",{subuid:e,frozen:t})}getQueryApiKey(){return this.getPrivate("/v5/user/query-api")}getSubAccountAllApiKeys(e){return this.getPrivate("/v5/user/sub-apikeys",e)}getUIDWalletType(e){return this.getPrivate("/v5/user/get-member-type",e)}updateMasterApiKey(e){return this.postPrivate("/v5/user/update-api",e)}updateSubApiKey(e){return this.postPrivate("/v5/user/update-sub-api",e)}deleteSubMember(e){return this.postPrivate("/v5/user/del-submember",e)}deleteMasterApiKey(){return this.postPrivate("/v5/user/delete-api")}deleteSubApiKey(e){return this.postPrivate("/v5/user/delete-sub-api",e)}getAffiliateUserList(e){return this.getPrivate("/v5/affiliate/aff-user-list",e)}
13getAffiliateUserInfo(e){return this.getPrivate("/v5/user/aff-customer-info",e)}getVIPMarginData(e){return this.get("/v5/spot-margin-trade/data",e)}getHistoricalInterestRate(e){return this.getPrivate("/v5/spot-margin-trade/interest-rate-history",e)}toggleSpotMarginTrade(e){return this.postPrivate("/v5/spot-margin-trade/switch-mode",{spotMarginMode:e})}setSpotMarginLeverage(e){return this.postPrivate("/v5/spot-margin-trade/set-leverage",{leverage:e})}getSpotMarginState(){return this.getPrivate("/v5/spot-margin-trade/state")}getSpotMarginCoinInfo(e){return this.getPrivate("/v5/spot-cross-margin-trade/pledge-token",{coin:e})}getSpotMarginBorrowableCoinInfo(e){return this.getPrivate("/v5/spot-cross-margin-trade/borrow-token",{coin:e})}getSpotMarginInterestAndQuota(e){return this.getPrivate("/v5/spot-cross-margin-trade/loan-info",{coin:e})}getSpotMarginLoanAccountInfo(){return this.getPrivate("/v5/spot-cross-margin-trade/account")}spotMarginBorrow(e){return this.postPrivate("/v5/spot-cross-margin-trade/loan",e)}spotMarginRepay(e){return this.postPrivate("/v5/spot-cross-margin-trade/repay",e)}getSpotMarginBorrowOrderDetail(e){return this.getPrivate("/v5/spot-cross-margin-trade/orders",e)}getSpotMarginRepaymentOrderDetail(e){return this.getPrivate("/v5/spot-cross-margin-trade/repay-history",e)}toggleSpotCrossMarginTrade(e){return this.postPrivate("/v5/spot-cross-margin-trade/switch",e)}getCollateralCoins(e){return this.get("/v5/crypto-loan/collateral-data",e)}getBorrowableCoins(e){return this.get("/v5/crypto-loan/loanable-data",e)}getAccountBorrowCollateralLimit(e){return this.getPrivate("/v5/crypto-loan/borrowable-collateralisable-number",e)}borrowCryptoLoan(e){return this.postPrivate("/v5/crypto-loan/borrow",e)}repayCryptoLoan(e){return this.postPrivate("/v5/crypto-loan/repay",e)}getUnpaidLoanOrders(e){return this.getPrivate("/v5/crypto-loan/ongoing-orders",e)}getRepaymentHistory(e){return this.getPrivate("/v5/crypto-loan/repayment-history",e)}getCompletedLoanOrderHistory(e){return this.getPrivate("/v5/crypto-loan/borrow-history",e)}getMaxAllowedReductionCollateralAmount(e){return this.getPrivate("/v5/crypto-loan/max-collateral-amount",e)}adjustCollateralAmount(e){return this.postPrivate("/v5/crypto-loan/adjust-ltv",e)}getLoanLTVAdjustmentHistory(e){return this.getPrivate("/v5/crypto-loan/adjustment-history",e)}getLoanBorrowableCoins(e){return this.get("/v5/crypto-loan-common/loanable-data",e)}getLoanCollateralCoins(e){return this.get("/v5/crypto-loan-common/collateral-data",e)}getMaxCollateralAmount(e){return this.getPrivate("/v5/crypto-loan-common/max-collateral-amount",e)}updateCollateralAmount(e){return this.postPrivate("/v5/crypto-loan-common/adjust-ltv",e)}getCollateralAdjustmentHistory(e){return this.getPrivate("/v5/crypto-loan-common/adjustment-history",e)}getCryptoLoanPosition(){return this.getPrivate("/v5/crypto-loan-common/position")}borrowFlexible(e){return this.postPrivate("/v5/crypto-loan-flexible/borrow",e)}repayFlexible(e){return this.postPrivate("/v5/crypto-loan-flexible/repay",e)}getOngoingFlexibleLoans(e){return this.getPrivate("/v5/crypto-loan-flexible/ongoing-coin",e)}getBorrowHistoryFlexible(e){return this.getPrivate("/v5/crypto-loan-flexible/borrow-history",e)}getRepaymentHistoryFlexible(e){return this.getPrivate("/v5/crypto-loan-flexible/repayment-history",e)}getSupplyOrderQuoteFixed(e){return this.get("/v5/crypto-loan-fixed/supply-order-quote",e)}getBorrowOrderQuoteFixed(e){return this.get("/v5/crypto-loan-fixed/borrow-order-quote",e)}createBorrowOrderFixed(e){return this.postPrivate("/v5/crypto-loan-fixed/borrow",e)}createSupplyOrderFixed(e){return this.postPrivate("/v5/crypto-loan-fixed/supply",e)}cancelBorrowOrderFixed(e){return this.postPrivate("/v5/crypto-loan-fixed/borrow-order-cancel",e)}cancelSupplyOrderFixed(e){return this.postPrivate("/v5/crypto-loan-fixed/supply-order-cancel",e)}getBorrowContractInfoFixed(e){return this.getPrivate("/v5/crypto-loan-fixed/borrow-contract-info",e)}getSupplyContractInfoFixed(e){return this.getPrivate("/v5/crypto-loan-fixed/supply-contract-info",e)}getBorrowOrderInfoFixed(e){return this.getPrivate("/v5/crypto-loan-fixed/borrow-order-info",e)}getSupplyOrderInfoFixed(e){return this.getPrivate("/v5/crypto-loan-fixed/supply-order-info",e)}repayFixed(e){return this.postPrivate("/v5/crypto-loan-fixed/fully-repay",e)}getRepaymentHistoryFixed(e){return this.getPrivate("/v5/crypto-loan-fixed/repayment-history",e)}getInstitutionalLendingProductInfo(e){return this.get("/v5/ins-loan/product-infos",{productId:e})}getInstitutionalLendingMarginCoinInfo(e){return this.get("/v5/ins-loan/ensure-tokens",{productId:e})}getInstitutionalLendingMarginCoinInfoWithConversionRate(e){return this.get("/v5/ins-loan/ensure-tokens-convert",{productId:e})}getInstitutionalLendingLoanOrders(e){return this.getPrivate("/v5/ins-loan/loan-order",e)}getInstitutionalLendingRepayOrders(e){return this.getPrivate("/v5/ins-loan/repaid-history",e)}getInstitutionalLendingLTV(){return this.getPrivate("/v5/ins-loan/ltv")}getInstitutionalLendingLTVWithLadderConversionRate(){return this.getPrivate("/v5/ins-loan/ltv-convert")}bindOrUnbindUID(e){return this.postPrivate("/v5/ins-loan/association-uid",e)}getExchangeBrokerEarnings(e){return this.getPrivate("/v5/broker/earnings-info",e)}getExchangeBrokerAccountInfo(){return this.getPrivate("/v5/broker/account-info")}getBrokerSubAccountDeposits(e){return this.getPrivate("/v5/broker/asset/query-sub-member-deposit-record",e)}getBrokerVoucherSpec(e){return this.postPrivate("/v5/broker/award/info",e)}issueBrokerVoucher(e){return this.postPrivate("/v5/broker/award/distribute-award",e)}getBrokerIssuedVoucher(e){return this.postPrivate("/v5/broker/award/distribution-record",e)}getEarnProduct(e){return this.get("/v5/earn/product",e)}submitStakeRedeem(e){return this.postPrivate("/v5/earn/place-order",e)}getEarnOrderHistory(e){return this.getPrivate("/v5/earn/order",e)}getEarnPosition(e){return this.getPrivate("/v5/earn/position",e)}createRFQ(e){return this.postPrivate("/v5/rfq/create-rfq",e)}getRFQConfig(){return this.getPrivate("/v5/rfq/config")}cancelRFQ(e){return this.postPrivate("/v5/rfq/cancel-rfq",e)}cancelAllRFQ(){return this.postPrivate("/v5/rfq/cancel-all-rfq")}createRFQQuote(e){return this.postPrivate("/v5/rfq/create-quote",e)}executeRFQQuote(e){return this.postPrivate("/v5/rfq/execute-quote",e)}cancelRFQQuote(e){return this.postPrivate("/v5/rfq/cancel-quote",e)}cancelAllRFQQuotes(){return this.postPrivate("/v5/rfq/cancel-all-quotes")}getRFQRealtimeInfo(e){return this.getPrivate("/v5/rfq/rfq-realtime",e)}getRFQHistory(e){return this.getPrivate("/v5/rfq/rfq-list",e)}getRFQRealtimeQuote(e){return this.getPrivate("/v5/rfq/quote-realtime",e)}getRFQHistoryQuote(e){return this.getPrivate("/v5/rfq/quote-list",e)}getRFQTrades(e){return this.getPrivate("/v5/rfq/trade-list",e)}getRFQPublicTrades(e){return this.getPrivate("/v5/rfq/public-trades",e)}getP2PAccountCoinsBalance(e){return this.getPrivate("/v5/asset/transfer/query-account-coins-balance",e)}getP2POnlineAds(e){return this.postPrivate("/v5/p2p/item/online",e)}createP2PAd(e){return this.postPrivate("/v5/p2p/item/create",e)}cancelP2PAd(e){return this.postPrivate("/v5/p2p/item/cancel",e)}updateP2PAd(e){return this.postPrivate("/v5/p2p/item/update",e)}getP2PPersonalAds(e){return this.postPrivate("/v5/p2p/item/personal/list",e)}getP2PAdDetail(e){return this.postPrivate("/v5/p2p/item/info",e)}getP2POrders(e){return this.postPrivate("/v5/p2p/order/simplifyList",e)}getP2POrderDetail(e){return this.postPrivate("/v5/p2p/order/info",e)}getP2PPendingOrders(e){return this.postPrivate("/v5/p2p/order/pending/simplifyList",e)}markP2POrderAsPaid(e){return this.postPrivate("/v5/p2p/order/pay",e)}releaseP2POrder(e){return this.postPrivate("/v5/p2p/order/finish",e)}sendP2POrderMessage(e){return this.postPrivate("/v5/p2p/order/message/send",e)}uploadP2PChatFile(e){return this.postPrivate("/v5/p2p/oss/upload_file",e)}
13getP2POrderMessages(e){return this.postPrivate("/v5/p2p/order/message/listpage",e)}getP2PUserInfo(){return this.postPrivate("/v5/p2p/user/personal/info")}getP2PCounterpartyUserInfo(e){return this.postPrivate("/v5/p2p/user/order/personal/info",e)}getP2PUserPayments(){return this.postPrivate("/v5/p2p/user/payment/list")}}r.RestClientV5=a},422750,(e,t,r)=>{"use strict";var n=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})},i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.SpotClientV3=void 0;let o=e.r(552718),s=i(e.r(530600));class a extends s.default{getClientType(){return o.REST_CLIENT_TYPE_ENUM.v5}fetchServerTime(){return n(this,void 0,void 0,function*(){return Number((yield this.getServerTime()).time_now)})}getMergedOrderBook(e,t,r){return this.get("/spot/v3/public/quote/depth/merged",{symbol:e,scale:t,limit:r})}getServerTime(){return this.get("/v2/public/time")}}r.SpotClientV3=a},324929,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},988621,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},851821,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},760109,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},672289,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},769204,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},675512,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},693347,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},977113,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},551897,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},590950,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},154709,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},422574,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},371483,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},529566,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},303177,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},584895,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},252689,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},291957,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},59856,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},610690,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},513331,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},29317,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},637845,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(324929),r),i(e.r(988621),r),i(e.r(851821),r),i(e.r(760109),r),i(e.r(672289),r),i(e.r(769204),r),i(e.r(675512),r),i(e.r(693347),r),i(e.r(977113),r),i(e.r(551897),r),i(e.r(590950),r),i(e.r(154709),r),i(e.r(422574),r),i(e.r(371483),r),i(e.r(529566),r),i(e.r(303177),r),i(e.r(584895),r),i(e.r(252689),r),i(e.r(291957),r),i(e.r(59856),r),i(e.r(610690),r),i(e.r(513331),r),i(e.r(29317),r)},707138,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},499953,(e,t,r)=>{"use strict";
13Object.defineProperty(r,"__esModule",{value:!0})},771234,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},637240,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},126845,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},187666,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},920159,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},545555,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},677188,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},200256,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},859932,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},6682,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},209776,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},139391,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},297012,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},955426,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},927005,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},718892,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},254722,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},101294,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},799294,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(707138),r),i(e.r(499953),r),i(e.r(771234),r),i(e.r(637240),r),i(e.r(126845),r),i(e.r(187666),r),i(e.r(920159),r),i(e.r(545555),r),i(e.r(677188),r),i(e.r(200256),r),i(e.r(859932),r),i(e.r(6682),r),i(e.r(209776),r),i(e.r(139391),r),i(e.r(297012),r),i(e.r(955426),r),i(e.r(927005),r),i(e.r(718892),r),i(e.r(254722),r),i(e.r(101294),r)},866027,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},594633,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},786078,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},532372,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isMessageEvent=function(e){return"object"==typeof e&&!!e&&"message"===e.type&&"string"==typeof e.data}},972519,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},815440,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(786078),r),i(e.r(532372),r),i(e.r(972519),r)},584257,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(637845),r),i(e.r(610690),r),i(e.r(799294),r),i(e.r(718892),r),i(e.r(866027),r),i(e.r(594633),r),i(e.r(815440),r)},718866,(e,t,r)=>{var n=null;t.exports=n="u">typeof WebSocket?WebSocket:"u">typeof MozWebSocket?MozWebSocket:e.g.WebSocket||e.g.MozWebSocket},496779,(e,t,r)=>{"use strict";var n=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})}
13,i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.BaseWebsocketClient=void 0;let o=i(e.r(679877)),s=i(e.r(718866)),a=e.r(584257),l=e.r(801484),u=e.r(216538),c=e.r(531737),d=e.r(475912);class f extends o.default{constructor(e,t){super(),this.wsApiRequestId=0,this.timeOffsetMs=0,this.pendingTopicSubscriptionRequests={},this.logger=t||l.DefaultLogger,this.wsStore=new d.WsStore(this.logger),this.options=Object.assign({testnet:!1,demoTrading:!1,market:"v5",pongTimeout:1e3,pingInterval:1e4,reconnectTimeout:500,recvWindow:5e3,promiseSubscribeRequests:!1,authPrivateConnectionsOnConnect:!0,authPrivateRequests:!1},e),this.options.key&&this.options.secret&&!this.options.customSignMessageFn&&(0,u.checkWebCryptoAPISupported)()}isPrivateWsKey(e){return this.getPrivateWSKeys().includes(e)}getNewRequestId(){return`${++this.wsApiRequestId}`}getTimeOffsetMs(){return this.timeOffsetMs}setTimeOffsetMs(e){this.timeOffsetMs=e}getWsKeyPendingSubscriptionStore(e){return this.pendingTopicSubscriptionRequests[e]||(this.pendingTopicSubscriptionRequests[e]={}),this.pendingTopicSubscriptionRequests[e]}upsertPendingTopicSubscribeRequests(e,t){let r=t.requestKey;if(this.getWsKeyPendingSubscriptionStore(e)[r])throw Error("Implementation error: attempted to upsert pending topics with duplicate request ID!");return new Promise((n,i)=>{this.getWsKeyPendingSubscriptionStore(e)[r]={requestData:t.requestEvent,resolver:n,rejector:i}})}removeTopicPendingSubscription(e,t){let r=this.getWsKeyPendingSubscriptionStore(e);delete r[t]}clearTopicsPendingSubscriptions(e,t,r){if(t){let n=this.getWsKeyPendingSubscriptionStore(e);for(let i in n){let o=n[i];this.logger.trace(`clearTopicsPendingSubscriptions(${e}, ${t}, ${r}, ${i}): rejecting promise for: ${JSON.stringify((null==o?void 0:o.requestData)||{})}`),null==o||o.rejector(o.requestData,r)}}this.pendingTopicSubscriptionRequests[e]={}}updatePendingTopicSubscriptionStatus(e,t,r,n){let i=this.getWsKeyPendingSubscriptionStore(e);if(!i)return;let o=i[t];if(o){if(n)o.resolver(o.requestData);else{this.logger.trace(`updatePendingTopicSubscriptionStatus.reject(${e}, ${t}, ${r}, ${n}): `,r);try{o.rejector(o.requestData,r)}catch(e){console.error("Exception rejecting promise: ",e)}}this.removeTopicPendingSubscription(e,t)}}subscribeTopicsForWsKey(e,t){return n(this,void 0,void 0,function*(){var r;let n=(0,c.getNormalisedTopicRequests)(e);for(let e of n)this.wsStore.addTopic(t,e);let i=this.wsStore.isConnectionState(t,c.WsConnectionStateEnum.CONNECTED),o=this.wsStore.isConnectionAttemptInProgress(t);if(!i&&!o)return this.connect(t);if(!i)return this.logger.trace("WS not connected - requests queued for retry once connected.",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,wsTopicRequests:e})),o;let s=this.isPrivateWsKey(t),a=null==(r=this.wsStore.get(t))?void 0:r.isAuthenticated;return(!s||!!a)&&this.requestSubscribeTopics(t,n)})}unsubscribeTopicsForWsKey(e,t){return n(this,void 0,void 0,function*(){var r;let n=(0,c.getNormalisedTopicRequests)(e);for(let e of n)this.wsStore.deleteTopic(t,e);if(!this.wsStore.isConnectionState(t,c.WsConnectionStateEnum.CONNECTED))return;let i=this.isPrivateWsKey(t),o=null==(r=this.wsStore.get(t))?void 0:r.isAuthenticated;if(!i||o)return this.requestUnsubscribeTopics(t,n)})}sortTopicRequestsIntoPublicPrivate(e,t){let r=[],n=[];for(let i of e)this.isPrivateTopicRequest(i,t)?n.push(i):r.push(i);return{publicReqs:r,privateReqs:n}}getWsStore(){return this.wsStore}close(e,t){this.logger.info("Closing connection",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e})),this.setWsState(e,c.WsConnectionStateEnum.CLOSING),this.clearTimers(e);let r=this.getWs(e);null==r||r.close(),t&&(0,c.safeTerminateWs)(r,!1)}closeAll(e){let t=this.wsStore.getKeys();this.logger.info(`Closing all ws connections: ${t}`),t.forEach(t=>{this.close(t,e)})}isConnected(e){return this.wsStore.isConnectionState(e,c.WsConnectionStateEnum.CONNECTED)}connect(e,t,r){return n(this,void 0,void 0,function*(){var n,i;try{if(this.wsStore.isWsOpen(e))return this.logger.error("Refused to connect to ws with existing active connection",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e})),{wsKey:e};if(this.wsStore.isConnectionState(e,c.WsConnectionStateEnum.CONNECTING))return this.logger.error("Refused to connect to ws, connection attempt already active",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e})),null==(n=this.wsStore.getConnectionInProgressPromise(e))?void 0:n.promise;(!this.wsStore.getConnectionState(e)||this.wsStore.isConnectionState(e,c.WsConnectionStateEnum.INITIAL))&&this.setWsState(e,c.WsConnectionStateEnum.CONNECTING),this.wsStore.getConnectionInProgressPromise(e)||this.wsStore.createConnectionInProgressPromise(e,!1);let r=t||(yield this.getWsUrl(e)),o=this.connectToWsUrl(r,e);return this.wsStore.setWs(e,o),null==(i=this.wsStore.getConnectionInProgressPromise(e))?void 0:i.promise}catch(t){if(this.parseWsError("Connection failed",t,e),this.reconnectWithDelay(e,this.options.reconnectTimeout),r)throw t}})}connectToWsUrl(e,t){var r;this.logger.trace(`Opening WS connection to URL: ${e}`,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t}));let n=null==(r=this.options.requestOptions)?void 0:r.agent,i=new s.default(e,void 0,n?{agent:n}:void 0);return i.onopen=e=>this.onWsOpen(e,t),i.onmessage=e=>this.onWsMessage(e,t,i),i.onerror=e=>
13this.parseWsError("Websocket onWsError",e,t),i.onclose=e=>this.onWsClose(e,t),i.wsKey=t,i}parseWsError(e,t,r){if(!t.message){this.logger.error(`${e} due to unexpected error: `,t),this.emit("response",Object.assign(Object.assign({},t),{wsKey:r})),this.emit("exception",Object.assign(Object.assign({},t),{wsKey:r}));return}"Unexpected server response: 401"===t.message?this.logger.error(`${e} due to 401 authorization failure.`,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:r})):this.wsStore.getConnectionState(r)!==c.WsConnectionStateEnum.CLOSING?(this.logger.error(`${e} due to unexpected response error: "${(null==t?void 0:t.msg)||(null==t?void 0:t.message)||t}"`,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:r,error:t})),this.executeReconnectableClose(r,"unhandled onWsError")):this.logger.info(`${r} socket forcefully closed. Will not reconnect.`),this.logger.error(`parseWsError(${e}, ${t}, ${r}) `,t),this.emit("response",Object.assign(Object.assign({},t),{wsKey:r})),this.emit("exception",Object.assign(Object.assign({},t),{wsKey:r}))}sendAuthRequest(e){return n(this,void 0,void 0,function*(){var t;try{this.logger.trace("Sending auth request...",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e})),yield this.assertIsConnected(e),this.wsStore.getAuthenticationInProgressPromise(e)||this.wsStore.createAuthenticationInProgressPromise(e,!1);let r=yield this.getWsAuthRequestEvent(e);return this.tryWsSend(e,JSON.stringify(r)),null==(t=this.wsStore.getAuthenticationInProgressPromise(e))?void 0:t.promise}catch(t){this.logger.trace(t,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e}))}})}reconnectWithDelay(e,t){var r;this.clearTimers(e),this.wsStore.isConnectionAttemptInProgress(e)||this.setWsState(e,c.WsConnectionStateEnum.RECONNECTING),this.logger.info("Reconnecting to websocket with delay...",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e,connectionDelayMs:t})),(null==(r=this.wsStore.get(e))?void 0:r.activeReconnectTimer)&&this.clearReconnectTimer(e),this.wsStore.get(e,!0).activeReconnectTimer=setTimeout(()=>{this.logger.info("Reconnecting to websocket now",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e})),this.clearReconnectTimer(e),this.connect(e)},t)}ping(e){if(this.wsStore.get(e,!0).activePongTimer)return;this.clearPongTimer(e),this.logger.trace("Sending ping",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e}));let t=this.wsStore.get(e,!0).ws;t?(this.sendPingEvent(e,t),this.wsStore.get(e,!0).activePongTimer=setTimeout(()=>this.executeReconnectableClose(e,"Pong timeout"),this.options.pongTimeout)):this.logger.error(`Unable to send ping for wsKey "${e}" - no connection found`)}executeReconnectableClose(e,t){this.logger.info(`${t} - closing socket to reconnect`,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e,reason:t}));let r=this.wsStore.isWsOpen(e);this.clearPingTimer(e),this.clearPongTimer(e);let n=this.getWs(e);n&&(n.close(),(0,c.safeTerminateWs)(n,!1)),r||(this.logger.info(`${t} - socket already closed - trigger immediate reconnect`,Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:e,reason:t})),this.reconnectWithDelay(e,this.options.reconnectTimeout))}clearTimers(e){this.clearPingTimer(e),this.clearPongTimer(e),this.clearReconnectTimer(e)}clearPingTimer(e){let t=this.wsStore.get(e);(null==t?void 0:t.activePingTimer)&&(clearInterval(t.activePingTimer),t.activePingTimer=void 0)}clearPongTimer(e){let t=this.wsStore.get(e);(null==t?void 0:t.activePongTimer)&&(clearTimeout(t.activePongTimer),t.activePongTimer=void 0)}clearReconnectTimer(e){let t=this.wsStore.get(e);(null==t?void 0:t.activeReconnectTimer)&&(clearTimeout(t.activeReconnectTimer),t.activeReconnectTimer=void 0)}getWsOperationEventsForTopics(e,t,r){return n(this,void 0,void 0,function*(){if(!e.length)return[];let n=[],i=this.getMaxTopicsPerSubscribeEvent(t);if(i&&null!==i&&e.length>i){for(let o=0;o<e.length;o+=i){let s=e.slice(o,o+i),a=yield this.getWsRequestEvents("all",r,s,t);n.push(...a)}return n}return yield this.getWsRequestEvents("all",r,e,t)})}requestSubscribeTopics(e,t){return n(this,void 0,void 0,function*(){if(!t.length)return;let r=yield this.getWsOperationEventsForTopics(t,e,"subscribe");this.logger.trace(`Subscribing to ${t.length} "${e}" topics in ${r.length} batches.`);let n=[];for(let t of r){let r=t.requestEvent;this.options.promiseSubscribeRequests&&n.push(this.upsertPendingTopicSubscribeRequests(e,t)),this.logger.trace(`Sending batch via message: "${JSON.stringify(r)}"`),this.tryWsSend(e,JSON.stringify(r))}
13return this.logger.trace(`Finished subscribing to ${t.length} "${e}" topics in ${r.length} batches.`),Promise.all(n)})}requestUnsubscribeTopics(e,t){return n(this,void 0,void 0,function*(){if(!t.length)return;let r=yield this.getWsOperationEventsForTopics(t,e,"unsubscribe");this.logger.trace(`Unsubscribing to ${t.length} "${e}" topics in ${r.length} batches. Events: "${JSON.stringify(t)}"`);let n=[];for(let t of r){let r=t.requestEvent;this.options.promiseSubscribeRequests&&n.push(this.upsertPendingTopicSubscribeRequests(e,t)),this.logger.trace(`Sending batch via message: "${r}"`),this.tryWsSend(e,JSON.stringify(r))}return this.logger.trace(`Finished unsubscribing to ${t.length} "${e}" topics in ${r.length} batches.`),Promise.all(n)})}tryWsSend(e,t,r){try{if(this.logger.trace("Sending upstream ws message: ",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsMessage:t,wsKey:e})),!e)throw Error("Cannot send message due to no known websocket for this wsKey");let r=this.getWs(e);if(!r)throw Error(`${e} socket not connected yet, call "connectAll()" first then try again when the "open" event arrives`);r.send(t)}catch(n){if(this.logger.error("Failed to send WS message",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsMessage:t,wsKey:e,exception:n})),r)throw n}}onWsOpen(e,t){return n(this,void 0,void 0,function*(){let r=this.wsStore.isConnectionState(t,c.WsConnectionStateEnum.CONNECTING),n=this.wsStore.isConnectionState(t,c.WsConnectionStateEnum.RECONNECTING);r?(this.logger.info("Websocket connected",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,testnet:!0===this.options.testnet,market:this.options.market})),this.emit("open",{wsKey:t,event:e})):n&&(this.logger.info("Websocket reconnected",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,testnet:!0===this.options.testnet,market:this.options.market})),this.emit("reconnected",{wsKey:t,event:e})),this.setWsState(t,c.WsConnectionStateEnum.CONNECTED),this.logger.trace("Enabled ping timer",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t})),this.wsStore.get(t,!0).activePingTimer=setInterval(()=>this.ping(t),this.options.pingInterval);try{let e=this.wsStore.getConnectionInProgressPromise(t);(null==e?void 0:e.resolve)&&e.resolve({wsKey:t})}catch(e){this.logger.error('Exception trying to resolve "connectionInProgress" promise',e)}this.wsStore.removeConnectingInProgressPromise(t);let{privateReqs:i,publicReqs:o}=this.sortTopicRequestsIntoPublicPrivate([...this.wsStore.getTopics(t)],t);try{yield this.requestSubscribeTopics(t,o)}catch(e){this.logger.error(`onWsOpen(): exception in public requestSubscribeTopics(${t}): `,o,e)}if(!this.options.authPrivateConnectionsOnConnect)try{this.requestSubscribeTopics(t,i)}catch(e){this.logger.error(`onWsOpen(): exception in private requestSubscribeTopics(${t}: `,i,e)}this.isAuthOnConnectWsKey(t)&&this.options.authPrivateConnectionsOnConnect&&(yield this.sendAuthRequest(t))})}onWsAuthenticated(e,t){this.wsStore.get(e,!0).isAuthenticated=!0;try{let r=this.wsStore.getAuthenticationInProgressPromise(e);(null==r?void 0:r.resolve)&&r.resolve({wsKey:e,event:t})}catch(e){this.logger.error('Exception trying to resolve "connectionInProgress" promise',e)}if(this.wsStore.removeAuthenticationInProgressPromise(e),this.options.authPrivateConnectionsOnConnect){let t=[...this.wsStore.getTopics(e)].filter(t=>this.isPrivateTopicRequest(t,e));t.length&&this.subscribeTopicsForWsKey(t,e)}}onWsMessage(e,t,r){try{if(this.clearPongTimer(t),this.isWsPong(e))return void this.logger.trace("Received pong",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,event:null==e?void 0:e.data}));if(this.isWsPing(e)){this.logger.trace("Received ping",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,event:e})),this.sendPongEvent(t,r);return}if((0,a.isMessageEvent)(e)){let r=e.data,n=e.type,i=this.resolveEmittableEvents(t,e);if(!i.length)return this.logger.error("Unhandled/unrecognised ws event message - returned no emittable data",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{message:r||"no message",dataType:n,event:e,wsKey:t}
13)),this.emit("update",Object.assign(Object.assign({},e),{wsKey:t}));for(let e of i){if(this.isWsPong(e)){this.logger.trace("Received pong2",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,data:r}));continue}let n=Object.assign(Object.assign({},e.event),{wsKey:t,isWSAPIResponse:e.isWSAPIResponse});if("authenticated"===e.eventType){this.logger.trace("Successfully authenticated",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t,emittable:e})),this.emit(e.eventType,n),this.onWsAuthenticated(t,e.event);continue}try{this.emit(e.eventType,n)}catch(t){this.logger.error(`Exception in onWsMessage().emit(${e.eventType}) handler:`,t)}}return}this.logger.error("Unhandled/unrecognised ws event message - unexpected message format",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{message:e||"no message",event:e,wsKey:t}))}catch(r){this.logger.error("Failed to parse ws event message",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{error:r,event:e,wsKey:t}))}}onWsClose(e,t){this.logger.info("Websocket connection closed",Object.assign(Object.assign({},c.WS_LOGGER_CATEGORY),{wsKey:t})),this.wsStore.get(t,!0).isAuthenticated=!1,this.wsStore.getConnectionState(t)!==c.WsConnectionStateEnum.CLOSING?(this.logger.trace(`onWsClose(${t}): rejecting all deferred promises...`),this.getWsStore().rejectAllDeferredPromises(t,"connection lost, reconnecting"),this.clearTopicsPendingSubscriptions(t,!0,"WS Closed"),this.setWsState(t,c.WsConnectionStateEnum.INITIAL),this.reconnectWithDelay(t,this.options.reconnectTimeout),this.emit("reconnect",{wsKey:t,event:e})):(this.logger.trace(`onWsClose(${t}): rejecting all deferred promises...`),this.getWsStore().rejectAllDeferredPromises(t,"disconnected"),this.setWsState(t,c.WsConnectionStateEnum.INITIAL),this.wsStore.delete(t),this.emit("close",{wsKey:t,event:e}))}getWs(e){return this.wsStore.getWs(e)}setWsState(e,t){this.wsStore.setConnectionState(e,t)}assertIsConnected(e){return n(this,void 0,void 0,function*(){if(!this.getWsStore().isConnectionState(e,c.WsConnectionStateEnum.CONNECTED)){let t=this.getWsStore().getConnectionInProgressPromise(e);if(t)return this.logger.trace("assertIsConnected(): awaiting..."),yield t.promise,this.logger.trace("assertIsConnected(): connected!"),t.promise;this.logger.trace("assertIsConnected(): connecting..."),yield this.connect(e),this.logger.trace("assertIsConnected(): newly connected!")}})}assertIsAuthenticated(e){return n(this,void 0,void 0,function*(){var t;this.getWsStore().isConnectionState(e,c.WsConnectionStateEnum.CONNECTED)||(this.logger.trace("assertIsAuthenticated(): connecting..."),yield this.assertIsConnected(e));let r=this.getWsStore().getAuthenticationInProgressPromise(e);if(r){this.logger.trace("assertIsAuthenticated(): awaiting..."),yield r.promise,this.logger.trace("assertIsAuthenticated(): authenticated!");return}(null==(t=this.wsStore.get(e))?void 0:t.isAuthenticated)?this.logger.trace("assertIsAuthenticated(): ok"):(this.logger.trace("assertIsAuthenticated(): authenticating..."),yield this.sendAuthRequest(e),this.logger.trace("assertIsAuthenticated(): newly authenticated!"))})}}r.BaseWebsocketClient=f},545836,(e,t,r)=>{"use strict";var n=e.e&&e.e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.WebsocketClient=void 0;let i=e.r(552718),o=e.r(496779),s=e.r(216538);class a extends o.BaseWebsocketClient{connectAll(){if("v5"===this.options.market)return[...this.connectPublic(),this.connectPrivate()];throw(0,i.neverGuard)(this.options.market,"connectAll(): Unhandled market")}connectWSAPI(){return this.assertIsAuthenticated(i.WS_KEY_MAP.v5PrivateTrade)}connectPublic(){return this.options.market,[this.connect(i.WS_KEY_MAP.v5SpotPublic),this.connect(i.WS_KEY_MAP.v5LinearPublic),this.connect(i.WS_KEY_MAP.v5InversePublic),this.connect(i.WS_KEY_MAP.v5OptionPublic)]}connectPrivate(){return this.options.market,this.connect(i.WS_KEY_MAP.v5Private)}subscribeV5(e,t,r){let n=Array.isArray(e)?e:[e],o={};for(let e of n){let n=(0,i.getWsKeyForTopic)(this.options.market,e,r,t),s={topic:e,category:t};o[n]&&Array.isArray(o[n])||(o[n]=[]),o[n].push(s)}let s=[];
13for(let e in o){let t=o[e];if(null==t?void 0:t.length){let r=this.subscribeTopicsForWsKey(t,e);Array.isArray(r)?s.push(...r):s.push(r)}}return s}unsubscribeV5(e,t,r){let n=Array.isArray(e)?e:[e],o={};for(let e of n){let n=(0,i.getWsKeyForTopic)(this.options.market,e,r,t),s={topic:e,category:t};o[n]&&Array.isArray(o[n])||(o[n]=[]),o[n].push(s)}let s=[];for(let e in o){let t=o[e];if(null==t?void 0:t.length){let r=this.unsubscribeTopicsForWsKey(t,e);Array.isArray(r)?s.push(...r):s.push(r)}}return s}subscribe(e,t){let r=Array.isArray(e)?e:[e],n=(0,i.getNormalisedTopicRequests)(r),o=(0,i.getTopicsPerWSKey)(this.options.market,n,t);for(let e in o){let t=o[e];(null==t?void 0:t.length)&&this.subscribeTopicsForWsKey(t,e)}}unsubscribe(e,t){let r=Array.isArray(e)?e:[e],n=(0,i.getNormalisedTopicRequests)(r),o=(0,i.getTopicsPerWSKey)(this.options.market,n,t);for(let e in o){let t=o[e];(null==t?void 0:t.length)&&this.unsubscribeTopicsForWsKey(t,e)}}sendWSAPIRequest(){return n(this,arguments,void 0,function*(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.WS_KEY_MAP.v5PrivateTrade,r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;this.logger.trace(`sendWSAPIRequest(): assert "${t}" is connected`),yield this.assertIsConnected(t),this.logger.trace("sendWSAPIRequest()->assertIsConnected() ok"),yield this.assertIsAuthenticated(t),this.logger.trace("sendWSAPIRequest()->assertIsAuthenticated() ok");let o=Date.now()+(this.getTimeOffsetMs()||0),s={reqId:this.getNewRequestId(),header:{"X-BAPI-RECV-WINDOW":`${this.options.recvWindow}`,"X-BAPI-TIMESTAMP":`${o}`,Referer:i.APIID},op:r,args:[n]},a=yield this.signWSAPIRequest(s),l=(0,i.getPromiseRefForWSAPIRequest)(s),u=this.getWsStore().createDeferredPromise(t,l,!1);return null==(e=u.promise)||e.then(e=>(Array.isArray(e)||(e.request=Object.assign({wsKey:t},a)),e)).catch(e=>("string"==typeof e?this.logger.error("Unexpected string thrown without Error object:",{e,wsKey:t,signedEvent:a}):e.request={wsKey:t,operation:r,params:n},e)),this.logger.trace(`sendWSAPIRequest(): sending raw request: ${JSON.stringify(a,null,2)}`),this.tryWsSend(t,JSON.stringify(a),!1),this.logger.trace(`sendWSAPIRequest(): sent "${r}" event with promiseRef(${l})`),u.promise})}getWsUrl(e){return n(this,void 0,void 0,function*(){let t=(0,i.getWsUrl)(e,this.options,this.logger),r=yield this.getWsAuthURLSuffix();return r?t+"?"+r:t})}getWsAuthURLSuffix(){return n(this,void 0,void 0,function*(){return""})}signMessage(e,t,r){return n(this,arguments,void 0,function*(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"SHA-256";return"function"==typeof this.options.customSignMessageFn?this.options.customSignMessageFn(e,t):yield(0,s.signMessage)(e,t,r,n)})}getWsAuthRequestEvent(e){return n(this,void 0,void 0,function*(){try{let{signature:t,expiresAt:r}=yield this.getWsAuthSignature(e);return{op:"auth",args:[this.options.key,r,t],req_id:`${e}-auth`}}catch(t){throw this.logger.error(t,Object.assign(Object.assign({},i.WS_LOGGER_CATEGORY),{wsKey:e})),t}})}getWsAuthSignature(e){return n(this,void 0,void 0,function*(){let{key:t,secret:r}=this.options;if(!t||!r)throw this.logger.error("Cannot authenticate websocket, either api or private keys missing.",Object.assign(Object.assign({},i.WS_LOGGER_CATEGORY),{wsKey:e})),Error("Cannot auth - missing api or secret in config");this.logger.trace("Getting auth'd request params",Object.assign(Object.assign({},i.WS_LOGGER_CATEGORY),{wsKey:e}));let n=this.options.recvWindow||5e3,o=Date.now()+this.getTimeOffsetMs()+n,s=yield this.signMessage("GET/realtime"+o,r,void 0,"SHA-256");return{expiresAt:o,signature:s}})}signWSAPIRequest(e){return n(this,void 0,void 0,function*(){return e})}sendPingEvent(e){this.tryWsSend(e,JSON.stringify({op:"ping"}))}sendPongEvent(e){this.tryWsSend(e,JSON.stringify({op:"pong"}))}getMaxTopicsPerSubscribeEvent(e){return(0,i.getMaxTopicsPerSubscribeEvent)(this.options.market,e)}getWsRequestEvents(e,t,r,o){return n(this,void 0,void 0,function*(){let n=[],o=[];if("all"===e){let e=r.map(e=>e.topic),i={req_id:["subscribe","unsubscribe"].includes(t)&&e.length?e.join(","):this.getNewRequestId(),op:t,args:e},o={requestKey:i.req_id,requestEvent:i};n.push(Object.assign({},o))}else throw(0,i.neverGuard)(e,`Unhandled market "${e}"`);
13if(o.length){let e=o.length===r.length?"all":"some";this.logger.error(`Failed to build/send ${o.length} event(s) for ${e} WS requests due to exceptions`,Object.assign(Object.assign({},i.WS_LOGGER_CATEGORY),{wsRequestBuildingErrors:o,wsRequestBuildingErrorsStringified:JSON.stringify(o,null,2)}))}return n})}getPrivateWSKeys(){return i.WS_AUTH_ON_CONNECT_KEYS}isAuthOnConnectWsKey(e){return i.WS_AUTH_ON_CONNECT_KEYS.includes(e)}isPrivateTopicRequest(e){var t;let r=null==(t=null==e?void 0:e.topic)?void 0:t.toLowerCase();return!!r&&(0,i.isPrivateWsTopic)(r)}isWsPing(e){return!!e&&(!!("string"==typeof(null==e?void 0:e.data)&&e.data.includes('op": "ping'))||!1)}isWsPong(e){var t;return!!e&&("string"==typeof(null==e?void 0:e.data)?!!(e.data.includes('ret_msg":"pong')||e.data.includes('op":"pong')):(null==(t=e.event)?void 0:t.ret_msg)==="pong"||(null==e?void 0:e.pong)||(0,i.isWsPong)(e))}resolveEmittableEvents(e,t){let r=[];try{let n=JSON.parse(t.data);if((0,i.isTopicSubscriptionConfirmation)(n)&&n.req_id){let t=(0,i.isTopicSubscriptionSuccess)(n);this.updatePendingTopicSubscriptionStatus(e,n.req_id,n,t)}let o=null==n?void 0:n.topic,s=null==n?void 0:n.op;if((0,i.isWSAPIResponse)(n)){let t=n.retCode,i=n.reqId,o=[n.op,i].join("_");if(i||this.logger.error("WS API response is missing reqId - promisified workflow could get stuck. If this happens, please get in touch with steps to reproduce. Trace:",{wsKey:e,promiseRef:o,parsedEvent:n}),0!==t){try{this.getWsStore().rejectDeferredPromise(e,o,Object.assign({wsKey:e},n),!0)}catch(t){this.logger.error("Exception trying to reject WSAPI promise",{wsKey:e,promiseRef:o,parsedEvent:n,error:t})}return r.push({eventType:"exception",event:n,isWSAPIResponse:!0}),r}try{this.getWsStore().resolveDeferredPromise(e,o,Object.assign({wsKey:e},n),!0)}catch(t){this.logger.error("Exception trying to resolve WSAPI promise",{wsKey:e,promiseRef:o,parsedEvent:n,error:t})}return r.push({eventType:"response",event:n,isWSAPIResponse:!0}),r}if("string"==typeof o)return r.push({eventType:"update",event:n}),r;if("string"==typeof s){if(!1===n.success)return r.push({eventType:"exception",event:n}),r;if(["subscribe","unsubscribe","COMMAND_RESP","ping","pong"].includes(s))return r.push({eventType:"response",event:n}),r;if(["auth"].includes(s))return r.push({eventType:"authenticated",event:n}),r;this.logger.error(`!! Unhandled string operation type "${s}". Defaulting to "update" channel...`,n)}else this.logger.error(`!! Unhandled non-string event type "${s}". Defaulting to "update" channel...`,n);r.push({eventType:"update",event:n})}catch(e){r.push({event:{message:"Failed to parse event data due to exception",exception:e,eventData:t.data},eventType:"exception"}),this.logger.error("Failed to parse event data due to exception: ",{exception:e,eventData:t.data})}return r}}r.WebsocketClient=a},341825,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WebsocketAPIClient=void 0;let n=e.r(955680),i=e.r(545836);r.WebsocketAPIClient=class{constructor(e,t){this.wsClient=new i.WebsocketClient(e,t),this.options=Object.assign({attachEventListeners:!0},e),this.logger=this.wsClient.logger,this.setupDefaultEventListeners()}getWSClient(){return this.wsClient}setTimeOffsetMs(e){return this.getWSClient().setTimeOffsetMs(e)}submitNewOrder(e){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.create",e)}amendOrder(e){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.amend",e)}cancelOrder(e){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.cancel",e)}batchSubmitOrders(e,t){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.create-batch",{category:e,request:t})}batchAmendOrder(e,t){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.amend-batch",{category:e,request:t})}batchCancelOrder(e,t){return this.wsClient.sendWSAPIRequest(n.WS_KEY_MAP.v5PrivateTrade,"order.cancel-batch",{category:e,request:t})}setupDefaultEventListeners(){this.options.attachEventListeners&&this.wsClient.on("open",e=>{console.log(new Date,"ws connected",e.wsKey)}).on("reconnect",e=>{let{wsKey:t}=e;console.log(new Date,"ws automatically reconnecting.... ",t)}).on("reconnected",e=>{console.log(new Date,"ws has reconnected ",null==e?void 0:e.wsKey)}).on("authenticated",e=>{console.info(new Date,"ws has authenticated ",null==e?void 0:e.wsKey)}).on("exception",e=>{console.error(new Date,"ws exception: ",JSON.stringify(e))})}}},476478,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);
13(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(87855),r),i(e.r(369297),r),i(e.r(422750),r),i(e.r(584257),r),i(e.r(552718),r),i(e.r(801484),r),i(e.r(341825),r),i(e.r(545836),r)},254986,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.OrderBook=void 0;let n=Object.freeze({symbol:0,price:1,side:2,qty:3,extraState:4});r.OrderBook=class{constructor(e,t={}){this.symbol=e,this.book=[],this.shouldCheckTimestamps=!0===t.checkTimestamps,this.lastUpdateTimestamp=new Date().getTime(),this.maxDepth=t.maxDepth||250}getBookState(){return structuredClone(this.book)}handleSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();return this.checkTimestamp(t),this.book=e,this.trimToMaxDepth().sort().trackDidUpdate(t)}handleDelta(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Date.now();return this.checkTimestamp(n),e.forEach(e=>{let t=this.findIndexForSlice(e);-1!==t&&this.book.splice(t,1)}),t.forEach(e=>{let t=this.findIndexForSlice(e);-1!==t?this.replaceLevelAtIndex(t,e):this.insertLevel(e)}),r.forEach(e=>{let t=this.findIndexForSlice(e);-1!==t&&this.replaceLevelAtIndex(t,e),this.insertLevel(e)}),this.trimToMaxDepth().sort().trackDidUpdate(n)}replaceLevelAtIndex(e,t){return this.book.splice(e,1,t),this}insertLevel(e){return this.book.push(e),this}findIndexForSlice(e){return this.book.findIndex(t=>t[n.price]===e[n.price])}checkTimestamp(e){if(!this.shouldCheckTimestamps)return!1;if(this.lastUpdateTimestamp>e)throw Error(`Received data older than last tick: ${{lastUpdate:this.lastUpdateTimestamp,currentUpdate:e}}`)}sort(){return this.book.sort((e,t)=>t[n.price]-e[n.price]),this}trimToMaxDepth(){let e=this.book,t=this.maxDepth;if(e.length<=t)return this;let r=e.reduce((e,t)=>("Sell"===t[n.side]?e.sells++:e.buys++,e),{buys:0,sells:0}),i=+(t/2).toFixed(0),o=r.buys-i,s=r.sells-i;return this.sort().trimSideCount(o,!1).trimSideCount(s,!0),this}trimSideCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;if(e<=0)return this;let r=this.book;return t?r.splice(0,e):r.splice(r.length-e-1,e),this}trackDidUpdate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date().getTime();return this.lastUpdateTimestamp=e,this}print(){var e;return console.log(`---------- ${this.symbol} ask:bid ${this.getBestAsk()}:${this.getBestBid()} & spread: ${null==(e=this.getSpreadBasisPoints())?void 0:e.toFixed(5)} bp`),console.table(this.book.map(e=>({symbol:e[n.symbol],price:e[n.price],side:e[n.side],qty:e[n.qty]}))),this}reset(){return this.book=[],this}getBestAsk(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.book.filter(e=>"Sell"===e[n.side]),r=t.length-1-e,i=t[Math.abs(r)];return i?i[n.price]:null}getBestBid(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.book.filter(e=>"Buy"===e[n.side])[Math.abs(e)];return t?t[n.price]:null}getSpreadPercent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.getBestAsk(e),r=this.getBestBid(e);return r&&t?(1-r/t)*100:null}getSpreadBasisPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.getBestAsk(e),r=this.getBestBid(e);return r&&t?(1-r/t)*1e4:null}getEstimatedSlippage(e,t){if(e<=0)throw Error("Order size is not positive!");let r=this.book.filter(e=>e[n.side]===("Buy"===t?"Sell":"Buy"));if(0===r.length)throw Error("No relevant levels found in orderbook!");let i=[...r].sort((e,r)=>"Buy"===t?e[n.price]-r[n.price]:r[n.price]-e[n.price]),o=e,s=0;for(let e of i){let t=e[n.price],r=Math.min(o,e[n.qty]);if(s+=r*t,(o-=r)<=0)break}if(o>0)throw Error("Could not fill the entire order");let a=s/e,l="Buy"===t?this.getBestAsk():this.getBestBid();if(!l)return null;let u="Buy"===t?(a/l-1)*100:(l/a-1)*100;return{executionPrice:a,slippagePercent:u,slippageBasisPoints:100*u}}}},744754,(e,t,r)=>{"use strict";
13Object.defineProperty(r,"__esModule",{value:!0}),r.OrderBookLevel=function(e,t,r,n){for(var i=arguments.length,o=Array(i>4?i-4:0),s=4;s<i;s++)o[s-4]=arguments[s];let a=[e,t,r,n,void 0];return o.length&&a.push(o),a}},980669,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.OrderBooksStore=void 0;let n=e.r(254986);r.OrderBooksStore=class{constructor(e){this.books={},this.books={},this.traceLog=(null==e?void 0:e.traceLog)===!0,this.shouldCheckTimestamp=(null==e?void 0:e.checkTimestamps)===!0,this.maxDepth=(null==e?void 0:e.maxDepth)||250}getBook(e){return this.books[e]||(this.books[e]=new n.OrderBook(e,{checkTimestamps:this.shouldCheckTimestamp,maxDepth:this.maxDepth})),this.books[e]}handleSnapshot(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();return this.traceLog&&console.log("handleSnapshot ",e,r),this.getBook(e).handleSnapshot(t,r)}handleDelta(e,t,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Date.now();return this.traceLog&&console.log("handleDelta ",e,i),this.getBook(e).handleDelta(t,r,n,i)}getEstimatedSlippage(e,t,r){return this.getBook(e).getEstimatedSlippage(t,r)}}},562025,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(r,"__esModule",{value:!0}),i(e.r(254986),r),i(e.r(744754),r),i(e.r(980669),r)},248664,(e,t,r)=>{var n=e.r(423748),i=e.r(819674);t.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},394370,(e,t,r)=>{var n=e.r(386716),i=e.r(791606),o=e.r(248664),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(o(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=l.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):a.test(e)?s:+e}},987325,(e,t,r)=>{var n=e.r(791606),i=e.r(702272),o=e.r(394370),s=Math.max,a=Math.min;t.exports=function(e,t,r){var l,u,c,d,f,h,p=0,g=!1,y=!1,b=!0;if("function"!=typeof e)throw TypeError("Expected a function");function v(t){var r=l,n=u;return l=u=void 0,p=t,d=e.apply(n,r)}function m(e){var r=e-h,n=e-p;return void 0===h||r>=t||r<0||y&&n>=c}function _(){var e,r,n,o=i();if(m(o))return S(o);f=setTimeout(_,(e=o-h,r=o-p,n=t-e,y?a(n,c-r):n))}function S(e){return(f=void 0,b&&l)?v(e):(l=u=void 0,d)}function O(){var e,r=i(),n=m(r);if(l=arguments,u=this,h=r,n){if(void 0===f)return p=e=h,f=setTimeout(_,t),g?v(e):d;if(y)return clearTimeout(f),f=setTimeout(_,t),v(h)}return void 0===f&&(f=setTimeout(_,t)),d}return t=o(t)||0,n(r)&&(g=!!r.leading,c=(y="maxWait"in r)?s(o(r.maxWait)||0,t):c,b="trailing"in r?!!r.trailing:b),O.cancel=function(){void 0!==f&&clearTimeout(f),p=0,l=h=u=f=void 0},O.flush=function(){return void 0===f?d:S(i())},O}},360174,(e,t,r)=>{var n=e.r(987325),i=e.r(791606);t.exports=function(e,t,r){var o=!0,s=!0;if("function"!=typeof e)throw TypeError("Expected a function");return i(r)&&(o="leading"in r?!!r.leading:o,s="trailing"in r?!!r.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}},702272,(e,t,r)=>{var n=e.r(818408);t.exports=function(){return n.Date.now()}},893912,(e,t,r)=>{var n=/\s/;t.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},386716,(e,t,r)=>{var n=e.r(893912),i=/^\s+/;t.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},535142,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={cancelIdleCallback:function(){return s},requestIdleCallback:function(){return o}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let o="u">typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},s="u">typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esMo
13dule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},625966,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={ESCAPE_REGEX:function(){return s},htmlEscapeAttributeString:function(){return c},htmlEscapeJsonString:function(){return u}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let o={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},s=/[&><\u2028\u2029]/g,a={"&":"&",'"':""","'":"'","<":"<",">":">"},l=/[&"'<>]/g;function u(e){return e.replace(s,e=>o[e])}function c(e){return e.replace(l,e=>a[e])}},646643,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return _},handleClientScriptLoad:function(){return b},initScriptLoader:function(){return v}};for(var i in n)Object.defineProperty(r,i,{enumerable:!0,get:n[i]});let o=e.r(836437),s=e.r(56421),a=e.r(77781),l=o._(e.r(147587)),u=s._(e.r(598607)),c=e.r(893165),d=e.r(381874),f=e.r(535142),h=e.r(625966),p=new Map,g=new Set,y=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:i=null,dangerouslySetInnerHTML:o,children:s="",strategy:a="afterInteractive",onError:u,stylesheets:c}=e,f=r||t;if(f&&g.has(f))return;if(p.has(t)){g.add(f),p.get(t).then(n,u);return}let h=()=>{i&&i(),g.add(f)},y=document.createElement("script"),b=new Promise((e,t)=>{y.addEventListener("load",function(t){e(),n&&n.call(this,t),h()}),y.addEventListener("error",function(e){t(e)})}).catch(function(e){u&&u(e)});o?(y.innerHTML=o.__html||"",h()):s?(y.textContent="string"==typeof s?s:Array.isArray(s)?s.join(""):"",h()):t&&(y.src=t,p.set(t,b)),(0,d.setAttributesFromProps)(y,e),"worker"===a&&y.setAttribute("type","text/partytown"),y.setAttribute("data-nscript",a),c&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});if("u">typeof window){let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(c),document.body.appendChild(y)};function b(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,f.requestIdleCallback)(()=>y(e))}):y(e)}function v(e){e.forEach(b),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");g.add(t)})}function m(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:i=null,strategy:o="afterInteractive",onError:s,stylesheets:d,...p}=e,{updateScripts:b,scripts:v,getIsSsr:m,appDir:_,nonce:S}=(0,u.useContext)(c.HeadManagerContext);S=p.nonce||S;let O=(0,u.useRef)(!1);(0,u.useEffect)(()=>{let e=t||r;O.current||(i&&e&&g.has(e)&&i(),O.current=!0)},[i,t,r]);let E=(0,u.useRef)(!1);if((0,u.useEffect)(()=>{if(!E.current){if("afterInteractive"===o)y(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,f.requestIdleCallback)(()=>y(e)):window.addEventListener("load",()=>{(0,f.requestIdleCallback)(()=>y(e))}));E.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(b?(v[o]=(v[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:i,onError:s,...p,nonce:S}]),b(v)):m&&m()?g.add(t||r):m&&!m()&&y({...e,nonce:S})),_){if(d&&d.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return p.dangerouslySetInnerHTML&&(p.children=p.dangerouslySetInnerHTML.__html,delete p.dangerouslySetInnerHTML),(0,a.jsx)("script",{nonce:S,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,h.htmlEscapeJsonString)(JSON.stringify([0,{...p,id:t}]))})`}});else return l.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:S,crossOrigin:p.crossOrigin}:{as:"script",nonce:S,crossOrigin:p.crossOrigin}),(0,a.jsx)("script",{nonce:S,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${(0,h.htmlEscapeJsonString)(JSON.stringify([r,{...p,id:t}]))})`}});"afterInteractive"===o&&r&&l.default.preload(r,p.integrity?{as:"script",integrity:p.integrity,nonce:S,crossOrigin:p.crossOrigin}:{as:"script",nonce:S,crossOrigin:p.crossOrigin})}return null}Object.defineProperty(m,"__nextScript",{value:!0});let _=m;("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esMo
13dule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},586596,(e,t,r)=>{t.exports=e.r(646643)},422442,e=>{"use strict";var t,r,n=e.i(77781),i=e.i(598607);e.i(753957);var o=e.i(187115),s=e.i(573304),a={d:(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},l={};a.d(l,{Il:()=>T,f6:()=>r,ps:()=>k,Jr:()=>M,Vy:()=>E,lb:()=>v,mx:()=>b,Q_:()=>N,h:()=>w,K_:()=>O,_3:()=>x,EM:()=>A,eG:()=>_,dg:()=>m,f:()=>y,xE:()=>S});let u=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,c=e=>{if("string"!=typeof e)throw TypeError("Invalid argument expected string");let t=e.match(u);if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},d=e=>"*"===e||"x"===e||"X"===e,f=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},h=(e,t)=>{let r,n;if(d(e)||d(t))return 0;let[i,o]=typeof(r=f(e))!=typeof(n=f(t))?[String(r),String(n)]:[r,n];return i>o?1:i<o?-1:0},p=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){let n=h(e[r]||"0",t[r]||"0");if(0!==n)return n}return 0},g=(e,t)=>{let r=c(e),n=c(t),i=r.pop(),o=n.pop(),s=p(r,n);return 0!==s?s:i&&o?p(i.split("."),o.split(".")):i||o?i?-1:1:0};function y(e,t){return -1===t.indexOf(".")?e[t]:t.split(".").reduce((e,t)=>e?e[t]:void 0,e)}function b(e,t,r){let{attribute:n,operator:i,value:o,regexFlags:s}=e,a=y(t,n);if("equals"===i)return a===o;if("notEquals"===i)return a!==o;if("before"===i||"after"===i){let e=a instanceof Date?a:new Date(a),t=o instanceof Date?o:new Date(o);return"before"===i?e<t:e>t}if(Array.isArray(o)&&(-1!==["string","number"].indexOf(typeof a)||null===a)){if("in"===i)return -1!==o.indexOf(a);if("notIn"===i)return -1===o.indexOf(a)}else if("string"==typeof a&&"string"==typeof o){if("contains"===i)return -1!==a.indexOf(o);if("notContains"===i)return -1===a.indexOf(o);if("startsWith"===i)return a.startsWith(o);if("endsWith"===i)return a.endsWith(o);if("semverEquals"===i)return 0===g(a,o);if("semverNotEquals"===i)return 0!==g(a,o);if("semverGreaterThan"===i)return 1===g(a,o);if("semverGreaterThanOrEquals"===i)return g(a,o)>=0;if("semverLessThan"===i)return -1===g(a,o);if("semverLessThanOrEquals"===i)return 0>=g(a,o);if("matches"===i)return r(o,s||"").test(a);if("notMatches"===i)return!r(o,s||"").test(a)}else if("number"==typeof a&&"number"==typeof o){if("greaterThan"===i)return a>o;if("greaterThanOrEquals"===i)return a>=o;if("lessThan"===i)return a<o;if("lessThanOrEquals"===i)return a<=o}else{if("exists"===i)return void 0!==a;if("notExists"===i)return void 0===a;if(Array.isArray(a)&&"string"==typeof o){if("includes"===i)return a.indexOf(o)>-1;if("notIncludes"===i)return -1===a.indexOf(o)}}return!1}let v=1e5;function m(e){return Math.floor(function(e){let t,r,n,i,o,s,a;for("string"==typeof e&&(a=e,e=(new TextEncoder).encode(a)),t=3&e.length,r=e.length-t,n=1,s=0;s<r;)o=255&e[s]|(255&e[++s])<<8|(255&e[++s])<<16|(255&e[++s])<<24,++s,n^=o=(65535&(o=(o=(65535&o)*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0,n=27492+(65535&(i=5*(65535&(n=n<<13|n>>>19))+((5*(n>>>16)&65535)<<16)|0))+((58964+(i>>>16)&65535)<<16);switch(o=0,t){case 3:o^=(255&e[s+2])<<16;case 2:o^=(255&e[s+1])<<8;case 1:o^=255&e[s],n^=o=(65535&(o=(o=(65535&o)*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0}return n^=e.length,n^=n>>>16,n=0x85ebca6b*(65535&n)+((0x85ebca6b*(n>>>16)&65535)<<16)|0,n^=n>>>13,n=0xc2b2ae35*(65535&n)+((0xc2b2ae35*(n>>>16)&65535)<<16)|0,(n^=n>>>16)>>>0}(e)/0x100000000*v)}function _(e){let t,r,{featureKey:n,bucketBy:i,context:o,logger:s}=e;if("string"==typeof i)t="plain",r=[i];else if(Array.isArray(i))t="and",r=i;else{if("object"!=typeof i||!Array.isArray(i.or))throw s.error("invalid bucketBy",{featureKey:n,bucketBy:i}),Error("invalid bucketBy");t="or",r=i.or}let a=[];return r.forEach(e=>{let r=y(o,e);void 0!==r&&("plain"===t||"and"===t||0===a.length)&&a.push(r)}),a.push(n),a.join(".")}let S="[Featurevisor]",O=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="log";"info"===e?n="info":"warn"===e?n="warn":"error"===e&&(n="error"),console[n](S,t,r)};class E{constructor(e){this.level=e.level||E.defaultLevel,this.handle=e.handler||O}setLevel(e){this.level=e}log(e,t,r){E.allLevels.indexOf(this.level)>=E.allLevels.indexOf(e)&&this.handle(e,t,r)}debug(e,t){this.log("debug",e,t)}info(e,t){this.log("info",e,t)}warn(e,t){this.log("warn",e,t)}error(e,t){this.log("error",e,t)}}function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new E(e)}E.allLevels=["fatal","error","warn","info","debug"],E.defaultLevel="info";class P{constructor(e){this.hooks=[],this.logger=e.logger,e.hooks&&e.hooks.forEach(e
13=>{this.add(e)})}add(e){if(!this.hooks.some(t=>t.name===e.name))return this.hooks.push(e),()=>{this.remove(e.name)};this.logger.error(`Hook with name "${e.name}" already exists.`,{name:e.name,hook:e})}remove(e){this.hooks=this.hooks.filter(t=>t.name!==e)}getAll(){return this.hooks}}class R{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]);let r=this.listeners[e];r.push(t);let n=!0;return function(){if(!n)return;n=!1;let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}trigger(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.listeners[e];r&&r.forEach(function(e){try{e(t)}catch(e){console.error(e)}})}clearAll(){this.listeners={}}}class T{constructor(e){const{datafile:t,logger:r}=e;this.logger=r,this.schemaVersion=t.schemaVersion,this.revision=t.revision,this.segments=t.segments,this.features=t.features,this.regexCache={}}getRevision(){return this.revision}getSchemaVersion(){return this.schemaVersion}getSegment(e){let t=this.segments[e];if(t)return t.conditions=this.parseConditionsIfStringified(t.conditions),t}
13getFeatureKeys(){return Object.keys(this.features)}getFeature(e){return this.features[e]}getVariableKeys(e){let t=this.getFeature(e);return t?Object.keys(t.variablesSchema||{}):[]}hasVariations(e){let t=this.getFeature(e);return!!t&&Array.isArray(t.variations)&&t.variations.length>0}getRegex(e,t){let r=t||"",n=`${e}-${r}`;if(this.regexCache[n])return this.regexCache[n];let i=new RegExp(e,r);return this.regexCache[n]=i,i}allConditionsAreMatched(e,t){if("string"==typeof e)return"*"===e;let r=(e,t)=>this.getRegex(e,t);if("attribute"in e)try{return b(e,t,r)}catch(r){return this.logger.warn(r.message,{error:r,details:{condition:e,context:t}}),!1}return"and"in e&&Array.isArray(e.and)?e.and.every(e=>this.allConditionsAreMatched(e,t)):"or"in e&&Array.isArray(e.or)?e.or.some(e=>this.allConditionsAreMatched(e,t)):"not"in e&&Array.isArray(e.not)?e.not.every(()=>!1===this.allConditionsAreMatched({and:e.not},t)):!!Array.isArray(e)&&e.every(e=>this.allConditionsAreMatched(e,t))}segmentIsMatched(e,t){return this.allConditionsAreMatched(e.conditions,t)}allSegmentsAreMatched(e,t){if("*"===e)return!0;if("string"==typeof e){let r=this.getSegment(e);return!!r&&this.segmentIsMatched(r,t)}if("object"==typeof e){if("and"in e&&Array.isArray(e.and))return e.and.every(e=>this.allSegmentsAreMatched(e,t));if("or"in e&&Array.isArray(e.or))return e.or.some(e=>this.allSegmentsAreMatched(e,t));if("not"in e&&Array.isArray(e.not))return e.not.every(e=>!1===this.allSegmentsAreMatched(e,t))}return!!Array.isArray(e)&&e.every(e=>this.allSegmentsAreMatched(e,t))}getMatchedTraffic(e,t){return e.find(e=>!!this.allSegmentsAreMatched(this.parseSegmentsIfStringified(e.segments),t))}getMatchedAllocation(e,t){if(e.allocation)for(let r of e.allocation){let[e,n]=r.range;if(r.range&&e<=t&&n>=t)return r}}getMatchedForce(e,t){let r={force:void 0,forceIndex:void 0},n="string"==typeof e?this.getFeature(e):e;if(!n||!n.force)return r;for(let e=0;e<n.force.length;e++){let i=n.force[e];if(i.conditions&&this.allConditionsAreMatched(this.parseConditionsIfStringified(i.conditions),t)||i.segments&&this.allSegmentsAreMatched(this.parseSegmentsIfStringified(i.segments),t)){r.force=i,r.forceIndex=e;break}}return r}parseConditionsIfStringified(e){if("string"!=typeof e||"*"===e)return e;try{return JSON.parse(e)}catch(t){return this.logger.error("Error parsing conditions",{error:t,details:{conditions:e}}),e}}parseSegmentsIfStringified(e){return"string"==typeof e&&(e.startsWith("{")||e.startsWith("["))?JSON.parse(e):e}}function A(e){try{let{hooksManager:t}=e,r=t.getAll(),n=e;for(let e of t.getAll())e.before&&(n=e.before(n));let i=x(n);for(let e of(void 0!==n.defaultVariationValue&&"variation"===i.type&&void 0===i.variationValue&&(i.variationValue=n.defaultVariationValue),void 0!==n.defaultVariableValue&&"variable"===i.type&&void 0===i.variableValue&&(i.variableValue=n.defaultVariableValue),r))e.after&&(i=e.after(i,n));return i}catch(a){let{type:t,featureKey:n,variableKey:i,logger:o}=e,s={type:t,featureKey:n,variableKey:i,reason:r.ERROR,error:a};return o.error("error during evaluation",s),s}}function x(e){let t,{type:n,featureKey:i,variableKey:o,context:s,logger:a,datafileReader:l,sticky:u,hooksManager:c}=e,d=c.getAll();try{let c,f;if("flag"!==n&&(c=x(Object.assign(Object.assign({},e),{type:"flag"})),!1===c.enabled)){t={type:n,featureKey:i,reason:r.DISABLED};let e=l.getFeature(i);if("variable"===n&&e&&o&&e.variablesSchema&&e.variablesSchema[o]){let s=e.variablesSchema[o];void 0!==s.disabledValue?t={type:n,featureKey:i,reason:r.VARIABLE_DISABLED,variableKey:o,variableValue:s.disabledValue,variableSchema:s,enabled:!1}:s.useDefaultWhenDisabled&&(t={type:n,featureKey:i,reason:r.VARIABLE_DEFAULT,variableKey:o,variableValue:s.defaultValue,variableSchema:s,enabled:!1})}return"variation"===n&&e&&e.disabledVariationValue&&(t={type:n,featureKey:i,reason:r.VARIATION_DISABLED,variationValue:e.disabledVariationValue,enabled:!1}),a.debug("feature is disabled",t),t}if(u&&u[i]){if("flag"===n&&void 0!==u[i].enabled)return t={type:n,featureKey:i,reason:r.STICKY,sticky:u[i],enabled:u[i].enabled},a.debug("using sticky enabled",t),t;if("variation"===n){let e=u[i].variation;if(void 0!==e)return t={type:n,featureKey:i,reason:r.STICKY,variationValue:e},a.debug("using sticky variation",t),t}if(o){let e=u[i].variables;if(e){let s=e[o];if(void 0!==s)return t={type:n,featureKey:i,reason:r.STICKY,variableKey:o,variableValue:s},a.debug("using sticky variable",t),t}}}
13let h="string"==typeof i?l.getFeature(i):i;if(!h)return t={type:n,featureKey:i,reason:r.FEATURE_NOT_FOUND},a.warn("feature not found",t),t;if("flag"===n&&h.deprecated&&a.warn("feature is deprecated",{featureKey:i}),o){if(h.variablesSchema&&h.variablesSchema[o]&&(f=h.variablesSchema[o]),!f)return t={type:n,featureKey:i,reason:r.VARIABLE_NOT_FOUND,variableKey:o},a.warn("variable schema not found",t),t;f.deprecated&&a.warn("variable is deprecated",{featureKey:i,variableKey:o})}if("variation"===n&&(!h.variations||0===h.variations.length))return t={type:n,featureKey:i,reason:r.NO_VARIATIONS},a.warn("no variations",t),t;let{force:p,forceIndex:g}=l.getMatchedForce(h,s);if(p){if("flag"===n&&void 0!==p.enabled)return t={type:n,featureKey:i,reason:r.FORCED,forceIndex:g,force:p,enabled:p.enabled},a.debug("forced enabled found",t),t;if("variation"===n&&p.variation&&h.variations){let e=h.variations.find(e=>e.value===p.variation);if(e)return t={type:n,featureKey:i,reason:r.FORCED,forceIndex:g,force:p,variation:e},a.debug("forced variation found",t),t}if(o&&p.variables&&void 0!==p.variables[o])return t={type:n,featureKey:i,reason:r.FORCED,forceIndex:g,force:p,variableKey:o,variableSchema:f,variableValue:p.variables[o]},a.debug("forced variable",t),t}if("flag"===n&&h.required&&h.required.length>0){let o=h.required.every(t=>{let r,n;if("string"==typeof t?r=t:(r=t.key,n=t.variation),!x(Object.assign(Object.assign({},e),{type:"flag",featureKey:r})).enabled)return!1;if(void 0!==n){let t,i=x(Object.assign(Object.assign({},e),{type:"variation",featureKey:r}));return i.variationValue?t=i.variationValue:i.variation&&(t=i.variation.value),t===n}return!0});if(!o)return t={type:n,featureKey:i,reason:r.REQUIRED,required:h.required,enabled:o},a.debug("required features not enabled",t),t}let y=_({featureKey:i,bucketBy:h.bucketBy,context:s,logger:a});for(let e of d)e.bucketKey&&(y=e.bucketKey({featureKey:i,context:s,bucketBy:h.bucketBy,bucketKey:y}));let b,v,S=m(y);for(let e of d)e.bucketValue&&(S=e.bucketValue({featureKey:i,bucketKey:y,context:s,bucketValue:S}));if("flag"!==n?(b=l.getMatchedTraffic(h.traffic,s))&&(v=l.getMatchedAllocation(b,S)):b=l.getMatchedTraffic(h.traffic,s),b){if(0===b.percentage)return t={type:n,featureKey:i,reason:r.RULE,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,enabled:!1},a.debug("matched rule with 0 percentage",t),t;if("flag"===n){if(h.ranges&&h.ranges.length>0)return h.ranges.find(e=>S>=e[0]&&S<e[1])?(t={type:n,featureKey:i,reason:r.ALLOCATED,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,enabled:void 0===b.enabled||b.enabled},a.debug("matched",t)):(t={type:n,featureKey:i,reason:r.OUT_OF_RANGE,bucketKey:y,bucketValue:S,enabled:!1},a.debug("not matched",t)),t;if(void 0!==b.enabled)return t={type:n,featureKey:i,reason:r.RULE,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,enabled:b.enabled},a.debug("override from rule",t),t;if(S<=b.percentage)return t={type:n,featureKey:i,reason:r.RULE,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,enabled:!0},a.debug("matched traffic",t),t}if("variation"===n&&h.variations){if(b.variation){let e=h.variations.find(e=>e.value===b.variation);if(e)return t={type:n,featureKey:i,reason:r.RULE,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,variation:e},a.debug("override from rule",t),t}if(v&&v.variation){let e=h.variations.find(e=>e.value===v.variation);if(e)return t={type:n,featureKey:i,reason:r.ALLOCATED,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,variation:e},a.debug("allocated variation",t),t}}}if("variable"===n&&o){let e;if(b&&b.variables&&void 0!==b.variables[o])return t={type:n,featureKey:i,reason:r.RULE,bucketKey:y,bucketValue:S,ruleKey:b.key,traffic:b,variableKey:o,variableSchema:f,variableValue:b.variables[o]},a.debug("override from rule",t),t;if(p&&p.variation?e=p.variation:b&&b.variation?e=b.variation:v&&v.variation&&(e=v.variation),e&&Array.isArray(h.variations)){let u=h.variations.find(t=>t.value===e);if(u&&u.variableOverrides&&u.variableOverrides[o]){let e=u.variableOverrides[o].find(e=>e.conditions?l.allConditionsAreMatched("string"==typeof e.conditions&&"*"!==e.conditions?JSON.parse(e.conditions):e.conditions,s):!!e.segments&&l.allSegmentsAreMatched(l.parseSegmentsIfStringified(e.segments),s));if(e)return t={type:n,featureKey:i,reason:r.VARIABLE_OVERRIDE,bucketKey:y,bucketValue:S,ruleKey:null==b?void 0:b.key,traffic:b,variableKey:o,variableSchema:f,variableValue:e.value},a.debug("variable override",t),t}if(u&&u.variables&&void 0!==u.variables[o])return t={type:n,featureKey:i,reason:r.ALLOCATED,bucketKey:y,bucketValue:S,ruleKey:null==b?void 0:b.key,traffic:b,variableKey:o,variableSchema:f,variableValue:u.variables[o]},a.debug("allocated variable",t),t}}return"variation"===n?(t={type:n,featureKey:i,reason:r.NO_MATCH,bucketKey:y,bucketValue:S},a.debug("no matched variation",t)):"variable"===n?f?(t={type:n,featureKey:i,reason:r.VARIABLE_DEFAULT,bucketKey:y,bucketValue:S,variableKey:o,variableSchema:f,variableValue:f.defaultValue},a.debug("using default value",t)):(t={type:n,featureKey:i,reason:r.VARIABLE_NOT_FOUND,variableKey:o,bucketKey:y,bucketValue:S},a.debug("variable not found",t)):(t={type:n,featureKey:i,reason:r.NO_MATCH,bucketKey:y,bucketValue:S,enabled:!1},a.debug("nothing matched",t)),t}catch(e){return t={type:n,featureKey:i,variableKey:o,reason:r.ERROR,error:e},a.error("error",t),t}}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=[...Object.keys(e),...Object.keys(t)];return{features:n.filter((e,t)=>
13n.indexOf(e)===t),replaced:r}}(t=r||(r={})).FEATURE_NOT_FOUND="feature_not_found",t.DISABLED="disabled",t.REQUIRED="required",t.OUT_OF_RANGE="out_of_range",t.NO_VARIATIONS="no_variations",t.VARIATION_DISABLED="variation_disabled",t.VARIABLE_NOT_FOUND="variable_not_found",t.VARIABLE_DEFAULT="variable_default",t.VARIABLE_DISABLED="variable_disabled",t.VARIABLE_OVERRIDE="variable_override",t.NO_MATCH="no_match",t.FORCED="forced",t.STICKY="sticky",t.RULE="rule",t.ALLOCATED="allocated",t.ERROR="error";class k{constructor(e){this.parent=e.parent,this.context=e.context,this.sticky=e.sticky||{},this.emitter=new R}on(e,t){return"context_set"===e||"sticky_set"===e?this.emitter.on(e,t):this.parent.on(e,t)}close(){this.emitter.clearAll()}setContext(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.context=t?e:Object.assign(Object.assign({},this.context),e),this.emitter.trigger("context_set",{context:this.context,replaced:t})}getContext(e){return this.parent.getContext(Object.assign(Object.assign({},this.context),e))}setSticky(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.sticky||{};this.sticky=t?Object.assign({},e):Object.assign(Object.assign({},this.sticky),e);let n=C(r,this.sticky,t);this.emitter.trigger("sticky_set",n)}isEnabled(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.parent.isEnabled(e,Object.assign(Object.assign({},this.context),t),Object.assign({sticky:this.sticky},r))}getVariation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.parent.getVariation(e,Object.assign(Object.assign({},this.context),t),Object.assign({sticky:this.sticky},r))}getVariable(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariable(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableBoolean(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableBoolean(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableString(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableString(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableInteger(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableInteger(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableDouble(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableDouble(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableArray(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableArray(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableObject(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableObject(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getVariableJSON(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.parent.getVariableJSON(e,t,Object.assign(Object.assign({},this.context),r),Object.assign({sticky:this.sticky},n))}getAllEvaluations(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.parent.getAllEvaluations(Object.assign(Object.assign({},this.context),e),t,Object.assign({sticky:this.sticky},r))}}function I(e,t){if(void 0===e)return null;switch(t){case"string":return"string"==typeof e?e:null;case"integer":return parseInt(e,10);case"double":return parseFloat(e);case"boolean":return!0===e;case"array":return Array.isArray(e)?e:null;case"object":return"object"==typeof e?e:null;default:return e}}let j={schemaVersion:"2",revision:"unknown",segments:{},features:{}};class M{constructor(e){this.context={},this.context=e.context||{},this.logger=e.logger||w({level:e.logLevel||E.defaultLevel}),this.hooksManager=new P({hooks:e.hooks||[],logger:this.logger}),this.emitter=new R,this.sticky=e.sticky,this.datafileReader=new T({datafile:j,logger:this.logger}),e.datafile&&(this.datafileReader=new T({datafile:"string"==typeof e.datafile?JSON.parse(e.datafile):e.datafile,logger:this.logger})),this.logger.info("Featurevisor SDK initialized")}setLogLevel(e){this.logger.setLevel(e)}setDatafile(e){try{let t=new T({datafile:"string"==typeof e?JSON.parse(e):e,logger:this.logger}
13),r=function(e,t){let r=e.getRevision(),n=e.getFeatureKeys(),i=t.getRevision(),o=t.getFeatureKeys(),s=[],a=[],l=[];for(let r of n){if(-1===o.indexOf(r)){s.push(r);continue}let n=e.getFeature(r),i=t.getFeature(r);(null==n?void 0:n.hash)!==(null==i?void 0:i.hash)&&a.push(r)}for(let e of o)-1===n.indexOf(e)&&l.push(e);return{revision:i,previousRevision:r,revisionChanged:r!==i,features:[...s,...a,...l].filter((e,t,r)=>r.indexOf(e)===t)}}(this.datafileReader,t);this.datafileReader=t,this.logger.info("datafile set",r),this.emitter.trigger("datafile_set",r)}catch(e){this.logger.error("could not parse datafile",{error:e})}}setSticky(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.sticky||{};this.sticky=t?Object.assign({},e):Object.assign(Object.assign({},this.sticky),e);let n=C(r,this.sticky,t);this.logger.info("sticky features set",n),this.emitter.trigger("sticky_set",n)}getRevision(){return this.datafileReader.getRevision()}getFeature(e){return this.datafileReader.getFeature(e)}addHook(e){return this.hooksManager.add(e)}on(e,t){return this.emitter.on(e,t)}close(){this.emitter.clearAll()}setContext(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.context=t?e:Object.assign(Object.assign({},this.context),e),this.emitter.trigger("context_set",{context:this.context,replaced:t}),this.logger.debug(t?"context replaced":"context updated",{context:this.context,replaced:t})}getContext(e){return e?Object.assign(Object.assign({},this.context),e):this.context}spawn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new k({parent:this,context:this.getContext(e),sticky:t.sticky})}getEvaluationDependencies(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{context:this.getContext(e),logger:this.logger,hooksManager:this.hooksManager,datafileReader:this.datafileReader,sticky:t.sticky?Object.assign(Object.assign({},this.sticky),t.sticky):this.sticky,defaultVariationValue:t.defaultVariationValue,defaultVariableValue:t.defaultVariableValue}}evaluateFlag(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return A(Object.assign(Object.assign({},this.getEvaluationDependencies(t,r)),{type:"flag",featureKey:e}))}isEnabled(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{return!0===this.evaluateFlag(e,t,r).enabled}catch(t){return this.logger.error("isEnabled",{featureKey:e,error:t}),!1}}evaluateVariation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return A(Object.assign(Object.assign({},this.getEvaluationDependencies(t,r)),{type:"variation",featureKey:e}))}getVariation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{let n=this.evaluateVariation(e,t,r);return void 0!==n.variationValue?n.variationValue:n.variation?n.variation.value:null}catch(t){return this.logger.error("getVariation",{featureKey:e,error:t}),null}}evaluateVariable(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return A(Object.assign(Object.assign({},this.getEvaluationDependencies(r,n)),{type:"variable",featureKey:e,variableKey:t}))}getVariable(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{let i=this.evaluateVariable(e,t,r,n);return void 0!==i.variableValue?i.variableSchema&&"json"===i.variableSchema.type&&"string"==typeof i.variableValue?JSON.parse(i.variableValue):i.variableValue:null}catch(r){return this.logger.error("getVariable",{featureKey:e,variableKey:t,error:r}),null}}getVariableBoolean(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"boolean")}getVariableString(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"string")}getVariableInteger(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"integer")}getVariableDouble(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"double")}getVariableArray(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"array")}getVariableObject(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"object")}getVariableJSON(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return I(this.getVariable(e,t,r,n),"json")}getAllEvaluations(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};for(let i of t.length>
130?t:this.datafileReader.getFeatureKeys()){let t={enabled:this.isEnabled(i,e,r)};if(this.datafileReader.hasVariations(i)){let n=this.getVariation(i,e,r);n&&(t.variation=n)}let o=this.datafileReader.getVariableKeys(i);if(o.length>0)for(let n of(t.variables={},o))t.variables[n]=this.getVariable(i,n,e,r);n[i]=t}return n}}function N(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new M(e)}l.Il,l.f6,l.ps,l.Jr,l.Vy,l.lb,l.mx;var D=l.Q_;l.h,l.K_,l._3,l.EM,l.eG,l.dg,l.f,l.xE;var L=e.i(893649),U=e.i(493633);e.i(433950);var W=e.i(300181),F=e.i(487486),B=e.i(519455),q=e.i(776639),K=e.i(699375),V=e.i(962964);let G="https://help.bitval.com/en/articles/45-privacy-policy",H=e=>{let{id:t,title:r,description:i,badge:o,checked:s,onCheckedChange:a}=e;return(0,n.jsxs)("div",{className:"border-border space-y-2 rounded-xl border p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("label",{htmlFor:t,className:"text-foreground text-sm font-semibold",children:r}),(0,n.jsx)(K.Switch,{id:t,checked:s,disabled:!a,onCheckedChange:a,"aria-describedby":`${t}-description`})]}),o&&(0,n.jsx)(F.Badge,{className:"border-transparent bg-[var(--switch-checked-bg)]/15 text-[var(--switch-checked-bg)]",children:o}),(0,n.jsx)("p",{id:`${t}-description`,className:"text-xs text-[var(--modal-description-color)]",children:i})]})},$=e=>{let{isOpen:t,onClose:r}=e,{t:o}=(0,W.useTranslation)(),[s,a]=(0,i.useState)(!1);return(0,n.jsx)(q.Dialog,{open:t,onOpenChange:r,children:(0,n.jsxs)(q.DialogContent,{className:"flex max-h-[85dvh] flex-col gap-6 max-sm:top-0 max-sm:left-0 max-sm:h-dvh max-sm:max-h-none max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:border-0 sm:rounded-xl",children:[(0,n.jsxs)(q.DialogHeader,{className:"gap-1.5 pr-6 text-left",children:[(0,n.jsx)(q.DialogTitle,{className:"text-xl text-[var(--modal-title-color)]",children:o("cookies.settings.title")}),(0,n.jsxs)(q.DialogDescription,{className:"text-[var(--modal-description-color)]",children:[o("cookies.settings.description")," ",(0,n.jsx)(U.default,{href:G,target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground underline transition-colors",children:o("cookies.privacyPolicy")})]})]}),(0,n.jsxs)("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto",children:[(0,n.jsx)(H,{id:"cookies-required",title:o("cookies.settings.required.title"),description:o("cookies.settings.required.description"),badge:o("cookies.settings.alwaysActive"),checked:!0}),(0,n.jsx)(H,{id:"cookies-analytics",title:o("cookies.settings.analytics.title"),description:o("cookies.settings.analytics.description"),checked:s,onCheckedChange:a})]}),(0,n.jsx)(B.Button,{className:"btn-primary w-full sm:w-auto sm:self-end",onClick:()=>{(0,V.setCookieConsent)(s?"accepted":"rejected")},children:o("cookies.settings.save")})]})})};function Y(){let{t:e}=(0,W.useTranslation)(),t=(0,V.useCookieConsent)(),[r,o]=(0,i.useState)(!1);return t?null:(0,n.jsxs)("div",{role:"dialog","aria-modal":"false","aria-label":e("cookies.title"),className:"border-border/40 fixed inset-x-0 bottom-0 z-[60] border-t bg-[#0a0a0a]/95 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"mx-auto flex max-w-5xl flex-col gap-3 px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("p",{className:"text-foreground text-sm font-semibold",children:e("cookies.title")}),(0,n.jsxs)("p",{className:"text-muted-foreground text-xs",children:[e("cookies.description")," ",(0,n.jsx)(U.default,{href:G,target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground underline transition-colors",children:e("cookies.privacyPolicy")})]})]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,n.jsx)(B.Button,{variant:"ghost",size:"sm",onClick:()=>{o(!0)},children:e("cookies.customize")}),(0,n.jsx)(B.Button,{variant:"outline",size:"sm",onClick:()=>{(0,V.setCookieConsent)("rejected")},children:e("cookies.decline")}),(0,n.jsx)(B.Button,{size:"sm",className:"btn-primary",onClick:()=>
13{(0,V.setCookieConsent)("accepted")},children:e("cookies.accept")})]})]}),(0,n.jsx)($,{isOpen:r,onClose:()=>{o(!1)}})]})}var Q=e.i(625556),z=e.i(341611),J=e.i(82109);function X(){let e=(0,J.useAppSelector)(e=>e.user.isAuthenticated),{data:t}=(0,z.useFeatureFlags)(e);return(0,i.useEffect)(()=>{},[t]),null}var Z=e.i(49955),ee=e.i(50025);function et(){let e=(0,J.useAppDispatch)(),t=(0,J.useAppSelector)(e=>e.user.isAuthenticated),r=(0,J.useAppSelector)(e=>e.user.email),{data:n}=(0,Z.useFrontendPreferences)(r,t);return(0,i.useEffect)(()=>{void 0!==n&&e((0,ee.setPreferences)(n))},[e,n]),null}var er=e.i(957134),en=e.i(176453);function ei(){return(0,n.jsx)("div",{className:"flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-[var(--color-background)] to-[var(--color-muted)] px-4 text-center",children:(0,n.jsxs)("div",{className:"flex max-w-lg flex-col items-center gap-6",children:[(0,n.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-[var(--color-muted)]",children:(0,n.jsx)(en.Wrench,{className:"h-10 w-10 text-[var(--color-primary)]"})}),(0,n.jsx)("h1",{className:"text-2xl font-bold text-[var(--color-foreground)] md:text-3xl",children:"We're Under Maintenance"}),(0,n.jsx)("p",{className:"text-base text-[var(--color-muted-foreground)] md:text-lg",children:"We're currently performing scheduled maintenance to improve your experience."}),(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-full bg-[var(--color-muted)] px-4 py-2",children:[(0,n.jsxs)("span",{className:"relative flex h-3 w-3",children:[(0,n.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-yellow-400 opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex h-3 w-3 rounded-full bg-yellow-500"})]}),(0,n.jsx)("span",{className:"text-sm font-medium text-[var(--color-foreground)]",children:"Maintenance in progress"})]}),(0,n.jsxs)("div",{className:"mt-2 w-full rounded-xl border border-[var(--color-border)] bg-[var(--color-card)] p-4 text-left",children:[(0,n.jsxs)("dl",{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("dt",{className:"text-[var(--color-muted-foreground)]",children:"Estimated Window:"}),(0,n.jsx)("dd",{className:"font-medium text-[var(--color-foreground)]",children:"06:00-14:00 UTC"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("dt",{className:"text-[var(--color-muted-foreground)]",children:"Estimated Duration:"}),(0,n.jsx)("dd",{className:"font-medium text-[var(--color-foreground)]",children:"6-8 hours"})]})]}),(0,n.jsx)("p",{className:"mt-4 text-center text-sm font-medium text-[var(--color-foreground)]",children:"All funds remain safe!"})]})]})})}let eo=["/sign-in","/sign-up","/verify-login","/forgot-password","/reset-password"];function es(e){let{children:t}=e,r=(0,er.usePathname)();return(0,s.useFlag)("siteMaintenance")&&!eo.some(e=>r===e||r.startsWith(`${e}/`))?(0,n.jsx)(ei,{}):(0,n.jsx)(n.Fragment,{children:t})}var ea=e.i(132897),el=e.i(614614),eu=e.i(185506),ec=e.i(273932),ed=e.i(196775),ef=class extends ed.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){let n=new eu.Mutation({client:e,mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#e.add(e);let t=eh(e);if("string"==typeof t){let r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){let t=eh(e);if("string"==typeof t){let r=this.#t.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=eh(e);if("string"!=typeof t)return!0;{let r=this.#t.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=eh(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#t.get(t)?.find(t=>
13t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){el.notifyManager.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,ec.matchMutation)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>(0,ec.matchMutation)(e,t))}notify(e){el.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return el.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(ec.noop))))}};function eh(e){return e.options.scope?.id}var ep=e.i(528146),eg=ed,ey=class extends eg.Subscribable{constructor(e={}){super(),this.config=e,this.#n=new Map}#n;build(e,t,r){let n=t.queryKey,i=t.queryHash??(0,ec.hashQueryKeyByOptions)(n,t),o=this.get(i);return o||(o=new ep.Query({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#n.has(e.queryHash)||(this.#n.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#n.get(e.queryHash);t&&(e.destroy(),t===e&&this.#n.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){el.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#n.get(e)}getAll(){return[...this.#n.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,ec.matchQuery)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,ec.matchQuery)(e,t)):t}notify(e){el.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){el.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){el.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},eb=e.i(165233),ev=e.i(779674),em=e.i(333534),e_=class{#i;#o;#s;#a;#l;#u;#c;#d;constructor(e={}){this.#i=e.queryCache||new ey,this.#o=e.mutationCache||new ef,this.#s=e.defaultOptions||{},this.#a=new Map,this.#l=new Map,this.#u=0}mount(){this.#u++,1===this.#u&&(this.#c=eb.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#i.onFocus())}),this.#d=ev.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#i.onOnline())}))}unmount(){this.#u--,0===this.#u&&(this.#c?.(),this.#c=void 0,this.#d?.(),this.#d=void 0)}isFetching(e){return this.#i.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#o.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#i.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#i.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,ec.resolveStaleTime)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#i.findAll(e).map(e=>{let{queryKey:t,state:r}=e;return[t,r.data]})}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=this.#i.get(n.queryHash),o=i?.state.data,s=(0,ec.functionalUpdate)(t,o);if(void 0!==s)return this.#i.build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return el.notifyManager.batch(()=>this.#i.findAll(e).map(e=>{let{queryKey:n}=e;return[n,this.setQueryData(n,t,r)]}))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#i.get(t.queryHash)?.state}removeQueries(e){let t=this.#i;el.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#i;return el.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={revert:!0,...t};return Promise.all(el.notifyManager.batch(()=>this.#i.findAll(e).map(e=>e.cancel(r)))).then(ec.noop).catch(ec.noop)}invalidateQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return el.notifyManager.batch(()=>
13(this.#i.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(el.notifyManager.batch(()=>this.#i.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(ec.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(ec.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#i.build(this,t);return r.isStaleByTime((0,ec.resolveStaleTime)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ec.noop).catch(ec.noop)}fetchInfiniteQuery(e){return e.behavior=(0,em.infiniteQueryBehavior)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ec.noop).catch(ec.noop)}ensureInfiniteQueryData(e){return e.behavior=(0,em.infiniteQueryBehavior)(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ev.onlineManager.isOnline()?this.#o.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#i}getMutationCache(){return this.#o}getDefaultOptions(){return this.#s}setDefaultOptions(e){this.#s=e}setQueryDefaults(e,t){this.#a.set((0,ec.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#a.values()],r={};return t.forEach(t=>{(0,ec.partialMatchKey)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#l.set((0,ec.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#l.values()],r={};return t.forEach(t=>{(0,ec.partialMatchKey)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#s.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,ec.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ec.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#s.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#i.clear(),this.#o.clear()}},eS=e.i(430483),eO=e.i(327468),eE=e.i(63557);let ew=new e_({queryCache:new ey({onError:e=>{(0,eO.recoverUnauthorizedSession)(e).catch(()=>{})}}),mutationCache:new ef({onError:e=>{(0,eO.recoverUnauthorizedSession)(e).catch(()=>{})}}),defaultOptions:{queries:{refetchInterval:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1,retryOnMount:!1},mutations:{retry:!1}}});(0,eE.setGlobalQueryClient)(ew);let eP=e=>{let{children:t}=e;return(0,n.jsx)(eS.QueryClientProvider,{client:ew,children:t})};var eR=e.i(486653);function eT(e){return(eT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function eA(e){return(eA=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ex(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eC(e,t){return(eC=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ek(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var eI=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");for(var t,n,i=arguments.length,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];return n=(e=(t=eA(r)).call.apply(t,[this].concat(o)))&&("object"===eT(e)||"function"==typeof e)?e:ex(this),ek(ex(n),"state",{bootstrapped:!1}),ek(ex(n),"_unsubscribe",void 0),ek(ex(n),"handlePersistorState",function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally(function(){return n.setState({bootstrapped:!0})}):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())}),n}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eC(r,e),t=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(i.PureComponent);ek(eI,"defaultProps",{children:null,loading:null});var ej=e.i(632852);function eM(){return(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-gradient-to-br from-neutral-950 via-neutral-900 to-neutral-950",children:[(0,n.jsxs)("div",{className:"absolute inset-0 overflow-hidden",children:[(0,n.jsx)("div",{className:"absolute -top-1/2 -left-1/2 h-full w-full animate-pulse rounded-full bg-blue-500/5 blur-3xl"}),(0,n.jsx)("div",{className:"absolute -right-1/2 -bottom-1/2 h-full w-full animate-pulse rounded-full bg-purple-500/5 blur-3xl"})]}),(0,n.jsxs)("div",{className:"relative z-10 flex flex-col items-center gap-8 px-4",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"absolute inset-0 animate-pulse rounded-full bg-blue-500/20 blur-2xl"}),(0,n.jsx)("div",{className:"relative flex h-24 w-24 items-center justify-center rounded-full bg-gradient-to-br from-blue-500/10 to-purple-500/10 p-4 ring-1 ring-white/10 backdrop-blur-sm",children:(0,n.jsx)(ej.default,{src:"/assets/Bitval-Logo.png",alt:"Bitval Logo",objectFit:"cover",width:64,height:64,className:"h-8 w-16",priority:!0})})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("div",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 [animation-delay:0ms] [animation-duration:1.5s]"}),(0,n.jsx)("div",{className:"h-2 w-2 animate-pulse rounded-full bg-purple-500 [animation-delay:300ms] [animation-duration:1.5s]"}),(0,n.jsx)("div",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 [animation-delay:600ms] [animation-duration:1.5s]"})]})]})]})}var eN=e.i(684368),eD=e.i(670367),eL=e.i(890357),eU=e.i(402707);(0,eD.installUnauthorizedSessionRecovery)();let eW=e=>{let{children:t}=e;return(0,n.jsx)(eR.Provider,{store:eL.store,children:(0,n.jsx)(eI,{loading:(0,n.jsx)(eM,{}),persistor:eL.persistor,children:(0,n.jsx)(eF,{children:t})})})};function eF(e){let{children:t}=e,r=(0,J.useAppDispatch)(),o=(0,J.useAppSelector)(e=>e.user.isAuthenticated),s=(0,J.useAppSelector)(e=>e.user.email),a=(0,J.useAppSelector)(e=>e.user.jwt),l=(0,J.useAppSelector)(e=>null!==e.user.tempLogin),u=i.default.useRef(!1),[c,d]=i.default.useState(!1);return(i.default.useEffect(()=>{u.current||(u.current=!0,o||l||!(0,eN.shouldAttemptLoginTokenRestore)()||r((0,eU.loginVerifySuccess)({jwt:a,email:s}))),d(!0)},[r,s,l,o,a]),c)?(0,n.jsx)(n.Fragment,{children:t}):(0,n.jsx)(eM,{})}var eB=e.i(943112);function eq(){let e=(0,J.useAppDispatch)(),{t}=(0,W.useTranslation)("translation",{useSuspense:!1}),r=(0,eR.useSelector)(e=>e.ui.toasts);return(0,i.useEffect)(()=>
13{if(0!==r.length){for(let e of r){let{title:r,message:n}=e.notification?(()=>{let r=(0,eB.renderNotification)(e.notification,t);return{title:r.title,message:r.body}})():{title:e.title??"",message:e.message};(0,L.toast[e.type])(r,{description:n,duration:e.duration??4e3})}e((0,ee.removeToasts)(r.map(e=>e.id)))}},[r,e,t]),null}var eK=e.i(866598),eV=e.i(227893),eG=e.i(476478),eH=e.i(562025),e$=e.i(360174);let eY=e=>e?String(e).split("_").join(""):"",eQ=async(e,t,r)=>{try{await Promise.allSettled([e.subscribeV5([`orderbook.50.${t}`],r),e.subscribeV5([`publicTrade.${t}`],r),e.subscribeV5([`tickers.${t}`],r)])}catch(e){console.error("Subscription error:",e)}},ez=async(e,t,r)=>{try{await Promise.allSettled([e.unsubscribeV5([`orderbook.50.${t}`],r),e.unsubscribeV5([`publicTrade.${t}`],r),e.unsubscribeV5([`tickers.${t}`],r)])}catch(e){console.error("Unsubscription error:",e)}};try{eG.DefaultLogger.silly=()=>{}}catch{}class eJ{client;orderBooks;status="disconnected";subscriptions=new Set;eventHandlers=new Map;reconnectAttempts=0;maxReconnectAttempts=10;reconnectDelay=1e3;maxReconnectDelay=3e4;reconnectTimeout;connectionLostTime;constructor(e=!1){this.client=new eG.WebsocketClient({market:"v5",testnet:e}),this.orderBooks=new eH.OrderBooksStore({traceLog:!1,checkTimestamps:!1}),this.setupEventHandlers()}connect(){"connected"!==this.status&&(this.status="connecting")}disconnect(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.client.closeAll(),this.status="disconnected",this.reconnectAttempts=0,this.connectionLostTime=void 0,this.emitToHandlers("bybit:disconnect")}getStatus(){return this.status}subscribeToSymbol(e){let t=eY(e);if(!t)return void console.warn("Invalid symbol for subscription:",e);try{console.log(`ð¡ Subscribing to all topics for ${t}`),eQ(this.client,t,"spot").catch(e=>{console.error("Subscribe error:",e)}),this.subscriptions.add(e)}catch(t){console.error("Failed to subscribe to symbol:",e,t)}}unsubscribeFromSymbol(e){let t=eY(e);if(!t)return void console.warn("Invalid symbol for unsubscription:",e);try{ez(this.client,t,"spot").catch(e=>{console.error("Unsubscribe error:",e)}),this.subscriptions.delete(e)}catch(t){console.error("Failed to unsubscribe from symbol:",e,t)}}unsubscribe(e){if(this.subscriptions.has(e))try{this.client.unsubscribe([e]),this.subscriptions.delete(e)}catch(t){console.error("Failed to unsubscribe from:",e,t)}}unsubscribeSymbol(e){for(let t of[...this.subscriptions].filter(t=>t.includes(e)))this.unsubscribe(t)}on(e,t){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]);let r=this.eventHandlers.get(e);void 0===r?console.error("Event handler not found for event:",e):r.push(t)}off(e,t){let r=this.eventHandlers.get(e);if(r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}subscribe(e){if(this.subscriptions.has(e))return void console.log("Already subscribed to:",e);try{this.client.subscribe([e]),this.subscriptions.add(e),console.log("ð¥ Subscribed to:",e)}catch(t){console.error("Failed to subscribe to:",e,t)}}setupEventHandlers(){this.client.on("open",()=>{console.log("â
Bybit WebSocket connected"),this.status="connected",this.reconnectAttempts=0,this.connectionLostTime=void 0,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0),this.emitToHandlers("bybit:connect")}),this.client.on("close",e=>{console.warn("â ï¸ Bybit WebSocket closed:",e.event),this.status="disconnected",this.connectionLostTime=Date.now(),this.emitToHandlers("bybit:disconnect"),"Manual disconnect"!==e.event&&this.scheduleReconnect()}),this.client.on("reconnected",()=>{console.log("â
Bybit WebSocket reconnected"),this.status="connected",this.reconnectAttempts=0,this.connectionLostTime=void 0,this.resubscribeAll(),this.emitToHandlers("bybit:reconnected")}),this.client.on("update",e=>{this.handleUpdate(e)})}handleUpdate(e){try{if(!e?.topic)return;let{topic:t,type:r,data:n}=e;switch(!0){case t.includes("orderbook.50"):(0,eG.isWsOrderbookEventV5)(e)&&this.handleOrderbookUpdate(e);break;case t.includes("publicTrade"):this.handleTradeUpdate(n);break;case t.includes("tickers"):this.handleTickerUpdate(n,r)}}catch(e){console.error("Error handling WebSocket update:",e)}}handleOrderbookUpdate(e){try{let{topic:t,type:r,data:n,cts:i}=e,o=t.split(".")[2],s=n.b.map(e=>{let[t,r]=e;return(0,eH.OrderBookLevel)(o,+t,"Buy",+r)}),a=n.a.map(e=>{let[t,r]=e;return(0,eH.OrderBookLevel)(o,+t,"Sell",+r)}),l=[...s,...a];if("snapshot"===r){let e=this.orderBooks.handleSnapshot(o,l,i);this.emitOrderbookUpdate(o,e);return}if("delta"===r){let e=[],t=[];for(let r of l){let[n,i,o,s]=r;0===s?t.push(r):e.push(r)}let r=this.orderBooks.handleDelta(o,t,e,[],i);this.emitOrderbookUpdate(o,r);return}console.error("Unhandled orderbook update type:",r)}catch(e){console.error("Error processing orderbook:",e)}}
13handleTradeUpdate(e){if(Array.isArray(e)&&e.length>0){let t=e.map(e=>({price:e.p,total:e.p*e.v,filled_amount:e.v,side:+("Buy"!==e.S),created_at:e.T}));this.emitToHandlers("bybit:trade",t)}}handleTickerUpdate(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1],e){let t={symbol:e.symbol,lastPrice:e.lastPrice,last_tick_direction:e.tickDirection,mark_price:e.markPrice,index_price:e.indexPrice,high_24h:e.highPrice24h,low_24h:e.lowPrice24h,volume_24h:e.volume24h,change_24_h:e.price24hPcnt,turnover:e.turnover24h};this.emitToHandlers("bybit:ticker",t)}}handleKlineUpdate(e,t){let r=this.extractIntervalFromTopic(e);Array.isArray(t)&&t.forEach(e=>{let t={start:e.start??e.timestamp,end:e.end??Number(e.start??e.timestamp)+6e4,interval:r,open:e.open??e.o,close:e.close??e.c,high:e.high??e.h,low:e.low??e.l,volume:e.volume??e.v,turnover:e.turnover??"0",confirm:e.confirm??!0,timestamp:e.timestamp??e.start};this.emitToHandlers("bybit:kline",t)})}emitOrderbookUpdate(e,t){let r=t.book.slice(-50),n=t.book.slice(0,50),i={symbol:e,bids:r,asks:n,buyOrderBook:r,sellOrderBook:n,ts:Date.now()};this.emitToHandlers("bybit:orderbook",i)}extractSymbolFromTopic(e){return e.split(".").at(-1)??""}extractIntervalFromTopic(e){return e.split(".")[1]??"1"}emitToHandlers(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let i=this.eventHandlers.get(e);if(i)for(let e of i)try{e(...r)}catch(e){console.error("Error in Bybit event handler:",e)}}scheduleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts){console.error(`Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`),this.status="error",this.emitToHandlers("bybit:max_reconnect_attempts_reached");return}let e=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts),this.maxReconnectDelay);this.reconnectAttempts++,console.log(`ð Scheduling reconnection attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${e}ms`),this.reconnectTimeout=setTimeout(()=>{this.attemptReconnect()},e)}attemptReconnect(){console.log(`ð Attempting to reconnect (${this.reconnectAttempts}/${this.maxReconnectAttempts})`),this.status="connecting";try{this.client=new eG.WebsocketClient({market:"v5",testnet:!1}),this.setupEventHandlers(),this.resubscribeAll()}catch(e){console.error("Reconnection attempt failed:",e),this.scheduleReconnect()}}resubscribeAll(){if(0===this.subscriptions.size)return;
13console.log(`ð Resubscribing to ${this.subscriptions.size} subscriptions`);let e=[...this.subscriptions];for(let t of(this.subscriptions.clear(),e))setTimeout(()=>{this.subscribeToSymbol(t)},100)}getConnectionInfo(){return{status:this.status,reconnectAttempts:this.reconnectAttempts,maxReconnectAttempts:this.maxReconnectAttempts,connectionLostTime:this.connectionLostTime,subscriptionsCount:this.subscriptions.size}}}let eX=new eJ(!1);var eZ=e.i(122563),e0=e.i(416756);let e1=e=>{let t=0;return e.filter(e=>{let[t,r]=e;return Number.parseFloat(r)>0}).map(e=>{let[r,n]=e,i=Number.parseFloat(r),o=Number.parseFloat(n);return t+=o,{price:i,size:o,total:t}})};var e5=e.i(639908),e2=e.i(437833);class e3{pendingUpdate=null;rafId=null;callback;isProcessing=!1;constructor(e){this.callback=e}schedule(e){this.pendingUpdate={data:e,timestamp:Date.now()},null!==this.rafId||this.isProcessing||(this.rafId=requestAnimationFrame(()=>this.processUpdate()))}processUpdate(){if(this.rafId=null,!this.pendingUpdate)return;this.isProcessing=!0;let e=this.pendingUpdate;this.pendingUpdate=null;try{this.callback(e.data)}catch(e){console.error("Error processing batched update:",e)}finally{this.isProcessing=!1}}cancel(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingUpdate=null}getStats(){return this.pendingUpdate?{hasPending:!0,age:Date.now()-this.pendingUpdate.timestamp}:{hasPending:!1,age:null}}}class e6{frameBatcher;lastUpdateTime=0;updateCount=0;dispatchCount=0;droppedCount=0;resetInterval;logInterval;minInterval;debugName;constructor(e,t=16,r="Batcher"){this.minInterval=t,this.debugName=r,this.frameBatcher=new e3(e),this.resetInterval=setInterval(()=>{this.updateCount=0},1e3),this.logInterval=setInterval(()=>{this.dispatchCount=0,this.droppedCount=0},3e3)}schedule(e){let t=Date.now(),r=t-this.lastUpdateTime;if(this.updateCount++,r<this.minInterval){this.droppedCount++,this.frameBatcher.schedule(e);return}this.dispatchCount++,this.lastUpdateTime=t,this.frameBatcher.schedule(e)}getUpdateRate(){return this.updateCount}destroy(){clearInterval(this.resetInterval),clearInterval(this.logInterval),this.frameBatcher.cancel()}}function e4(e){return"object"==typeof e&&null!==e}function e8(e){let t="number"==typeof e?e:"string"==typeof e?Number.parseFloat(e):NaN;return Number.isFinite(t)?t:null}function e7(e){return"string"==typeof e&&e.length>0?e:null}
13function e9(e,t){let r=e8(e),n=e8(t);return void 0!==t&&null!==n&&n>0&&(null===r||0===r)?t:e}function te(e,t){let r=0;for(let n of e){let e=n.priceUsdt??0;r+=t(n)*e}return r}function tt(e,t,r){e.setQueryData(e5.SPOT_WALLETS_QUERY_KEY,e=>{let n=e?.wallets??[],i=new Map(n.map(e=>[e.currencyTicker.toUpperCase(),e])),o=new Map;for(let e of t){let t=e7(e.coin_symbol??e.currencyTicker??e.coin);if(!t)continue;let r=function(e,t){let r=e7(e.coin_symbol??e.currencyTicker??e.coin);if(!r)return null;let n=e8(e.balance??e.availableQuantity)??t?.availableQuantity??0,i=e8(e.locked_balance??e.reservedQuantity)??t?.reservedQuantity??0,o=n+i,s=e8(e.usdtPrice??e.totalMarketValueUsdt)??t?.totalMarketValueUsdt??null,a=e8(e.priceUsdt??e.price??e.coinPrice)??(null!==s&&o>0?s/o:t?.priceUsdt??null);return{currencyTicker:r,availableQuantity:n,reservedQuantity:i,totalQuantity:o,priceUsdt:a,totalMarketValueUsdt:s??(null===a?null:o*a),priceChange24hRatio:e8(e.priceChange24hRatio??e.price24hPcnt)??t?.priceChange24hRatio??null}}(e,i.get(t.toUpperCase()));r&&o.set(t.toUpperCase(),r)}let s=n.map(e=>o.get(e.currencyTicker.toUpperCase())??e);for(let[e,t]of o)i.has(e)||s.push(t);return 0===s.length?e:{availableMarketValueUsdt:te(s,e=>e.availableQuantity),reservedMarketValueUsdt:te(s,e=>e.reservedQuantity),totalMarketValueUsdt:r??s.reduce((e,t)=>e+(t.totalMarketValueUsdt??0),0),wallets:s}})}class tr{dispatch=null;getState=null;isInitialized=!1;orderbookBatcher=null;tickerBatcher=null;throttledTickerUpdate=(0,e$.default)(this.handleTickerUpdate.bind(this),500);initialize(e,t){this.isInitialized||(this.dispatch=e,this.getState=t,this.isInitialized=!0,this.orderbookBatcher=new e6(e=>{this.processOrderbookUpdate(e)},16,"OrderBook"),this.tickerBatcher=new e6(e=>{this.processTickerUpdate(e)},100,"Ticker"),this.setupSocketIOEventHandlers(),this.setupBybitEventHandlers(),eX.connect())}connectSocketIO(e){this.isInitialized?eV.socketIOClient.connect(e):eZ.logger.error("WebSocket Manager not initialized")}disconnectAll(){this.orderbookBatcher&&(this.orderbookBatcher.destroy(),this.orderbookBatcher=null),this.tickerBatcher&&(this.tickerBatcher.destroy(),this.tickerBatcher=null),eV.socketIOClient.disconnect(),eX.disconnect()}disconnectSocketIO(){eV.socketIOClient.disconnect()}reconnectSocketIO(e){this.isInitialized&&eV.socketIOClient.reconnectWithSession(e)}subscribeToServerRoom(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eV.socketIOClient.subscribe(e,t)}unsubscribeFromServerRoom(e){eV.socketIOClient.unsubscribe(e)}subscribeToMarketData(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1],eX.subscribeToSymbol(e),this.updateConnectionStatus()}unsubscribeFromMarketData(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1],eX.unsubscribeFromSymbol(e)}getWebSocketState(){return{socketIO:{status:eV.socketIOClient.getStatus(),lastConnected:Date.now()},bybit:{status:eX.getStatus(),lastConnected:Date.now(),subscriptions:[]}}}setupSocketIOEventHandlers(){eV.socketIOClient.on("connect",()=>{this.updateConnectionStatus()}),eV.socketIOClient.on("disconnect",()=>{this.updateConnectionStatus()}),eV.socketIOClient.on("connect_error",()=>{this.updateConnectionStatus()}),eV.socketIOClient.on("reconnect_failed",()=>{let e=this.getCurrentUserId();eZ.logger.error("Socket.IO reconnection failed after all attempts",{userId:e??"unknown"}),e0.captureMessage("Socket.IO reconnection exhausted",{level:"error",tags:{component:"websocket"},extra:{userId:e}}),this.dispatchToast("error","Connection Error","Failed to connect to server"),this.updateConnectionStatus()}),eV.socketIOClient.on("WALLET_BALANCE",e=>{this.handleWalletUpdate(e)}),eV.socketIOClient.on("DERIVATIVE_WALLET_BALANCE",e=>{this.handleDerivativeWalletUpdate(e)}),eV.socketIOClient.on("NOTIFICATION_COUNT",e=>{this.handleNotificationCount(e)}),eV.socketIOClient.on("user_notification",e=>{this.handleUserNotification(e)})}setupBybitEventHandlers(){eX.on("bybit:connect",()=>{this.updateConnectionStatus()}),eX.on("bybit:disconnect",()=>{this.updateConnectionStatus()}),eX.on("bybit:error",e=>{console.error("â Bybit WebSocket error:",e),this.updateConnectionStatus()}),eX.on("bybit:orderbook",e=>{this.handleOrderbookUpdate(e)}),eX.on("bybit:ticker",e=>{this.throttledTickerUpdate(e)}),eX.on("bybit:trade",e=>
13{this.handleTradeUpdate(e)})}handleOrderbookUpdate(e){this.orderbookBatcher?this.orderbookBatcher.schedule(e):console.warn("â ï¸ [OrderBook] Batcher not initialized!")}processOrderbookUpdate(e){if(!this.dispatch||!this.getState)return;let t=function(e,t){if(t&&t.symbol===e.s){let r=new Map(t.bids.map(e=>[e.price,e])),n=new Map(t.asks.map(e=>[e.price,e]));for(let[t,n]of e.b){let e=Number.parseFloat(t),i=Number.parseFloat(n);0===i?r.delete(e):r.set(e,{price:e,size:i,total:0})}for(let[t,r]of e.a){let e=Number.parseFloat(t),i=Number.parseFloat(r);0===i?n.delete(e):n.set(e,{price:e,size:i,total:0})}let i=[...r.values()].sort((e,t)=>t.price-e.price),o=[...n.values()].sort((e,t)=>e.price-t.price),s=0,a=i.map(e=>(s+=e.size,{price:e.price,size:e.size,total:s})),l=0,u=o.map(e=>(l+=e.size,{price:e.price,size:e.size,total:l}));return{symbol:e.s,bids:a.slice(0,50),asks:u.slice(0,50),timestamp:Date.now()}}let r=e1(e.b).sort((e,t)=>t.price-e.price),n=e1(e.a).sort((e,t)=>e.price-t.price);return{symbol:e.s,bids:r.slice(0,50),asks:n.slice(0,50),timestamp:Date.now()}}(e,this.getState().trading.orderbook||void 0);this.dispatch((0,e2.updateOrderbookState)(t))}handleTickerUpdate(e){this.tickerBatcher&&this.tickerBatcher.schedule(e)}processTickerUpdate(e){var t;let r;if(!this.dispatch)return;let n=(r={symbol:(t={symbol:e.symbol,lastPrice:e.lastPrice,prevPrice24h:e.prevPrice24h??e.lastPrice,price24hPcnt:e.price24hPcnt,highPrice24h:e.highPrice24h,lowPrice24h:e.lowPrice24h,volume24h:e.volume24h,turnover24h:e.turnover24h,bid1Price:e.bid1Price??"0",bid1Size:e.bid1Size??"0",ask1Price:e.ask1Price??"0",ask1Size:e.ask1Size??"0",tickDirection:e.tickDirection??"ZeroPlusTick",markPrice:e.markPrice,indexPrice:e.indexPrice,fundingRate:e.fundingRate,nextFundingTime:e.nextFundingTime,openInterest:e.openInterest}).symbol,timestamp:Date.now()},t.lastPrice&&(r.lastPrice=Number.parseFloat(t.lastPrice)),t.prevPrice24h&&(r.prevPrice24h=Number.parseFloat(t.prevPrice24h)),t.price24hPcnt&&(r.price24hPcnt=Number.parseFloat(t.price24hPcnt)),t.highPrice24h&&(r.highPrice24h=Number.parseFloat(t.highPrice24h)),t.lowPrice24h&&(r.lowPrice24h=Number.parseFloat(t.lowPrice24h)),t.volume24h&&(r.volume24h=Number.parseFloat(t.volume24h)),t.turnover24h&&(r.turnover24h=Number.parseFloat(t.turnover24h)),t.bid1Price&&(r.bid1Price=Number.parseFloat(t.bid1Price)),t.bid1Size&&(r.bid1Size=Number.parseFloat(t.bid1Size)),t.ask1Price&&(r.ask1Price=Number.parseFloat(t.ask1Price)),t.ask1Size&&(r.ask1Size=Number.parseFloat(t.ask1Size)),t.tickDirection&&(r.tickDirection=t.tickDirection),void 0!==r.ask1Price&&void 0!==r.bid1Price&&(r.spread=r.ask1Price-r.bid1Price),t.markPrice&&(r.markPrice=Number.parseFloat(t.markPrice)),t.indexPrice&&(r.indexPrice=Number.parseFloat(t.indexPrice)),t.fundingRate&&(r.fundingRate=Number.parseFloat(t.fundingRate)),t.nextFundingTime&&(r.nextFundingTime=t.nextFundingTime),t.openInterest&&(r.openInterest=Number.parseFloat(t.openInterest)),r);this.dispatch((0,e2.updateMarketStats)(n))}handleTradeUpdate(e){}handleWalletUpdate(e){let t=eE.globalQueryClient;if(t&&e4(e)){if(e.coinList&&Array.isArray(e.coinList)){let r=e.coinList.filter(e=>e4(e));t.setQueriesData({queryKey:["wallet","coinList"]},e=>{if(!e?.coinList||!Array.isArray(e.coinList))return e;let t=e.coinList.map(e=>{let t=r.find(t=>e7(t.coin_symbol)?.toUpperCase()===e.coin_symbol.toUpperCase());return t?{...e,...t}:e});return t.some((t,r)=>t!==e.coinList[r])?{...e,coinList:t}:e}),tt(t,r,e8(e.spotBalance??e.userTotalBalance)),t.invalidateQueries({queryKey:["wallet","spotPnlSummary"],refetchType:"none"}),t.invalidateQueries({queryKey:["wallet","spotPnlCoins"],refetchType:"none"}),t.invalidateQueries({queryKey:["wallet","spotPnlHistory"],refetchType:"none"})}else if(e.coin&&"string"==typeof e.coin){let r=e.coin.toLowerCase(),n=e[r]??e[e.coin]??e[e.coin.toUpperCase()];if(null==n||"string"!=typeof n&&"number"!=typeof n)return;let i="number"==typeof n?n:Number.parseFloat(n);if(Number.isNaN(i))return;t.setQueriesData({queryKey:["wallet","coinList"]},e=>{if(!e?.coinList||!Array.isArray(e.coinList))return e;let t=e.coinList.findIndex(e=>(e.coin_symbol||"").toLowerCase()===r);if(-1===t)return e;let n=[...e.coinList];return n[t]={...n[t],balance:i},{...e,coinList:n}}),tt(t,[{coin_symbol:e.coin,balance:i,locked_balance:e.locked_balance}],e8(e.usdt_balance)),t.invalidateQueries({queryKey:["wallet","spotPnlSummary"],refetchType:"none"}),t.invalidateQueries({queryKey:["wallet","spotPnlCoins"],refetchType:"none"}),t.invalidateQueries({queryKey:["wallet","spotPnlHistory"],refetchType:"none"})}}}handleDerivativeWalletUpdate(e){let t=eE.globalQueryClient;if(!t)return void eZ.logger.warn("Query client not available for derivative wallet update");let r=Array.isArray(e)?e[0]:e;if(!e4(r))return void eZ.logger.warn("No data in derivative wallet update event");let n=Array.isArray(r.coin)?r.coin.map(e=>({...e})):[];t.setQueriesData({queryKey:["wallet","derivativeWallet"]},e=>{let t=e?.[0];return[{...r,accountIMRate:e9(r.accountIMRate,t?.accountIMRate),accountIMRateByMp:e9(r.accountIMRateByMp,t?.accountIMRateByMp),accountMMRate:e9(r.accountMMRate,t?.accountMMRate),accountMMRateByMp:e9(r.accountMMRateByMp,t?.accountMMRateByMp),totalInitialMargin:e9(r.totalInitialMargin,t?.totalInitialMargin),totalInitialMarginByMp:e9(r.totalInitialMarginByMp,t?.totalInitialMarginByMp),totalMaintenanceMargin:e9(r.totalMaintenanceMargin,t?.totalMaintenanceMargin),totalMaintenanceMarginByMp:e9(r.totalMaintenanceMarginByMp,t?.totalMaintenanceMarginByMp),c
13oin:n}]})}handleNotificationCount(e){eE.globalQueryClient?eE.globalQueryClient.invalidateQueries({queryKey:["notifications"]}):eZ.logger.warn("Query client not available for notification count update")}handleUserNotification(e){this.dispatchToast(e.type,e.title,e.message)}getCurrentUserId(){if(this.getState)return this.getState().user.userId??void 0}updateConnectionStatus(){this.dispatch&&this.dispatch((0,e2.updateConnectionStatus)({socketIO:eV.socketIOClient.getStatus(),bybit:eX.getStatus()}))}dispatchToast(e,t,r){this.dispatch&&this.dispatch((0,ee.addToast)({type:e,title:t,message:r,duration:4e3}))}}let tn=new tr,ti=()=>eL.store.getState();var to=e.i(593196),ts=e.i(205561),ta=e.i(680599);let tl=e=>{if(null==e||""===e)return null;let t=Number(e);return Number.isFinite(t)?t:null},tu=e=>{let t=tl(e);return null===t?null:100*t};e.i(593106);var tc=e.i(532121),td=e.i(712847);let tf=["referral","code"];var th=e.i(951428),tp=e.i(586197),tg=e.i(65274);let ty=(e,t)=>{if(!e)return;let r=e[t];return"string"==typeof r||"number"==typeof r||"boolean"==typeof r?r:void 0},tb=e=>e[0]===th.NOTIFICATIONS_QUERY_KEY&&"feed"===e[1];var tv=e.i(412889),tm=e.i(868708);let t_=[tm.PAYMENT_HISTORY_QUERY_KEY];e.i(899599);var tS=e.i(893783);let tO="reward-claim-status",tE=new Set(["STREAK_TICK","VOLUME_TICK"]),tw=function(e){let t,r,o,s,a,l,u,c,d,f,h,p,g,y,b,v,m,_,S,{children:O}=e;return t=(0,J.useAppDispatch)(),r=(0,J.useAppSelector)(e=>e.user.isAuthenticated),o=(0,J.useAppSelector)(e=>e.user.jwt),s=r?`authenticated:${o||"cookie"}`:"anonymous",(0,i.useEffect)(()=>{tn.initialize(t,ti)},[t]),a=(0,i.useRef)(null),(0,i.useEffect)(()=>{let e=s!==a.current,t=tn.getWebSocketState().socketIO.status;"disconnected"!==t&&"error"!==t&&a.current?e&&tn.reconnectSocketIO(s):tn.connectSocketIO(s),a.current=s},[s]),tn.getWebSocketState().socketIO.status,tn.subscribeToServerRoom.bind(tn),tn.unsubscribeFromServerRoom.bind(tn),tn.subscribeToMarketData.bind(tn),tn.unsubscribeFromMarketData.bind(tn),tn.getWebSocketState.bind(tn),(0,to.usePageWake)(()=>{eV.socketIOClient.forceReconnect()}),(0,i.useEffect)(()=>{let e=()=>{eV.socketIOClient.forceReconnect()};return globalThis.addEventListener("online",e),()=>{globalThis.removeEventListener("online",e)}},[]),l=(0,J.useAppSelector)(e=>e.user.isAuthenticated),(0,i.useEffect)(()=>{l&&(0,eK.registerPushIfPermitted)()},[l]),u=(0,J.useAppDispatch)(),c=(0,eS.useQueryClient)(),d=(0,i.useCallback)(e=>{if(e.type.startsWith("TRADING_")){let{variables:t}=e,r="TRADING_ORDER_REJECTED"===e.type?"error":"event";(0,tg.traceTradeAction)("notification",r,{notificationType:e.type,notificationId:e.id,instrumentCode:ty(t,"instrumentCode")??ty(t,"symbol"),positionId:ty(t,"positionId"),orderId:ty(t,"orderId"),price:ty(t,"price"),reason:ty(t,"reason"),createdAt:e.createdAt})}u((0,ee.addToast)({type:function(e){switch(e){case"WALLET_DEPOSIT_CREDITED":case"WALLET_WITHDRAWAL_COMPLETED":case"TRADING_ORDER_FILLED":case"TRADING_POSITION_OPENED":case"ACCOUNT_WELCOME":case"KYC_LEVEL_1_APPROVED":case"KYC_LEVEL_2_APPROVED":case"KYC_LEVEL_3_APPROVED":case"KYC_BUSINESS_APPROVED":case"COPY_TRADING_MASTER_APPLICATION_ACCEPTED":case"REWARDS_CLAIM_ELIGIBLE":case"REWARDS_CLAIM_CREDITED":return"success";case"WALLET_TRANSACTION_FAILED":case"WALLET_WITHDRAWAL_REJECTED":case"TRADING_ORDER_REJECTED":case"KYC_REJECTED_FINAL":case"COPY_TRADING_MASTER_APPLICATION_REJECTED":case"REWARDS_CLAIM_FAILED":case"SECURITY_ACCOUNT_BLOCKED":case"SECURITY_ACCOUNT_PERMANENT_LOCKED":case"SECURITY_ACCOUNT_ADMIN_LOCKED":return"error";case"SECURITY_MFA_ENABLED":case"SECURITY_MFA_DISABLED":case"SECURITY_PASSWORD_CHANGED":case"SECURITY_PASSWORD_RESET":case"SECURITY_EMAIL_CHANGED":case"SECURITY_ACCOUNT_TEMPORARY_LOCKED":case"TRADING_POSITION_LIQUIDATED":case"TRADING_MARGIN_CALL":case"KYC_REJECTED":case"COPY_TRADING_MASTER_APPLICATION_CHANGES_REQUESTED":case"PLATFORM_MAINTENANCE":return"warning"}return"info"}(e.type),duration:4e3,notification:{type:e.type,titleKey:e.titleKey,bodyKey:e.bodyKey,variables:e.variables}})),c.cancelQueries({queryKey:[th.NOTIFICATIONS_QUERY_KEY,"feed"]}).finally(()=>{((e,t)=>
13{for(let r of e.getQueryCache().findAll({queryKey:[th.NOTIFICATIONS_QUERY_KEY,"feed"]})){if(!tb(r.queryKey))continue;let n=r.queryKey[2],i=r.queryKey[3],o=r.queryKey[4];void 0===n&&(!0!==o||null===t.readAt)&&e.setQueryData(r.queryKey,e=>{if(!e)return e;let r=[t,...e.items.filter(e=>e.id!==t.id)].slice(0,i);return{...e,items:r}})}})(c,{id:e.id,type:e.type,titleKey:e.titleKey,bodyKey:e.bodyKey,variables:e.variables,createdAt:e.createdAt,readAt:null}),c.invalidateQueries({queryKey:[th.NOTIFICATIONS_QUERY_KEY],refetchType:"inactive"})}),"PRICE_ALERT_TRIGGERED"===e.type&&c.invalidateQueries({queryKey:[tp.PRICE_ALERTS_QUERY_KEY]})},[u,c]),(0,i.useEffect)(()=>(eV.socketIOClient.on(eV.NOTIFICATION_EVENT,d),()=>{eV.socketIOClient.off(eV.NOTIFICATION_EVENT,d)}),[d]),f=(0,eS.useQueryClient)(),h=(0,i.useCallback)(e=>{f.setQueryData(e5.SPOT_WALLETS_QUERY_KEY,e)},[f]),(0,i.useEffect)(()=>(eV.socketIOClient.on(eV.SPOT_WALLETS_UPDATED_EVENT,h),()=>{eV.socketIOClient.off(eV.SPOT_WALLETS_UPDATED_EVENT,h)}),[h]),p=(0,eS.useQueryClient)(),g=(0,i.useCallback)(e=>{let t=p.getQueryData((0,ts.derivativeWalletQueryKey)(!1))?.[0],r=t?tl(t.totalPerpUPL):null,n=t?tl(t.totalEquity):null,i=Number(e.totalQuantity),o=null!==r&&Number.isFinite(i)?i+r:n,s=((e,t,r)=>{if(null===t||null===r)return e;let n=t-r;return{...e,availableMargin:n,withdrawableQuantity:Math.max(0,Math.min(e.withdrawableQuantity,n,e.availableQuantity))}})(e,o,t?tl(t.totalInitialMargin):null),a=t?{totalUnrealizedPnl:r,totalEquity:o,totalInitialMargin:t.totalInitialMargin,totalMaintenanceMargin:t.totalMaintenanceMargin,accountInitialMarginRatePercent:tu(t.accountIMRate),accountMaintenanceMarginRatePercent:tu(t.accountMMRate)}:void 0;p.setQueryData(ta.DERIVATIVE_WALLET_SNAPSHOT_QUERY_KEY,s),p.setQueryData((0,ts.derivativeWalletQueryKey)(!1),(0,ts.toDerivativeWalletData)(s,a,t))},[p]),(0,i.useEffect)(()=>(eV.socketIOClient.on(eV.DERIVATIVE_WALLET_UPDATED_EVENT,g),()=>{eV.socketIOClient.off(eV.DERIVATIVE_WALLET_UPDATED_EVENT,g)}),[g]),y=(0,eS.useQueryClient)(),b=(0,i.useCallback)(e=>{let t=(0,tm.toPaymentHistoryItemV2)(e);y.invalidateQueries({queryKey:(0,tv.depositProgressQueryKey)(t.id)});let r=y.getQueriesData({queryKey:t_}),n=!1;for(let[e,i]of r){if(!i)continue;let r=i.lists.findIndex(e=>e.id===t.id);r<0||(y.setQueryData(e,{...i,lists:i.lists.map((e,n)=>n===r?t:e)}),n=!0)}n||y.invalidateQueries({queryKey:t_})},[y]),(0,i.useEffect)(()=>(eV.socketIOClient.on(eV.PAYMENT_HISTORY_UPDATED_EVENT,b),()=>{eV.socketIOClient.off(eV.PAYMENT_HISTORY_UPDATED_EVENT,b)}),[b]),v=(0,eS.useQueryClient)(),m=(0,i.useCallback)(e=>{v.setQueryData([tc.KYC_QUERY_KEY,"status"],t=>{let r={type:e.type,kycLevel:e.kycLevel,deactivated:e.deactivated,level1Status:e.level1Status,level2Status:e.level2Status,level3Status:e.level3Status,updatedAt:e.occurredAt};return t?.level1Status!==td.LevelStatus.APPROVED&&r.level1Status===td.LevelStatus.APPROVED&&v.invalidateQueries({queryKey:tf}),r})},[v]),(0,i.useEffect)(()=>(eV.socketIOClient.on(eV.KYC_STATUS_CHANGED_EVENT,m),()=>{eV.socketIOClient.off(eV.KYC_STATUS_CHANGED_EVENT,m)}),[m]),_=(0,eS.useQueryClient)(),S=(0,i.useCallback)(e=>{let t=e.progress;tE.has(e.status)&&null!=t&&t.length>0?_.setQueryData([...tS.REWARDS_QUERY_KEY,"user-progress"],e=>{let r;return e?(r=e.progress.map(e=>{let r=t.find(t=>null!=t.volumeCurrent&&null!=t.ruleId&&t.ruleId===e.ruleId);if(r)return{...e,volumeCurrent:r.volumeCurrent??e.volumeCurrent};let n=t.find(t=>null!=t.streakCurrent&&(null==t.ruleId?t.triggerType===e.triggerType:t.ruleId===e.ruleId));return n?{...e,streakCurrent:n.streakCurrent??e.streakCurrent}:e}),{...e,progress:r}):e}):_.invalidateQueries({queryKey:tS.REWARDS_QUERY_KEY})},[_]),(0,i.useEffect)(()=>(eV.socketIOClient.on(tO,S),()=>{eV.socketIOClient.off(tO,S)}),[S]),(0,n.jsx)(n.Fragment,{children:O})};var tP=e.i(755261),tR=e.i(890602),tT=e.i(546861);e.i(477371);var tA=e.i(297242);function tx(e){let{children:t}=e;return(0,n.jsx)(tT.I18nextProvider,{i18n:tA.default,children:(0,n.jsx)(i.Suspense,{fallback:null,children:t})})}function tC(e){return e?{accountId:e}:{}}function tk(e){let{children:t}=e,{isAuthenticated:r}=(0,J.useAppSelector)(eU.selectUserState),{data:s}=(0,tP.useGetMe)({enabled:r}),a=r?s?.id:void 0,[l,u]=(0,i.useState)(null),c=(0,i.useRef)(a);return((0,i.useEffect)(()=>{c.current=a,l?.setContext(tC(a),!0)},[l,a]),(0,i.useEffect)(()=>{let e=!1;return(async()=>{let t;try{let e=await fetch("https://bitval-feature-visor-datafiles.pages.dev/production/featurevisor-tag-all.json");if(!e.ok)throw Error(`Failed to fetch datafile: status ${e.status.toString()}`);t=await e.json()}catch(e){console.error("Featurevisor init failed, falling back to empty datafile",e),t={schemaVersion:"1",revision:"0",features:{},segments:{}}}e||u(D({datafile:t,context:tC(c.current)}))})(),()=>{e=!0}},[]),l)?(0,n.jsxs)(o.FeaturevisorProvider,{instance:l,children:[(0,n.jsx)(tM,{}),(0,n.jsx)(es,{children:t})]}):null}function tI(){return(0,i.useEffect)(()=>
13{if("u"<typeof PerformanceObserver)return;let e=!1;try{e=PerformanceObserver.supportedEntryTypes.includes("longtask")}catch{}if(!e)return;let t=new PerformanceObserver(e=>{for(let t of e.getEntries())!(t.duration<200)&&(tR.addBreadcrumb({category:"performance",message:`Long task: ${Math.round(t.duration)}ms`,level:"warning",data:{durationMs:Math.round(t.duration),startTime:Math.round(t.startTime)}}),t.duration>500&&e0.captureMessage("UI freeze detected (long task)",{level:"warning",tags:{component:"performance"},extra:{durationMs:Math.round(t.duration),startTime:Math.round(t.startTime)}}))});return t.observe({type:"longtask",buffered:!0}),()=>{t.disconnect()}},[]),null}function tj(){return(()=>{let{isAuthenticated:e}=(0,J.useAppSelector)(eU.selectUserState),{data:t}=(0,tP.useGetMe)({enabled:e});(0,i.useEffect)(()=>{e&&t?.id?e0.setUser({id:t.id,username:t.uuid,email:t.email}):e0.setUser(null)},[e,t?.id,t?.uuid,t?.email])})(),null}function tM(){let e=(0,s.useFlag)("useOldWallet");return(0,i.useEffect)(()=>{},[e]),null}e.s(["default",0,function(e){let{children:t}=e;return(0,n.jsx)(eP,{children:(0,n.jsx)(eW,{children:(0,n.jsx)(tx,{children:(0,n.jsx)(tw,{children:(0,n.jsxs)(ea.default,{children:[(0,n.jsx)(tI,{}),(0,n.jsx)(tj,{}),(0,n.jsx)(et,{}),(0,n.jsx)(X,{}),(0,n.jsx)(Y,{}),(0,n.jsxs)(tk,{children:[(0,n.jsx)(i.Suspense,{children:t}),(0,n.jsx)(eq,{}),(0,n.jsx)(Q.AppDialogs,{}),(0,n.jsx)(L.Toaster,{position:"top-right",closeButton:!0,duration:4e3,theme:"dark",toastOptions:{classNames:{toast:"group",title:"text-sm font-semibold",description:"text-sm opacity-90",actionButton:"bg-primary text-primary-foreground",cancelButton:"bg-muted text-muted-foreground",closeButton:"bg-transparent border-none text-current opacity-70 hover:opacity-100"}}})]})]})})})})})}],422442)},778971,e=>{"use strict";var t=e.i(77781),r=e.i(598607),n=e.i(957134),i=e.i(586596),o=e.i(962964),s=e.i(570746);let a=["/forgot-password/verify"],l="GTM-PRBLPVSV";e.s(["AnalyticsGuard",0,function(){let e=(0,n.usePathname)(),u=(0,o.useCookieConsent)(),c=a.some(t=>e.startsWith(t)),d="G-2PYQL5BDY0";return((0,r.useEffect)(()=>{c||(0,s.initializeGleap)()},[c]),c||"accepted"!==u)?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.default,{id:"google-tag-manager",strategy:"afterInteractive",children:` 14 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 15 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 16 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
17 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 18 })(window,document,'script','dataLayer','${l}'); 19 `}),(0,t.jsx)("noscript",{children:(0,t.jsx)("iframe",{src:`https://www.googletagmanager.com/ns.html?id=${l}`,height:"0",width:"0",style:{display:"none",visibility:"hidden"},title:"Google Tag Manager"})}),d&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.default,{src:`https://www.googletagmanager.com/gtag/js?id=${d}`,strategy:"lazyOnload"}),(0,t.jsx)(i.default,{id:"google-analytics",strategy:"lazyOnload",children:` 20 window.dataLayer = window.dataLayer || []; 21 function gtag(){dataLayer.push(arguments);} 22 gtag('js', new Date()); 23 gtag('config', '${d}'); 24 `})]})]})}])},962964,e=>{"use strict";var t=e.i(598607),r=e.i(274493);let n="bitval:cookie-consent",i=e=>(globalThis.addEventListener(n,e),globalThis.addEventListener("storage",e),()=>{globalThis.removeEventListener(n,e),globalThis.removeEventListener("storage",e)}),o=()=>{let e=localStorage.getItem(r.storageKeys.cookieConsent);return"accepted"===e||"rejected"===e?e:null};e.s(["setCookieConsent",0,e=>{localStorage.setItem(r.storageKeys.cookieConsent,e),globalThis.dispatchEvent(new Event(n))},"useCookieConsent",0,()=>(0,t.useSyncExternalStore)(i,o,()=>null)])}]); 25 26//# debugId=a626fedc-ad78-56ae-eec3-585ffe423b29
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.