bw-frontend-sdk 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -317,16 +317,45 @@ new FrontendSDK(options)
317
317
 
318
318
  ## 性能监控
319
319
 
320
- SDK 自动监控以下性能指标:
321
-
322
- - **首屏加载时间**: First Contentful Paint (FCP)
323
- - **最大内容绘制**: Largest Contentful Paint (LCP)
324
- - **首次输入延迟**: First Input Delay (FID)
325
- - **累积布局偏移**: Cumulative Layout Shift (CLS)
326
- - **DOM加载时间**: DOM Content Loaded
327
- - **页面完全加载时间**: Window Load
328
- - **资源加载时间**: 图片、CSS、JS等资源加载性能
329
- - **API请求响应时间**: Fetch和XMLHttpRequest请求性能
320
+ SDK 提供全面的性能监控功能,包括:
321
+
322
+ 1. **页面性能**: 监控页面加载时间、Web Vitals 等核心指标
323
+ 2. **资源监控**: 监控静态资源加载性能
324
+ 3. **API监控**: 监控接口请求性能
325
+ 4. **路由监控**: 监控 Vue Router 路由跳转的页面浏览时间
326
+ 5. **用户交互**: 监控用户交互性能指标
327
+
328
+ ### 路由监控(Vue Router)
329
+
330
+ 专门为 Vue 3 应用提供路由跳转监控,准确计算页面停留时间:
331
+
332
+ ```javascript
333
+ // 初始化 SDK 后设置路由监控
334
+ const sdk = new FrontendSDK({
335
+ enablePerformanceTracking: true
336
+ })
337
+
338
+ // 设置 Vue Router 监控
339
+ sdk.setupVueRouterMonitoring(router)
340
+
341
+ // 获取当前页面停留时间
342
+ const stayTime = sdk.getCurrentPageStayTime()
343
+
344
+ // 获取路由性能统计
345
+ const routeStats = sdk.getRoutePerformanceStats()
346
+
347
+ // 获取路由历史
348
+ const routeHistory = sdk.getRouteHistory()
349
+ ```
350
+
351
+ **功能特性:**
352
+ - ✅ 监控路由跳转(进入/离开)
353
+ - ✅ 准确计算页面停留时间
354
+ - ✅ 记录完整的路由历史
355
+ - ✅ 提供路由性能统计
356
+ - ✅ 自动上报性能数据
357
+
358
+ 详细使用说明请参考:[Vue 3 路由监控使用指南](./VUE3_ROUTER_MONITORING.md)
330
359
 
331
360
  ## 用户行为追踪
