UNPKG

smr-performance-monitor

Version:

smr-performance-monitor

2 lines 53 kB
class e{constructor(e,t,n){this.name=e,this.version=t,this.os=n}}class t{constructor(e){this.version=e,this.name="node",this.os=process.platform}}class n{constructor(){this.bot=!0,this.name="bot",this.version=null,this.os=null}}const r=3,o=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],s=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function i(){return"undefined"!=typeof navigator?function(t){const i=""!==t&&o.reduce(((e,[n,r])=>{if(e)return e;const o=r.exec(t);return!!o&&[n,o]}),!1);if(!i)return null;const[a,c]=i;if("searchbot"===a)return new n;let u=c[1]&&c[1].split(/[._]/).slice(0,3);u?u.length<r&&(u=[...u,...new Array(r-u.length).fill("0")]):u=[];return new e(a,u.join("."),function(e){const t=s.find((([t,n])=>n.test(e)));return t?t[0]:null}(t))}(navigator.userAgent):"undefined"!=typeof process&&process.version?new t(process.version.slice(1)):null}class a{constructor(){this.navigationTimingCached={},this.basePerfCount={},this.tcpLoadCount=0,this.calcBasePerfCount()}static supported(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark}static supportedPerformanceObserver(){return window.chrome&&"PerformanceObserver"in window}getNavigationTiming(e=!1){if(!a.supported())return this.navigationTimingCached;const t=performance.getEntriesByType("navigation")[0];return t?e?{pageLoadTime:parseFloat((t.loadEventEnd-t.startTime).toFixed(2))}:(this.navigationTimingCached={fetchTime:parseFloat((t.responseEnd-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.workerStart>0?t.responseEnd-t.workerStart:0).toFixed(2)),totalTime:parseFloat((t.responseEnd-t.requestStart).toFixed(2)),downloadTime:parseFloat((t.responseEnd-t.responseStart).toFixed(2)),timeToFirstByte:parseFloat((t.responseStart-t.requestStart).toFixed(2)),headerSize:parseFloat((t.transferSize-t.encodedBodySize||0).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.navigationTimingCached):this.navigationTimingCached}get tcpLoadCountInfo(){return this.tcpLoadCount}calcBasePerfCount(){new PerformanceObserver((e=>{e.getEntries().forEach((e=>{this.basePerfCount={dnsCount:e.domainLookupEnd-e.domainLookupStart,tcpDnsCount:e.connectEnd-e.connectStart,reqCount:e.responseEnd-e.responseStart,dParseCount:e.domComplete-e.domInteractive,resLoadCount:e.loadEventStart-e.domContentLoadedEventEnd,dclCount:e.domContentLoadedEventEnd-e.domInteractive,pldCount:e.domComplete-e.startTime,oldCount:e.loadEventEnd-e.loadEventStart},this.tcpLoadCount=e.connectEnd-e.startTime}))})).observe({entryTypes:["navigation"],buffered:!0})}get basePerfCountInfo(){return this.basePerfCount}get networkInformation(){if("connection"in window.navigator){const e=window.navigator.connection;return"object"!=typeof e?{}:{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData,hardwareConcurrency:window.navigator.hardwareConcurrency}}return{}}now(){return window.performance.now()}mark(e,t){const n=`mark_${e}_${t}`;window.performance.mark(n)}checkStartMarkName(e){const t=window.performance.getEntriesByName(this.getStartMarkName(e),"mark");return!(!t||!t.length)}measure(e){const t=this.getStartMarkName(e),n=this.getEndMarkName(e);window.performance.measure(e,t,n);const r=window.performance.getEntriesByName(e);return r[r.length-1].duration}performanceObserver(e,t){return this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,t)),this.perfObserver.observe({type:e,buffered:!0}),this.perfObserver}performanceObserverCb(e,t){e(t.getEntries())}getStartMarkName(e){return`mark_${e}_start`}getEndMarkName(e){return`mark_${e}_end`}}const c=e=>e.split("_").map(((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1))).join(""),u=e=>{let{data:t,switchToUnderline:n=!0,ntnArr:r=[]}=e;if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map((e=>u({data:e,switchToUnderline:n,ntnArr:r})));const o={};for(const e in t)if(Object.hasOwnProperty.call(t,e)){let s="";r.includes(e)?o[e]=u({data:t[e],switchToUnderline:n,ntnArr:r}):(s=n?e.replace(/[A-Z]/g,(e=>"_"+e.toLowerCase())):c(e),o[s]=u({data:t[e],switchToUnderline:n,ntnArr:r}))}return o};function l(e,t){return function(){return e.apply(t,arguments)}}const{toString:d}=Object.prototype,{getPrototypeOf:h}=Object,{iterator:f,toStringTag:p}=Symbol,m=(g=Object.create(null),e=>{const t=d.call(e);return g[t]||(g[t]=t.slice(8,-1).toLowerCase())});var g;const w=e=>(e=e.toLowerCase(),t=>m(t)===e),b=e=>t=>typeof t===e,{isArray:y}=Array,R=b("undefined");function T(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&S(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const E=w("ArrayBuffer");const C=b("string"),S=b("function"),v=b("number"),k=e=>null!==e&&"object"==typeof e,O=e=>{if("object"!==m(e))return!1;const t=h(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||p in e||f in e)},A=w("Date"),N=w("File"),_=w("Blob"),P=w("FileList"),x=w("URLSearchParams"),[j,L,F,B]=["ReadableStream","Request","Response","Headers"].map(w);function U(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),y(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(T(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function I(e,t){if(T(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,D=e=>!R(e)&&e!==M;const q=(W="undefined"!=typeof Uint8Array&&h(Uint8Array),e=>W&&e instanceof W);var W;const H=w("HTMLFormElement"),z=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),V=w("RegExp"),K=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};U(n,((n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)})),Object.defineProperties(e,r)};const $=w("AsyncFunction"),J=(X="function"==typeof setImmediate,Q=S(M.postMessage),X?setImmediate:Q?(G=`axios@${Math.random()}`,Y=[],M.addEventListener("message",(({source:e,data:t})=>{e===M&&t===G&&Y.length&&Y.shift()()}),!1),e=>{Y.push(e),M.postMessage(G,"*")}):e=>setTimeout(e));var X,Q,G,Y;const Z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(M):"undefined"!=typeof process&&process.nextTick||J;var ee={isArray:y,isArrayBuffer:E,isBuffer:T,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||S(e.append)&&("formdata"===(t=m(e))||"object"===t&&S(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&E(e.buffer),t},isString:C,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:k,isPlainObject:O,isEmptyObject:e=>{if(!k(e)||T(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:j,isRequest:L,isResponse:F,isHeaders:B,isUndefined:R,isDate:A,isFile:N,isBlob:_,isRegExp:V,isFunction:S,isStream:e=>k(e)&&S(e.pipe),isURLSearchParams:x,isTypedArray:q,isFileList:P,forEach:U,merge:function e(){const{caseless:t}=D(this)&&this||{},n={},r=(r,o)=>{const s=t&&I(n,o)||o;O(n[s])&&O(r)?n[s]=e(n[s],r):O(r)?n[s]=e({},r):y(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&U(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(U(t,((t,r)=>{n&&S(t)?e[r]=l(t,n):e[r]=t}),{allOwnKeys:r}),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,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&h(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:m,kindOfTest:w,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(y(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[f]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:H,hasOwnProperty:z,hasOwnProp:z,reduceDescriptors:K,freezeMethods:e=>{K(e,((t,n)=>{if(S(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];S(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return y(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:I,global:M,isContextDefined:D,isSpecCompliantForm:function(e){return!!(e&&S(e.append)&&"FormData"===e[p]&&e[f])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(k(e)){if(t.indexOf(e)>=0)return;if(T(e))return e;if(!("toJSON"in e)){t[r]=e;const o=y(e)?[]:{};return U(e,((e,t)=>{const s=n(e,r+1);!R(s)&&(o[t]=s)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:$,isThenable:e=>e&&(k(e)||S(e))&&S(e.then)&&S(e.catch),setImmediate:J,asap:Z,isIterable:e=>null!=e&&S(e[f])};function te(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}ee.inherits(te,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:ee.toJSONObject(this.config),code:this.code,status:this.status}}});const ne=te.prototype,re={};["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=>{re[e]={value:e}})),Object.defineProperties(te,re),Object.defineProperty(ne,"isAxiosError",{value:!0}),te.from=(e,t,n,r,o,s)=>{const i=Object.create(ne);return ee.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),te.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function oe(e){return ee.isPlainObject(e)||ee.isArray(e)}function se(e){return ee.endsWith(e,"[]")?e.slice(0,-2):e}function ie(e,t,n){return e?e.concat(t).map((function(e,t){return e=se(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const ae=ee.toFlatObject(ee,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ce(e,t,n){if(!ee.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ee.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ee.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ee.isSpecCompliantForm(t);if(!ee.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ee.isDate(e))return e.toISOString();if(ee.isBoolean(e))return e.toString();if(!a&&ee.isBlob(e))throw new te("Blob is not supported. Use a Buffer instead.");return ee.isArrayBuffer(e)||ee.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(ee.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ee.isArray(e)&&function(e){return ee.isArray(e)&&!e.some(oe)}(e)||(ee.isFileList(e)||ee.endsWith(n,"[]"))&&(a=ee.toArray(e)))return n=se(n),a.forEach((function(e,r){!ee.isUndefined(e)&&null!==e&&t.append(!0===i?ie([n],r,s):null===i?n:n+"[]",c(e))})),!1;return!!oe(e)||(t.append(ie(o,n,s),c(e)),!1)}const l=[],d=Object.assign(ae,{defaultVisitor:u,convertValue:c,isVisitable:oe});if(!ee.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!ee.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),ee.forEach(n,(function(n,s){!0===(!(ee.isUndefined(n)||null===n)&&o.call(t,n,ee.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])})),l.pop()}}(e),t}function ue(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function le(e,t){this._pairs=[],e&&ce(e,this,t)}const de=le.prototype;function he(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function fe(e,t,n){if(!t)return e;const r=n&&n.encode||he;ee.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):ee.isURLSearchParams(t)?t.toString():new le(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}de.append=function(e,t){this._pairs.push([e,t])},de.toString=function(e){const t=e?function(t){return e.call(this,t,ue)}:ue;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var pe=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ee.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ge={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:le,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const we="undefined"!=typeof window&&"undefined"!=typeof document,be="object"==typeof navigator&&navigator||void 0,ye=we&&(!be||["ReactNative","NativeScript","NS"].indexOf(be.product)<0),Re="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Te=we&&window.location.href||"http://localhost";var Ee={...Object.freeze({__proto__:null,hasBrowserEnv:we,hasStandardBrowserWebWorkerEnv:Re,hasStandardBrowserEnv:ye,navigator:be,origin:Te}),...ge};function Ce(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&ee.isArray(r)?r.length:s,a)return ee.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&ee.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&ee.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(ee.isFormData(e)&&ee.isFunction(e.entries)){const n={};return ee.forEachEntry(e,((e,r)=>{t(function(e){return ee.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Se={transitional:me,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ee.isObject(e);o&&ee.isHTMLForm(e)&&(e=new FormData(e));if(ee.isFormData(e))return r?JSON.stringify(Ce(e)):e;if(ee.isArrayBuffer(e)||ee.isBuffer(e)||ee.isStream(e)||ee.isFile(e)||ee.isBlob(e)||ee.isReadableStream(e))return e;if(ee.isArrayBufferView(e))return e.buffer;if(ee.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ce(e,new Ee.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ee.isNode&&ee.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=ee.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ce(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ee.isString(e))try{return(t||JSON.parse)(e),ee.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Se.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ee.isResponse(e)||ee.isReadableStream(e))return e;if(e&&ee.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw te.from(e,te.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:Ee.classes.FormData,Blob:Ee.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ee.forEach(["delete","get","head","post","put","patch"],(e=>{Se.headers[e]={}}));var ve=Se;const ke=ee.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"]);const Oe=Symbol("internals");function Ae(e){return e&&String(e).trim().toLowerCase()}function Ne(e){return!1===e||null==e?e:ee.isArray(e)?e.map(Ne):String(e)}function _e(e,t,n,r,o){return ee.isFunction(r)?r.call(this,t,n):(o&&(t=n),ee.isString(t)?ee.isString(r)?-1!==t.indexOf(r):ee.isRegExp(r)?r.test(t):void 0:void 0)}class Pe{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Ae(t);if(!o)throw new Error("header name must be a non-empty string");const s=ee.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Ne(e))}const s=(e,t)=>ee.forEach(e,((e,n)=>o(e,n,t)));if(ee.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(ee.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ke[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(ee.isObject(e)&&ee.isIterable(e)){let n,r,o={};for(const t of e){if(!ee.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ee.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Ae(e)){const n=ee.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(ee.isFunction(t))return t.call(this,e,n);if(ee.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ae(e)){const n=ee.findKey(this,e);return!(!n||void 0===this[n]||t&&!_e(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Ae(e)){const o=ee.findKey(n,e);!o||t&&!_e(0,n[o],o,t)||(delete n[o],r=!0)}}return ee.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!_e(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ee.forEach(this,((r,o)=>{const s=ee.findKey(n,o);if(s)return t[s]=Ne(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();i!==o&&delete t[o],t[i]=Ne(r),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ee.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ee.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\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,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[Oe]=this[Oe]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Ae(e);t[r]||(!function(e,t){const n=ee.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return ee.isArray(e)?e.forEach(r):r(e),this}}Pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ee.reduceDescriptors(Pe.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),ee.freezeMethods(Pe);var xe=Pe;function je(e,t){const n=this||ve,r=t||n,o=xe.from(r.headers);let s=r.data;return ee.forEach(e,(function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function Le(e){return!(!e||!e.__CANCEL__)}function Fe(e,t,n){te.call(this,null==e?"canceled":e,te.ERR_CANCELED,t,n),this.name="CanceledError"}function Be(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new te("Request failed with status code "+n.status,[te.ERR_BAD_REQUEST,te.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}ee.inherits(Fe,te,{__CANCEL__:!0});const Ue=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const h=u&&c-u;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout((()=>{r=null,i(n)}),s-a)))},()=>n&&i(n)]}((n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})}),n)},Ie=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Me=e=>(...t)=>ee.asap((()=>e(...t)));var De=Ee.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ee.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ee.origin),Ee.navigator&&/(msie|trident)/i.test(Ee.navigator.userAgent)):()=>!0,qe=Ee.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];ee.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),ee.isString(r)&&i.push("path="+r),ee.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function We(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const He=e=>e instanceof xe?{...e}:e;function ze(e,t){t=t||{};const n={};function r(e,t,n,r){return ee.isPlainObject(e)&&ee.isPlainObject(t)?ee.merge.call({caseless:r},e,t):ee.isPlainObject(t)?ee.merge({},t):ee.isArray(t)?t.slice():t}function o(e,t,n,o){return ee.isUndefined(t)?ee.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!ee.isUndefined(t))return r(void 0,t)}function i(e,t){return ee.isUndefined(t)?ee.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(He(e),He(t),0,!0)};return ee.forEach(Object.keys({...e,...t}),(function(r){const s=c[r]||o,i=s(e[r],t[r],r);ee.isUndefined(i)&&s!==a||(n[r]=i)})),n}var Ve=e=>{const t=ze({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=xe.from(a),t.url=fe(We(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ee.isFormData(r))if(Ee.hasStandardBrowserEnv||Ee.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(Ee.hasStandardBrowserEnv&&(o&&ee.isFunction(o)&&(o=o(t)),o||!1!==o&&De(t.url))){const e=s&&i&&qe.read(i);e&&a.set(s,e)}return t};var Ke="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=Ve(e);let o=r.data;const s=xe.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:f}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=xe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Be((function(e){t(e),p()}),(function(e){n(e),p()}),{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new te("Request aborted",te.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new te("Network Error",te.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||me;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new te(t,o.clarifyTimeoutError?te.ETIMEDOUT:te.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&ee.forEach(s.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),ee.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,l]=Ue(f,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,u]=Ue(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Fe(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===Ee.protocols.indexOf(w)?n(new te("Unsupported protocol "+w+":",te.ERR_BAD_REQUEST,e)):m.send(o||null)}))};var $e=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof te?t:new Fe(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{s=null,o(new te(`timeout ${t} of ms exceeded`,te.ETIMEDOUT))}),t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)})),e=null)};e.forEach((e=>e.addEventListener("abort",o)));const{signal:a}=r;return a.unsubscribe=()=>ee.asap(i),a}};const Je=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Xe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Qe=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Xe(e))yield*Je(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Ge="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Ye=Ge&&"function"==typeof ReadableStream,Ze=Ge&&("function"==typeof TextEncoder?(et=new TextEncoder,e=>et.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var et;const tt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nt=Ye&&tt((()=>{let e=!1;const t=new Request(Ee.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),rt=Ye&&tt((()=>ee.isReadableStream(new Response("").body))),ot={stream:rt&&(e=>e.body)};var st;Ge&&(st=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!ot[e]&&(ot[e]=ee.isFunction(st[e])?t=>t[e]():(t,n)=>{throw new te(`Response type '${e}' is not supported`,te.ERR_NOT_SUPPORT,n)})})));const it=async(e,t)=>{const n=ee.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(ee.isBlob(e))return e.size;if(ee.isSpecCompliantForm(e)){const t=new Request(Ee.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ee.isArrayBufferView(e)||ee.isArrayBuffer(e)?e.byteLength:(ee.isURLSearchParams(e)&&(e+=""),ee.isString(e)?(await Ze(e)).byteLength:void 0)})(t):n};const at={http:null,xhr:Ke,fetch:Ge&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:h}=Ve(e);u=u?(u+"").toLowerCase():"text";let f,p=$e([o,s&&s.toAbortSignal()],i);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let g;try{if(c&&nt&&"get"!==n&&"head"!==n&&0!==(g=await it(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(ee.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ie(g,Ue(Me(c)));r=Qe(n.body,65536,e,t)}}ee.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;f=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(f,h);const i=rt&&("stream"===u||"response"===u);if(rt&&(a||i&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=s[t]}));const t=ee.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ie(t,Ue(Me(a),!0))||[];s=new Response(Qe(s.body,65536,n,(()=>{r&&r(),m&&m()})),e)}u=u||"text";let w=await ot[ee.findKey(ot,u)||"text"](s,e);return!i&&m&&m(),await new Promise(((t,n)=>{Be(t,n,{data:w,headers:xe.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:f})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new te("Network Error",te.ERR_NETWORK,e,f),{cause:t.cause||t});throw te.from(t,t&&t.code,e,f)}})};ee.forEach(at,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ct=e=>`- ${e}`,ut=e=>ee.isFunction(e)||null===e||!1===e;var lt=e=>{e=ee.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!ut(n)&&(r=at[(t=String(n)).toLowerCase()],void 0===r))throw new te(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new te("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ct).join("\n"):" "+ct(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function dt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fe(null,e)}function ht(e){dt(e),e.headers=xe.from(e.headers),e.data=je.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return lt(e.adapter||ve.adapter)(e).then((function(t){return dt(e),t.data=je.call(e,e.transformResponse,t),t.headers=xe.from(t.headers),t}),(function(t){return Le(t)||(dt(e),t&&t.response&&(t.response.data=je.call(e,e.transformResponse,t.response),t.response.headers=xe.from(t.response.headers))),Promise.reject(t)}))}const ft="1.11.0",pt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{pt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const mt={};pt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+ft+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new te(r(o," has been removed"+(t?" in "+t:"")),te.ERR_DEPRECATED);return t&&!mt[o]&&(mt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},pt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var gt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new te("options must be an object",te.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new te("option "+s+" must be "+n,te.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new te("Unknown option "+s,te.ERR_BAD_OPTION)}},validators:pt};const wt=gt.validators;class bt{constructor(e){this.defaults=e||{},this.interceptors={request:new pe,response:new pe}}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=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ze(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&gt.assertOptions(n,{silentJSONParsing:wt.transitional(wt.boolean),forcedJSONParsing:wt.transitional(wt.boolean),clarifyTimeoutError:wt.transitional(wt.boolean)},!1),null!=r&&(ee.isFunction(r)?t.paramsSerializer={serialize:r}:gt.assertOptions(r,{encode:wt.function,serialize:wt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),gt.assertOptions(t,{baseUrl:wt.spelling("baseURL"),withXsrfToken:wt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&ee.merge(o.common,o[t.method]);o&&ee.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=xe.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,d=0;if(!a){const e=[ht.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let h=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=ht.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return fe(We((e=ze(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}ee.forEach(["delete","get","head","options"],(function(e){bt.prototype[e]=function(t,n){return this.request(ze(n||{},{method:e,url:t,data:(n||{}).data}))}})),ee.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(ze(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}bt.prototype[e]=t(),bt.prototype[e+"Form"]=t(!0)}));var yt=bt;class Rt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new Fe(e,r,o),t(n.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;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Rt((function(t){e=t})),cancel:e}}}var Tt=Rt;const Et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Et).forEach((([e,t])=>{Et[t]=e}));var Ct=Et;const St=function e(t){const n=new yt(t),r=l(yt.prototype.request,n);return ee.extend(r,yt.prototype,n,{allOwnKeys:!0}),ee.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ze(t,n))},r}(ve);St.Axios=yt,St.CanceledError=Fe,St.CancelToken=Tt,St.isCancel=Le,St.VERSION=ft,St.toFormData=ce,St.AxiosError=te,St.Cancel=St.CanceledError,St.all=function(e){return Promise.all(e)},St.spread=function(e){return function(t){return e.apply(null,t)}},St.isAxiosError=function(e){return ee.isObject(e)&&!0===e.isAxiosError},St.mergeConfig=ze,St.AxiosHeaders=xe,St.formToJSON=e=>Ce(ee.isHTMLForm(e)?new FormData(e):e),St.getAdapter=lt,St.HttpStatusCode=Ct,St.default=St;const vt=St.create({});vt.interceptors.request.use((e=>e),(e=>{console.log(e),Promise.reject(e)})),vt.interceptors.response.use((e=>e.data),(e=>{console.error("sdk https:err"+e);let{message:t}=e;return"Network Error"==t?t="后端接口连接异常":t.includes("timeout")?t="系统接口请求超时":t.includes("Request failed with status code")&&(t="系统接口"+t.substr(t.length-3)+"异常"),Promise.reject(e)}));const kt={debug:"https://console-debug.smartlink.intlgame.com",test:"https://console-test.smartlink.intlgame.com",gcp:"https://console-gcp.smartlink.intlgame.com",prod:"https://console.smartlink.intlgame.com",auto:""};var Ot,At={setBaseUrl(e){vt.defaults.baseURL=kt[e]||kt.auto},setRequestHeaders(e){Object.entries(e).forEach((([e,t])=>{vt.defaults.headers[e]=t}))},customReport(e,t){const n={};let r=Object.keys(n).map((e=>`${e}=${n[e]}`)).join("&");r=r?`?${r}`:"";const o=(null==t?void 0:t.reportPath)?null==t?void 0:t.reportPath:"/api/v2/report/web-add";return vt.post(`${o}${r}`,{data:e})}};!function(e){e[e.PV=1]="PV",e[e.UV=2]="UV",e[e.CLICK=3]="CLICK",e[e.INFO=4]="INFO",e[e.ERROR=5]="ERROR",e[e.WARN=6]="WARN",e[e.INPUT=7]="INPUT",e[e.HOVER=8]="HOVER",e[e.APP_PE=9]="APP_PE",e[e.PAGE_PE=10]="PAGE_PE"}(Ot||(Ot={}));class Nt{constructor(e){this.config={},this.config={uin:e.uin,accountId:e.accountId,token:e.token,env:e.env,serviceType:e.serviceType,reportPath:e.reportPath},At.setBaseUrl(this.config.env),At.setRequestHeaders({"Access-Token":this.config.token,"X-User-id":this.config.accountId,"X-Service-Type":this.config.serviceType})}async uploadReport(e){try{const{uin:t,accountId:n}=this.config;if(t&&n){const r=u({data:{uin:t,accountId:n,path:window.location.pathname,...e},switchToUnderline:!0}),o=await At.customReport(r,{reportPath:this.config.reportPath}),{code:s,msg:i}=o;0===s||console.error(`sdk 上报失败==>>[${s}]:`,i)}else console.error("sdk uploadReport - 上报失败, 必填信息不存在")}catch(e){console.error("sdk uploadReport - 上报失败",e)}}reportAppRelaunch(e){this.uploadReport({eventType:Ot.APP_PE,eventName:"app_relaunch_performance",moduleName:"layouts",...e})}reportChangeRouter(e){this.uploadReport({eventType:Ot.PAGE_PE,eventName:"page_performance",moduleName:"layoutContainer",...e})}reportEvent(e){this.uploadReport(e)}}const _t=()=>+new Date;class Pt{constructor(e){this.initTime_=e}get didTimeout(){return!1}timeRemaining(){return Math.max(0,50-(_t()-this.initTime_))}}const xt="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1,jt="MutationObserver"in window||"WebKitMutationObserver"in window||"MozMutationObserver"in window,Lt=xt?e=>{Promise.resolve().then(e)}:jt?(()=>{let e=0,t=[];const n=new MutationObserver((()=>{t.forEach((e=>e())),t=[]})),r=document.createTextNode("");return n.observe(r,{characterData:!0}),n=>{t.push(n),r.data=String(++e%2)}})():e=>{},Ft=!("object"!=typeof window.safari||!window.safari.pushNotification);class Bt{constructor({ensureTasksRun:e=!1,defaultMinTaskTime:t=0}={}){this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=t,this.ensureTasksRun_=e,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),Ft&&addEventListener("beforeunload",this.runTasksImmediately,!0))}pushTask(e){this.addTask_(Array.prototype.push,e)}unshiftTask(e){this.addTask_(Array.prototype.unshift,e)}runTasksImmediately(){this.runTasks_()}hasPendingTasks(){return this.taskQueue_.length>0}clearPendingTasks(){this.taskQueue_=[],this.cancelScheduledRun_()}getState(){return this.state_}destroy(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),Ft&&removeEventListener("beforeunload",this.runTasksImmediately,!0))}addTask_(e,t,{minTaskTime:n=this.defaultMinTaskTime_}={}){const r={time:_t(),visibilityState:document.visibilityState};e.call(this.taskQueue_,{state:r,task:t,minTaskTime:n}),this.scheduleTasksToRun_()}scheduleTasksToRun_(){this.ensureTasksRun_&&"hidden"===document.visibilityState?Lt(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=(e=>{const t=new Pt(_t());return setTimeout((()=>e(t)),0)})(this.runTasks_))}runTasks_(e){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!Ut(e,this.taskQueue_[0].minTaskTime);){const{task:e,state:t}=this.taskQueue_.shift();this.state_=t,e(t),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}}cancelScheduledRun_(){var e;e=this.idleCallbackHandle_,clearTimeout(e),this.idleCallbackHandle_=null}onVisibilityChange_(){"hidden"===document.visibilityState&&this.runTasksImmediately()}}const Ut=(e,t)=>!!(e&&e.timeRemaining()<=t);class It{constructor(e){this.config={},this.metrics={},this.isHidden=!1,this.networkStore={},this.maxFindCount=800,this.reportApi=null,this.appRelaunchCount={fpCount:0,fmpCount:0,allRenderCount:0},this.changeRouterCount={fpCount:0,fmpCount:0,allRenderCount:0},this.appRelaunchReportFinish=!1,this.appRelaunchCalculateFinish=!1,this.changeRouterStartTime=0,this.exitsChangeRouterMetricName=!1,this.didVisibilityChange=()=>{document.hidden&&(this.isHidden=document.hidden)},this.config=Object.assign({},this.config,e),this.perf=new a,this.queue=new Bt({ensureTasksRun:!0}),this.browser=i(),this.networkStore={},this.onBeforeUnload()}setReportApi(e){if(this.reportApi=new Nt({...e,reportPath:this.config.reportPath}),this.appRelaunchCalculateFinish&&!this.appRelaunchReportFinish){const e=this.browser,t=this.perf.networkInformation,n=this.perf.basePerfCountInfo,r={exts:{browser:e,networkInformation:t,tcpLoadCount:this.perf.tcpLoadCountInfo},performance:{fpCount:this.appRelaunchCount.fpCount,fmpCount:this.appRelaunchCount.fmpCount,allRenderCount:this.appRelaunchCount.allRenderCount,...n}};this.pushTask((()=>{this.reportAppRelaunch(r)}))}}reportAppRelaunch(e){if(!this.reportApi)return this.appRelaunchReportFinish=!1,void console.warn("warn reportApi null;");e.performance&&Object.keys(e.performance).forEach((t=>{e.performance[t]=Math.floor(e.performance[t])})),this.reportApi.reportAppRelaunch({eventType:Ot.APP_PE,...e}),this.appRelaunchReportFinish=!0}pushTask(e){this.queue&&this.queue.pushTask?this.queue.pushTask((()=>{e()})):e()}reportChangeRouter(e){this.reportApi?(e.performance&&Object.keys(e.performance).forEach((t=>{e.performance[t]=Math.floor(e.performance[t])})),this.reportApi.reportChangeRouter({eventType:Ot.PAGE_PE,...e})):console.warn("warn reportApi null;")}reportEvent(e){this.reportApi?this.reportApi.reportEvent(e):console.warn("warn reportApi null;")}searchDom(e,t){var n;e.searchCount+=1;let r=null;e.domIdName?r=document.querySelector(e.domIdName):e.domClassName?r=document.querySelector(e.domClassName):e.domTagName&&(r=null===(n=document.getElementsByTagName(e.domTagName))||void 0===n?void 0:n[0]),r?t(r):e.searchCount<100&&setTimeout((()=>this.searchDom(e,t)))}listenApprelaunchSectionDom(e){const t=t=>{new MutationObserver(((n,r)=>{const o=Number(t.offsetHeight);if(Math.ceil(o)){this.appRelaunchCount.fmpCount=this.perf.now()-this.changeRouterStartTime;const t=this.getNetworkInfoKeys();this.searchAppRelauchNetworkInfo(t,0,e),r.disconnect()}})).observe(t,{attributes:!0,childList:!0,subtree:!0})};setTimeout((()=>{this.searchDom({domTagName:"MAIN",searchCount:0},t)}))}listenAppRelaunchDomChange(e,t){const n=e=>{new MutationObserver(((n,r)=>{const o=Number(e.offsetHeight);let s=!1;for(let e=0;e<n.length&&!s;++e){const t=n[e];if("childList"===t.type){const e=t.addedNodes;for(let t=0;t<e.length&&!s;++t){"SECTION"===e[t].tagName&&(s=!0)}}}if(s)this.listenApprelaunchSectionDom(t),r.disconnect();else if(Math.ceil(o)){this.appRelaunchCount.fmpCount=this.perf.now()-this.changeRouterStartTime;const e=this.getNetworkInfoKeys();this.searchAppRelauchNetworkInfo(e,0,t),r.disconnect()}})).observe(e,{attributes:!0,childList:!0,subtree:!0})};setTimeout((()=>{this.searchDom({...e,searchCount:0},n)}))}listenChangeRouterDomChange(e,t){const n=e=>{new MutationObserver(((n,r)=>{const o=Number(e.offsetHeight);if(Math.ceil(o)){this.changeRouterCount.fmpCount=this.perf.now()-this.changeRouterStartTime;const e=this.getNetworkInfoKeys();this.searchChangeRouterNetworkInfo(e,0,t),r.disconnect()}})).observe(e,{attributes:!0,childList:!0,subtree:!0})};setTimeout((()=>{this.searchDom({...e,searchCount:0},n)}))}setNetworkInfo(e,t){this.networkStore[e]=t}delNetworkCount(e){delete this.networkStore[e]}getNetworkInfoKeys(){return[...Object.keys(this.networkStore)]}searchAppRelauchNetworkInfo(e,t=0,n){const r=[...e],o=this.getNetworkInfoKeys(),s=r.reduce(((e,t)=>(o.includes(t)&&e.push(t),e)),[]);if(s.length&&t<this.maxFindCount)setTimeout((()=>this.searchAppRelauchNetworkInfo(s,t+1,n)));else{this.appRelaunchCount.allRenderCount=this.perf.now();const e=this.browser,t=this.perf.networkInformation,r=this.perf.basePerfCountInfo,o=this.perf.tcpLoadCountInfo,s={exts:{browser:e,networkInformation:t,tcpLoadCount:o},performance:{fpCount:this.appRelaunchCount.fpCount-o,fmpCount:this.appRelaunchCount.fmpCount-o,allRenderCount:this.appRelaunchCount.allRenderCount-o,...r}};this.appRelaunchCalculateFinish=!0,this.pushTask((()=>{this.reportAppRelaunch(s)})),n&&n(s)}}searchChangeRouterNetworkInfo(e,t=0,n){const r=[...e],o=this.getNetworkInfoKeys(),s=r.reduce(((e,t)=>(o.includes(t)&&e.push(t),e)),[]);if(s.length&&t<this.maxFindCount)setTimeout((()=>this.searchChangeRouterNetworkInfo(s,t+1,n)));else{this.changeRouterCount.allRenderCount=this.perf.now()-this.changeRouterStartTime;const e={exts:{browser:this.browser,networkInformation:this.perf.networkInformation,tcpLoadCount:this.perf.tcpLoadCountInfo},performance:{fpCount:this.changeRouterCount.fpCount,fmpCount:this.changeRouterCount.fmpCount,allRenderCount:this.changeRouterCount.allRenderCount}};this.pushTask((()=>{this.exitsChangeRouterMetricName&&this.reportChangeRouter(e)})),n&&n(e)}}get networkInformation(){return this.config.networkInformation?this.perf.networkInformation:{}}start(e){if(!this.checkMetricName(e)||!a.supported())return;this.metrics[e]&&console.warn("Recording already started.");const t=this.perf.now();this.changeRouterStartTime=t,this.metrics[e]={end:0,start:t},this.perf.mark(e,"start"),this.isHidden=!1}checkStartMarkName(e){return this.perf.checkStartMarkName(e)}end(e,t){if(!this.checkMetricName(e)||!a.supported())return void console.warn("not support");const n=this.metrics[e];if(!n)return console.warn("!metric:\t"+e),"appRelaunch"===t?this.appRelaunchCount.fpCount=this.perf.now():"changeRouter"===t&&(this.exitsChangeRouterMetricName=!1,this.changeRouterCount.fpCount=this.perf.now()),this.perf.now();if("appRelaunch"===t)return this.appRelaunchCount.fpCount=this.perf.now(),this.perf.now();"changeRouter"===t&&(this.exitsChangeRouterMetricName=!0,this.changeRouterCount.fpCount=this.perf.now()-this.changeRouterStartTime),n.end=this.perf.now(),this.perf.mark(e,"end");const r=this.perf.measure(e),o=Math.floor(r);return delete this.metrics[e],o}clear(e){window.performance.clearMarks(this.perf.getStartMarkName(e)),window.performance.clearMarks(this.perf.getEndMarkName(e)),delete this.metrics[e]}endPaint(e){return new Promise((t=>{setTimeout((()=>{const n=this.end(e,"enPaint");t(n)}))}))}checkMetricName(e){return!!e}onBeforeUnload(){void 0!==document.hidden&&document.addEventListener("beforeunload",this.didVisibilityChange)}sendTiming(e){this.isHidden||this.config.analyticsTracker&&Math.random()<this.config.sampleRate&&this.config.analyticsTracker(e)}}export{It as SmlMonitor};