332
361
 
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:i}=Symbol,s=(o=Object.create(null),e=>{const n=t.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())});var o;const a=e=>(e=e.toLowerCase(),t=>s(t)===e),c=e=>t=>typeof t===e,{isArray:u}=Array,l=c("undefined");function h(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const d=a("ArrayBuffer");const p=c("string"),f=c("function"),g=c("number"),m=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==s(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||i in e||r in e)},y=a("Date"),b=a("File"),v=a("Blob"),T=a("FileList"),k=a("URLSearchParams"),[E,S,R,P]=["ReadableStream","Request","Response","Headers"].map(a);function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,i;if("object"!=typeof e&&(e=[e]),u(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(h(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),s=i.length;let o;for(r=0;r<s;r++)o=i[r],t.call(null,e[o],o,e)}}function A(e,t){if(h(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,i=n.length;for(;i-- >0;)if(r=n[i],t===r.toLowerCase())return r;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,D=e=>!l(e)&&e!==C;const I=(_="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>_&&e instanceof _);var _;const L=a("HTMLFormElement"),U=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),N=a("RegExp"),x=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};O(n,(n,i)=>{let s;!1!==(s=t(n,i,e))&&(r[i]=s||n)}),Object.defineProperties(e,r)};const j=a("AsyncFunction"),B=(F="function"==typeof setImmediate,K=f(C.postMessage),F?setImmediate:K?(M=`axios@${Math.random()}`,z=[],C.addEventListener("message",({source:e,data:t})=>{e===C&&t===M&&z.length&&z.shift()()},!1),e=>{z.push(e),C.postMessage(M,"*")}):e=>setTimeout(e));var F,K,M,z;const V="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):"undefined"!=typeof process&&process.nextTick||B;var q={isArray:u,isArrayBuffer:d,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=s(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:w,isEmptyObject:e=>{if(!m(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:E,isRequest:S,isResponse:R,isHeaders:P,isUndefined:l,isDate:y,isFile:b,isBlob:v,isRegExp:N,isFunction:f,isStream:e=>m(e)&&f(e.pipe),isURLSearchParams:k,isTypedArray:I,isFileList:T,forEach:O,merge:function e(){const{caseless:t}=D(this)&&this||{},n={},r=(r,i)=>{const s=t&&A(n,i)||i;w(n[s])&&w(r)?n[s]=e(n[s],r):w(r)?n[s]=e({},r):u(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],r);return n},extend:(t,n,r,{allOwnKeys:i}={})=>(O(n,(n,i)=>{r&&f(n)?t[i]=e(n,r):t[i]=n},{allOwnKeys:i}),t),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,r,i)=>{let s,o,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)a=s[o],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,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(u(e))return e;let t=e.length;if(!g(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.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:L,hasOwnProperty:U,hasOwnProp:U,reduceDescriptors:x,freezeMethods:e=>{x(e,(t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];f(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 u(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:A,global:C,isContextDefined:D,isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[i]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[r]=e;const i=u(e)?[]:{};return O(e,(e,t)=>{const s=n(e,r+1);!l(s)&&(i[t]=s)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:j,isThenable:e=>e&&(m(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:B,asap:V,isIterable:e=>null!=e&&f(e[r])};function Q(e,t,n,r,i){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),i&&(this.response=i,this.status=i.status?i.status:null)}q.inherits(Q,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:q.toJSONObject(this.config),code:this.code,status:this.status}}});const H=Q.prototype,J={};["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=>{J[e]={value:e}}),Object.defineProperties(Q,J),Object.defineProperty(H,"isAxiosError",{value:!0}),Q.from=(e,t,n,r,i,s)=>{const o=Object.create(H);return q.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),Q.call(o,e.message,t,n,r,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};function W(e){return q.isPlainObject(e)||q.isArray(e)}function $(e){return q.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=$(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const G=q.toFlatObject(q,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!q.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=q.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!q.isUndefined(t[e])})).metaTokens,i=n.visitor||u,s=n.dots,o=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&q.isSpecCompliantForm(t);if(!q.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(q.isDate(e))return e.toISOString();if(q.isBoolean(e))return e.toString();if(!a&&q.isBlob(e))throw new Q("Blob is not supported. Use a Buffer instead.");return q.isArrayBuffer(e)||q.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,i){let a=e;if(e&&!i&&"object"==typeof e)if(q.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(q.isArray(e)&&function(e){return q.isArray(e)&&!e.some(W)}(e)||(q.isFileList(e)||q.endsWith(n,"[]"))&&(a=q.toArray(e)))return n=$(n),a.forEach(function(e,r){!q.isUndefined(e)&&null!==e&&t.append(!0===o?X([n],r,s):null===o?n:n+"[]",c(e))}),!1;return!!W(e)||(t.append(X(i,n,s),c(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!q.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!q.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),q.forEach(n,function(n,s){!0===(!(q.isUndefined(n)||null===n)&&i.call(t,n,q.isString(s)?s.trim():s,r,h))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Y(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne;q.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(s=i?i(t,n):q.isURLSearchParams(t)?t.toString():new ee(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ie=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){q.forEach(this.handlers,function(t){null!==t&&e(t)})}},se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,ue=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=ae&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ue,navigator:ce,origin:he}),...oe};function pe(e){function t(e,n,r,i){let s=e[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=e.length;if(s=!s&&q.isArray(r)?r.length:s,a)return q.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!o;r[s]&&q.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],i)&&q.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],t[s]=e[s];return t}(r[s])),!o}if(q.isFormData(e)&&q.isFunction(e.entries)){const n={};return q.forEachEntry(e,(e,r)=>{t(function(e){return q.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const fe={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,i=q.isObject(e);i&&q.isHTMLForm(e)&&(e=new FormData(e));if(q.isFormData(e))return r?JSON.stringify(pe(e)):e;if(q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)||q.isReadableStream(e))return e;if(q.isArrayBufferView(e))return e.buffer;if(q.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&q.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=q.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),function(e,t,n){if(q.isString(e))try{return(t||JSON.parse)(e),q.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(q.isResponse(e)||q.isReadableStream(e))return e;if(e&&q.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 Q.from(e,Q.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:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};q.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var ge=fe;const me=q.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 we=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:q.isArray(e)?e.map(be):String(e)}function ve(e,t,n,r,i){return q.isFunction(r)?r.call(this,t,n):(i&&(t=n),q.isString(t)?q.isString(r)?-1!==t.indexOf(r):q.isRegExp(r)?r.test(t):void 0:void 0)}class Te{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function i(e,t,n){const i=ye(t);if(!i)throw new Error("header name must be a non-empty string");const s=q.findKey(r,i);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=be(e))}const s=(e,t)=>q.forEach(e,(e,n)=>i(e,n,t));if(q.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(q.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!n||t[n]&&me[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(q.isObject(e)&&q.isIterable(e)){let n,r,i={};for(const t of e){if(!q.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[r=t[0]]=(n=i[r])?q.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(i,t)}else null!=e&&i(t,e,n);return this}get(e,t){if(e=ye(e)){const n=q.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(q.isFunction(t))return t.call(this,e,n);if(q.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=q.findKey(this,e);return!(!n||void 0===this[n]||t&&!ve(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function i(e){if(e=ye(e)){const i=q.findKey(n,e);!i||t&&!ve(0,n[i],i,t)||(delete n[i],r=!0)}}return q.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const i=t[n];e&&!ve(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}normalize(e){const t=this,n={};return q.forEach(this,(r,i)=>{const s=q.findKey(n,i);if(s)return t[s]=be(r),void delete t[i];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(i):String(i).trim();o!==i&&delete t[i],t[o]=be(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return q.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&q.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[we]=this[we]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=q.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}(n,e),t[r]=!0)}return q.isArray(e)?e.forEach(r):r(e),this}}Te.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),q.reduceDescriptors(Te.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),q.freezeMethods(Te);var ke=Te;function Ee(e,t){const n=this||ge,r=t||n,i=ke.from(r.headers);let s=r.data;return q.forEach(e,function(e){s=e.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Se(e){return!(!e||!e.__CANCEL__)}function Re(e,t,n){Q.call(this,null==e?"canceled":e,Q.ERR_CANCELED,t,n),this.name="CanceledError"}function Pe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Q("Request failed with status code "+n.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}q.inherits(Re,Q,{__CANCEL__:!0});const Oe=(e,t,n=3)=>{let r=0;const i=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[o];i||(i=c),n[s]=a,r[s]=c;let l=o,h=0;for(;l!==s;)h+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-i<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,i=0,s=1e3/t;const o=(t,s=Date.now())=>{i=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=s?o(e,t):(n=e,r||(r=setTimeout(()=>{r=null,o(n)},s-a)))},()=>n&&o(n)]}(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-r,c=i(a);r=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:n,lengthComputable:null!=o,[t?"download":"upload"]:!0})},n)},Ae=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ce=e=>(...t)=>q.asap(()=>e(...t));var De=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ie=de.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];q.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),q.isString(r)&&o.push("path="+r),q.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.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 _e(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 Le=e=>e instanceof ke?{...e}:e;function Ue(e,t){t=t||{};const n={};function r(e,t,n,r){return q.isPlainObject(e)&&q.isPlainObject(t)?q.merge.call({caseless:r},e,t):q.isPlainObject(t)?q.merge({},t):q.isArray(t)?t.slice():t}function i(e,t,n,i){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e,0,i):r(e,t,0,i)}function s(e,t){if(!q.isUndefined(t))return r(void 0,t)}function o(e,t){return q.isUndefined(t)?q.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,i,s){return s in t?r(n,i):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,n)=>i(Le(e),Le(t),0,!0)};return q.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||i,o=s(e[r],t[r],r);q.isUndefined(o)&&s!==a||(n[r]=o)}),n}var Ne=e=>{const t=Ue({},e);let n,{data:r,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:c}=t;if(t.headers=a=ke.from(a),t.url=re(_e(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),q.isFormData(r))if(de.hasStandardBrowserEnv||de.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(de.hasStandardBrowserEnv&&(i&&q.isFunction(i)&&(i=i(t)),i||!1!==i&&De(t.url))){const e=s&&o&&Ie.read(o);e&&a.set(s,e)}return t};var xe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ne(e);let i=r.data;const s=ke.from(r.headers).normalize();let o,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(o),r.signal&&r.signal.removeEventListener("abort",o)}let g=new XMLHttpRequest;function m(){if(!g)return;const r=ke.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Pe(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:r,config:e,request:g}),g=null}g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(n(new Q("Request aborted",Q.ECONNABORTED,e,g)),g=null)},g.onerror=function(){n(new Q("Network Error",Q.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const i=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Q(t,i.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,e,g)),g=null},void 0===i&&s.setContentType(null),"setRequestHeader"in g&&q.forEach(s.toJSON(),function(e,t){g.setRequestHeader(t,e)}),q.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),h&&"json"!==h&&(g.responseType=r.responseType),p&&([c,l]=Oe(p,!0),g.addEventListener("progress",c)),d&&g.upload&&([a,u]=Oe(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(o=t=>{g&&(n(!t||t.type?new Re(null,e,g):t),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(o),r.signal&&(r.signal.aborted?o():r.signal.addEventListener("abort",o)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);w&&-1===de.protocols.indexOf(w)?n(new Q("Unsupported protocol "+w+":",Q.ERR_BAD_REQUEST,e)):g.send(i||null)})};var je=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const i=function(e){if(!n){n=!0,o();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Q?t:new Re(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,i(new Q(`timeout ${t} of ms exceeded`,Q.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(e=>e.addEventListener("abort",i));const{signal:a}=r;return a.unsubscribe=()=>q.asap(o),a}};const Be=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,i=0;for(;i<n;)r=i+t,yield e.slice(i,r),i=r},Fe=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()}},Ke=(e,t,n,r)=>{const i=async function*(e,t){for await(const n of Fe(e))yield*Be(n,t)}(e,t);let s,o=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await i.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=o+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Me="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=Me&&"function"==typeof ReadableStream,Ve=Me&&("function"==typeof TextEncoder?(qe=new TextEncoder,e=>qe.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var qe;const Qe=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},He=ze&&Qe(()=>{let e=!1;const t=new Request(de.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Je=ze&&Qe(()=>q.isReadableStream(new Response("").body)),We={stream:Je&&(e=>e.body)};var $e;Me&&($e=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!We[e]&&(We[e]=q.isFunction($e[e])?t=>t[e]():(t,n)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,n)})}));const Xe=async(e,t)=>{const n=q.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(q.isBlob(e))return e.size;if(q.isSpecCompliantForm(e)){const t=new Request(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return q.isArrayBufferView(e)||q.isArrayBuffer(e)?e.byteLength:(q.isURLSearchParams(e)&&(e+=""),q.isString(e)?(await Ve(e)).byteLength:void 0)})(t):n};const Ge={http:null,xhr:xe,fetch:Me&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ne(e);u=u?(u+"").toLowerCase():"text";let p,f=je([i,s&&s.toAbortSignal()],o);const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(c&&He&&"get"!==n&&"head"!==n&&0!==(m=await Xe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(q.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ae(m,Oe(Ce(c)));r=Ke(n.body,65536,e,t)}}q.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...d,signal:f,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:i?h:void 0});let s=await fetch(p,d);const o=Je&&("stream"===u||"response"===u);if(Je&&(a||o&&g)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=q.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ae(t,Oe(Ce(a),!0))||[];s=new Response(Ke(s.body,65536,n,()=>{r&&r(),g&&g()}),e)}u=u||"text";let w=await We[q.findKey(We,u)||"text"](s,e);return!o&&g&&g(),await new Promise((t,n)=>{Pe(t,n,{data:w,headers:ke.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:p})})}catch(t){if(g&&g(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Q("Network Error",Q.ERR_NETWORK,e,p),{cause:t.cause||t});throw Q.from(t,t&&t.code,e,p)}})};q.forEach(Ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ye=e=>`- ${e}`,Ze=e=>q.isFunction(e)||null===e||!1===e;var et=e=>{e=q.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!Ze(n)&&(r=Ge[(t=String(n)).toLowerCase()],void 0===r))throw new Q(`Unknown adapter '${t}'`);if(r)break;i[t||"#"+s]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Q("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ye).join("\n"):" "+Ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Re(null,e)}function nt(e){tt(e),e.headers=ke.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return et(e.adapter||ge.adapter)(e).then(function(t){return tt(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=ke.from(t.headers),t},function(t){return Se(t)||(tt(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=ke.from(t.response.headers))),Promise.reject(t)})}const rt="1.11.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const st={};it.transitional=function(e,t,n){function r(e,t){return"[Axios v"+rt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,i,s)=>{if(!1===e)throw new Q(r(i," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!st[i]&&(st[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,s)}},it.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ot={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new Q("option "+s+" must be "+n,Q.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Q("Unknown option "+s,Q.ERR_BAD_OPTION)}},validators:it};const at=ot.validators;class ct{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}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=Ue(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:i}=t;void 0!==n&&ot.assertOptions(n,{silentJSONParsing:at.transitional(at.boolean),forcedJSONParsing:at.transitional(at.boolean),clarifyTimeoutError:at.transitional(at.boolean)},!1),null!=r&&(q.isFunction(r)?t.paramsSerializer={serialize:r}:ot.assertOptions(r,{encode:at.function,serialize:at.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ot.assertOptions(t,{baseUrl:at.spelling("baseURL"),withXsrfToken:at.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=i&&q.merge(i.common,i[t.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=ke.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[nt.bind(this),void 0];for(e.unshift(...o),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=o.length;let d=t;for(h=0;h<l;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=nt.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return re(_e((e=Ue(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(e){ct.prototype[e]=function(t,n){return this.request(Ue(n||{},{method:e,url:t,data:(n||{}).data}))}}),q.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,i){return this.request(Ue(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}ct.prototype[e]=t(),ct.prototype[e+"Form"]=t(!0)});var ut=ct;class lt{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,i){n.reason||(n.reason=new Re(e,r,i),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 lt(function(t){e=t}),cancel:e}}}var ht=lt;const dt={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(dt).forEach(([e,t])=>{dt[t]=e});var pt=dt;const ft=function t(n){const r=new ut(n),i=e(ut.prototype.request,r);return q.extend(i,ut.prototype,r,{allOwnKeys:!0}),q.extend(i,r,null,{allOwnKeys:!0}),i.create=function(e){return t(Ue(n,e))},i}(ge);ft.Axios=ut,ft.CanceledError=Re,ft.CancelToken=ht,ft.isCancel=Se,ft.VERSION=rt,ft.toFormData=Y,ft.AxiosError=Q,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return q.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ue,ft.AxiosHeaders=ke,ft.formToJSON=e=>pe(q.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=et,ft.HttpStatusCode=pt,ft.default=ft;const gt=ft.create({timeout:1e4,headers:{"Content-Type":"application/json"}});gt.interceptors.request.use(e=>(e._startTime=performance.now(),e),e=>Promise.reject(e)),gt.interceptors.response.use(e=>{if(e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return e},e=>{if(e.config&&e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return Promise.reject(e)});class mt{constructor(e){this.config=e,this.isReporting=!1}async report(e,t){if(!this.isReporting){this.isReporting=!0;try{const n=this.formatReportData(e,t);this.config.getConfig().customReport?await this.config.getConfig().customReport(e,n):await this.defaultReport(e,n)}catch(e){console.error("上报失败:",e)}finally{this.isReporting=!1}}}formatReportData(e,t){return{...{type:e,timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}},data:Array.isArray(t)?t:[t]}}async defaultReport(e,t){const n=this.config.getReportUrl(),r=this.config.getThirdPartyConfig();n&&await this.reportToBackend(n,t),r&&Object.keys(r).length>0&&await this.reportToThirdParty(r,t)}async reportToBackend(e,t){try{return(await gt.post(e,t)).data}catch(e){throw console.error("后端上报失败:",e),e}}async reportToThirdParty(e,t){const n=[];e.baidu&&window._hmt&&n.push(this.reportToBaidu(e.baidu,t)),e.umeng&&window._um&&n.push(this.reportToUmeng(e.umeng,t)),e.sensors&&window.sensors&&n.push(this.reportToSensors(e.sensors,t)),e.tencent&&window.MTA&&n.push(this.reportToTencent(e.tencent,t)),e.custom&&n.push(this.reportToCustom(e.custom,t));try{await Promise.allSettled(n)}catch(e){console.error("第三方上报失败:",e)}}async reportToBaidu(e,t){window._hmt&&window._hmt.push(["_trackEvent",t.type,JSON.stringify(t.data)])}async reportToUmeng(e,t){window._um&&window._um.push(["track",t.type,t.data])}async reportToSensors(e,t){window.sensors&&window.sensors.track(t.type,t.data[0]||{})}async reportToTencent(e,t){window.MTA&&window.MTA.Event.stat(t.type,t.data[0]||{})}async reportToCustom(e,t){"function"==typeof e.report&&await e.report(t)}}class wt{constructor(e){this.config=e,this.reporter=new mt(e),this.errorQueue=[],this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableErrorTracking&&this.setupErrorListener(),e.enableUnhandledRejection&&this.setupUnhandledRejectionListener(),e.enableResourceError&&this.setupResourceErrorListener(),this.isInitialized=!0}setupErrorListener(){window.addEventListener("error",e=>{this.handleError(e.error||e.message,{type:"javascript",filename:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack})},!0)}setupUnhandledRejectionListener(){window.addEventListener("unhandledrejection",e=>{this.handleError(e.reason,{type:"unhandledrejection",stack:e.reason?.stack})})}setupResourceErrorListener(){window.addEventListener("error",e=>{e.target&&e.target!==window&&this.handleError(`Resource load failed: ${e.target.src||e.target.href}`,{type:"resource",tagName:e.target.tagName,src:e.target.src,href:e.target.href})},!0)}handleError(e,t={}){const n={message:e?.message||e?.toString()||e,stack:e?.stack||t.stack,type:t.type||"unknown",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,...t};this.errorQueue.push(n),this.errorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushErrorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("error",[n])}reportError(e,t={}){this.handleError(e,t)}flushErrorQueue(){this.errorQueue.length>0&&(this.reporter.report("error",[...this.errorQueue]),this.errorQueue=[])}destroy(){this.flushErrorQueue(),this.isInitialized=!1}}class yt{constructor(e){this.config=e,this.reporter=new mt(e),this.eventQueue=[],this.isInitialized=!1,this.clickListener=null,this.pageViewListener=null}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableClickTracking&&this.setupClickTracking(),e.enablePageViewTracking&&this.setupPageViewTracking(),this.setupPeriodicReport(),this.isInitialized=!0}setupClickTracking(){this.clickListener=e=>{const t=e.target,n={type:"click",timestamp:Date.now(),url:window.location.href,element:{tagName:t.tagName,className:t.className,id:t.id,text:t.textContent?.substring(0,50)},position:{x:e.clientX,y:e.clientY}};this.handleEvent("click",n)},document.addEventListener("click",this.clickListener,!0)}setupPageViewTracking(){this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer}),this.pageViewListener=()=>{this.handleEvent("pageview",{type:"pageview",timestamp:Date.now(),url:window.location.href,title:document.title,referrer:document.referrer})},window.addEventListener("popstate",this.pageViewListener);const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.pageViewListener()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.pageViewListener()},0)}.bind(this)}setupPeriodicReport(){const e=this.config.getConfig().reportInterval;e>0&&setInterval(()=>{this.flushEventQueue()},e)}handleEvent(e,t){const n={eventName:e,...t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.eventQueue.push(n),this.eventQueue.length>=this.config.getConfig().maxQueueSize&&this.flushEventQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("event",[n])}reportEvent(e,t={}){this.handleEvent(e,{type:"custom",timestamp:Date.now(),url:window.location.href,...t})}flushEventQueue(){this.eventQueue.length>0&&(this.reporter.report("event",[...this.eventQueue]),this.eventQueue=[])}destroy(){this.flushEventQueue(),this.clickListener&&document.removeEventListener("click",this.clickListener,!0),this.pageViewListener&&window.removeEventListener("popstate",this.pageViewListener),this.isInitialized=!1}}class bt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.pageStartTime=Date.now(),this.performanceQueue=[],this.thirdPartySDKs={},this.metrics={fcp:0,lcp:0,fid:0,cls:0,ttfb:0,domLoad:0,windowLoad:0,resourceLoad:[],apiRequests:[]}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePerformanceTracking&&this.setupPerformanceMonitoring(),e.enableResourceTracking&&this.setupResourceMonitoring(),e.enableApiTracking&&this.setupApiMonitoring(),e.enableInteractionTracking&&this.setupInteractionMonitoring(),this.initThirdPartySDKs(),this.isInitialized=!0}setupPerformanceMonitoring(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.captureDOMLoadTime()}):this.captureDOMLoadTime(),window.addEventListener("load",()=>{this.captureWindowLoadTime(),this.captureWebVitals(),this.reportPerformanceMetrics()}),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupResourceMonitoring(){const e=new PerformanceObserver(e=>{for(const t of e.getEntries())"resource"===t.entryType&&this.handleResourceLoad(t)});try{e.observe({entryTypes:["resource"]})}catch(e){this.setupResourceFallback()}}setupApiMonitoring(){void 0!==window.axios&&(window.axios.interceptors.request.use(e=>(e._startTime=performance.now(),e)),window.axios.interceptors.response.use(e=>{const t=performance.now()-e.config._startTime;return console.log("duration----",e.config.url,t,e.status),this.handleApiRequest(e.config.url,t,e.status),e},e=>{if(e.config){const t=performance.now()-e.config._startTime;console.log("duration----",e.config.url,t,"error"),this.handleApiRequest(e.config.url,t,"error")}throw e}))}setupInteractionMonitoring(){let e=0,t=0;const n=r=>{0===e&&(e=performance.now(),t=e-this.metrics.fcp,this.metrics.fid=t,document.removeEventListener("click",n,!0),document.removeEventListener("keydown",n,!0),document.removeEventListener("touchstart",n,!0))};document.addEventListener("click",n,!0),document.addEventListener("keydown",n,!0),document.addEventListener("touchstart",n,!0)}captureDOMLoadTime(){this.metrics.domLoad=performance.now()}captureWindowLoadTime(){this.metrics.windowLoad=performance.now()}captureWebVitals(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.fcp=t.startTime)}).observe({entryTypes:["paint"]})}catch(e){console.warn("FCP监控失败:",e)}if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.metrics.lcp=t.startTime}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP监控失败:",e)}if("PerformanceObserver"in window)try{let e=0;new PerformanceObserver(t=>{for(const n of t.getEntries())n.hadRecentInput||(e+=n.value);this.metrics.cls=e}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS监控失败:",e)}}handleResourceLoad(e){const t={name:e.name,type:e.initiatorType,duration:e.duration,size:e.transferSize,timestamp:Date.now()};this.metrics.resourceLoad.push(t),e.duration>3e3&&this.reportSlowResource(t)}handleApiRequest(e,t,n){const r={url:"string"==typeof e?e:e.toString(),duration:t,status:n,timestamp:Date.now()};this.metrics.apiRequests.push(r),t>5e3&&this.reportSlowApi(r)}handlePageHidden(){this.calculatePageStayTime()}handlePageVisible(){this.pageStartTime=Date.now()}calculatePageStayTime(){const e=Date.now()-this.pageStartTime;this.reportPageStayTime(e)}reportPerformanceMetrics(){const e={type:"performance",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,metrics:this.metrics,user:this.config.getUser(),device:this.getDeviceInfo()};this.performanceQueue.push(e),this.performanceQueue.length>=this.config.getConfig().maxQueueSize&&this.flushPerformanceQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("performance",[e])}reportSlowResource(e){this.reporter.report("slow_resource",[e])}reportSlowApi(e){this.reporter.report("slow_api",[e])}reportPageStayTime(e){const t={type:"page_stay",url:window.location.href,stayTime:e,timestamp:Date.now()};this.reporter.report("page_stay",[t])}getDeviceInfo(){return{screen:{width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth},viewport:{width:window.innerWidth,height:window.innerHeight},connection:navigator.connection?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,memory:navigator.memory?{usedJSHeapSize:navigator.memory.usedJSHeapSize,totalJSHeapSize:navigator.memory.totalJSHeapSize,jsHeapSizeLimit:navigator.memory.jsHeapSizeLimit}:null}}initThirdPartySDKs(){const e=this.config.getThirdPartyConfig();e.baidu&&window._hmt&&(this.thirdPartySDKs.baidu=window._hmt),e.umeng&&window._um&&(this.thirdPartySDKs.umeng=window._um),e.sensors&&window.sensors&&(this.thirdPartySDKs.sensors=window.sensors),e.tencent&&window.MTA&&(this.thirdPartySDKs.tencent=window.MTA)}flushPerformanceQueue(){this.performanceQueue.length>0&&(this.reporter.report("performance",[...this.performanceQueue]),this.performanceQueue=[])}reportPerformance(e={}){const t={type:"custom_performance",timestamp:Date.now(),url:window.location.href,metrics:e,user:this.config.getUser()};this.reporter.report("performance",[t])}getCurrentMetrics(){return{...this.metrics}}destroy(){this.flushPerformanceQueue(),this.isInitialized=!1}}class vt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.behaviorQueue=[],this.sessionId=this.generateSessionId(),this.pageStartTime=Date.now(),this.scrollDepth=0,this.mouseMovements=[],this.keyStrokes=[],this.formInteractions=[],this.behaviors={pageViews:[],clicks:[],scrolls:[],formSubmissions:[],navigation:[],timeOnPage:0}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePageViewTracking&&this.setupPageViewTracking(),e.enableUserInteractionTracking&&this.setupUserInteractionTracking(),e.enableFormTracking&&this.setupFormTracking(),e.enableScrollTracking&&this.setupScrollTracking(),e.enableMouseTracking&&this.setupMouseTracking(),e.enableKeyboardTracking&&this.setupKeyboardTracking(),this.setupTimeTracking(),this.trackReferrer(),this.isInitialized=!0}setupPageViewTracking(){this.trackPageView(),this.setupRouteChangeTracking(),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupRouteChangeTracking(){window.addEventListener("popstate",()=>{this.trackPageView()});const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.trackPageView()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.trackPageView()},0)}.bind(this)}setupUserInteractionTracking(){document.addEventListener("click",e=>{this.trackClick(e)},!0),document.addEventListener("dblclick",e=>{this.trackDoubleClick(e)},!0),document.addEventListener("contextmenu",e=>{this.trackRightClick(e)},!0),"ontouchstart"in window&&document.addEventListener("touchstart",e=>{this.trackTouch(e)},!0)}setupFormTracking(){document.addEventListener("submit",e=>{this.trackFormSubmission(e)},!0),document.addEventListener("change",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldChange(e)},!0),document.addEventListener("focus",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldFocus(e)},!0),document.addEventListener("blur",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldBlur(e)},!0)}setupScrollTracking(){let e;document.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(()=>{const e=window.pageYOffset||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,n=document.documentElement.clientHeight,r=Math.round(e/(t-n)*100);r>this.scrollDepth&&(this.scrollDepth=r,this.trackScroll(r,e))},100)},{passive:!0})}setupMouseTracking(){let e,t=[];document.addEventListener("mousemove",n=>{clearTimeout(e),t.push({x:n.clientX,y:n.clientY,timestamp:Date.now()}),t.length>100&&t.shift(),e=setTimeout(()=>{t.length>10&&(this.trackMouseMovement(t),t=[])},1e3)},{passive:!0})}setupKeyboardTracking(){document.addEventListener("keydown",e=>{"password"!==e.target.type&&this.trackKeyStroke(e)},!0)}setupTimeTracking(){setInterval(()=>{this.behaviors.timeOnPage+=1},1e3),window.addEventListener("beforeunload",()=>{this.reportTimeOnPage()})}trackReferrer(){const e=document.referrer;if(e){const t={type:"referrer",url:e,domain:this.extractDomain(e),timestamp:Date.now()};this.behaviors.navigation.push(t),this.reportBehavior("referrer",t)}}trackPageView(){const e={type:"pageview",url:window.location.href,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer};this.behaviors.pageViews.push(e),this.reportBehavior("pageview",e),this.pageStartTime=Date.now(),this.scrollDepth=0}trackClick(e){const t={type:"click",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id,text:e.target.textContent?.substring(0,50),href:e.target.href},position:{x:e.clientX,y:e.clientY,pageX:e.pageX,pageY:e.pageY},timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.clicks.push(t),this.reportBehavior("click",t)}trackDoubleClick(e){const t={type:"doubleclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("doubleclick",t)}trackRightClick(e){const t={type:"rightclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("rightclick",t)}trackTouch(e){const t={type:"touch",touches:Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY,identifier:e.identifier})),timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("touch",t)}trackFormSubmission(e){const t={type:"form_submission",form:{action:e.target.action,method:e.target.method,id:e.target.id,className:e.target.className},fields:this.getFormFields(e.target),timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.formSubmissions.push(t),this.reportBehavior("form_submission",t)}trackFormFieldChange(e){const t={type:"form_field_change",field:{name:e.target.name,type:e.target.type,value:"password"===e.target.type?"***":e.target.value,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_change",t)}trackFormFieldFocus(e){const t={type:"form_field_focus",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_focus",t)}trackFormFieldBlur(e){const t={type:"form_field_blur",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_blur",t)}trackScroll(e,t){const n={type:"scroll",depth:e,scrollTop:t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("scroll",n)}trackMouseMovement(e){const t={type:"mouse_movement",movements:e,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("mouse_movement",t)}trackKeyStroke(e){const t={type:"keystroke",key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("keystroke",t)}handlePageHidden(){this.reportTimeOnPage()}handlePageVisible(){this.pageStartTime=Date.now()}reportTimeOnPage(){const e={type:"time_on_page",time:this.behaviors.timeOnPage,url:window.location.href,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("time_on_page",e)}reportBehavior(e,t){const n={type:e,data:t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.behaviorQueue.push(n),this.behaviorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushBehaviorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("behavior",[n])}reportCustomBehavior(e,t={}){const n={type:"custom_behavior",eventName:e,...t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("custom_behavior",n)}flushBehaviorQueue(){this.behaviorQueue.length>0&&(this.reporter.report("behavior",[...this.behaviorQueue]),this.behaviorQueue=[])}getFormFields(e){const t=[],n=e.elements;for(let e=0;e<n.length;e++){const r=n[e];r.name&&t.push({name:r.name,type:r.type,value:"password"===r.type?"***":r.value})}return t}extractDomain(e){try{return new URL(e).hostname}catch(t){return e}}generateSessionId(){return"session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}getCurrentBehaviors(){return{...this.behaviors}}getSessionId(){return this.sessionId}destroy(){this.flushBehaviorQueue(),this.reportTimeOnPage(),this.isInitialized=!1}}class Tt{constructor(e){this.config=e,this.integratedSDKs={},this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getThirdPartyConfig();e.baidu&&e.baidu.enabled&&this.initBaiduAnalytics(e.baidu),e.umeng&&e.umeng.enabled&&this.initUmengAnalytics(e.umeng),e.sensors&&e.sensors.enabled&&this.initSensorsAnalytics(e.sensors),e.tencent&&e.tencent.enabled&&this.initTencentAnalytics(e.tencent),e.google&&e.google.enabled&&this.initGoogleAnalytics(e.google),e.custom&&e.custom.enabled&&this.initCustomAnalytics(e.custom),this.isInitialized=!0}initBaiduAnalytics(e){try{window._hmt?(this.integratedSDKs.baidu={name:"baidu",instance:window._hmt,config:e},e.siteId&&window._hmt.push(["_setAccount",e.siteId]),!1!==e.autoPageview&&window._hmt.push(["_trackPageview"]),console.log("百度统计集成成功")):console.warn("百度统计未加载,请检查脚本是否正确引入")}catch(e){console.error("百度统计集成失败:",e)}}initUmengAnalytics(e){try{window._um?(this.integratedSDKs.umeng={name:"umeng",instance:window._um,config:e},e.siteId&&window._um.push(["setAccount",e.siteId]),!1!==e.autoPageview&&window._um.push(["trackPageview"]),console.log("友盟统计集成成功")):console.warn("友盟统计未加载,请检查脚本是否正确引入")}catch(e){console.error("友盟统计集成失败:",e)}}initSensorsAnalytics(e){try{window.sensors?(this.integratedSDKs.sensors={name:"sensors",instance:window.sensors,config:e},e.serverUrl&&window.sensors.setServerUrl(e.serverUrl),e.siteId&&window.sensors.setSiteId(e.siteId),!1!==e.autoPageview&&window.sensors.trackPageview(),console.log("神策数据集成成功")):console.warn("神策数据未加载,请检查脚本是否正确引入")}catch(e){console.error("神策数据集成失败:",e)}}initTencentAnalytics(e){try{window.MTA?(this.integratedSDKs.tencent={name:"tencent",instance:window.MTA,config:e},e.appId&&window.MTA.setAppId(e.appId),!1!==e.autoPageview&&window.MTA.trackPageview(),console.log("腾讯云分析集成成功")):console.warn("腾讯云分析未加载,请检查脚本是否正确引入")}catch(e){console.error("腾讯云分析集成失败:",e)}}initGoogleAnalytics(e){try{window.gtag?(this.integratedSDKs.google={name:"google",instance:window.gtag,config:e},e.measurementId&&window.gtag("config",e.measurementId,{page_title:document.title,page_location:window.location.href}),console.log("Google Analytics集成成功")):console.warn("Google Analytics未加载,请检查脚本是否正确引入")}catch(e){console.error("Google Analytics集成失败:",e)}}initCustomAnalytics(e){try{if("function"==typeof e.init){const t=e.init(e);this.integratedSDKs.custom={name:"custom",instance:t,config:e},console.log("自定义第三方集成成功")}else console.warn("自定义第三方配置缺少init函数")}catch(e){console.error("自定义第三方集成失败:",e)}}reportEvent(e,t={}){Object.values(this.integratedSDKs).forEach(n=>{try{this.reportToSDK(n,e,t)}catch(e){console.error(`上报事件到${n.name}失败:`,e)}})}reportPageView(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPageViewToSDK(t,e)}catch(e){console.error(`上报页面浏览到${t.name}失败:`,e)}})}reportUser(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportUserToSDK(t,e)}catch(e){console.error(`上报用户信息到${t.name}失败:`,e)}})}reportPerformance(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPerformanceToSDK(t,e)}catch(e){console.error(`上报性能指标到${t.name}失败:`,e)}})}reportToSDK(e,t,n){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent",t,JSON.stringify(n)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track",t,n]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track(t,n);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat(t,n);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event",t,n);break;case"custom":e.instance&&"function"==typeof e.instance.track&&e.instance.track(t,n);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPageViewToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackPageview",t.url||window.location.href]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["trackPageview",t.url||window.location.href]);break;case"sensors":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t);break;case"tencent":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t.url||window.location.href);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("config",e.config.measurementId,{page_title:t.title||document.title,page_location:t.url||window.location.href});break;case"custom":e.instance&&"function"==typeof e.instance.trackPageview&&e.instance.trackPageview(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportUserToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&(e.instance.push(["_setUserTag","userId",t.userId]),e.instance.push(["_setUserTag","userType",t.userType]));break;case"umeng":e.instance&&e.instance.push&&(e.instance.push(["setUserTag","userId",t.userId]),e.instance.push(["setUserTag","userType",t.userType]));break;case"sensors":e.instance&&e.instance.setProfile&&e.instance.setProfile(t);break;case"tencent":e.instance&&e.instance.setUserInfo&&e.instance.setUserInfo(t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("set","user_id",t.userId);break;case"custom":e.instance&&"function"==typeof e.instance.setUser&&e.instance.setUser(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPerformanceToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent","performance",JSON.stringify(t)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track","performance",t]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track("performance",t);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat("performance",t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event","performance",t);break;case"custom":e.instance&&"function"==typeof e.instance.trackPerformance&&e.instance.trackPerformance(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}isSDKIntegrated(e){return!!this.integratedSDKs[e]}getIntegratedSDKs(){return Object.keys(this.integratedSDKs)}getSDKInstance(e){return this.integratedSDKs[e]?.instance||null}destroy(){Object.values(this.integratedSDKs).forEach(e=>{try{e.instance&&"function"==typeof e.instance.destroy&&e.instance.destroy()}catch(t){console.error(`销毁${e.name}失败:`,t)}}),this.integratedSDKs={},this.isInitialized=!1}}class kt{constructor(e={}){this.config={appId:e.appId||"",appVersion:e.appVersion||"1.0.0",environment:e.environment||"production",reportUrl:e.reportUrl||"",reportInterval:e.reportInterval||5e3,maxQueueSize:e.maxQueueSize||100,enableErrorTracking:!1!==e.enableErrorTracking,enableUnhandledRejection:!1!==e.enableUnhandledRejection,enableResourceError:!1!==e.enableResourceError,enableEventTracking:!1!==e.enableEventTracking,enableClickTracking:!1!==e.enableClickTracking,enablePageViewTracking:!1!==e.enablePageViewTracking,enablePerformanceTracking:!1!==e.enablePerformanceTracking,enableResourceTracking:!1!==e.enableResourceTracking,enableApiTracking:!1!==e.enableApiTracking,enableInteractionTracking:!1!==e.enableInteractionTracking,enableUserInteractionTracking:!1!==e.enableUserInteractionTracking,enableFormTracking:!1!==e.enableFormTracking,enableScrollTracking:!1!==e.enableScrollTracking,enableMouseTracking:!1!==e.enableMouseTracking,enableKeyboardTracking:!1!==e.enableKeyboardTracking,thirdPartyConfig:e.thirdPartyConfig||{},user:e.user||null,customReport:e.customReport||null},this.user=null}updateConfig(e){this.config={...this.config,...e}}setUser(e){this.user=e}getConfig(){return this.config}getUser(){return this.user}getReportUrl(){return this.config.reportUrl}getThirdPartyConfig(){return this.config.thirdPartyConfig}isErrorTrackingEnabled(){return this.config.enableErrorTracking}isEventTrackingEnabled(){return this.config.enableEventTracking}}"undefined"==typeof window||window.axios||(window.axios=gt);class Et{constructor(e={}){this.config=new kt(e),this.errorTracker=new wt(this.config),this.eventTracker=new yt(this.config),this.performanceTracker=new bt(this.config),this.userBehaviorTracker=new vt(this.config),this.thirdPartyIntegrator=new Tt(this.config),this.init()}init(){this.errorTracker.init(),this.eventTracker.init(),this.performanceTracker.init(),this.userBehaviorTracker.init(),this.thirdPartyIntegrator.init(),console.log("Frontend SDK 初始化完成")}reportError(e,t={}){this.errorTracker.reportError(e,t)}reportEvent(e,t={}){this.eventTracker.reportEvent(e,t)}reportPerformance(e={}){this.performanceTracker.reportPerformance(e)}reportBehavior(e,t={}){this.userBehaviorTracker.reportCustomBehavior(e,t)}setUser(e){this.config.setUser(e),this.thirdPartyIntegrator.reportUser(e)}setConfig(e){this.config.updateConfig(e)}getPerformanceMetrics(){return this.performanceTracker.getCurrentMetrics()}getBehaviorData(){return this.userBehaviorTracker.getCurrentBehaviors()}getSessionId(){return this.userBehaviorTracker.getSessionId()}isThirdPartySDKIntegrated(e){return this.thirdPartyIntegrator.isSDKIntegrated(e)}getIntegratedThirdPartySDKs(){return this.thirdPartyIntegrator.getIntegratedSDKs()}destroy(){this.errorTracker.destroy(),this.eventTracker.destroy(),this.performanceTracker.destroy(),this.userBehaviorTracker.destroy(),this.thirdPartyIntegrator.destroy(),console.log("Frontend SDK 已销毁")}}export{Et as default};
1
+ function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:r}=Object,{iterator:n,toStringTag:i}=Symbol,o=(s=Object.create(null),e=>{const r=t.call(e);return s[r]||(s[r]=r.slice(8,-1).toLowerCase())});var s;const a=e=>(e=e.toLowerCase(),t=>o(t)===e),c=e=>t=>typeof t===e,{isArray:u}=Array,l=c("undefined");function h(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const d=a("ArrayBuffer");const p=c("string"),f=c("function"),g=c("number"),m=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==o(e))return!1;const t=r(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||i in e||n in e)},y=a("Date"),b=a("File"),T=a("Blob"),v=a("FileList"),S=a("URLSearchParams"),[k,E,R,P]=["ReadableStream","Request","Response","Headers"].map(a);function O(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),u(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(h(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function C(e,t){if(h(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,A=e=>!l(e)&&e!==D;const I=(_="undefined"!=typeof Uint8Array&&r(Uint8Array),e=>_&&e instanceof _);var _;const L=a("HTMLFormElement"),U=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),N=a("RegExp"),x=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};O(r,(r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)}),Object.defineProperties(e,n)};const j=a("AsyncFunction"),B=(F="function"==typeof setImmediate,M=f(D.postMessage),F?setImmediate:M?(K=`axios@${Math.random()}`,z=[],D.addEventListener("message",({source:e,data:t})=>{e===D&&t===K&&z.length&&z.shift()()},!1),e=>{z.push(e),D.postMessage(K,"*")}):e=>setTimeout(e));var F,M,K,z;const V="undefined"!=typeof queueMicrotask?queueMicrotask.bind(D):"undefined"!=typeof process&&process.nextTick||B;var q={isArray:u,isArrayBuffer:d,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=o(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:w,isEmptyObject:e=>{if(!m(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:k,isRequest:E,isResponse:R,isHeaders:P,isUndefined:l,isDate:y,isFile:b,isBlob:T,isRegExp:N,isFunction:f,isStream:e=>m(e)&&f(e.pipe),isURLSearchParams:S,isTypedArray:I,isFileList:v,forEach:O,merge:function e(){const{caseless:t}=A(this)&&this||{},r={},n=(n,i)=>{const o=t&&C(r,i)||i;w(r[o])&&w(n)?r[o]=e(r[o],n):w(n)?r[o]=e({},n):u(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],n);return r},extend:(t,r,n,{allOwnKeys:i}={})=>(O(r,(r,i)=>{n&&f(r)?t[i]=e(r,n):t[i]=r},{allOwnKeys:i}),t),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,n,i)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&r(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!g(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[n]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:L,hasOwnProperty:U,hasOwnProp:U,reduceDescriptors:x,freezeMethods:e=>{x(e,(t,r)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];f(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return u(e)?n(e):n(String(e).split(t)),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=+e)?e:t,findKey:C,global:D,isContextDefined:A,isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[i]&&e[n])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[n]=e;const i=u(e)?[]:{};return O(e,(e,t)=>{const o=r(e,n+1);!l(o)&&(i[t]=o)}),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:j,isThenable:e=>e&&(m(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:B,asap:V,isIterable:e=>null!=e&&f(e[n])};function H(e,t,r,n,i){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),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}q.inherits(H,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:q.toJSONObject(this.config),code:this.code,status:this.status}}});const Q=H.prototype,$={};["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=>{$[e]={value:e}}),Object.defineProperties(H,$),Object.defineProperty(Q,"isAxiosError",{value:!0}),H.from=(e,t,r,n,i,o)=>{const s=Object.create(Q);return q.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),H.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function J(e){return q.isPlainObject(e)||q.isArray(e)}function W(e){return q.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,r){return e?e.concat(t).map(function(e,t){return e=W(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const G=q.toFlatObject(q,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,r){if(!q.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=q.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!q.isUndefined(t[e])})).metaTokens,i=r.visitor||u,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&q.isSpecCompliantForm(t);if(!q.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(q.isDate(e))return e.toISOString();if(q.isBoolean(e))return e.toString();if(!a&&q.isBlob(e))throw new H("Blob is not supported. Use a Buffer instead.");return q.isArrayBuffer(e)||q.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(q.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(q.isArray(e)&&function(e){return q.isArray(e)&&!e.some(J)}(e)||(q.isFileList(e)||q.endsWith(r,"[]"))&&(a=q.toArray(e)))return r=W(r),a.forEach(function(e,n){!q.isUndefined(e)&&null!==e&&t.append(!0===s?X([r],n,o):null===s?r:r+"[]",c(e))}),!1;return!!J(e)||(t.append(X(i,r,o),c(e)),!1)}const l=[],h=Object.assign(G,{defaultVisitor:u,convertValue:c,isVisitable:J});if(!q.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!q.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),q.forEach(r,function(r,o){!0===(!(q.isUndefined(r)||null===r)&&i.call(t,r,q.isString(o)?o.trim():o,n,h))&&e(r,n?n.concat(o):[o])}),l.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Y(e,this,t)}const te=ee.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ne(e,t,r){if(!t)return e;const n=r&&r.encode||re;q.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let o;if(o=i?i(t,r):q.isURLSearchParams(t)?t.toString():new ee(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ie=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){q.forEach(this.handlers,function(t){null!==t&&e(t)})}},oe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},se={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,ue=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),le="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=ae&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserWebWorkerEnv:le,hasStandardBrowserEnv:ue,navigator:ce,origin:he}),...se};function pe(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&q.isArray(n)?n.length:o,a)return q.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&q.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&q.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(q.isFormData(e)&&q.isFunction(e.entries)){const r={};return q.forEachEntry(e,(e,n)=>{t(function(e){return q.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const fe={transitional:oe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=q.isObject(e);i&&q.isHTMLForm(e)&&(e=new FormData(e));if(q.isFormData(e))return n?JSON.stringify(pe(e)):e;if(q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)||q.isReadableStream(e))return e;if(q.isArrayBufferView(e))return e.buffer;if(q.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,r,n){return de.isNode&&q.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=q.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(q.isString(e))try{return(t||JSON.parse)(e),q.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fe.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(q.isResponse(e)||q.isReadableStream(e))return e;if(e&&q.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw H.from(e,H.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:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};q.forEach(["delete","get","head","post","put","patch"],e=>{fe.headers[e]={}});var ge=fe;const me=q.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 we=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:q.isArray(e)?e.map(be):String(e)}function Te(e,t,r,n,i){return q.isFunction(n)?n.call(this,t,r):(i&&(t=r),q.isString(t)?q.isString(n)?-1!==t.indexOf(n):q.isRegExp(n)?n.test(t):void 0:void 0)}class ve{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=ye(t);if(!i)throw new Error("header name must be a non-empty string");const o=q.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=be(e))}const o=(e,t)=>q.forEach(e,(e,r)=>i(e,r,t));if(q.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(q.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach(function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&me[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(q.isObject(e)&&q.isIterable(e)){let r,n,i={};for(const t of e){if(!q.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[n=t[0]]=(r=i[n])?q.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=ye(e)){const r=q.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(q.isFunction(t))return t.call(this,e,r);if(q.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const r=q.findKey(this,e);return!(!r||void 0===this[r]||t&&!Te(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=ye(e)){const i=q.findKey(r,e);!i||t&&!Te(0,r[i],i,t)||(delete r[i],n=!0)}}return q.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!Te(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return q.forEach(this,(n,i)=>{const o=q.findKey(r,i);if(o)return t[o]=be(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(i):String(i).trim();s!==i&&delete t[i],t[s]=be(n),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return q.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&q.isArray(r)?r.join(", "):r)}),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 r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[we]=this[we]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ye(e);t[n]||(!function(e,t){const r=q.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})})}(r,e),t[n]=!0)}return q.isArray(e)?e.forEach(n):n(e),this}}ve.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),q.reduceDescriptors(ve.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),q.freezeMethods(ve);var Se=ve;function ke(e,t){const r=this||ge,n=t||r,i=Se.from(n.headers);let o=n.data;return q.forEach(e,function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Ee(e){return!(!e||!e.__CANCEL__)}function Re(e,t,r){H.call(this,null==e?"canceled":e,H.ERR_CANCELED,t,r),this.name="CanceledError"}function Pe(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new H("Request failed with status code "+r.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}q.inherits(Re,H,{__CANCEL__:!0});const Oe=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[s];i||(i=c),r[o]=a,n[o]=c;let l=s,h=0;for(;l!==o;)h+=r[l++],l%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(r=e,n||(n=setTimeout(()=>{n=null,s(r)},o-a)))},()=>r&&s(r)]}(r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=o-n,c=i(a);n=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})},r)},Ce=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},De=e=>(...t)=>q.asap(()=>e(...t));var Ae=de.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,de.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,Ie=de.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];q.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),q.isString(n)&&s.push("path="+n),q.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.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 _e(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Le=e=>e instanceof Se?{...e}:e;function Ue(e,t){t=t||{};const r={};function n(e,t,r,n){return q.isPlainObject(e)&&q.isPlainObject(t)?q.merge.call({caseless:n},e,t):q.isPlainObject(t)?q.merge({},t):q.isArray(t)?t.slice():t}function i(e,t,r,i){return q.isUndefined(t)?q.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function o(e,t){if(!q.isUndefined(t))return n(void 0,t)}function s(e,t){return q.isUndefined(t)?q.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}const c={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(Le(e),Le(t),0,!0)};return q.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||i,s=o(e[n],t[n],n);q.isUndefined(s)&&o!==a||(r[n]=s)}),r}var Ne=e=>{const t=Ue({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=Se.from(a),t.url=ne(_e(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),q.isFormData(n))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[e,...t]=r?r.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(de.hasStandardBrowserEnv&&(i&&q.isFunction(i)&&(i=i(t)),i||!1!==i&&Ae(t.url))){const e=o&&s&&Ie.read(s);e&&a.set(o,e)}return t};var xe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Ne(e);let i=n.data;const o=Se.from(n.headers).normalize();let s,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=n;function f(){u&&u(),l&&l(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let g=new XMLHttpRequest;function m(){if(!g)return;const n=Se.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());Pe(function(e){t(e),f()},function(e){r(e),f()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:n,config:e,request:g}),g=null}g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout,"onloadend"in g?g.onloadend=m:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(m)},g.onabort=function(){g&&(r(new H("Request aborted",H.ECONNABORTED,e,g)),g=null)},g.onerror=function(){r(new H("Network Error",H.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||oe;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new H(t,i.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,e,g)),g=null},void 0===i&&o.setContentType(null),"setRequestHeader"in g&&q.forEach(o.toJSON(),function(e,t){g.setRequestHeader(t,e)}),q.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),h&&"json"!==h&&(g.responseType=n.responseType),p&&([c,l]=Oe(p,!0),g.addEventListener("progress",c)),d&&g.upload&&([a,u]=Oe(d),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(s=t=>{g&&(r(!t||t.type?new Re(null,e,g):t),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const w=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);w&&-1===de.protocols.indexOf(w)?r(new H("Unsupported protocol "+w+":",H.ERR_BAD_REQUEST,e)):g.send(i||null)})};var je=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const i=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof H?t:new Re(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,i(new H(`timeout ${t} of ms exceeded`,H.ETIMEDOUT))},t);const 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));const{signal:a}=n;return a.unsubscribe=()=>q.asap(s),a}};const Be=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},Fe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Me=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of Fe(e))yield*Be(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Ke="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=Ke&&"function"==typeof ReadableStream,Ve=Ke&&("function"==typeof TextEncoder?(qe=new TextEncoder,e=>qe.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var qe;const He=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Qe=ze&&He(()=>{let e=!1;const t=new Request(de.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),$e=ze&&He(()=>q.isReadableStream(new Response("").body)),Je={stream:$e&&(e=>e.body)};var We;Ke&&(We=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Je[e]&&(Je[e]=q.isFunction(We[e])?t=>t[e]():(t,r)=>{throw new H(`Response type '${e}' is not supported`,H.ERR_NOT_SUPPORT,r)})}));const Xe=async(e,t)=>{const r=q.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(q.isBlob(e))return e.size;if(q.isSpecCompliantForm(e)){const t=new Request(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return q.isArrayBufferView(e)||q.isArrayBuffer(e)?e.byteLength:(q.isURLSearchParams(e)&&(e+=""),q.isString(e)?(await Ve(e)).byteLength:void 0)})(t):r};const Ge={http:null,xhr:xe,fetch:Ke&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:h="same-origin",fetchOptions:d}=Ne(e);u=u?(u+"").toLowerCase():"text";let p,f=je([i,o&&o.toAbortSignal()],s);const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(c&&Qe&&"get"!==r&&"head"!==r&&0!==(m=await Xe(l,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(q.isFormData(n)&&(e=r.headers.get("content-type"))&&l.setContentType(e),r.body){const[e,t]=Ce(m,Oe(De(c)));n=Me(r.body,65536,e,t)}}q.isString(h)||(h=h?"include":"omit");const i="credentials"in Request.prototype;p=new Request(t,{...d,signal:f,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",credentials:i?h:void 0});let o=await fetch(p,d);const s=$e&&("stream"===u||"response"===u);if($e&&(a||s&&g)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=o[t]});const t=q.toFiniteNumber(o.headers.get("content-length")),[r,n]=a&&Ce(t,Oe(De(a),!0))||[];o=new Response(Me(o.body,65536,r,()=>{n&&n(),g&&g()}),e)}u=u||"text";let w=await Je[q.findKey(Je,u)||"text"](o,e);return!s&&g&&g(),await new Promise((t,r)=>{Pe(t,r,{data:w,headers:Se.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})})}catch(t){if(g&&g(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new H("Network Error",H.ERR_NETWORK,e,p),{cause:t.cause||t});throw H.from(t,t&&t.code,e,p)}})};q.forEach(Ge,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ye=e=>`- ${e}`,Ze=e=>q.isFunction(e)||null===e||!1===e;var et=e=>{e=q.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o<t;o++){let t;if(r=e[o],n=r,!Ze(r)&&(n=Ge[(t=String(r)).toLowerCase()],void 0===n))throw new H(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+o]=n}if(!n){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new H("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Ye).join("\n"):" "+Ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function tt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Re(null,e)}function rt(e){tt(e),e.headers=Se.from(e.headers),e.data=ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return et(e.adapter||ge.adapter)(e).then(function(t){return tt(e),t.data=ke.call(e,e.transformResponse,t),t.headers=Se.from(t.headers),t},function(t){return Ee(t)||(tt(e),t&&t.response&&(t.response.data=ke.call(e,e.transformResponse,t.response),t.response.headers=Se.from(t.response.headers))),Promise.reject(t)})}const nt="1.11.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ot={};it.transitional=function(e,t,r){function n(e,t){return"[Axios v"+nt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new H(n(i," has been removed"+(t?" in "+t:"")),H.ERR_DEPRECATED);return t&&!ot[i]&&(ot[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)}},it.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var st={assertOptions:function(e,t,r){if("object"!=typeof e)throw new H("options must be an object",H.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new H("option "+o+" must be "+r,H.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new H("Unknown option "+o,H.ERR_BAD_OPTION)}},validators:it};const at=st.validators;class ct{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}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 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){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ue(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&st.assertOptions(r,{silentJSONParsing:at.transitional(at.boolean),forcedJSONParsing:at.transitional(at.boolean),clarifyTimeoutError:at.transitional(at.boolean)},!1),null!=n&&(q.isFunction(n)?t.paramsSerializer={serialize:n}:st.assertOptions(n,{encode:at.function,serialize:at.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),st.assertOptions(t,{baseUrl:at.spelling("baseURL"),withXsrfToken:at.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&q.merge(i.common,i[t.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],e=>{delete i[e]}),t.headers=Se.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[rt.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=s.length;let d=t;for(h=0;h<l;){const e=s[h++],t=s[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=rt.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return ne(_e((e=Ue(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(e){ct.prototype[e]=function(t,r){return this.request(Ue(r||{},{method:e,url:t,data:(r||{}).data}))}}),q.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,i){return this.request(Ue(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ct.prototype[e]=t(),ct.prototype[e+"Form"]=t(!0)});var ut=ct;class lt{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 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;const 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 Re(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;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 lt(function(t){e=t}),cancel:e}}}var ht=lt;const dt={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(dt).forEach(([e,t])=>{dt[t]=e});var pt=dt;const ft=function t(r){const n=new ut(r),i=e(ut.prototype.request,n);return q.extend(i,ut.prototype,n,{allOwnKeys:!0}),q.extend(i,n,null,{allOwnKeys:!0}),i.create=function(e){return t(Ue(r,e))},i}(ge);ft.Axios=ut,ft.CanceledError=Re,ft.CancelToken=ht,ft.isCancel=Ee,ft.VERSION=nt,ft.toFormData=Y,ft.AxiosError=H,ft.Cancel=ft.CanceledError,ft.all=function(e){return Promise.all(e)},ft.spread=function(e){return function(t){return e.apply(null,t)}},ft.isAxiosError=function(e){return q.isObject(e)&&!0===e.isAxiosError},ft.mergeConfig=Ue,ft.AxiosHeaders=Se,ft.formToJSON=e=>pe(q.isHTMLForm(e)?new FormData(e):e),ft.getAdapter=et,ft.HttpStatusCode=pt,ft.default=ft;const gt=ft.create({timeout:1e4,headers:{"Content-Type":"application/json"}});gt.interceptors.request.use(e=>(e._startTime=performance.now(),e),e=>Promise.reject(e)),gt.interceptors.response.use(e=>{if(e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return e},e=>{if(e.config&&e.config._startTime){const t=performance.now()-e.config._startTime;e._duration=t}return Promise.reject(e)});class mt{constructor(e){this.config=e,this.isReporting=!1}async report(e,t){if(!this.isReporting){this.isReporting=!0;try{const r=this.formatReportData(e,t);this.config.getConfig().customReport?await this.config.getConfig().customReport(e,r):await this.defaultReport(e,r)}catch(e){console.error("上报失败:",e)}finally{this.isReporting=!1}}}formatReportData(e,t){return{...{type:e,timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}},data:Array.isArray(t)?t:[t]}}async defaultReport(e,t){const r=this.config.getReportUrl(),n=this.config.getThirdPartyConfig();r&&await this.reportToBackend(r,t),n&&Object.keys(n).length>0&&await this.reportToThirdParty(n,t)}async reportToBackend(e,t){try{return(await gt.post(e,t)).data}catch(e){throw console.error("后端上报失败:",e),e}}async reportToThirdParty(e,t){const r=[];e.baidu&&window._hmt&&r.push(this.reportToBaidu(e.baidu,t)),e.umeng&&window._um&&r.push(this.reportToUmeng(e.umeng,t)),e.sensors&&window.sensors&&r.push(this.reportToSensors(e.sensors,t)),e.tencent&&window.MTA&&r.push(this.reportToTencent(e.tencent,t)),e.custom&&r.push(this.reportToCustom(e.custom,t));try{await Promise.allSettled(r)}catch(e){console.error("第三方上报失败:",e)}}async reportToBaidu(e,t){window._hmt&&window._hmt.push(["_trackEvent",t.type,JSON.stringify(t.data)])}async reportToUmeng(e,t){window._um&&window._um.push(["track",t.type,t.data])}async reportToSensors(e,t){window.sensors&&window.sensors.track(t.type,t.data[0]||{})}async reportToTencent(e,t){window.MTA&&window.MTA.Event.stat(t.type,t.data[0]||{})}async reportToCustom(e,t){"function"==typeof e.report&&await e.report(t)}}class wt{constructor(e){this.config=e,this.reporter=new mt(e),this.errorQueue=[],this.isInitialized=!1,this.errorCache=new Map,this.errorCacheTimeout=5e3,this.maxCacheSize=100,this.errorFingerprint=this.createErrorFingerprint.bind(this)}createErrorFingerprint(e,t){const r=e?.message||e?.toString()||e,n=e?.stack||t.stack;return`${t.type||"unknown"}:${r}:${window.location.href}:${n?n.split("\n")[0]:""}`}isDuplicateError(e,t){const r=this.errorFingerprint(e,t),n=Date.now();if(this.cleanupErrorCache(n),this.errorCache.has(r)){if(n-this.errorCache.get(r)<this.errorCacheTimeout)return!0}if(this.errorCache.set(r,n),this.errorCache.size>this.maxCacheSize){const e=this.errorCache.keys().next().value;this.errorCache.delete(e)}return!1}cleanupErrorCache(e){for(const[t,r]of this.errorCache.entries())e-r>this.errorCacheTimeout&&this.errorCache.delete(t)}init(){if(this.isInitialized)return;const e=this.config.getConfig();(e.enableErrorTracking||e.enableResourceError)&&this.setupErrorListener(),e.enableUnhandledRejection&&this.setupUnhandledRejectionListener(),this.isInitialized=!0}setupErrorListener(){window.addEventListener("error",e=>{e.target&&e.target!==window?this.handleResourceError(e,null,null):this.handleJavaScriptError(e,null)},!0)}handleJavaScriptError(e,t){t&&clearTimeout(t),t=setTimeout(()=>{this.handleError(e.error||e.message,{type:"javascript",filename:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack})},100)}handleResourceError(e,t,r){const n=`${e.target.tagName}:${e.target.src||e.target.href}`;r!==n?(r=n,t&&clearTimeout(t),t=setTimeout(()=>{this.handleError(`Resource load failed: ${e.target.src||e.target.href}`,{type:"resource",tagName:e.target.tagName,src:e.target.src,href:e.target.href}),setTimeout(()=>{r=null},2e3)},100)):console.log("忽略重复的资源加载错误:",n)}setupUnhandledRejectionListener(){let e=null,t=null;window.addEventListener("unhandledrejection",r=>{const n=`${r.reason?.message||r.reason}:${r.reason?.stack||""}`;t!==n?(t=n,e&&clearTimeout(e),e=setTimeout(()=>{this.handleError(r.reason,{type:"unhandledrejection",stack:r.reason?.stack}),setTimeout(()=>{t=null},1e3)},100)):console.log("忽略重复的 Promise 拒绝:",r.reason)})}handleError(e,t={}){if(this.isDuplicateError(e,t))return void console.log("忽略重复错误:",e?.message||e);const r={message:e?.message||e?.toString()||e,stack:e?.stack||t.stack,type:t.type||"unknown",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,...t};this.errorQueue.push(r),this.errorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushErrorQueue(),console.log("errorInfo-----",r),0===this.config.getConfig().reportInterval&&this.reporter.report("error",[r])}reportError(e,t={}){this.handleError(e,t)}flushErrorQueue(){this.errorQueue.length>0&&(this.reporter.report("error",[...this.errorQueue]),this.errorQueue=[])}destroy(){this.flushErrorQueue(),this.isInitialized=!1}}class yt{constructor(e){this.config=e,this.reporter=new mt(e),this.eventQueue=[],this.isInitialized=!1,this.clickListener=null,this.pageViewListener=null}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enableClickTracking&&this.setupClickTracking(),e.enablePageViewTracking&&this.setupPageViewTracking(),this.setupPeriodicReport(),this.isInitialized=!0}setupClickTracking(){this.clickListener=e=>{const t=e.target,r={type:"click",timestamp:Date.now(),url:window.location.href,element:{tagName:t.tagName,className:t.className,id:t.id,text:t.textContent?.substring(0,50)},position:{x:e.clientX,y:e.clientY}};this.handleEvent("click",r)},document.addEventListener("click",this.clickListener,!0)}setupPageViewTracking(){const e=this.config.getConfig().pageViewTracking||{};let t=window.location.href,r=Date.now();const n=e.debounce||100;if(this.pageViewListener=()=>{const e=window.location.href,i=Date.now();e===t&&i-r<n?console.log("忽略重复的页面浏览事件:",e):(t=e,r=i,this.handleEvent("pageview",{type:"pageview",timestamp:i,url:e,title:document.title,referrer:document.referrer}))},!1!==e.listenPopstate&&window.addEventListener("popstate",this.pageViewListener),!1!==e.listenHistoryAPI){const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.pageViewListener()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.pageViewListener()},0)}.bind(this)}e.vueRouterMode&&console.log("Vue Router 模式:页面浏览追踪已优化")}setupPeriodicReport(){const e=this.config.getConfig().reportInterval;e>0&&setInterval(()=>{this.flushEventQueue()},e)}handleEvent(e,t){const r={eventName:e,...t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.eventQueue.push(r),this.eventQueue.length>=this.config.getConfig().maxQueueSize&&this.flushEventQueue(),console.log("eventInfo----",r),0===this.config.getConfig().reportInterval&&this.reporter.report("event",[r])}reportEvent(e,t={}){this.handleEvent(e,{type:"custom",timestamp:Date.now(),url:window.location.href,...t})}flushEventQueue(){this.eventQueue.length>0&&(this.reporter.report("event",[...this.eventQueue]),this.eventQueue=[])}destroy(){this.flushEventQueue(),this.clickListener&&document.removeEventListener("click",this.clickListener,!0),this.pageViewListener&&window.removeEventListener("popstate",this.pageViewListener),this.isInitialized=!1}}class bt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.pageStartTime=Date.now(),this.performanceQueue=[],this.thirdPartySDKs={},this.currentRoute=null,this.routeStartTime=Date.now(),this.routeHistory=[],this.vueRouter=null,this.metrics={fcp:0,lcp:0,fid:0,cls:0,ttfb:0,domLoad:0,windowLoad:0,resourceLoad:[],apiRequests:[],pageStayTime:0}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePerformanceTracking&&this.setupPerformanceMonitoring(),e.enableResourceTracking&&this.setupResourceMonitoring(),e.enableApiTracking&&this.setupApiMonitoring(),e.enableInteractionTracking&&this.setupInteractionMonitoring(),this.initThirdPartySDKs(),this.isInitialized=!0}setupVueRouterMonitoring(e){e&&!this.vueRouter&&(this.vueRouter=e,this.currentRoute=e.currentRoute.value,e.beforeEach((e,t,r)=>{t.name&&this.handleRouteLeave(t,e),r()}),e.afterEach((e,t)=>{this.handleRouteEnter(e,t)}),e.beforeResolve((e,t,r)=>{t.name&&this.calculateRouteStayTime(t),r()}),console.log("Vue Router 监控已设置"))}handleRouteLeave(e,t){const r=Date.now()-this.routeStartTime;this.recordRouteStayTime(e,r),this.currentRoute=e,this.routeStartTime=Date.now()}handleRouteEnter(e,t){this.routeStartTime=Date.now(),this.currentRoute=e,this.recordRouteEnter(e,t)}recordRouteStayTime(e,t){const r={name:e.name||"unknown",path:e.path,fullPath:e.fullPath,stayTime:t,enterTime:this.routeStartTime,leaveTime:Date.now(),params:e.params,query:e.query,meta:e.meta};this.routeHistory.push(r),this.metrics.pageStayTime=t,this.reportRouteStayTime(r),console.log(`路由 ${e.name||e.path} 停留时间: ${t}ms`)}recordRouteEnter(e,t){e.name,e.path,e.fullPath,Date.now(),e.params,e.query,e.meta,t&&(t.name,t.path),console.log(`进入路由: ${e.name||e.path}`)}calculateRouteStayTime(e){if(!this.routeStartTime)return 0;return Date.now()-this.routeStartTime}reportRouteStayTime(e){const t={type:"route_stay_time",timestamp:Date.now(),route:e,user:this.config.getUser(),device:this.getDeviceInfo()};this.reporter.report("route_performance",[t])}getCurrentRoute(){return this.currentRoute}getRouteHistory(){return[...this.routeHistory]}getCurrentPageStayTime(){return this.routeStartTime?Date.now()-this.routeStartTime:0}getRoutePerformanceStats(){const e={totalRoutes:this.routeHistory.length,averageStayTime:0,routesByPath:new Map,totalStayTime:0};return this.routeHistory.length>0&&(this.routeHistory.forEach(t=>{e.totalStayTime+=t.stayTime,e.routesByPath.has(t.path)||e.routesByPath.set(t.path,{count:0,totalStayTime:0,averageStayTime:0});const r=e.routesByPath.get(t.path);r.count++,r.totalStayTime+=t.stayTime,r.averageStayTime=r.totalStayTime/r.count}),e.averageStayTime=e.totalStayTime/e.totalRoutes),e}setupPerformanceMonitoring(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{this.captureDOMLoadTime()}):this.captureDOMLoadTime(),window.addEventListener("load",()=>{this.captureWindowLoadTime(),this.captureWebVitals(),this.reportPerformanceMetrics()}),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupResourceMonitoring(){const e=new PerformanceObserver(e=>{for(const t of e.getEntries())"resource"===t.entryType&&this.handleResourceLoad(t)});try{e.observe({entryTypes:["resource"]})}catch(e){this.setupResourceFallback()}}setupApiMonitoring(){void 0!==window.axios&&(window.axios.interceptors.request.use(e=>(e._startTime=performance.now(),e)),window.axios.interceptors.response.use(e=>{const t=performance.now()-e.config._startTime;return console.log("duration----",e.config.url,t,e.status),this.handleApiRequest(e.config.url,t,e.status),e},e=>{if(e.config){const t=performance.now()-e.config._startTime;console.log("duration----",e.config.url,t,"error"),this.handleApiRequest(e.config.url,t,"error")}throw e}))}setupInteractionMonitoring(){let e=0,t=0;const r=n=>{0===e&&(e=performance.now(),t=e-this.metrics.fcp,this.metrics.fid=t,document.removeEventListener("click",r,!0),document.removeEventListener("keydown",r,!0),document.removeEventListener("touchstart",r,!0))};document.addEventListener("click",r,!0),document.addEventListener("keydown",r,!0),document.addEventListener("touchstart",r,!0)}captureDOMLoadTime(){this.metrics.domLoad=performance.now()}captureWindowLoadTime(){this.metrics.windowLoad=performance.now()}captureWebVitals(){if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())"first-contentful-paint"===t.name&&(this.metrics.fcp=t.startTime)}).observe({entryTypes:["paint"]})}catch(e){console.warn("FCP监控失败:",e)}if("PerformanceObserver"in window)try{new PerformanceObserver(e=>{for(const t of e.getEntries())this.metrics.lcp=t.startTime}).observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("LCP监控失败:",e)}if("PerformanceObserver"in window)try{let e=0;new PerformanceObserver(t=>{for(const r of t.getEntries())r.hadRecentInput||(e+=r.value);this.metrics.cls=e}).observe({entryTypes:["layout-shift"]})}catch(e){console.warn("CLS监控失败:",e)}}handleResourceLoad(e){const t={name:e.name,type:e.initiatorType,duration:e.duration,size:e.transferSize,timestamp:Date.now()};this.metrics.resourceLoad.push(t),e.duration>3e3&&this.reportSlowResource(t)}handleApiRequest(e,t,r){const n={url:"string"==typeof e?e:e.toString(),duration:t,status:r,timestamp:Date.now()};this.metrics.apiRequests.push(n),t>5e3&&this.reportSlowApi(n)}handlePageHidden(){this.calculatePageStayTime()}handlePageVisible(){this.pageStartTime=Date.now()}calculatePageStayTime(){const e=Date.now()-this.pageStartTime;this.reportPageStayTime(e)}reportPerformanceMetrics(){const e={type:"performance",timestamp:Date.now(),url:window.location.href,userAgent:navigator.userAgent,metrics:this.metrics,user:this.config.getUser(),device:this.getDeviceInfo()};this.performanceQueue.push(e),this.performanceQueue.length>=this.config.getConfig().maxQueueSize&&this.flushPerformanceQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("performance",[e])}reportSlowResource(e){this.reporter.report("slow_resource",[e])}reportSlowApi(e){this.reporter.report("slow_api",[e])}reportPageStayTime(e){const t={type:"page_stay",url:window.location.href,stayTime:e,timestamp:Date.now()};this.reporter.report("page_stay",[t])}getDeviceInfo(){return{screen:{width:screen.width,height:screen.height,availWidth:screen.availWidth,availHeight:screen.availHeight,colorDepth:screen.colorDepth,pixelDepth:screen.pixelDepth},viewport:{width:window.innerWidth,height:window.innerHeight},connection:navigator.connection?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,memory:navigator.memory?{usedJSHeapSize:navigator.memory.usedJSHeapSize,totalJSHeapSize:navigator.memory.totalJSHeapSize,jsHeapSizeLimit:navigator.memory.jsHeapSizeLimit}:null}}initThirdPartySDKs(){const e=this.config.getThirdPartyConfig();e.baidu&&window._hmt&&(this.thirdPartySDKs.baidu=window._hmt),e.umeng&&window._um&&(this.thirdPartySDKs.umeng=window._um),e.sensors&&window.sensors&&(this.thirdPartySDKs.sensors=window.sensors),e.tencent&&window.MTA&&(this.thirdPartySDKs.tencent=window.MTA)}flushPerformanceQueue(){this.performanceQueue.length>0&&(this.reporter.report("performance",[...this.performanceQueue]),this.performanceQueue=[])}reportPerformance(e={}){const t={type:"custom_performance",timestamp:Date.now(),url:window.location.href,metrics:e,user:this.config.getUser()};this.reporter.report("performance",[t])}getCurrentMetrics(){return{...this.metrics}}destroy(){this.flushPerformanceQueue(),this.isInitialized=!1}}class Tt{constructor(e){this.config=e,this.reporter=new mt(e),this.isInitialized=!1,this.behaviorQueue=[],this.sessionId=this.generateSessionId(),this.pageStartTime=Date.now(),this.scrollDepth=0,this.mouseMovements=[],this.keyStrokes=[],this.formInteractions=[],this.behaviors={pageViews:[],clicks:[],scrolls:[],formSubmissions:[],navigation:[],timeOnPage:0}}init(){if(this.isInitialized)return;const e=this.config.getConfig();e.enablePageViewTracking&&this.setupPageViewTracking(),e.enableUserInteractionTracking&&this.setupUserInteractionTracking(),e.enableFormTracking&&this.setupFormTracking(),e.enableScrollTracking&&this.setupScrollTracking(),e.enableMouseTracking&&this.setupMouseTracking(),e.enableKeyboardTracking&&this.setupKeyboardTracking(),this.setupTimeTracking(),this.trackReferrer(),this.isInitialized=!0}setupPageViewTracking(){this.trackPageView(),this.setupRouteChangeTracking(),document.addEventListener("visibilitychange",()=>{document.hidden?this.handlePageHidden():this.handlePageVisible()})}setupRouteChangeTracking(){window.addEventListener("popstate",()=>{this.trackPageView()});const e=history.pushState,t=history.replaceState;history.pushState=function(...t){e.apply(history,t),setTimeout(()=>{this.trackPageView()},0)}.bind(this),history.replaceState=function(...e){t.apply(history,e),setTimeout(()=>{this.trackPageView()},0)}.bind(this)}setupUserInteractionTracking(){document.addEventListener("click",e=>{this.trackClick(e)},!0),document.addEventListener("dblclick",e=>{this.trackDoubleClick(e)},!0),document.addEventListener("contextmenu",e=>{this.trackRightClick(e)},!0),"ontouchstart"in window&&document.addEventListener("touchstart",e=>{this.trackTouch(e)},!0)}setupFormTracking(){document.addEventListener("submit",e=>{this.trackFormSubmission(e)},!0),document.addEventListener("change",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldChange(e)},!0),document.addEventListener("focus",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldFocus(e)},!0),document.addEventListener("blur",e=>{"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName||this.trackFormFieldBlur(e)},!0)}setupScrollTracking(){let e;document.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(()=>{const e=window.pageYOffset||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,r=document.documentElement.clientHeight,n=Math.round(e/(t-r)*100);n>this.scrollDepth&&(this.scrollDepth=n,this.trackScroll(n,e))},100)},{passive:!0})}setupMouseTracking(){let e,t=[];document.addEventListener("mousemove",r=>{clearTimeout(e),t.push({x:r.clientX,y:r.clientY,timestamp:Date.now()}),t.length>100&&t.shift(),e=setTimeout(()=>{t.length>10&&(this.trackMouseMovement(t),t=[])},1e3)},{passive:!0})}setupKeyboardTracking(){document.addEventListener("keydown",e=>{"password"!==e.target.type&&this.trackKeyStroke(e)},!0)}setupTimeTracking(){setInterval(()=>{this.behaviors.timeOnPage+=1},1e3),window.addEventListener("beforeunload",()=>{this.reportTimeOnPage()})}trackReferrer(){const e=document.referrer;if(e){const t={type:"referrer",url:e,domain:this.extractDomain(e),timestamp:Date.now()};this.behaviors.navigation.push(t),this.reportBehavior("referrer",t)}}trackPageView(){const e={type:"pageview",url:window.location.href,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer};this.behaviors.pageViews.push(e),this.reportBehavior("pageview",e),this.pageStartTime=Date.now(),this.scrollDepth=0}trackClick(e){const t={type:"click",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id,text:e.target.textContent?.substring(0,50),href:e.target.href},position:{x:e.clientX,y:e.clientY,pageX:e.pageX,pageY:e.pageY},timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.clicks.push(t),this.reportBehavior("click",t)}trackDoubleClick(e){const t={type:"doubleclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("doubleclick",t)}trackRightClick(e){const t={type:"rightclick",element:{tagName:e.target.tagName,className:e.target.className,id:e.target.id},position:{x:e.clientX,y:e.clientY},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("rightclick",t)}trackTouch(e){const t={type:"touch",touches:Array.from(e.touches).map(e=>({x:e.clientX,y:e.clientY,identifier:e.identifier})),timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("touch",t)}trackFormSubmission(e){const t={type:"form_submission",form:{action:e.target.action,method:e.target.method,id:e.target.id,className:e.target.className},fields:this.getFormFields(e.target),timestamp:Date.now(),sessionId:this.sessionId};this.behaviors.formSubmissions.push(t),this.reportBehavior("form_submission",t)}trackFormFieldChange(e){const t={type:"form_field_change",field:{name:e.target.name,type:e.target.type,value:"password"===e.target.type?"***":e.target.value,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_change",t)}trackFormFieldFocus(e){const t={type:"form_field_focus",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_focus",t)}trackFormFieldBlur(e){const t={type:"form_field_blur",field:{name:e.target.name,type:e.target.type,id:e.target.id},timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("form_field_blur",t)}trackScroll(e,t){const r={type:"scroll",depth:e,scrollTop:t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("scroll",r)}trackMouseMovement(e){const t={type:"mouse_movement",movements:e,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("mouse_movement",t)}trackKeyStroke(e){const t={type:"keystroke",key:e.key,code:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("keystroke",t)}handlePageHidden(){this.reportTimeOnPage()}handlePageVisible(){this.pageStartTime=Date.now()}reportTimeOnPage(){const e={type:"time_on_page",time:this.behaviors.timeOnPage,url:window.location.href,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("time_on_page",e)}reportBehavior(e,t){const r={type:e,data:t,user:this.config.getUser(),config:{appId:this.config.getConfig().appId,appVersion:this.config.getConfig().appVersion,environment:this.config.getConfig().environment}};this.behaviorQueue.push(r),this.behaviorQueue.length>=this.config.getConfig().maxQueueSize&&this.flushBehaviorQueue(),0===this.config.getConfig().reportInterval&&this.reporter.report("behavior",[r])}reportCustomBehavior(e,t={}){const r={type:"custom_behavior",eventName:e,...t,timestamp:Date.now(),sessionId:this.sessionId};this.reportBehavior("custom_behavior",r)}flushBehaviorQueue(){this.behaviorQueue.length>0&&(this.reporter.report("behavior",[...this.behaviorQueue]),this.behaviorQueue=[])}getFormFields(e){const t=[],r=e.elements;for(let e=0;e<r.length;e++){const n=r[e];n.name&&t.push({name:n.name,type:n.type,value:"password"===n.type?"***":n.value})}return t}extractDomain(e){try{return new URL(e).hostname}catch(t){return e}}generateSessionId(){return"session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}getCurrentBehaviors(){return{...this.behaviors}}getSessionId(){return this.sessionId}destroy(){this.flushBehaviorQueue(),this.reportTimeOnPage(),this.isInitialized=!1}}class vt{constructor(e){this.config=e,this.integratedSDKs={},this.isInitialized=!1}init(){if(this.isInitialized)return;const e=this.config.getThirdPartyConfig();e.baidu&&e.baidu.enabled&&this.initBaiduAnalytics(e.baidu),e.umeng&&e.umeng.enabled&&this.initUmengAnalytics(e.umeng),e.sensors&&e.sensors.enabled&&this.initSensorsAnalytics(e.sensors),e.tencent&&e.tencent.enabled&&this.initTencentAnalytics(e.tencent),e.google&&e.google.enabled&&this.initGoogleAnalytics(e.google),e.custom&&e.custom.enabled&&this.initCustomAnalytics(e.custom),this.isInitialized=!0}initBaiduAnalytics(e){try{window._hmt?(this.integratedSDKs.baidu={name:"baidu",instance:window._hmt,config:e},e.siteId&&window._hmt.push(["_setAccount",e.siteId]),!1!==e.autoPageview&&window._hmt.push(["_trackPageview"]),console.log("百度统计集成成功")):console.warn("百度统计未加载,请检查脚本是否正确引入")}catch(e){console.error("百度统计集成失败:",e)}}initUmengAnalytics(e){try{window._um?(this.integratedSDKs.umeng={name:"umeng",instance:window._um,config:e},e.siteId&&window._um.push(["setAccount",e.siteId]),!1!==e.autoPageview&&window._um.push(["trackPageview"]),console.log("友盟统计集成成功")):console.warn("友盟统计未加载,请检查脚本是否正确引入")}catch(e){console.error("友盟统计集成失败:",e)}}initSensorsAnalytics(e){try{window.sensors?(this.integratedSDKs.sensors={name:"sensors",instance:window.sensors,config:e},e.serverUrl&&window.sensors.setServerUrl(e.serverUrl),e.siteId&&window.sensors.setSiteId(e.siteId),!1!==e.autoPageview&&window.sensors.trackPageview(),console.log("神策数据集成成功")):console.warn("神策数据未加载,请检查脚本是否正确引入")}catch(e){console.error("神策数据集成失败:",e)}}initTencentAnalytics(e){try{window.MTA?(this.integratedSDKs.tencent={name:"tencent",instance:window.MTA,config:e},e.appId&&window.MTA.setAppId(e.appId),!1!==e.autoPageview&&window.MTA.trackPageview(),console.log("腾讯云分析集成成功")):console.warn("腾讯云分析未加载,请检查脚本是否正确引入")}catch(e){console.error("腾讯云分析集成失败:",e)}}initGoogleAnalytics(e){try{window.gtag?(this.integratedSDKs.google={name:"google",instance:window.gtag,config:e},e.measurementId&&window.gtag("config",e.measurementId,{page_title:document.title,page_location:window.location.href}),console.log("Google Analytics集成成功")):console.warn("Google Analytics未加载,请检查脚本是否正确引入")}catch(e){console.error("Google Analytics集成失败:",e)}}initCustomAnalytics(e){try{if("function"==typeof e.init){const t=e.init(e);this.integratedSDKs.custom={name:"custom",instance:t,config:e},console.log("自定义第三方集成成功")}else console.warn("自定义第三方配置缺少init函数")}catch(e){console.error("自定义第三方集成失败:",e)}}reportEvent(e,t={}){Object.values(this.integratedSDKs).forEach(r=>{try{this.reportToSDK(r,e,t)}catch(e){console.error(`上报事件到${r.name}失败:`,e)}})}reportPageView(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPageViewToSDK(t,e)}catch(e){console.error(`上报页面浏览到${t.name}失败:`,e)}})}reportUser(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportUserToSDK(t,e)}catch(e){console.error(`上报用户信息到${t.name}失败:`,e)}})}reportPerformance(e={}){Object.values(this.integratedSDKs).forEach(t=>{try{this.reportPerformanceToSDK(t,e)}catch(e){console.error(`上报性能指标到${t.name}失败:`,e)}})}reportToSDK(e,t,r){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent",t,JSON.stringify(r)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track",t,r]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track(t,r);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat(t,r);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event",t,r);break;case"custom":e.instance&&"function"==typeof e.instance.track&&e.instance.track(t,r);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPageViewToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackPageview",t.url||window.location.href]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["trackPageview",t.url||window.location.href]);break;case"sensors":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t);break;case"tencent":e.instance&&e.instance.trackPageview&&e.instance.trackPageview(t.url||window.location.href);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("config",e.config.measurementId,{page_title:t.title||document.title,page_location:t.url||window.location.href});break;case"custom":e.instance&&"function"==typeof e.instance.trackPageview&&e.instance.trackPageview(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportUserToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&(e.instance.push(["_setUserTag","userId",t.userId]),e.instance.push(["_setUserTag","userType",t.userType]));break;case"umeng":e.instance&&e.instance.push&&(e.instance.push(["setUserTag","userId",t.userId]),e.instance.push(["setUserTag","userType",t.userType]));break;case"sensors":e.instance&&e.instance.setProfile&&e.instance.setProfile(t);break;case"tencent":e.instance&&e.instance.setUserInfo&&e.instance.setUserInfo(t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("set","user_id",t.userId);break;case"custom":e.instance&&"function"==typeof e.instance.setUser&&e.instance.setUser(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}reportPerformanceToSDK(e,t){switch(e.name){case"baidu":e.instance&&e.instance.push&&e.instance.push(["_trackEvent","performance",JSON.stringify(t)]);break;case"umeng":e.instance&&e.instance.push&&e.instance.push(["track","performance",t]);break;case"sensors":e.instance&&e.instance.track&&e.instance.track("performance",t);break;case"tencent":e.instance&&e.instance.Event&&e.instance.Event.stat&&e.instance.Event.stat("performance",t);break;case"google":e.instance&&"function"==typeof e.instance&&e.instance("event","performance",t);break;case"custom":e.instance&&"function"==typeof e.instance.trackPerformance&&e.instance.trackPerformance(t);break;default:console.warn(`未知的SDK类型: ${e.name}`)}}isSDKIntegrated(e){return!!this.integratedSDKs[e]}getIntegratedSDKs(){return Object.keys(this.integratedSDKs)}getSDKInstance(e){return this.integratedSDKs[e]?.instance||null}destroy(){Object.values(this.integratedSDKs).forEach(e=>{try{e.instance&&"function"==typeof e.instance.destroy&&e.instance.destroy()}catch(t){console.error(`销毁${e.name}失败:`,t)}}),this.integratedSDKs={},this.isInitialized=!1}}class St{constructor(e={}){this.config={appId:e.appId||"",appVersion:e.appVersion||"1.0.0",environment:e.environment||"production",reportUrl:e.reportUrl||"",reportInterval:e.reportInterval||5e3,maxQueueSize:e.maxQueueSize||100,enableErrorTracking:!1!==e.enableErrorTracking,enableUnhandledRejection:!1!==e.enableUnhandledRejection,enableResourceError:!1!==e.enableResourceError,enableEventTracking:!1!==e.enableEventTracking,enableClickTracking:!1!==e.enableClickTracking,enablePageViewTracking:!1!==e.enablePageViewTracking,enablePerformanceTracking:!1!==e.enablePerformanceTracking,enableResourceTracking:!1!==e.enableResourceTracking,enableApiTracking:!1!==e.enableApiTracking,enableInteractionTracking:!1!==e.enableInteractionTracking,enableUserInteractionTracking:!1!==e.enableUserInteractionTracking,enableFormTracking:!1!==e.enableFormTracking,enableScrollTracking:!1!==e.enableScrollTracking,enableMouseTracking:!1!==e.enableMouseTracking,enableKeyboardTracking:!1!==e.enableKeyboardTracking,thirdPartyConfig:e.thirdPartyConfig||{},user:e.user||null,customReport:e.customReport||null},this.user=null}updateConfig(e){this.config={...this.config,...e}}setUser(e){this.user=e}getConfig(){return this.config}getUser(){return this.user}getReportUrl(){return this.config.reportUrl}getThirdPartyConfig(){return this.config.thirdPartyConfig}isErrorTrackingEnabled(){return this.config.enableErrorTracking}isEventTrackingEnabled(){return this.config.enableEventTracking}}"undefined"==typeof window||window.axios||(window.axios=gt);class kt{constructor(e={}){this.config=new St(e),this.errorTracker=new wt(this.config),this.eventTracker=new yt(this.config),this.performanceTracker=new bt(this.config),this.userBehaviorTracker=new Tt(this.config),this.thirdPartyIntegrator=new vt(this.config),this.init()}init(){this.errorTracker.init(),this.eventTracker.init(),this.performanceTracker.init(),this.userBehaviorTracker.init(),this.thirdPartyIntegrator.init(),console.log("Frontend SDK 初始化完成")}reportError(e,t={}){this.errorTracker.reportError(e,t)}reportEvent(e,t={}){this.eventTracker.reportEvent(e,t)}reportPerformance(e={}){this.performanceTracker.reportPerformance(e)}reportBehavior(e,t={}){this.userBehaviorTracker.reportCustomBehavior(e,t)}setUser(e){this.config.setUser(e),this.thirdPartyIntegrator.reportUser(e)}setConfig(e){this.config.updateConfig(e)}getPerformanceMetrics(){return this.performanceTracker.getCurrentMetrics()}getBehaviorData(){return this.userBehaviorTracker.getCurrentBehaviors()}getSessionId(){return this.userBehaviorTracker.getSessionId()}isThirdPartySDKIntegrated(e){return this.thirdPartyIntegrator.isSDKIntegrated(e)}getIntegratedThirdPartySDKs(){return this.thirdPartyIntegrator.getIntegratedSDKs()}setupVueRouterMonitoring(e){e?(this.performanceTracker.setupVueRouterMonitoring(e),console.log("Vue Router 监控已设置")):console.warn("Vue Router 实例未提供")}getCurrentRoute(){return this.performanceTracker.getCurrentRoute()}getRouteHistory(){return this.performanceTracker.getRouteHistory()}getCurrentPageStayTime(){return this.performanceTracker.getCurrentPageStayTime()}getRoutePerformanceStats(){return this.performanceTracker.getRoutePerformanceStats()}destroy(){this.errorTracker.destroy(),this.eventTracker.destroy(),this.performanceTracker.destroy(),this.userBehaviorTracker.destroy(),this.thirdPartyIntegrator.destroy(),console.log("Frontend SDK 已销毁")}}export{kt as default};
2
2
  //# sourceMappingURL=index.esm.js.map