12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613 |
- import {
- __commonJS
- } from "./chunk-Y2F7D3TJ.js";
- // E:/Project/2023/问诊平台/his_user_app/node_modules/aegis-web-sdk/lib/aegis.min.js
- var require_aegis_min = __commonJS({
- "E:/Project/2023/问诊平台/his_user_app/node_modules/aegis-web-sdk/lib/aegis.min.js"(exports, module) {
- !function(e, t) {
- "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).Aegis = t();
- }(exports, function() {
- "use strict";
- var _, j;
- function H(e2) {
- this.name = "__st" + (1e9 * Math.random() >>> 0) + _ + "__", null != e2 && e2.forEach(this.add, this), _ += 1;
- }
- Array.prototype.find || Object.defineProperty(Array.prototype, "find", { configurable: true, writable: true, value: function(e2) {
- if (null === this)
- throw new TypeError('"this" is null or not defined');
- var t2 = Object(this), n2 = t2.length >>> 0;
- if ("function" != typeof e2)
- throw new TypeError("predicate must be a function");
- for (var o2 = arguments[1], i2 = 0; i2 < n2; ) {
- var r2 = t2[i2];
- if (e2.call(o2, r2, i2, t2))
- return r2;
- i2 += 1;
- }
- } }), window.WeakSet || (_ = Date.now() % 1e9, H.prototype.add = function(e2) {
- var t2 = this.name;
- return e2[t2] || Object.defineProperty(e2, t2, { value: true, writable: true }), this;
- }, H.prototype.delete = function(e2) {
- return !!e2[this.name] && !(e2[this.name] = void 0);
- }, H.prototype.has = function(e2) {
- return !!e2[this.name];
- }, j = H, Object.defineProperty(window, "WeakSet", { value: function(e2) {
- return new j(e2);
- } })), Object.assign || Object.defineProperty(Object, "assign", { enumerable: false, configurable: true, writable: true, value: function(e2) {
- if (null == e2)
- throw new TypeError("Cannot convert first argument to object");
- for (var t2 = Object(e2), n2 = 1; n2 < arguments.length; n2++)
- if (null != (o2 = arguments[n2]))
- for (var o2 = Object(o2), i2 = Object.keys(Object(o2)), r2 = 0, a2 = i2.length; r2 < a2; r2++) {
- var s2 = i2[r2], c2 = Object.getOwnPropertyDescriptor(o2, s2);
- null != c2 && c2.enumerable && (t2[s2] = o2[s2]);
- }
- return t2;
- } });
- var B = function(e2, t2) {
- return (B = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? function(e3, t3) {
- e3.__proto__ = t3;
- } : function(e3, t3) {
- for (var n2 in t3)
- Object.prototype.hasOwnProperty.call(t3, n2) && (e3[n2] = t3[n2]);
- }))(e2, t2);
- }, E = function() {
- return (E = Object.assign || function(e2) {
- for (var t2, n2 = 1, o2 = arguments.length; n2 < o2; n2++)
- for (var i2 in t2 = arguments[n2])
- Object.prototype.hasOwnProperty.call(t2, i2) && (e2[i2] = t2[i2]);
- return e2;
- }).apply(this, arguments);
- };
- function u() {
- for (var e2 = 0, t2 = 0, n2 = arguments.length; t2 < n2; t2++)
- e2 += arguments[t2].length;
- for (var o2 = Array(e2), i2 = 0, t2 = 0; t2 < n2; t2++)
- for (var r2 = arguments[t2], a2 = 0, s2 = r2.length; a2 < s2; a2++, i2++)
- o2[i2] = r2[a2];
- return o2;
- }
- function D(t2) {
- try {
- return encodeURIComponent(decodeURIComponent(t2));
- } catch (e2) {
- return t2;
- }
- }
- var n, F = /_?t(\d)?(imestamp)?=\d+&?/g, M = ["aegis.qq.com", "tamaegis.com", "/aegis-sdk", "rumt-", "/flog.core.min.js", "pingfore.qq.com", "pingfore.tencent.com", "zhiyan.tencent-cloud.net", "h.trace.qq.com", "btrace.qq.com", "beacon.qq.com", "dmplog.qq.com", "qq.com/report", "svibeacon.onezapp.com", "cube.weixinbridge.com", "doubleclick.net", "pcmgrmonitor.3g.qq.com", "report.qqweb.qq.com", "tpstelemetry.tencent.com", "insight.cloud.tencent.com", "facebook.com", "facebook.net", "google", "yahoo.com", "twitter.com", "ga-audiences", "report.idqqimg.com", "arms-retcode.aliyuncs.com", "px.effirst.com", "sentry", "hot-update.json", "u.c.b.r.o.w.s.e.r", "report.url.cn", "sockjs-node", "m3u8"], W = ["ResizeObserver loop limit exceeded", "Failed to execute 'transaction'", "window.indexedDB.deleteDatabase is not a function"], V = ["ext1", "ext2", "ext3", "level", "trace", "tag", "seq", "code"], X = ["static", "fetch"], G = (e.prototype.indexOf = function(e2, t2) {
- for (var n2 = 0; n2 < e2.length; n2++)
- if (e2[n2].callback === t2)
- return n2;
- return -1;
- }, e.prototype.on = function(e2, t2, n2) {
- var o2;
- if (void 0 === n2 && (n2 = 0), this)
- return (o2 = this.eventsList[e2]) || (this.eventsList[e2] = [], o2 = this.eventsList[e2]), -1 === this.indexOf(o2, t2) && o2.push({ name: e2, type: n2 || 0, callback: t2 }), this;
- }, e.prototype.one = function(e2, t2) {
- this.on(e2, t2, 1);
- }, e.prototype.remove = function(e2, t2) {
- if (this) {
- var n2 = this.eventsList[e2];
- if (n2) {
- if (t2)
- return n2.length && (t2 = this.indexOf(n2, t2), n2.splice(t2, 1)), this;
- try {
- delete this.eventsList[e2];
- } catch (e3) {
- }
- }
- return null;
- }
- }, e.prototype.clear = function() {
- this.eventsList = {};
- }, e), J = function(e2) {
- if (!e2 || 0 === e2.length)
- return "{}";
- e2 = Array.isArray(e2) ? e2 : [e2];
- var t2 = Object.keys(e2[0]), n2 = {};
- return t2.forEach(function(t3) {
- n2[t3] = e2.map(function(e3) {
- return e3[t3];
- });
- }), n2.count = e2.length, fe(n2);
- };
- function e() {
- var a2 = this;
- this.emit = function(e2, t2) {
- if (a2) {
- var n2;
- if (null != (o2 = a2.eventsList[e2]) && o2.length)
- for (var o2 = o2.slice(), i2 = 0; i2 < o2.length; i2++) {
- n2 = o2[i2];
- try {
- var r2 = n2.callback.apply(a2, [t2]);
- if (1 === n2.type && a2.remove(e2, n2.callback), false === r2)
- break;
- } catch (e3) {
- throw e3;
- }
- }
- return a2;
- }
- }, this.eventsList = {};
- }
- (o = n = n || {})[o.number = -1] = "number", o.string = "";
- function $(e2, t2) {
- return "number" == typeof e2 || "string" == typeof e2 ? e2 : t2 ? n.string : n.number;
- }
- function P(e2, t2) {
- return "string" == typeof e2 ? e2.split("?")[t2 ? 1 : 0] || "" : e2;
- }
- function K(e2, t2) {
- return void 0 === t2 && (t2 = 2048), String(e2).replace(F, "").slice(0, t2);
- }
- function Q(e2) {
- return "string" == typeof e2 && /^\//.test(e2) ? "https:" === (null === location || void 0 === location ? void 0 : location.protocol) : /^https/.test(e2);
- }
- function Y(e2, t2, n2) {
- var o2, i2;
- try {
- if ("function" == typeof (null == t2 ? void 0 : t2.retCodeHandler))
- return { code: void 0 === (r2 = (i2 = t2.retCodeHandler(e2, null == n2 ? void 0 : n2.url, null == n2 ? void 0 : n2.ctx, null == n2 ? void 0 : n2.payload) || {}).code) ? "unknown" : r2, isErr: i2.isErr };
- if (!(e2 = "string" == typeof e2 ? JSON.parse(e2) : e2))
- return { code: "unknown", isErr: false };
- "function" == typeof (null == (o2 = null == t2 ? void 0 : t2.ret) ? void 0 : o2.join) && (ue = [].concat(t2.ret.map(function(e3) {
- return e3.toLowerCase();
- })));
- var r2, a2 = Object.getOwnPropertyNames(e2).filter(function(e3) {
- return -1 !== ue.indexOf(e3.toLowerCase());
- });
- return a2.length ? { code: "" + (r2 = "未知" !== (r2 = e2[a2[0]]) && "" !== r2 ? r2 : "unknown"), isErr: 0 !== r2 && "0" !== r2 && "unknown" !== r2 } : { code: "unknown", isErr: false };
- } catch (e3) {
- return { code: "unknown", isErr: false };
- }
- }
- function x(e2, t2, n2) {
- try {
- var o2 = "function" == typeof t2 ? t2(e2, null == n2 ? void 0 : n2.url) || "" : e2;
- return de(o2).slice(0, 102400);
- } catch (e3) {
- return "";
- }
- }
- function z() {
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e2) {
- var t2 = 16 * Math.random() | 0;
- return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
- });
- }
- function l(t2, e2) {
- return "string" != typeof t2 || !t2 || e2 && -1 < t2.indexOf(e2) || ge.test(t2) || M.some(function(e3) {
- return -1 < t2.indexOf(e3);
- });
- }
- function Z(n2, o2) {
- var i2, r2 = [], a2 = n2.config;
- return n2.lifeCycle.on("destroy", function() {
- r2.length = 0;
- }), function(e2, t2) {
- Array.isArray(e2) ? r2 = r2.concat(e2) : r2.push(e2), o2 && r2.length >= o2 || n2.sendNow && 0 < r2.length ? (r2 = me(r2), t2(r2.splice(0, r2.length)), i2 && clearTimeout(i2)) : (i2 && clearTimeout(i2), i2 = setTimeout(function() {
- i2 = null, 0 < (r2 = me(r2)).length && t2(r2.splice(0, r2.length));
- }, a2.delay));
- };
- }
- function ee(e2, t2) {
- return Array.isArray(e2) ? t2(e2.map(function(e3) {
- return t3 = E(E({}, e3), { msg: "string" == typeof e3.msg ? e3.msg : [].concat(e3.msg).map(O).join(" ") }), V.forEach(function(e4) {
- t3[e4] || delete t3[e4];
- }), t3;
- var t3;
- })) : t2([E(E({}, e2), { msg: "string" == typeof e2.msg ? e2.msg : O(e2.msg) })]);
- }
- function te(c2, u2) {
- return function(e2, t2) {
- var n2, o2, i2, r2 = Array.isArray(e2), a2 = r2 ? e2 : [e2], s2 = (c2.lifeCycle.emit("beforeRequest", e2), c2.config.beforeRequest);
- (a2 = "function" == typeof s2 ? a2.map(function(t3) {
- try {
- var e3 = s2({ logs: t3, logType: u2 });
- return (null == e3 ? void 0 : e3.logType) === u2 && null != e3 && e3.logs ? e3.logs : false !== e3 && t3;
- } catch (e4) {
- return t3;
- }
- }).filter(function(e3) {
- return false !== e3;
- }) : a2).length && (n2 = a2, e2 = V, !Array.isArray(n2) || n2.length <= 1 || (o2 = [], i2 = [], !(i2 = "string" == typeof e2 ? [e2] : e2)) || i2.length <= 0 || (i2.forEach(function(t3) {
- n2.forEach(function(e3) {
- null != e3 && e3[t3] && o2.push(t3);
- });
- }), 0 < o2.length && (n2 = n2.map(function(e3) {
- var t3 = {};
- return o2.forEach(function(e4) {
- t3[e4] = "";
- }), E(E({}, t3), e3);
- }))), a2 = n2, t2(r2 ? a2 : a2[0]));
- };
- }
- function ne(i2) {
- return function(e2, t2) {
- i2.lifeCycle.emit("modifyRequest", e2);
- var n2 = i2.config.modifyRequest;
- if ("function" == typeof n2)
- try {
- var o2 = n2(e2);
- "object" == typeof o2 && "url" in o2 && (e2 = o2);
- } catch (e3) {
- console.error(e3);
- }
- t2(e2);
- };
- }
- function oe(o2) {
- return function(e2, t2) {
- null != (n2 = o2.lifeCycle) && n2.emit("afterRequest", e2);
- var n2 = (o2.config || {}).afterRequest;
- "function" == typeof n2 && false === n2(e2) || t2(e2);
- };
- }
- function m(n2) {
- if (n2 && n2.reduce && n2.length)
- return 1 === n2.length ? function(e2, t2) {
- n2[0](e2, t2 || Ee);
- } : n2.reduce(function(n3, o2) {
- return function(e2, t2) {
- return void 0 === t2 && (t2 = Ee), n3(e2, function(e3) {
- return null == o2 ? void 0 : o2(e3, t2);
- });
- };
- });
- throw new TypeError("createPipeline need at least one function param");
- }
- function ie(t2, n2) {
- Object.getOwnPropertyNames(t2).forEach(function(e2) {
- "function" == typeof t2[e2] && "constructor" !== e2 && (n2 ? n2[e2] = "sendPipeline" === e2 ? function() {
- return function() {
- };
- } : function() {
- } : t2[e2] = function() {
- });
- });
- }
- function re() {
- return void 0 !== window.performance && "function" == typeof performance.clearResourceTimings && "function" == typeof performance.getEntriesByType && "function" == typeof performance.now;
- }
- function ae(t2, n2) {
- function o2(e2) {
- "pagehide" !== e2.type && "hidden" !== document.visibilityState || (t2(e2), n2 && (removeEventListener("visibilitychange", o2, true), removeEventListener("pagehide", o2, true)));
- }
- addEventListener("visibilitychange", o2, true), addEventListener("pagehide", o2, true);
- }
- function t(e2) {
- return -1 !== Pe.indexOf(e2);
- }
- var L, R, f, se = ["application/xhtml+xml", "application/xml", "application/pdf", "application/pkcs12", "application/javascript", "application/x-javascript", "application/ecmascript", "application/vnd.mspowerpoint", "application/vnd.apple.mpegurl", "application/ogg", "text/css", "text/javascript", "image", "audio", "video", "video/mp2t"], ce = /\.(json|js|css|jpg|jpeg|png|svg|apng|webp|gif|bmp|mp4|mp3|ts|mpeg|wav|webm|ogg|flv|m3u8|ttf|woff2|otf|eot|woff|html|htm|shtml|shtm|)$/gi, ue = ["ret", "retcode", "code", "errcode"], le = function() {
- var n2 = /* @__PURE__ */ new WeakSet();
- return function(e2, t2) {
- if (t2 instanceof Error)
- return "Error.message: " + t2.message + " \n Error.stack: " + t2.stack;
- if ("object" == typeof t2 && null !== t2) {
- if (n2.has(t2))
- return "[Circular " + (e2 || "root") + "]";
- n2.add(t2);
- }
- return t2;
- };
- }, O = function(e2) {
- if ("string" == typeof e2)
- return e2;
- try {
- return e2 instanceof Error ? (JSON.stringify(e2, le(), 4) || "undefined").replace(/"/gim, "") : JSON.stringify(e2, le(), 4) || "undefined";
- } catch (e3) {
- return "error happen when aegis stringify: \n " + e3.message + " \n " + e3.stack;
- }
- }, fe = function(e2) {
- if ("string" == typeof e2)
- return e2;
- try {
- return JSON.stringify(e2, le()) || "undefined";
- } catch (e3) {
- return "error happen when aegis stringify: \n " + e3.message + " \n " + e3.stack;
- }
- }, de = function(n2, o2) {
- void 0 === o2 && (o2 = 3);
- var i2, r2, a2, s2 = "";
- return Array.isArray(n2) ? (s2 += "[", i2 = n2.length, n2.forEach(function(e2, t2) {
- s2 = (s2 += "object" == typeof e2 && 1 < o2 ? de(e2, o2 - 1) : he(e2)) + (t2 === i2 - 1 ? "" : ",");
- }), s2 += "]") : n2 instanceof Object ? (s2 = "{", r2 = Object.keys(n2), a2 = r2.length, r2.forEach(function(e2, t2) {
- "object" == typeof n2[e2] && 1 < o2 ? s2 += '"' + e2 + '":' + de(n2[e2], o2 - 1) : s2 += pe(e2, n2[e2]), s2 += t2 === a2 - 1 || t2 < a2 - 1 && void 0 === n2[r2[t2 + 1]] ? "" : ",";
- }), s2 += "}") : s2 += n2, s2;
- }, pe = function(e2, t2) {
- var n2 = typeof t2, o2 = "";
- return "string" == n2 || "object" == n2 ? o2 += '"' + e2 + '":"' + t2 + '"' : "function" == typeof t2 ? o2 += '"' + e2 + '":"function ' + t2.name + '"' : "symbol" == typeof t2 ? o2 += '"' + e2 + '":"symbol"' : "number" != typeof t2 && "boolean" != n2 || (o2 += '"' + e2 + '": ' + t2), o2;
- }, he = function(e2) {
- var t2 = typeof e2;
- return "" + ("undefined" == t2 || "symbol" == t2 || "function" == t2 ? "null" : "string" == t2 || "object" == t2 ? '"' + e2 + '"' : e2);
- }, ge = /data:(image|text|application|font)\/.*;base64/, me = ((o = L = L || {}).INFO_ALL = "-1", o.API_RESPONSE = "1", o.INFO = "2", o.ERROR = "4", o.PROMISE_ERROR = "8", o.AJAX_ERROR = "16", o.SCRIPT_ERROR = "32", o.IMAGE_ERROR = "64", o.CSS_ERROR = "128", o.CONSOLE_ERROR = "256", o.MEDIA_ERROR = "512", o.RET_ERROR = "1024", o.REPORT = "2048", o.PV = "4096", o.EVENT = "8192", o.PAGE_NOT_FOUND_ERROR = "16384", o.WEBSOCKET_ERROR = "32768", o.BRIDGE_ERROR = "65536", o.LAZY_LOAD_ERROR = "131072", (o = R = R || {}).LOG = "log", o.SPEED = "speed", o.PERFORMANCE = "performance", o.OFFLINE = "offline", o.WHITE_LIST = "whiteList", o.VITALS = "vitals", o.PV = "pv", o.CUSTOM_PV = "customPV", o.EVENT = "event", o.CUSTOM = "custom", o.SDK_ERROR = "sdkError", o.SET_DATA = "setData", o.LOAD_PACKAGE = "loadPackage", (o = f = f || {}).production = "production", o.development = "development", o.gray = "gray", o.pre = "pre", o.daily = "daily", o.local = "local", o.test = "test", o.others = "others", function(e2) {
- return e2.filter(function(n2, o2) {
- return "static" !== n2.type || !e2.find(function(e3, t2) {
- return n2.url === e3.url && 200 === n2.status && o2 < t2;
- });
- });
- }), ve = function(e2) {
- e2.level === L.INFO_ALL && (e2.level = L.INFO);
- }, v = {}, y = {}, ye = function(e2) {
- return v[e2] || (v[e2] = setTimeout(function() {
- y[e2] = {}, v[e2] = null;
- }, 6e4)), v[e2];
- }, we = function(e2) {
- return (Array.isArray(e2) ? e2 : [e2]).map(function(n2) {
- return Object.getOwnPropertyNames(n2).reduce(function(e3, t2) {
- return "ctx" !== t2 && (e3[t2] = n2[t2]), e3;
- }, { level: L.INFO, msg: "" });
- });
- }, be = function(o2) {
- return function(e2) {
- return o2.sendPipeline([function(e3, n2) {
- return n2({ url: o2.config.url || "", data: J(we(e3)), method: "post", contentType: "application/json", type: R.LOG, log: e3, requestConfig: { timeout: 5e3 }, success: function() {
- var t2 = o2.config.onReport;
- "function" == typeof t2 && e3.forEach(function(e4) {
- t2(e4);
- }), "function" == typeof n2 && n2([]);
- } });
- }], R.LOG)(e2);
- };
- }, Ee = function() {
- }, o = (Object.defineProperty(w.prototype, "__version__", { get: function() {
- return console.warn("__version__ has discard, please use version"), "1.37.5";
- }, enumerable: false, configurable: true }), Object.defineProperty(w.prototype, "LogType", { get: function() {
- return console.warn("LogType has discard, please use logType"), L;
- }, enumerable: false, configurable: true }), w.prototype.init = function(e2) {
- this.setConfig(e2);
- for (var t2 = 0; t2 < w.installedPlugins.length; t2++)
- try {
- w.installedPlugins[t2].patch(this);
- } catch (e3) {
- this.sendSDKError(e3);
- }
- this.lifeCycle.emit("onInited");
- }, w.prototype.setConfig = function(e2) {
- Object.assign(this.config, e2);
- var e2 = this.config, t2 = e2.id, n2 = e2.uin, o2 = e2.version, i2 = e2.ext1, r2 = e2.ext2, a2 = e2.ext3, s2 = e2.aid, c2 = e2.env, u2 = void 0 === c2 ? "production" : c2, c2 = e2.pageUrl, e2 = this.bean.id !== t2 || this.bean.uin !== n2 || this.bean.aid !== s2;
- return this.bean.id = t2 || "", this.bean.uin = n2 || "", this.bean.version = o2 || "1.37.5", this.bean.aid = s2 || "", this.bean.env = function() {
- switch (u2) {
- case f.production:
- case f.development:
- case f.gray:
- case f.pre:
- case f.daily:
- case f.local:
- case f.test:
- case f.others:
- return 1;
- default:
- return;
- }
- }() ? u2 : f.others, c2 && this.extendBean("from", encodeURIComponent(c2.slice(0, 2048))), i2 && this.extendBean("ext1", encodeURIComponent(i2)), r2 && this.extendBean("ext2", encodeURIComponent(r2)), a2 && this.extendBean("ext3", encodeURIComponent(a2)), e2 && this.lifeCycle.emit("onConfigChange", this.config), this.config;
- }, w.use = function(e2) {
- -1 === w.installedPlugins.indexOf(e2) && e2.aegisPlugin && w.installedPlugins.push(e2);
- }, w.unuse = function(e2) {
- e2 = w.installedPlugins.indexOf(e2);
- -1 !== e2 && w.installedPlugins.splice(e2, 1);
- }, w.prototype.info = function() {
- for (var e2 = [], t2 = 0; t2 < arguments.length; t2++)
- e2[t2] = arguments[t2];
- var n2 = { level: L.INFO, msg: e2 };
- 1 === e2.length && e2[0].msg && Object.assign(n2, E({}, e2[0]), { level: L.INFO }), this.normalLogPipeline(n2);
- }, w.prototype.infoAll = function() {
- for (var e2 = [], t2 = 0; t2 < arguments.length; t2++)
- e2[t2] = arguments[t2];
- var n2 = { level: L.INFO_ALL, msg: e2 };
- 1 === e2.length && e2[0].msg && Object.assign(n2, E({}, e2[0]), { level: L.INFO_ALL }), this.normalLogPipeline(n2);
- }, w.prototype.report = function() {
- for (var e2 = [], t2 = 0; t2 < arguments.length; t2++)
- e2[t2] = arguments[t2];
- var n2 = { level: L.REPORT, msg: e2 };
- 1 === e2.length && e2[0].msg && Object.assign(n2, E({}, e2[0])), this.normalLogPipeline(n2);
- }, w.prototype.error = function() {
- for (var e2 = [], t2 = 0; t2 < arguments.length; t2++)
- e2[t2] = arguments[t2];
- var n2 = { level: L.ERROR, msg: e2 };
- 1 === e2.length && e2[0].msg && Object.assign(n2, E({}, e2[0]), { level: L.ERROR }), this.normalLogPipeline(n2);
- }, w.prototype.speedLogPipeline = function(e2) {
- throw new Error('You need to override "speedLogPipeline" method');
- }, w.prototype.reportPv = function(n2) {
- var o2, i2 = this;
- n2 && (console.warn("reportPv is deprecated, please use reportEvent"), o2 = "" + Object.getOwnPropertyNames(this.bean).filter(function(e2) {
- return "id" !== e2;
- }).map(function(e2) {
- return e2 + "=" + i2.bean[e2];
- }).join("&"), this.sendPipeline([function(e2, t2) {
- t2({ url: i2.config.url + "/" + n2 + "?" + o2, addBean: false, type: R.CUSTOM_PV });
- }], R.CUSTOM_PV)(null));
- }, w.prototype.reportEvent = function(e2) {
- e2 && ((e2 = "string" == typeof e2 ? { name: e2, ext1: this.config.ext1 || "", ext2: this.config.ext2 || "", ext3: this.config.ext3 || "" } : e2).name ? ("string" != typeof e2.name && (console.warn("reportEvent params name must be string"), e2.name = String(e2.name)), this.eventPipeline(e2)) : console.warn("reportEvent params error"));
- }, w.prototype.reportTime = function(e2, t2) {
- if ("object" == typeof e2)
- return this.reportT(e2);
- "string" == typeof e2 ? "number" == typeof t2 ? t2 < 0 || 6e4 < t2 ? console.warn("reportTime: duration must between 0 and 60000") : this.submitCustomTime(e2, t2) : console.warn("reportTime: second param must be number") : console.warn("reportTime: first param must be a string");
- }, w.prototype.reportT = function(e2) {
- var t2 = e2.name, n2 = e2.duration, o2 = e2.ext1, o2 = void 0 === o2 ? "" : o2, i2 = e2.ext2, i2 = void 0 === i2 ? "" : i2, r2 = e2.ext3, r2 = void 0 === r2 ? "" : r2, e2 = e2.from;
- if ("string" == typeof t2 && "number" == typeof n2 && "string" == typeof o2 && "string" == typeof i2 && "string" == typeof r2) {
- if (!(n2 < 0 || 6e4 < n2))
- return this.submitCustomTime(t2, n2, o2, i2, r2, void 0 === e2 ? "" : e2);
- console.warn("reportTime: duration must between 0 and 60000");
- } else
- console.warn("reportTime: params error");
- }, w.prototype.time = function(e2) {
- "string" == typeof e2 ? this.timeMap[e2] ? console.warn("Timer " + e2 + " already exists") : this.timeMap[e2] = Date.now() : console.warn("time: first param must be a string");
- }, w.prototype.timeEnd = function(e2) {
- "string" == typeof e2 ? this.timeMap[e2] ? (this.submitCustomTime(e2, Date.now() - this.timeMap[e2]), delete this.timeMap[e2]) : console.warn("Timer " + e2 + " does not exist") : console.warn("timeEnd: first param must be a string");
- }, w.prototype.submitCustomTime = function(e2, t2, n2, o2, i2, r2) {
- this.customTimePipeline({ name: e2, duration: t2, ext1: n2 || this.config.ext1, ext2: o2 || this.config.ext2, ext3: i2 || this.config.ext3, from: r2 || void 0 });
- }, w.prototype.extendBean = function(e2, t2) {
- this.bean[e2] = t2;
- }, w.prototype.sendPipeline = function(e2, t2) {
- var n2, r2 = this;
- return m(u([function(e3, t3) {
- if ("number" != typeof n2.config.random && (console.warn("random must in [0, 1], default is 1."), n2.config.random = 1), !n2.isHidden || !n2.isGetSample)
- if (n2.isGetSample)
- n2.isHidden || t3(e3);
- else {
- if (n2.isGetSample = true, Math.random() < n2.config.random)
- return n2.isHidden = false, t3(e3);
- n2.isHidden = true;
- }
- }, te(n2 = this, t2)], e2, [ne(this), function(o2, i2) {
- r2.request(o2, function() {
- for (var e3, t3 = [], n3 = 0; n3 < arguments.length; n3++)
- t3[n3] = arguments[n3];
- r2.failRequestCount = 0, i2({ isErr: false, result: t3, logType: null == o2 ? void 0 : o2.type, logs: null == o2 ? void 0 : o2.log }), null != (e3 = null == o2 ? void 0 : o2.success) && e3.call.apply(e3, u([o2], t3));
- }, function() {
- for (var e3, t3 = [], n3 = 0; n3 < arguments.length; n3++)
- t3[n3] = arguments[n3];
- 60 <= ++r2.failRequestCount && r2.destroy(), -1 < ("" + t3[0]).indexOf("403 forbidden") && r2.destroy(), i2({ isErr: true, result: t3, logType: null == o2 ? void 0 : o2.type, logs: null == o2 ? void 0 : o2.log }), null != (e3 = null == o2 ? void 0 : o2.fail) && e3.call.apply(e3, u([o2], t3));
- });
- }, oe(this)]));
- }, w.prototype.send = function(e2, i2, r2) {
- var t2 = this;
- return m([ne(this), function(n2, o2) {
- t2.request(n2, function() {
- for (var e3 = [], t3 = 0; t3 < arguments.length; t3++)
- e3[t3] = arguments[t3];
- o2({ isErr: false, result: e3, logType: n2.type, logs: n2.log }), null != i2 && i2.apply(void 0, e3);
- }, function() {
- for (var e3 = [], t3 = 0; t3 < arguments.length; t3++)
- e3[t3] = arguments[t3];
- o2({ isErr: true, result: e3, logType: n2.type, logs: n2.log }), null != r2 && r2.apply(void 0, e3);
- });
- }, oe(this)])(e2);
- }, w.prototype.ready = function(e2, t2, n2) {
- throw new Error('You need to override "ready" method');
- }, w.prototype.request = function(e2, t2, n2) {
- throw new Error('You need to override "request" method');
- }, w.prototype.sendSDKError = function(e2) {
- var n2 = this;
- this.sendPipeline([function(e3, t2) {
- t2({ url: n2.config.url + "?id=1085&msg[0]=" + encodeURIComponent(O(e3)) + "&level[0]=2&from=" + n2.config.id + "&count=1&version=" + n2.config.id + "(1.37.5)", addBean: false, method: "get", type: R.SDK_ERROR, log: e3 });
- }], R.SDK_ERROR)(e2);
- }, w.prototype.destroy = function(e2) {
- void 0 === e2 && (e2 = false);
- var t2, n2, o2 = w.instances.indexOf(this);
- -1 !== o2 && w.instances.splice(o2, 1);
- for (var i2 = w.installedPlugins.length - 1; 0 <= i2; i2--)
- try {
- w.installedPlugins[i2].unpatch(this);
- } catch (e3) {
- this.sendSDKError(e3);
- }
- if (this.lifeCycle.emit("destroy"), this.lifeCycle.clear(), e2)
- t2 = this, n2 = Object.getOwnPropertyDescriptors(t2), Object.keys(n2).forEach(function(e3) {
- n2[e3].writable && (t2[e3] = null);
- }), Object.setPrototypeOf(this, null);
- else {
- for (var r2 = this; r2.constructor !== Object && ie(r2, this), r2 = Object.getPrototypeOf(r2); )
- ;
- 0 === w.instances.length && (o2 = Object.getPrototypeOf(this).constructor, ie(o2), ie(w));
- }
- }, w.version = "1.37.5", w.instances = [], w.logType = L, w.environment = f, w.installedPlugins = [], w), i = (a.prototype.patch = function(e2) {
- this.canUse(e2) && this.exist(e2) && (this.instances.push(e2), this.triggerInit(e2), this.triggerOnNewAegis(e2));
- }, a.prototype.unpatch = function(e2) {
- var t2 = this.instances.indexOf(e2);
- -1 !== t2 && (this.instances.splice(t2, 1), 0 === this.instances.length) && this.uninstall(e2);
- }, a.prototype.countInstance = function() {
- return this.instances.length;
- }, a.prototype.uninstall = function(e2) {
- var t2;
- null != (t2 = null == (t2 = this.option) ? void 0 : t2.destroy) && t2.apply(this, [e2]);
- }, a.prototype.walk = function(n2) {
- var o2 = this;
- this.instances.forEach(function(e2) {
- var t2 = o2.canUse(e2);
- t2 && n2(e2, t2);
- });
- }, a.prototype.canUse = function(e2) {
- e2 = this.getConfig(e2);
- return !(!e2 || "object" != typeof e2) || !!e2;
- }, a.prototype.getConfig = function(e2) {
- return null == (e2 = e2.config) ? void 0 : e2[this.name];
- }, a.prototype.exist = function(e2) {
- return -1 === this.instances.indexOf(e2);
- }, a.prototype.triggerInit = function(e2) {
- var t2;
- this.inited || (this.inited = true, null == (t2 = null == (t2 = this.option) ? void 0 : t2.init)) || t2.call(this.option, this.getConfig(e2));
- }, a.prototype.triggerOnNewAegis = function(e2) {
- var t2;
- null != (t2 = null == (t2 = this.option) ? void 0 : t2.onNewAegis) && t2.call(this.option, e2, this.getConfig(e2));
- }, a), Re = new i({ name: "aid", aid: "", init: function(e2) {
- try {
- var t2 = true !== e2 && e2 || window.localStorage.getItem("AEGIS_ID");
- t2 || (t2 = z(), window.localStorage.setItem("AEGIS_ID", t2)), this.aid = t2;
- } catch (e3) {
- }
- }, onNewAegis: function(e2) {
- e2.bean.aid = this.aid, e2.config.aid = this.aid;
- } }), Oe = function(t2) {
- var n2;
- return t2.payload ? (n2 = {}, Object.keys(t2).forEach(function(e2) {
- "payload" !== e2 && (n2[e2] = t2[e2]);
- }), n2) : t2;
- }, Se = new i({ name: "reportAssetSpeed" }), Te = Se = new i({ name: "reportAssetSpeed", collectCur: 0, collectEntryType: "resource", ASSETS_INITIATOR_TYPE: ["img", "css", "script", "link", "audio", "video"], onNewAegis: function(e2) {
- var t2 = this;
- re() && (this.collectSuccessLog(e2), this.collectFailLog(e2), performance.onresourcetimingbufferfull = function() {
- t2.collectCur = 0, performance.clearResourceTimings();
- });
- }, publish: function(t2, n2) {
- this.$walk(function(e2) {
- e2 === n2 && e2.speedLogPipeline(t2);
- });
- }, publishMany: function(e2, t2) {
- for (var n2 = t2.config, o2 = 0, i2 = e2.length; o2 < i2; o2++) {
- var r2 = e2[o2];
- -1 === this.ASSETS_INITIATOR_TYPE.indexOf(r2.initiatorType) || l(r2.name, n2.hostUrl) || this.publish(this.generateLog(r2, n2), t2);
- }
- }, collectSuccessLog: function(n2) {
- var e2, t2, o2 = this;
- "function" == typeof window.PerformanceObserver ? (this.publishMany(performance.getEntriesByType(this.collectEntryType), n2), (e2 = new window.PerformanceObserver(function(e3) {
- o2.publishMany(e3.getEntries(), n2);
- })).observe({ entryTypes: [this.collectEntryType] }), n2.lifeCycle.on("destroy", function() {
- 0 === Se.countInstance() && e2.disconnect();
- })) : (t2 = setInterval(function() {
- var e3 = performance.getEntriesByType(o2.collectEntryType), t3 = e3.slice(o2.collectCur);
- o2.collectCur = e3.length, o2.publishMany(t3, n2);
- }, 3e3), n2.lifeCycle.on("destroy", function() {
- 0 === Se.countInstance() && clearInterval(t2);
- }));
- }, collectFailLog: function(o2) {
- function e2(e3) {
- var t2, n2;
- e3 && (e3 = e3.target || e3.srcElement, !(t2 = (null == e3 ? void 0 : e3.src) || (null == e3 ? void 0 : e3.href)) || "string" != typeof t2 || -1 < window.location.href.indexOf(t2) || (e3 = "function" == typeof (null == (e3 = r2.api) ? void 0 : e3.resourceTypeHandler) ? null == (e3 = r2.api) ? void 0 : e3.resourceTypeHandler(t2) : "", n2 = performance.getEntriesByType(i2.collectEntryType).find(function(e4) {
- return e4.name === t2;
- }), l(t2, r2.hostUrl)) || (n2 = { url: K(t2), status: 400, duration: Number(((null == n2 ? void 0 : n2.duration) || 0).toFixed(2)), method: "get", type: e3 || "static", isHttps: Q(t2), urlQuery: P(t2, true), nextHopProtocol: "", domainLookup: 0, connectTime: 0 }, i2.publish(n2, o2)));
- }
- var i2 = this, r2 = o2.config;
- window.document.addEventListener("error", e2, true), o2.lifeCycle.on("destroy", function() {
- 0 === Se.countInstance() && window.document.removeEventListener("error", e2, true);
- });
- }, generateLog: function(e2, t2) {
- var t2 = "function" == typeof (null == (n2 = t2.api) ? void 0 : n2.resourceTypeHandler) ? null == (n2 = t2.api) ? void 0 : n2.resourceTypeHandler(e2.name) : "", n2 = e2.transferSize;
- return { url: K(e2.name), method: "get", duration: Number(e2.duration.toFixed(2)), status: 200, type: t2 || "static", isHttps: Q(e2.name), nextHopProtocol: e2.nextHopProtocol || "", urlQuery: P(e2.name, true), domainLookup: $(e2.domainLookupEnd - e2.domainLookupStart), connectTime: $(e2.connectEnd - e2.connectStart), transferSize: 0 < n2 ? n2 : -1 };
- }, collectNotReportedLog: function(e2) {
- var t2, n2;
- re() && (t2 = (n2 = performance.getEntriesByType(this.collectEntryType)).length, "function" != typeof window.PerformanceObserver) && this.collectCur !== t2 && (n2 = n2.slice(this.collectCur), this.collectCur = t2, this.publishMany(n2, e2, true));
- }, destroy: function() {
- this.option.publish = function() {
- };
- } }), Pe = window.navigator.userAgent.toLowerCase(), r = {};
- function a(e2) {
- this.aegisPlugin = true, this.name = "", this.instances = [], this.inited = false, e2.$walk = this.walk.bind(this), e2.$getConfig = this.getConfig.bind(this), this.option = e2, this.name = e2.name;
- }
- function w(e2) {
- var n2, t2, o2, i2, a2, r2, s2, c2, u2, l2, f2, d2, p2, h2, g2 = this;
- this.isGetSample = false, this.isHidden = false, this.config = { version: 0, delay: 1e3, onError: true, repeat: 60, random: 1, aid: true, device: true, pagePerformance: true, webVitals: true, speedSample: true, onClose: true, reportLoadPackageSpeed: true, hostUrl: "https://aegis.qq.com", env: "production", url: "", offlineUrl: "", whiteListUrl: "", pvUrl: "", speedUrl: "", customTimeUrl: "", performanceUrl: "", webVitalsUrl: "", eventUrl: "", setDataReportUrl: "", reportImmediately: true }, this.isWhiteList = false, this.lifeCycle = new G(), this.bean = {}, this.normalLogPipeline = m([Z(this, 5), ee, function(e3, t3) {
- var o3 = n2.config;
- t3(e3 = e3.map(function(e4) {
- var t4, n3 = o3.maxLength || 102400;
- try {
- if (!e4.msg || e4.msg.length <= n3)
- return e4;
- e4.msg = null == (t4 = e4.msg) ? void 0 : t4.substring(0, n3);
- } catch (t5) {
- e4.msg = O(e4.msg).substring(0, o3.maxLength);
- }
- return e4;
- }));
- }, (h2 = (n2 = this).config, function(e3, t3) {
- var n3 = "number" == typeof h2.repeat ? h2.repeat : 60;
- if (n3 <= 0)
- return t3(e3);
- var o3 = (null == h2 ? void 0 : h2.id) + "_error", i3 = y[o3] || {};
- t3(e3.filter(function(e4) {
- if (e4.level === L.ERROR || e4.level === L.PROMISE_ERROR || e4.level === L.AJAX_ERROR || e4.level === L.SCRIPT_ERROR || e4.level === L.IMAGE_ERROR || e4.level === L.CSS_ERROR || e4.level === L.MEDIA_ERROR || e4.level === L.RET_ERROR || e4.level === L.BRIDGE_ERROR || e4.level === L.PAGE_NOT_FOUND_ERROR || e4.level === L.WEBSOCKET_ERROR || e4.level === L.LAZY_LOAD_ERROR) {
- e4 = e4.msg.slice(0, 200);
- if (i3[e4] > n3)
- return v[o3] || ye(o3), false;
- i3[e4] = 1 + ~~i3[e4], y[o3] = i3;
- }
- return true;
- }));
- }), (d2 = this.lifeCycle.emit, p2 = this.config, function(e3, t3) {
- var n3, o3 = p2.logCreated;
- return "function" == typeof o3 ? (n3 = e3.filter(function(e4) {
- return false !== o3(e4);
- }), d2("beforeWrite", n3), t3(n3)) : (d2("beforeWrite", e3), t3(e3));
- }), (f2 = this, setTimeout(function() {
- var e3 = f2.config, t3 = e3.pvUrl, n3 = void 0 === t3 ? "" : t3, t3 = e3.spa, e3 = -1 < ["web-sdk", "mp-sdk"].indexOf("web-sdk");
- n3 && (e3 && !t3 || !e3) && f2.sendPipeline([function(e4, t4) {
- t4({ url: n3, type: R.PV });
- }], R.PV)(null);
- }, 100), function(e3, t3) {
- t3(e3);
- }), (u2 = c2 = s2 = false, l2 = [], (a2 = this).lifeCycle.on("onConfigChange", function() {
- r2 && clearTimeout(r2), r2 = setTimeout(function() {
- var e3, n3;
- !u2 && a2.config && (u2 = true, e3 = a2.config.whiteListUrl, (n3 = void 0 === e3 ? "" : e3) && a2.sendPipeline([function(e4, t3) {
- t3({ url: n3, type: R.WHITE_LIST, success: function(e5) {
- c2 = true;
- try {
- var t4 = e5.data || JSON.parse(e5), n4 = t4.retcode, o3 = t4.result, i3 = void 0 === o3 ? {} : o3, r3 = (0 === n4 && (s2 = i3.is_in_white_list, a2.isWhiteList = s2, 0 <= i3.rate) && i3.rate <= 1 && (a2.config.random = i3.rate, a2.isGetSample = false), a2.isWhiteList && l2.length ? be(a2)(l2.splice(0), function() {
- }) : !a2.isWhiteList && l2.length && (l2.length = 0), a2.config.onWhitelist);
- "function" == typeof r3 && r3(s2);
- } catch (e6) {
- }
- }, fail: function() {
- c2 = true;
- } });
- }], R.WHITE_LIST)(null), u2 = false);
- }, a2.config.uin ? 50 : 500);
- }), a2.lifeCycle.on("destroy", function() {
- l2.length = 0;
- }), function(e3, t3) {
- var n3;
- s2 || null != (n3 = null == (n3 = a2.config) ? void 0 : n3.api) && n3.reportRequest ? t3(e3.concat(l2.splice(0)).map(function(e4) {
- return ve(e4), e4;
- })) : (n3 = e3.filter(function(e4) {
- return e4.level !== L.INFO && e4.level !== L.API_RESPONSE ? (ve(e4), true) : (c2 || (l2.push(e4), 200 <= l2.length && (l2.length = 200)), false);
- })).length && t3(n3);
- }), function(e3, t3) {
- try {
- var n3 = JSON.parse(JSON.stringify(e3)), o3 = (g2.lifeCycle.emit("beforeReport", n3), g2.config.beforeReport);
- (e3 = "function" == typeof o3 ? e3.filter(function(e4) {
- return false !== o3(e4);
- }) : e3).length && t3(e3);
- } catch (e4) {
- }
- }, be(this)]), this.eventPipeline = m([Z(this, 10), (i2 = this, function(e3) {
- i2.sendPipeline([function(e4, t3) {
- var n3 = e4.map(function(e5) {
- return { name: e5.name, ext1: e5.ext1 || i2.config.ext1 || "", ext2: e5.ext2 || i2.config.ext2 || "", ext3: e5.ext3 || i2.config.ext3 || "" };
- });
- t3({ url: i2.config.eventUrl + "?payload=" + encodeURIComponent(JSON.stringify(n3)), type: R.EVENT, log: e4 });
- }], R.EVENT)(e3);
- })]), this.timeMap = {}, this.failRequestCount = 0, this.customTimePipeline = m([Z(this, 10), (o2 = this, function(e3) {
- return o2.sendPipeline([function(e4, t3) {
- t3({ url: o2.config.customTimeUrl + "?payload=" + encodeURIComponent(JSON.stringify({ custom: e4 })), type: R.CUSTOM, log: e4 });
- }], R.CUSTOM)(e3);
- })]), this.config = (t2 = this.config, void 0 === (e2 = e2.hostUrl) && (e2 = "https://aegis.qq.com"), t2.url = t2.url || e2 + "/collect", t2.offlineUrl = t2.offlineUrl || e2 + "/offline", t2.whiteListUrl = t2.whiteListUrl || e2 + "/collect/whitelist", t2.pvUrl = t2.pvUrl || e2 + "/collect/pv", t2.eventUrl = t2.eventUrl || e2 + "/collect/events", t2.speedUrl = t2.speedUrl || e2 + "/speed", t2.customTimeUrl = t2.customTimeUrl || e2 + "/speed/custom", t2.performanceUrl = t2.performanceUrl || e2 + "/speed/performance", t2.webVitalsUrl = t2.webVitalsUrl || e2 + "/speed/webvitals", t2.setDataReportUrl = t2.SetDataReportUrl || e2 + "/speed/miniProgramData", t2), w.instances.push(this);
- }
- function xe() {
- return ("10000000100040008000" + 1e11).replace(/[018]/g, function(e2) {
- return (e2 ^ (16 * Math.random() & 15) >> e2 / 4).toString(16);
- });
- }
- r.macos = function() {
- return t("mac");
- }, r.ios = function() {
- return r.iphone() || r.ipod() || r.ipad();
- }, r.iphone = function() {
- return !r.windows() && t("iphone");
- }, r.ipod = function() {
- return t("ipod");
- }, r.ipad = function() {
- var e2 = "MacIntel" === navigator.platform && 1 < navigator.maxTouchPoints;
- return t("ipad") || e2;
- }, r.android = function() {
- return !r.windows() && t("android");
- }, r.androidPhone = function() {
- return r.android() && t("mobile");
- }, r.androidTablet = function() {
- return r.android() && !t("mobile");
- }, r.blackberry = function() {
- return t("blackberry") || t("bb10");
- }, r.blackberryPhone = function() {
- return r.blackberry() && !t("tablet");
- }, r.blackberryTablet = function() {
- return r.blackberry() && t("tablet");
- }, r.windows = function() {
- return t("windows");
- }, r.windowsPhone = function() {
- return r.windows() && t("phone");
- }, r.windowsTablet = function() {
- return r.windows() && t("touch") && !r.windowsPhone();
- }, r.fxos = function() {
- return (t("(mobile") || t("(tablet")) && t(" rv:");
- }, r.fxosPhone = function() {
- return r.fxos() && t("mobile");
- }, r.fxosTablet = function() {
- return r.fxos() && t("tablet");
- }, r.meego = function() {
- return t("meego");
- }, r.cordova = function() {
- return window.cordova && "file:" === location.protocol;
- }, r.nodeWebkit = function() {
- return "object" == typeof window.process;
- }, r.mobile = function() {
- return r.androidPhone() || r.iphone() || r.ipod() || r.windowsPhone() || r.blackberryPhone() || r.fxosPhone() || r.meego();
- }, r.tablet = function() {
- return r.ipad() || r.androidTablet() || r.blackberryTablet() || r.windowsTablet() || r.fxosTablet();
- }, r.desktop = function() {
- return !r.tablet() && !r.mobile();
- }, r.isIE = function() {
- return "ActiveXObject" in window;
- };
- var Le = { generateTraceId: Ce(16), generateSpanId: Ce(8) }, ke = Array(32);
- function Ce(t2) {
- return function() {
- for (var e2 = 0; e2 < 2 * t2; e2++)
- ke[e2] = Math.floor(16 * Math.random()) + 48, 58 <= ke[e2] && (ke[e2] += 39);
- return String.fromCharCode.apply(null, ke.slice(0, 2 * t2));
- };
- }
- function Ie(e2) {
- var t2, n2 = "";
- return n2 = "object" == typeof e2 && (t2 = (e2 = function(e3, t3) {
- for (var n3 = 0; n3 < t3.length; n3++) {
- var o2 = t3[n3], i2 = e3[o2] || "function" == typeof e3.get && e3.get(o2);
- if (i2)
- return [o2, i2];
- }
- return ["", ""];
- }(e2, Object.keys(He)))[0], e2 = e2[1], t2) ? He[t2](e2) : n2;
- }
- function k(o2, e2, i2) {
- return null != e2 && e2.length && "object" == typeof o2 ? e2.reduce(function(e3, t2) {
- var n2 = o2 instanceof Headers ? o2.get(t2) : o2[t2];
- return n2 ? e3 + ("" === e3 ? "\n" : "\n\n") + i2 + " header " + t2 + ": " + n2 : e3;
- }, "") : "";
- }
- var Ae, Ne, qe, Ue, s, _e, je, He = { sw8: function(e2) {
- e2 = e2.split("-")[1];
- return e2 ? atob(e2) : "";
- }, traceparent: function(e2) {
- return e2.split("-")[1];
- }, b3: function(e2) {
- return e2.split("-")[0];
- }, "sentry-trace": function(e2) {
- return e2.split("-")[0];
- } }, Be = (p.prototype.generate = function(e2, t2) {
- if (void 0 === t2 && (t2 = {}), this.url = e2, !this.isUrlIgnored() && this.isUrlInTraceUrls() && this.traceType) {
- switch (this.traceType) {
- case "traceparent":
- this.traceId = this.createTraceparent();
- break;
- case "b3":
- this.traceId = this.createB3();
- break;
- case "sw8":
- this.traceId = this.createSw8();
- break;
- case "sentry-trace":
- this.traceId = this.createSentryTrace();
- break;
- default:
- return console.warn("this trace key " + this.traceType + " is not supported"), void (this.traceId = "");
- }
- return t2[this.traceType] && (this.traceId = t2[this.traceType]), { name: this.traceType, value: this.traceId };
- }
- }, p.prototype.createTraceparent = function() {
- var e2 = Le.generateSpanId();
- return "00-" + Le.generateTraceId() + "-" + e2 + "-0" + Number(1).toString(16);
- }, p.prototype.createB3 = function() {
- var e2 = Le.generateSpanId();
- return Le.generateTraceId() + "-" + e2 + "-1";
- }, p.prototype.createSw8 = function() {
- var e2 = new URL(location.href), t2 = z(), n2 = z();
- return "1-" + String(btoa(n2)) + "-" + String(btoa(t2)) + "-1-" + String(btoa("aegis")) + "-" + String(btoa("1.37.5")) + "-" + String(btoa(encodeURI(location.pathname))) + "-" + String(btoa(e2.host));
- }, p.prototype.createSentryTrace = function() {
- var e2 = xe().substring(16);
- return xe() + "-" + e2 + "-1";
- }, p.prototype.isUrlIgnored = function() {
- if (Array.isArray(this.ignoreUrls) && 0 !== this.ignoreUrls.length)
- for (var e2 = 0, t2 = this.ignoreUrls; e2 < t2.length; e2++) {
- var n2 = t2[e2];
- if (this.urlMatches(this.url, n2))
- return true;
- }
- return false;
- }, p.prototype.isUrlInTraceUrls = function() {
- if (!this.urls)
- return true;
- if (Array.isArray(this.urls)) {
- if (0 === this.urls.length)
- return false;
- for (var e2 = 0, t2 = this.urls; e2 < t2.length; e2++) {
- var n2 = t2[e2];
- if (this.urlMatches(this.url, n2))
- return true;
- }
- }
- return false;
- }, p.prototype.urlMatches = function(e2, t2) {
- return "string" == typeof t2 ? e2 === t2 : !!e2.match(t2);
- }, p), De = false, c = [], Fe = /^\/[^/]/, Me = false, d = [], We = (new i({ name: "reportApiSpeed" }), new i({ name: "reportApiSpeed", override: false, onNewAegis: function(e2) {
- var t2, n2;
- this.override || (null != (n2 = e2.config.api) && n2.injectTraceHeader && (this.traceRequestHeader = new Be(n2.injectTraceHeader, null != (t2 = null == n2 ? void 0 : n2.injectTraceIgnoreUrls) ? t2 : [], null == n2 ? void 0 : n2.injectTraceUrls)), this.override = true, this.overrideFetch(e2.config, e2), this.overrideXhr(e2.config, e2));
- }, getRequestType: function(e2, t2, n2) {
- void 0 === t2 && (t2 = "");
- var o2, i2, e2 = "function" == typeof (null == (i2 = e2.api) ? void 0 : i2.resourceTypeHandler) ? null == (i2 = e2.api) ? void 0 : i2.resourceTypeHandler(n2) : "";
- return -1 === X.indexOf(e2) && (o2 = void 0 === t2 ? "" : t2, i2 = (void 0 === n2 ? "" : n2).split("?")[0], e2 = ce.test(i2) || se.some(function(e3) {
- return -1 !== String(o2).indexOf(e3);
- }) ? "static" : "fetch"), e2;
- }, overrideFetch: function(m2, v2) {
- var y2 = this, e2 = m2.api, e2 = { name: this.name, traceRequestHeader: null != e2 && e2.injectTraceHeader ? this.traceRequestHeader : null, then: function(f2, d2, p2, h2) {
- var e3, g2;
- l(p2, m2.hostUrl) || (e3 = f2.headers ? f2.headers.get("content-type") : "", "fetch" === (g2 = y2.getRequestType(m2, e3, p2)) ? f2.clone().text().then(function(n2) {
- var e4, o2 = f2.status <= 0 || 400 <= f2.status, t2 = (null == (t2 = m2.api) ? void 0 : t2.reqHeaders) || [], i2 = k(null == h2 ? void 0 : h2.headers, t2, "req"), t2 = (null == (t2 = m2.api) ? void 0 : t2.resHeaders) || [], r2 = k(f2.headers, t2, "res"), a2 = Ie(null == h2 ? void 0 : h2.headers), t2 = Y(n2, m2.api, { url: p2, ctx: f2, payload: null == h2 ? void 0 : h2.body }), s2 = t2.code, c2 = t2.isErr, t2 = null == (t2 = m2.api) ? void 0 : t2.apiDetail, u3 = t2 ? x(null == h2 ? void 0 : h2.body, null == (e4 = m2.api) ? void 0 : e4.reqParamHandler, { url: p2 }) : "", l2 = t2 ? x(n2, null == (e4 = m2.api) ? void 0 : e4.resBodyHandler, { url: p2, ctx: f2 }) : "";
- setTimeout(function() {
- var e5 = y2.getPerformanceEntryByUrl(m2, { url: p2, duration: d2, type: g2, status: f2.status || 0, method: (null == h2 ? void 0 : h2.method) || "get" }), t3 = (o2 ? "FETCH_ERROR: " + n2 + " \n\n" : "") + "fetch req url: " + p2 + " \n \nres status: " + (f2.status || 0) + " \n \nres duration: " + e5.duration + "ms \n \nreq method: " + ((null == h2 ? void 0 : h2.method) || "get") + " \n \nres retcode: " + s2 + "\n \nreq param: " + u3 + "\n \nres data: " + l2 + "\n " + i2 + "\n " + r2;
- e5.payload = null == h2 ? void 0 : h2.body, e5.ret = s2, e5.isErr = +c2, y2.publishNormalLog({ msg: t3, level: o2 ? L.AJAX_ERROR : c2 ? L.RET_ERROR : L.API_RESPONSE, code: s2, trace: a2 }, v2), y2.publishSpeed(e5, v2);
- }, 0);
- }) : setTimeout(function() {
- var e4 = y2.getPerformanceEntryByUrl(m2, { url: p2, duration: d2, type: g2, status: f2.status || 0, method: (null == h2 ? void 0 : h2.method) || "get" });
- e4.type = "static", e4.urlQuery = P(p2, true), y2.publishSpeed(e4, v2);
- }, 0));
- }, catch: function(t2, n2, o2, i2) {
- var r2, e3, a2, s2, c2;
- throw l(o2, m2.hostUrl) || (r2 = y2.getRequestType(m2, "", o2), e3 = (null == (e3 = m2.api) ? void 0 : e3.reqHeaders) || [], a2 = k(null == i2 ? void 0 : i2.headers, e3, "req"), s2 = Ie(null == i2 ? void 0 : i2.headers), c2 = null != (e3 = m2.api) && e3.apiDetail ? x(null == i2 ? void 0 : i2.body, null == (e3 = m2.api) ? void 0 : e3.reqParamHandler, { url: o2 }) : "", setTimeout(function() {
- var e4 = y2.getPerformanceEntryByUrl(m2, { url: o2, duration: n2, type: r2, status: 0, method: (null == i2 ? void 0 : i2.method) || "get" }), e4 = (y2.publishSpeed(e4, v2), "AJAX_ERROR: " + t2 + "\n \nreq url: " + o2 + "\n \nres status: 0\n \nres duration: " + e4.duration + "ms\n \nreq method: " + ((null == i2 ? void 0 : i2.method) || "get") + "\n \nreq param: " + c2 + "\n " + a2);
- y2.publishNormalLog({ msg: e4, level: L.AJAX_ERROR, code: -400, trace: s2 }, v2);
- }, 0)), t2;
- } }, u2 = (this.hackFetchOptions = e2, this.hackFetchOptions);
- if (d.find(function(e3) {
- return e3.name === u2.name;
- }))
- throw new Error("name '" + u2.name + "' is already in hackFetch option list");
- d.push(u2), !Me && window.fetch && (Me = true, Ue = window.fetch, window.fetch = function(e3, i2) {
- void 0 === i2 && (i2 = {});
- var t2, n2, r2 = "string" == typeof e3 ? e3 : null == e3 ? void 0 : e3.url, o2 = (Fe.test(r2) && (r2 = "" + location.origin + r2), (u2 || {}).traceRequestHeader);
- o2 && (n2 = (i2 || {}).headers, t2 = (n2 = o2.generate(r2, o2 = void 0 === n2 ? {} : n2) || {}).name, n2 = n2.value) && t2 && (i2.headers = Object.assign(o2, ((o2 = {})[t2] = n2, o2)));
- for (var a2 = 0; a2 < d.length; a2++) {
- var s2 = d[a2];
- try {
- "function" == typeof s2.beforeFetch && s2.beforeFetch(r2, i2);
- } catch (e4) {
- }
- }
- var c2 = Date.now();
- return Ue(e3, i2).then(function(e4) {
- for (var t3 = e4.clone(), n3 = 0; n3 < d.length; n3++) {
- var o3 = d[n3];
- try {
- "function" == typeof o3.then && o3.then(t3, Date.now() - c2, r2, i2);
- } catch (e5) {
- }
- }
- return t3;
- }).catch(function(e4) {
- for (var t3 = 0; t3 < d.length; t3++) {
- var n3 = d[t3];
- try {
- "function" == typeof n3.catch && n3.catch(e4, Date.now() - c2, r2, i2);
- } catch (e5) {
- }
- }
- throw e4;
- });
- });
- }, overrideXhr: function(O2, S2) {
- var t2, T2 = this, e2 = { name: this.name, send: function(E2, R2) {
- var e3, t3, n2 = Date.now();
- ((null == O2 ? void 0 : O2.api) || {}).injectTraceHeader && (e3 = (t3 = T2.traceRequestHeader.generate(E2.aegisUrl) || {}).name, t3 = t3.value, e3) && t3 && E2.setRequestHeader(e3, t3), E2.addEventListener("loadend", function() {
- var v2, y2, e4, w2, b2 = E2.aegisUrl || "";
- l(b2, O2.hostUrl) || "abort" === E2.failType || (v2 = "", (E2.failType || !E2.status || 400 <= E2.status) && (v2 = E2.failType || "failed"), y2 = Date.now() - n2, e4 = E2.getResponseHeader("content-type"), w2 = T2.getRequestType(O2, e4, b2), setTimeout(function() {
- var o2 = T2.getPerformanceEntryByUrl(O2, { url: b2, duration: y2, type: w2, status: E2.status, method: E2.aegisMethod || "get" });
- if ("fetch" === w2) {
- var e5 = (null == (e5 = O2.api) ? void 0 : e5.reqHeaders) || [], i2 = k(E2.aegisXhrReqHeader, e5, "req"), e5 = (null == (e5 = O2.api) ? void 0 : e5.resHeaders) || [], t4 = E2.getAllResponseHeaders().split("\r\n").reduce(function(e6, t5) {
- t5 = t5.split(": ");
- return t5[0] && t5[1] && (e6[t5[0]] = t5[1]), e6;
- }, {}), r2 = k(t4, e5, "res"), a2 = Ie(E2.aegisXhrReqHeader), e5 = null == (t4 = O2.api) ? void 0 : t4.apiDetail, s2 = e5 ? x(R2, null == (t4 = O2.api) ? void 0 : t4.reqParamHandler, { url: b2 }) : "", c2 = e5 ? x(E2.response, null == (t4 = O2.api) ? void 0 : t4.resBodyHandler, { url: b2 }) : "";
- try {
- var n3, u2, l2, f2, d2 = E2.response, p2 = O2.api, h2 = { url: b2, ctx: E2, payload: R2 }, g2 = function(e6) {
- var t5 = e6.code, e6 = e6.isErr, n4 = (v2 ? "AJAX_ERROR: request " + v2 + " \n\n" : "") + "fetch req url: " + b2 + " \n \nres status: " + o2.status + "\n \nres duration: " + o2.duration + "ms\n \nreq method: " + o2.method + "\n \nres retcode: " + t5 + "\n \nreq param: " + s2 + "\n \nres data: " + c2 + "\n " + i2 + "\n " + r2;
- o2.ret = t5, o2.isErr = +e6, o2.payload = R2, T2.publishNormalLog({ msg: n4, level: v2 ? L.AJAX_ERROR : e6 ? L.RET_ERROR : L.API_RESPONSE, code: t5, trace: a2 }, S2), T2.publishSpeed(o2, S2);
- };
- try {
- if ("function" == typeof (null == p2 ? void 0 : p2.retCodeHandlerAsync))
- return void p2.retCodeHandlerAsync(d2, null == h2 ? void 0 : h2.url, null == h2 ? void 0 : h2.ctx, function(e6) {
- var t5 = e6.code, e6 = e6.isErr;
- null != g2 && g2({ code: void 0 === t5 ? "unknown" : t5, isErr: e6 });
- });
- if ("function" == typeof (null == p2 ? void 0 : p2.retCodeHandler))
- return void (l2 = (u2 = p2.retCodeHandler(d2, null == h2 ? void 0 : h2.url, null == h2 ? void 0 : h2.ctx, null == h2 ? void 0 : h2.payload) || {}).code, f2 = u2.isErr, null != g2 && g2({ code: void 0 === l2 ? "unknown" : l2, isErr: f2 }));
- if (!(d2 = "string" == typeof d2 ? JSON.parse(d2) : d2))
- return void (null != g2 && g2({ code: "unknown", isErr: false }));
- "function" == typeof (null == (n3 = null == p2 ? void 0 : p2.ret) ? void 0 : n3.join) && (ue = [].concat(p2.ret.map(function(e6) {
- return e6.toLowerCase();
- })));
- var m2 = Object.getOwnPropertyNames(d2).filter(function(e6) {
- return -1 !== ue.indexOf(e6.toLowerCase());
- });
- if (m2.length)
- return void ("未知" !== (l2 = d2[m2[0]]) && "" !== l2 || (l2 = "unknown"), null != g2 && g2({ code: "" + l2, isErr: 0 !== l2 && "0" !== l2 && "unknown" !== l2 }));
- null != g2 && g2({ code: "unknown", isErr: false });
- } catch (d3) {
- null != g2 && g2({ code: "unknown", isErr: false });
- }
- } catch (e6) {
- o2.ret = "unknown", T2.publishSpeed(o2, S2);
- }
- } else
- o2.type = "static", o2.urlQuery = P(b2, true), T2.publishSpeed(o2, S2);
- }, 0));
- }), ["abort", "error", "timeout"].map(function(e4) {
- E2.addEventListener(e4, function() {
- E2.failType = e4;
- });
- });
- } };
- this.hackXHROptions = e2, t2 = this.hackXHROptions, c.find(function(e3) {
- return e3.name === t2.name;
- }) || (c.push(t2), !De && window.XMLHttpRequest && (Ae = window.XMLHttpRequest.prototype.send, Ne = window.XMLHttpRequest.prototype.open, qe = window.XMLHttpRequest.prototype.setRequestHeader, De = true, window.XMLHttpRequest.prototype.open = function() {
- this.aegisMethod = arguments[0];
- var e3 = arguments[1];
- if (Fe.test(e3) && (e3 = "" + location.origin + e3), this.aegisUrl = e3, this.aegisXhrStartTime = Date.now(), this.sendByAegis)
- r.isIE() || (this.timeout = 5e3);
- else
- for (var t3 = 0; t3 < c.length; t3++) {
- var n2 = c[t3];
- try {
- "function" == typeof n2.open && n2.open(this);
- } catch (e4) {
- }
- }
- return Ne.apply(this, arguments);
- }, window.XMLHttpRequest.prototype.setRequestHeader = function() {
- var e3, t3 = arguments[0], n2 = arguments[1];
- if (this.aegisXhrReqHeader = null != (e3 = this.aegisXhrReqHeader) ? e3 : {}, !(-1 < ["traceparent", "b3", "sw8", "sentry-trace"].indexOf(t3) && (this.aegisXhrReqHeader[t3] || (arguments[1] = n2), this.aegisXhrReqHeader[t3])))
- return this.aegisXhrReqHeader[t3] = arguments[1], qe.apply(this, arguments);
- }, window.XMLHttpRequest.prototype.send = function() {
- if (!this.sendByAegis)
- for (var e3 = 0; e3 < c.length; e3++) {
- var t3 = c[e3];
- try {
- "function" == typeof t3.send && t3.send(this, arguments[0]);
- } catch (e4) {
- }
- }
- return Ae.apply(this, arguments);
- }));
- }, getPerformanceEntryByUrl: function(e2, t2) {
- if (null != (e2 = e2.api) && e2.usePerformanceTiming && "string" == typeof t2.url) {
- e2 = null == (e2 = performance.getEntriesByName(t2.url)) ? void 0 : e2.pop();
- if (e2)
- return { url: t2.url, isHttps: Q(t2.url), method: t2.method, type: t2.type, status: t2.status, duration: Number(e2.duration.toFixed(2)), nextHopProtocol: e2.nextHopProtocol || "", domainLookup: $(e2.domainLookupEnd - e2.domainLookupStart), connectTime: $(e2.connectEnd - e2.connectStart) };
- }
- return { url: t2.url, isHttps: Q(t2.url), method: t2.method, type: t2.type, status: t2.status, duration: Number(t2.duration.toFixed(2)), nextHopProtocol: "", domainLookup: n.number, connectTime: n.number };
- }, publishSpeed: function(n2) {
- var o2 = this;
- this.$walk(function(e2) {
- var t2 = o2.$getConfig(e2);
- "fetch" === n2.type && t2 && "function" == typeof t2.urlHandler ? e2.speedLogPipeline(E(E({}, n2), { url: P(t2.urlHandler(n2.url, n2.payload)) })) : (n2.url = P(n2.url), e2.speedLogPipeline(n2));
- });
- }, publishNormalLog: function(t2) {
- this.$walk(function(e2) {
- e2.normalLogPipeline(t2);
- });
- }, destroy: function() {
- var t2, n2, e2;
- this.option.publishSpeed = function() {
- }, this.option.publishNormalLog = function() {
- }, this.option.hackXHROptions && (t2 = this.option.hackXHROptions, -1 !== (e2 = c.findIndex(function(e3) {
- return e3.name === t2.name;
- }))) && c.splice(e2, 1), this.option.hackFetchOptions && (n2 = this.option.hackFetchOptions, -1 !== (e2 = d.findIndex(function(e3) {
- return e3.name === n2.name;
- }))) && d.splice(e2, 1), this.option.override = false;
- } })), Ve = {}, Xe = new i({ name: "reportBridgeSpeed", override: false, onNewAegis: function(e2) {
- this.override || (this.override = true, this.overrideBridge(e2));
- }, publishSpeed: function(t2, n2) {
- this.$walk(function(e2) {
- e2 === n2 && e2.speedLogPipeline(t2);
- });
- }, overrideBridge: function(c2) {
- var u2 = this, l2 = c2.config;
- l2.reportBridgeSpeed && l2.h5Bridge && l2.h5BridgeFunc.length && l2.h5BridgeFunc.forEach(function(e2) {
- var s2 = l2.h5Bridge[e2];
- Ve[e2] = s2, l2.h5Bridge[e2] = function() {
- for (var e3 = [], t2 = 0; t2 < arguments.length; t2++)
- e3[t2] = arguments[t2];
- var o2 = e3[0], i2 = e3[1], n2 = e3[2], r2 = e3[3], a2 = Date.now();
- s2(o2, i2, n2, function(e4) {
- var t3 = Y(e4, l2.api), n3 = t3.code, t3 = t3.isErr, n3 = { url: o2 + "-" + i2, name: o2 + "-" + i2, duration: Date.now() - a2, type: "bridge", ret: n3, isErr: +t3 };
- u2.publishSpeed(n3, c2), r2(e4);
- });
- };
- });
- }, unHackBridge: function(t2) {
- Object.keys(Ve).forEach(function(e2) {
- Ve[e2] && (t2.config.h5Bridge[e2] = Ve[e2]);
- }), Ve = {};
- }, destroy: function(e2) {
- this.option.publishSpeed = function() {
- }, this.option.unHackBridge(e2), this.option.override = false;
- } });
- function p(e2, t2, n2) {
- void 0 === n2 && (n2 = null), this.traceType = e2, this.ignoreUrls = t2, this.urls = n2;
- }
- (T = s = s || {})[T.unknown = 100] = "unknown", T[T.wifi = 1] = "wifi", T[T.net2g = 2] = "net2g", T[T.net3g = 3] = "net3g", T[T.net4g = 4] = "net4g", T[T.net5g = 5] = "net5g", T[T.net6g = 6] = "net6g", (T = _e = _e || {})[T.android = 1] = "android", T[T.ios = 2] = "ios", T[T.windows = 3] = "windows", T[T.macos = 4] = "macos", T[T.linux = 5] = "linux", T[T.other = 100] = "other", (T = je = je || {})[T.unknown = 100] = "unknown", T[T.normal = 0] = "normal", T[T.weak = 1] = "weak", T[T.disconnected = 2] = "disconnected";
- function h(e2, t2, n2, o2) {
- return void 0 === n2 && (n2 = 15e3), void 0 === o2 && (o2 = 0), (t2 = void 0 === t2 ? 0 : t2) <= e2 && e2 <= n2 ? e2 : o2;
- }
- var g, b, Ge, Je, $e, S, Ke, Qe, Ye, T = new i({ name: "device", onNewAegis: function(e2) {
- e2.extendBean("platform", this.getPlatform()), e2.extendBean("netType", s.unknown), this.getDpi(e2), this.refreshNetworkTypeToBean(e2), this.refreshNetworkStatusToBean(e2);
- }, getDpi: function(e2) {
- e2.extendBean("vp", Math.round(window.innerWidth) + " * " + Math.round(window.innerHeight)), window.screen && e2.extendBean("sr", Math.round(window.screen.width) + " * " + Math.round(window.screen.height));
- }, getPlatform: function() {
- var t2 = { android: /\bAndroid\s*([^;]+)/, ios: /\b(iPad|iPhone|iPod)\b.*? OS ([\d_]+)/, windows: /\b(Windows NT)/, macos: /\b(Mac OS)/, linux: /\b(Linux)/i }, e2 = Object.keys(t2).find(function(e3) {
- return t2[e3].test(navigator.userAgent);
- });
- return e2 ? _e[e2] : _e.other;
- }, refreshNetworkTypeToBean: function(t2) {
- var n2 = this, e2 = t2.config;
- e2 && ("function" == typeof e2.getNetworkType ? e2.getNetworkType : ze)(function(e3) {
- s[e3] || (e3 = s.unknown), t2.extendBean("netType", e3), n2.NetworkRefreshTimer = setTimeout(function() {
- n2.refreshNetworkTypeToBean(t2), clearTimeout(n2.NetworkRefreshTimer);
- }, 1e4);
- });
- }, refreshNetworkStatusToBean: function(t2) {
- var e2, n2 = this, o2 = t2.config;
- o2 && null != (e2 = "function" == typeof o2.getNetworkStatus ? o2.getNetworkStatus : e2) && e2(function(e3) {
- void 0 === je[e3] && (e3 = je.unknown), t2.extendBean("netStatus", e3), n2.NetworkStatusRefreshTimer = setTimeout(function() {
- n2.refreshNetworkStatusToBean(t2), clearTimeout(n2.NetworkStatusRefreshTimer);
- }, 1e4);
- });
- } }), ze = function(e2) {
- var t2 = "", n2 = navigator.userAgent.match(/NetType\/(\w+)/);
- n2 ? t2 = n2[1] : navigator.connection && (t2 = navigator.connection.effectiveType || navigator.connection.type), e2((n2 = t2 = t2 || "unknown", 0 <= (n2 = String(n2).toLowerCase()).indexOf("4g") ? s.net4g : 0 <= n2.indexOf("wifi") ? s.wifi : 0 <= n2.indexOf("5g") ? s.net5g : 0 <= n2.indexOf("6g") ? s.net6g : 0 <= n2.indexOf("3g") ? s.net3g : 0 <= n2.indexOf("2g") ? s.net2g : s.unknown));
- }, Ze = window.WebSocket, C = [], et = { construct: function(e2, t2) {
- var a2 = new e2(t2[0], t2[1]);
- return a2.originSend = a2.send, a2.addEventListener("error", function(e3) {
- var e3 = (null == e3 ? void 0 : e3.currentTarget) || {}, t3 = e3.url, n2 = e3.readyState;
- null != C && C.forEach(function(e4) {
- e4 = e4.onErr;
- null != e4 && e4({ msg: "无法获知具体错误信息,需在浏览器控制台查看!", readyState: n2, connectUrl: t3 });
- });
- }), Object.defineProperty(a2, "send", { get: function() {
- return function(e3) {
- null != (t3 = a2.originSend) && t3.call(a2, e3);
- var t3 = a2.readyState, e3 = WebSocket.OPEN, n2 = WebSocket.CLOSED, o2 = WebSocket.CONNECTING, i2 = WebSocket.CLOSING;
- if (t3 !== e3) {
- var r2 = { readyState: t3, connectUrl: a2.url };
- switch (t3) {
- case n2:
- C.forEach(function(e4) {
- e4 = e4.sendErr;
- null != e4 && e4(E({ msg: "消息发送失败,连接已关闭!" }, r2));
- });
- break;
- case o2:
- C.forEach(function(e4) {
- (0, e4.sendErr)(E({ msg: "消息发送失败,正在连接中!" }, r2));
- });
- break;
- case i2:
- C.forEach(function(e4) {
- (0, e4.sendErr)(E({ msg: "消息发送失败,连接正在关闭!" }, r2));
- });
- }
- }
- };
- } }), a2;
- } }, tt = new i({ name: "onError" }), nt = tt = new i({ name: "onError", onNewAegis: function(e2) {
- this.startListen(e2);
- }, startListen: function(i2) {
- function e2(e3) {
- (e3 = e3 && O(e3.reason)) && s2.publishErrorLog({ msg: "PROMISE_ERROR: " + e3, level: L.PROMISE_ERROR }, i2);
- }
- function t2(e3) {
- var t3;
- if (e3 = (null == e3 ? void 0 : e3.target) || (null == e3 ? void 0 : e3.srcElement)) {
- var n3 = e3.src || e3.href || "", e3 = e3.tagName, e3 = void 0 === e3 ? "script" : e3;
- if (!(l(t3 = n3, i2.config.hostUrl) || -1 < window.location.href.indexOf(t3))) {
- var o3 = { msg: e3 + " load fail: " + n3, level: L.INFO };
- if (/\.js$/.test(n3))
- o3.level = L.SCRIPT_ERROR;
- else if (/\.css$/.test(n3))
- o3.level = L.CSS_ERROR;
- else
- switch (e3.toLowerCase()) {
- case "script":
- o3.level = L.SCRIPT_ERROR;
- break;
- case "link":
- o3.level = L.CSS_ERROR;
- break;
- case "img":
- o3.level = L.IMAGE_ERROR;
- break;
- case "audio":
- case "video":
- o3.level = L.MEDIA_ERROR;
- break;
- default:
- return;
- }
- s2.publishErrorLog(o3, i2);
- }
- }
- }
- var n2, o2, r2, a2, s2 = this, c2 = window.onerror;
- window.onerror = function() {
- for (var e3 = [], t3 = 0; t3 < arguments.length; t3++)
- e3[t3] = arguments[t3];
- var n3, o3 = O(e3[0]);
- "string" != typeof (n3 = o3) || !n3 || W.some(function(e4) {
- return -1 < n3.indexOf(e4);
- }) || M.some(function(e4) {
- return -1 < n3.indexOf(e4);
- }) || s2.publishErrorLog({ msg: (o3 || "") + " @ (" + (O(e3[1]) || "") + ":" + (e3[2] || 0) + ":" + (e3[3] || 0) + ")\n \n" + O(e3[4] || ""), level: L.ERROR }, i2), null != c2 && c2.call.apply(c2, u([window], e3));
- }, window.addEventListener("unhandledrejection", e2);
- window.document.addEventListener("error", t2, true), i2.lifeCycle.on("destroy", function() {
- 0 === tt.countInstance() && (window.document.removeEventListener("unhandledrejection", e2), window.document.removeEventListener("error", t2, true));
- }), i2.config.websocketHack && (n2 = { key: i2.config.id + "-" + this.name, onErr: function(e3) {
- var t3;
- null != (t3 = s2.publishWsErrorLog) && t3.call(s2, e3, i2);
- }, sendErr: function(e3) {
- var t3;
- null != (t3 = s2.publishWsErrorLog) && t3.call(s2, e3, i2);
- } }, this.hackWebsocketConfig = n2, n2 = this.hackWebsocketConfig, window.Proxy) && window.WebSocket && (o2 = window.WebSocket, window && !o2.isHack && (r2 = new Proxy(WebSocket, et), o2.isHack = true, window.WebSocket = r2), a2 = n2, C.find(function(e3) {
- return e3.key === a2.key;
- }) || a2 && C.push(a2));
- }, publishErrorLog: function(t2, n2) {
- this.$walk(function(e2) {
- e2 === n2 && e2.normalLogPipeline(t2);
- });
- }, publishWsErrorLog: function(e2, t2) {
- var n2 = e2.connectUrl, o2 = e2.msg, e2 = e2.readyState;
- this.publishErrorLog({ msg: "WEBSOCKET_ERROR: \n connect: " + n2 + "\n readyState: " + e2 + "\n msg: " + o2, level: L.WEBSOCKET_ERROR }, t2);
- }, destroy: function() {
- var t2, e2;
- this.option.publishErrorLog = function() {
- }, this.option.hackWebsocketConfig && (t2 = this.option.hackWebsocketConfig, window.WebSocket = Ze, -1 !== (e2 = C.findIndex(function(e3) {
- return e3.key === t2.key;
- }))) && C.splice(e2, 1);
- } }), ot = (new i({ name: "pagePerformance" }), 3), it = new i({ name: "pagePerformance", onNewAegis: function(e2) {
- re() && (g ? this.publish(g, e2) : this.startCalcPerformance(e2));
- }, publish: function(e2, t2) {
- var s2 = this;
- this.$walk(function(a2) {
- a2 === t2 && a2.sendPipeline([function(e3, t3) {
- var n2, o2 = [];
- for (n2 in e3)
- o2.push(n2 + "=" + e3[n2]);
- var i2, r2 = s2.$getConfig(a2);
- if (r2)
- return i2 = -1 === (null == (i2 = a2.config.performanceUrl) ? void 0 : i2.indexOf("?")) ? "?" : "&", "function" == typeof r2.urlHandler ? t3({ url: a2.config.performanceUrl + i2 + o2.join("&") + "&from=" + (encodeURIComponent(r2.urlHandler()) || window.location.href), beanFilter: ["from"], type: R.PERFORMANCE, log: e3 }) : t3({ url: a2.config.performanceUrl + i2 + o2.join("&"), type: R.PERFORMANCE, log: e3 });
- }], R.PERFORMANCE)(e2);
- });
- }, startCalcPerformance: function(n2) {
- var o2 = this;
- try {
- this.getFirstScreenTiming(n2, function(e2) {
- var t2 = performance.timing;
- t2 && (g = { dnsLookup: h(t2.domainLookupEnd - t2.domainLookupStart), tcp: h(t2.connectEnd - t2.connectStart), ssl: h(0 === t2.secureConnectionStart ? 0 : t2.requestStart - t2.secureConnectionStart), ttfb: h(t2.responseStart - t2.requestStart), contentDownload: h(t2.responseEnd - t2.responseStart), domParse: h(t2.domInteractive - t2.domLoading, 0, 15e3, 1070), resourceDownload: h(t2.loadEventStart - t2.domInteractive, 0, 15e3, 1070), firstScreenTiming: h(Math.floor(e2), 0, 15e3, 15e3) }, (t2 = n2.config).extraPerformanceData && "{}" !== JSON.stringify(t2.extraPerformanceData) && (t2 = (e2 = t2.extraPerformanceData).engineInit, e2 = e2.bundleLoad, g = E(E({}, g), { engineInit: h(t2, 0, 1e4), bundleLoad: h(e2, 0, 1e4) })), o2.publish(g, n2));
- });
- } catch (n3) {
- }
- }, getFirstScreenTiming: function(s2, c2) {
- s2.lifeCycle.on("destroy", function() {
- h2 && clearTimeout(h2);
- });
- var u2 = this, n2 = ["script", "style", "link", "br"], l2 = [], f2 = {}, d2 = new MutationObserver(function(e2) {
- var t2 = { roots: [], rootsDomNum: [], time: performance.now() };
- e2.forEach(function(e3) {
- e3 && e3.addedNodes && e3.addedNodes.forEach && e3.addedNodes.forEach(function(e4) {
- 1 === e4.nodeType && e4.hasAttribute("AEGIS-FIRST-SCREEN-TIMING") ? (Object.prototype.hasOwnProperty.apply(f2, [t2.time]) || (f2[t2.time] = []), f2[t2.time].push(e4)) : 1 !== e4.nodeType || -1 !== n2.indexOf(e4.nodeName.toLocaleLowerCase()) || u2.isEleInArray(e4, t2.roots) || e4.hasAttribute("AEGIS-IGNORE-FIRST-SCREEN-TIMING") || (t2.roots.push(e4), t2.rootsDomNum.push(u2.walkAndCount(e4) || 0));
- });
- }), t2.roots.length && l2.push(t2);
- }), p2 = (d2.observe(document, { childList: true, subtree: true }), function(o2) {
- (o2 = void 0 === o2 ? 0 : o2) || (i2 = 0, (e2 = Object.keys(f2)).length ? (o2 = Math.max.apply(null, e2), ("object" != typeof (null == (e2 = s2.config) ? void 0 : e2.pagePerformance) || null != (e2 = s2.config.pagePerformance) && e2.firstScreenInfo) && (s2.firstScreenInfo = { element: null == (e2 = f2[o2]) ? void 0 : e2[0], timing: o2, markDoms: f2 })) : l2.forEach(function(e3) {
- for (var t3, n4 = 0; n4 < e3.roots.length; n4++)
- e3.rootsDomNum[n4] > i2 && u2.isInFirstScreen(e3.roots[n4]) && (i2 = e3.rootsDomNum[n4], o2 = e3.time, "object" != typeof (null == (t3 = s2.config) ? void 0 : t3.pagePerformance) || null != (t3 = s2.config.pagePerformance) && t3.firstScreenInfo) && (s2.firstScreenInfo = { element: e3.roots[n4], timing: o2 });
- }), l2.length = 0, Object.keys(f2).forEach(function(e3) {
- f2[e3] = f2[e3].map(function(e4) {
- var t3 = { tagName: e4.tagName }, n4 = e4.attributes;
- if (!n4)
- return e4;
- for (var o3 = 0; o3 < n4.length; o3++) {
- var i3 = n4[o3];
- i3.name && (t3[i3.name] = e4.getAttribute(i3.name));
- }
- return t3;
- });
- }));
- var i2, e2 = performance.timing, t2 = e2.domInteractive - e2.domLoading, e2 = e2.loadEventStart - e2.domInteractive, n3 = o2;
- h2 = null;
- for (var r2 = 0, a2 = [t2, e2, n3]; r2 < a2.length; r2++)
- if (a2[r2] <= 0 && 0 < ot) {
- h2 = setTimeout(function() {
- return p2(n3);
- }, 3e3);
- break;
- }
- h2 ? --ot : (d2.disconnect(), null != c2 && c2(o2));
- }), h2 = setTimeout(function() {
- return p2();
- }, 3e3);
- }, isEleInArray: function(e2, t2) {
- return !(!e2 || e2 === document.documentElement) && (-1 !== t2.indexOf(e2) || this.isEleInArray(e2.parentElement, t2));
- }, isInFirstScreen: function(e2) {
- var t2, n2;
- return !(!e2 || "function" != typeof e2.getBoundingClientRect) && (e2 = e2.getBoundingClientRect(), t2 = window.innerHeight, n2 = window.innerWidth, 0 <= e2.left) && e2.left < n2 && 0 <= e2.top && e2.top < t2 && 0 < e2.width && 0 < e2.height;
- }, walkAndCount: function(e2) {
- var t2 = 0;
- if (e2 && 1 === e2.nodeType) {
- t2 += 1;
- var n2 = e2.children;
- if (null != n2 && n2.length)
- for (var o2 = 0; o2 < n2.length; o2++)
- t2 += this.walkAndCount(n2[o2]);
- }
- return t2;
- } });
- function rt() {
- $e = [], Ge = -1, b = null, ct(addEventListener);
- }
- function at(e2, t2) {
- b || (b = t2, Ge = e2, Je = /* @__PURE__ */ new Date(), ct(removeEventListener), st());
- }
- function st() {
- var t2;
- 0 <= Ge && Ge < Je - Ke && (t2 = { entryType: "first-input", name: b.type, target: b.target, cancelable: b.cancelable, startTime: b.timeStamp, processingStart: b.timeStamp + Ge }, $e.forEach(function(e2) {
- e2(t2);
- }), $e = []);
- }
- function ct(t2) {
- ["mousedown", "keydown", "touchstart", "pointerdown"].forEach(function(e2) {
- return t2(e2, Qe, S);
- });
- }
- S = { passive: true, capture: true }, Ke = /* @__PURE__ */ new Date(), Qe = function(e2) {
- var t2, n2, o2, i2;
- function r2() {
- at(n2, o2), i2();
- }
- function a2() {
- i2();
- }
- e2.cancelable && (t2 = (1e12 < e2.timeStamp ? /* @__PURE__ */ new Date() : performance.now()) - e2.timeStamp, "pointerdown" == e2.type ? (n2 = t2, o2 = e2, i2 = function() {
- removeEventListener("pointerup", r2, S), removeEventListener("pointercancel", a2, S);
- }, addEventListener("pointerup", r2, S), addEventListener("pointercancel", a2, S)) : at(t2, e2));
- }, Ye = "hidden" === document.visibilityState ? 0 : 1 / 0, addEventListener("visibilitychange", function e2(t2) {
- "hidden" === document.visibilityState && (Ye = t2.timeStamp, removeEventListener("visibilitychange", e2, true));
- }, true), rt(), self.webVitals = { firstInputPolyfill: function(e2) {
- $e.push(e2), st();
- }, resetFirstInputPolyfill: rt, get firstHiddenTime() {
- return Ye;
- } };
- function I(e2, t2) {
- return { name: e2, value: void 0 === t2 ? -1 : t2, delta: 0, entries: [], id: "v1-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12) };
- }
- function ut(e2, t2) {
- try {
- var n2;
- if (PerformanceObserver.supportedEntryTypes.includes(e2)) {
- if ("first-input" !== e2 || "PerformanceEventTiming" in self)
- return (n2 = new PerformanceObserver(function(e3) {
- return e3.getEntries().map(t2);
- })).observe({ type: e2, buffered: true }), n2;
- }
- } catch (e3) {
- }
- }
- function lt(t2) {
- addEventListener("pageshow", function(e2) {
- e2.persisted && t2(e2);
- }, true);
- }
- function A(e2, t2, n2) {
- var o2;
- return function() {
- 0 <= t2.value && (n2 || N.has(t2) || "hidden" === document.visibilityState) && (t2.delta = t2.value - (o2 || 0), t2.delta || void 0 === o2) && (o2 = t2.value, e2(t2));
- };
- }
- function ft() {
- vt(function(e2) {
- e2 = e2.timeStamp;
- yt = e2;
- }, true);
- }
- function dt() {
- return yt < 0 && ((yt = self.webVitals.firstHiddenTime) === 1 / 0 && ft(), lt(function() {
- setTimeout(function() {
- yt = "hidden" === document.visibilityState ? 0 : 1 / 0, ft();
- }, 0);
- })), { get timeStamp() {
- return yt;
- } };
- }
- function pt(e2) {
- var t2 = e2.name;
- 0 < (e2 = e2.value) && (wt[t2] = e2);
- }
- function ht(e2, h2) {
- function g2(e3) {
- b2 = e3;
- }
- function m2(e3) {
- y2 = y2.concat(e3);
- }
- function v2(e3, t2) {
- w2 = { conds: e3 = void 0 === e3 ? {} : e3, params: t2 = void 0 === t2 ? {} : t2 };
- }
- var y2 = [], w2 = null, b2 = null;
- q.useAsyncPlugin(e2, { exportsConstructor: "Flog", onAegisInit: function(e3) {
- e3.lifeCycle.on("beforeWrite", m2), e3.lifeCycle.on("uploadLogs", v2), e3.lifeCycle.on("onConfigChange", g2);
- }, onAegisInitAndPluginLoaded: function(o2, e3) {
- var t2, n2, i2, r2, a2, s2, c2 = h2.dbConfig, c2 = void 0 === c2 ? {} : c2, u2 = h2.url, u2 = void 0 === u2 ? q.urls.aegisCollect : u2, l2 = h2.offlineLogExp, l2 = void 0 === l2 ? 3 : l2, f2 = h2.id, d2 = h2.uin, u2 = (null != (t2 = o2.lifeCycle) && t2.remove("beforeWrite", m2), null != (t2 = o2.lifeCycle) && t2.remove("uploadLogs", v2), null != (t2 = o2.lifeCycle) && t2.remove("onConfigChange", g2), Object.assign({ lookupUrl: u2 + "/offlineAuto?id=" + f2, preservedDay: l2, id: f2, uin: d2, aid: (null == (t2 = o2.bean) ? void 0 : t2.aid) || "", beforeRequest: o2.config.beforeRequest, afterRequest: o2.config.afterRequest }, c2, { sessionId: q.sessionID }));
- try {
- var p2 = new e3(u2);
- y2.forEach(function(e4) {
- p2.add(E(E({}, e4), { level: e4.level === L.INFO_ALL ? L.INFO : e4.level }));
- }), null != (n2 = o2.lifeCycle) && n2.on("beforeWrite", function(e4) {
- (e4 = void 0 === e4 ? [] : e4).forEach(function(e5) {
- p2.add(E(E({}, e5), { level: e5.level === L.INFO_ALL ? L.INFO : e5.level }));
- });
- }), null != (i2 = o2.lifeCycle) && i2.on("uploadLogs", function(e4, t3) {
- var n3;
- void 0 === e4 && (e4 = {}), void 0 === t3 && (t3 = {}), p2.uploadLogs(Object.assign({ id: h2.id, uin: h2.uin, aid: null == (n3 = o2.bean) ? void 0 : n3.aid }, e4), t3);
- }), null != (r2 = o2.lifeCycle) && r2.on("onConfigChange", function(e4) {
- p2.setConfig(e4);
- }), null != (a2 = o2.lifeCycle) && a2.on("destroy", function() {
- 0 === Rt.countInstance() && (y2.length = 0, "function" == typeof ((w2 = null) == p2 ? void 0 : p2.destroy)) && p2.destroy();
- }), p2.on("PERREVENT", function(e4) {
- o2.sendPipeline([function(e5, t3) {
- n3 = { msg: O(e5), level: L.INFO };
- var n3 = (n3 = Array.isArray(n3) ? n3 : [n3]).map(function(t4, n4) {
- return Object.getOwnPropertyNames(t4).map(function(e6) {
- return D(e6) + "[" + n4 + "]=" + (void 0 === t4[e6] ? "" : D(t4[e6]));
- }).join("&");
- }).join("&") + (n3.length ? "&count=" + n3.length : "");
- t3({ type: R.OFFLINE, data: n3, contentType: "application/x-www-form-urlencoded", method: "post", addBean: false, url: h2.url + "?id=893&sessionId=" + q.sessionID + "&uin=" + h2.uin + "&from=" + h2.id + "&count=1&version=1.37.5", log: e5 });
- }], R.OFFLINE)(e4);
- }), b2 && (p2.setConfig(b2), b2 = null), w2 && (null != (s2 = o2.lifeCycle) && s2.emit("uploadLogs", w2.conds, w2.params), w2 = null), o2.flog = p2;
- } catch (o3) {
- console.log(o3);
- }
- } });
- }
- var gt, mt, vt = function(t2, n2) {
- function o2(e2) {
- "pagehide" !== e2.type && "hidden" !== document.visibilityState || (t2(e2), n2 && (removeEventListener("visibilitychange", o2, true), removeEventListener("pagehide", o2, true)));
- }
- addEventListener("visibilitychange", o2, true), addEventListener("pagehide", o2, true);
- }, N = new ("function" == typeof WeakSet ? WeakSet : Set)(), yt = -1, wt = (new i({ name: "webVitals" }), { FCP: -1, LCP: -1, FID: -1, CLS: -1 }), bt = new i({ name: "webVitals", onNewAegis: function(e2) {
- if (re() && "function" == typeof window.PerformanceObserver && "function" == typeof performance.getEntriesByName)
- try {
- v2 = pt, w2 = dt(), b2 = I("FCP"), E2 = performance.getEntriesByName("first-contentful-paint")[0], R2 = E2 ? null : ut("paint", T2), (E2 || R2) && (y2 = A(v2, b2, void 0), E2 && T2(E2), lt(function(e3) {
- b2 = I("FCP"), y2 = A(v2, b2, void 0), requestAnimationFrame(function() {
- requestAnimationFrame(function() {
- b2.value = performance.now() - e3.timeStamp, N.add(b2), y2();
- });
- });
- })), f2 = pt, h2 = dt(), g2 = I("LCP"), (m2 = ut("largest-contentful-paint", S2)) && (d2 = A(f2, g2, void 0), p2 = function() {
- N.has(g2) || (m2.takeRecords().map(S2), m2.disconnect(), N.add(g2), d2());
- }, ["keydown", "click"].forEach(function(e3) {
- addEventListener(e3, p2, { once: true, capture: true });
- }), vt(p2, true), lt(function(e3) {
- g2 = I("LCP"), d2 = A(f2, g2, void 0), requestAnimationFrame(function() {
- requestAnimationFrame(function() {
- g2.value = performance.now() - e3.timeStamp, N.add(g2), d2();
- });
- });
- })), a2 = pt, s2 = dt(), c2 = I("FID"), u2 = ut("first-input", O2), l2 = A(a2, c2, void 0), u2 && vt(function() {
- u2.takeRecords().map(O2), u2.disconnect();
- }, true), u2 || window.webVitals.firstInputPolyfill(O2), lt(function() {
- c2 = I("FID"), l2 = A(a2, c2, void 0), window.webVitals.resetFirstInputPolyfill(), window.webVitals.firstInputPolyfill(O2);
- }), n2 = pt, i2 = I("CLS", 0), (r2 = ut("layout-shift", t2)) && (o2 = A(n2, i2, void 0), vt(function() {
- r2.takeRecords().map(t2), o2();
- }), lt(function() {
- i2 = I("CLS", 0), o2 = A(n2, i2, void 0);
- })), ae(this.publish.bind(this, e2), true);
- } catch (e3) {
- }
- function t2(e3) {
- e3.hadRecentInput || (i2.value += e3.value, i2.entries.push(e3), o2());
- }
- var n2, o2, i2, r2, a2, s2, c2, u2, l2, f2, d2, p2, h2, g2, m2, v2, y2, w2, b2, E2, R2;
- function O2(e3) {
- e3.startTime < s2.timeStamp && (c2.value = e3.processingStart - e3.startTime, c2.entries.push(e3), N.add(c2), l2());
- }
- function S2(e3) {
- var t3 = e3.startTime;
- t3 < h2.timeStamp && (g2.value = t3, g2.entries.push(e3)), d2();
- }
- function T2(e3) {
- "first-contentful-paint" === e3.name && (R2 && R2.disconnect(), e3.startTime < w2.timeStamp) && (b2.value = e3.startTime, b2.entries.push(e3), N.add(b2), y2());
- }
- }, publish: function(t2) {
- this.$walk(function(r2) {
- var e2;
- r2 === t2 && null != (e2 = r2.sendPipeline) && e2.call(r2, [function(e3, t3) {
- var n2, o2 = [];
- for (n2 in e3)
- o2.push(n2 + "=" + e3[n2]);
- var i2 = -1 === (null == (i2 = null == (i2 = r2.config) ? void 0 : i2.performanceUrl) ? void 0 : i2.indexOf("?")) ? "?" : "&";
- t3({ url: r2.config.webVitalsUrl + i2 + o2.join("&"), type: R.VITALS, log: e3, sendBeacon: true });
- }], R.VITALS)(wt);
- });
- }, destroy: function() {
- this.option.publish = function() {
- };
- } }), Et = 0, q = (B(mt = U, o = gt = o), mt.prototype = null === o ? Object.create(o) : (Tt.prototype = o.prototype, new Tt()), U.prototype.getBean = function(t2) {
- var n2 = this;
- return void 0 === t2 && (t2 = []), "" + Object.getOwnPropertyNames(this.bean).filter(function(e2) {
- return -1 === t2.indexOf(e2);
- }).map(function(e2) {
- return "from" === e2 ? "from=" + n2.getCurrentPageUrl() : e2 + "=" + n2.bean[e2];
- }).join("&");
- }, U.prototype.getCurrentPageUrl = function() {
- var e2 = this.config.pageUrl || location.href, e2 = (e2 = "function" == typeof this.config.urlHandler ? this.config.urlHandler() : e2).slice(0, 2048);
- return encodeURIComponent(e2);
- }, U.prototype.ready = function() {
- function r2() {
- var e2, n2, o2, i2;
- t2.reportRequestQueue.length && (e2 = t2.reportRequestQueue.splice(0, 1)[0], n2 = e2.options, o2 = e2.success, i2 = e2.fail, t2.$request(n2, function() {
- for (var e3 = [], t3 = 0; t3 < arguments.length; t3++)
- e3[t3] = arguments[t3];
- try {
- return null == o2 ? void 0 : o2.apply(n2, e3);
- } finally {
- r2();
- }
- }, function() {
- for (var e3 = [], t3 = 0; t3 < arguments.length; t3++)
- e3[t3] = arguments[t3];
- try {
- return null == i2 ? void 0 : i2.apply(n2, e3);
- } finally {
- r2();
- }
- }));
- }
- var t2 = this;
- r2(), this.isReportReady = true;
- }, U.prototype.request = function(e2, t2, n2) {
- this.config.reportImmediately || this.isReportReady ? this.$request(e2, t2, n2) : this.reportRequestQueue.push({ options: e2, success: t2, fail: n2 });
- }, U.prototype.$request = function(e2, t2, n2) {
- var o2, i2, r2, a2;
- if (e2 && "string" == typeof e2.url && "" !== e2.url && this.bean.id)
- return a2 = e2.url, false !== e2.addBean && (a2 = a2 + (-1 === a2.indexOf("?") ? "?" : "&") + this.getBean(e2.beanFilter)), e2.url = a2, a2 = e2.method || "get", (e2 = (i2 = this.config.onBeforeRequest) ? i2(e2, this) : e2) ? e2.url ? void ((null != e2 && e2.sendBeacon || this.sendNow) && "function" == typeof (null === navigator || void 0 === navigator ? void 0 : navigator.sendBeacon) ? navigator.sendBeacon(e2.url, e2.data) : ((o2 = new XMLHttpRequest()).sendByAegis = true, o2.addEventListener("readystatechange", function() {
- 4 === o2.readyState && (400 <= o2.status || 0 === o2.status ? null != n2 && n2(o2.response) : null != t2 && t2(o2.response));
- }), "get" === a2.toLocaleLowerCase() ? (o2.open("get", (i2 = e2.url, r2 = e2.data, "string" != typeof i2 ? "" : "object" == typeof r2 && r2 ? (a2 = Object.getOwnPropertyNames(r2).map(function(e3) {
- var t3 = r2[e3];
- return e3 + "=" + ("string" == typeof t3 ? encodeURIComponent(t3) : encodeURIComponent(JSON.stringify(t3)));
- }).join("&").replace(/eval/gi, "evaI"), i2 + (-1 === i2.indexOf("?") ? "?" : "&") + a2) : i2)), o2.send()) : (o2.open("post", e2.url), e2.contentType && o2.setRequestHeader("Content-Type", e2.contentType), "string" == typeof e2.data && (e2.data = e2.data.replace(/eval/gi, "evaI")), o2.send(e2.data)))) : console.warn("Please handle the parameters reasonably, options.url is necessary") : console.warn("Sending request blocked");
- }, U.useAsyncPlugin = function(a2, e2) {
- var t2 = (e2 = void 0 === e2 ? {} : e2).exportsConstructor, s2 = void 0 === t2 ? "aegis-plugin-" + Et : t2, t2 = e2.onAegisInit, c2 = void 0 === t2 ? function() {
- } : t2, t2 = e2.onAegisInitAndPluginLoaded, u2 = void 0 === t2 ? function() {
- } : t2;
- if (Et += 1, "string" != typeof a2)
- throw new TypeError("useAsyncPlugin first param must be string");
- if ("function" != typeof c2 || "function" != typeof u2)
- throw new TypeError("onAegisInit and onAegisInitAndPluginLoaded must be function");
- this.use(new i({ name: "asyncPlugin", onNewAegis: function(t3) {
- try {
- c2(t3), U.asyncPlugin[a2] ? u2(t3, window[U.asyncPlugin[a2]]) : (e3 = a2, n2 = s2, o2 = function(e4) {
- e4 || (U.asyncPlugin[a2] = s2, e4 = window[s2], u2(t3, e4));
- }, i2 = document.createElement("script"), r2 = document.head, "function" == typeof n2 && (o2 = n2, n2 = ""), i2.src = e3, i2.setAttribute("name", n2), i2.name = n2, i2.setAttribute("crossorigin", "anonymous"), i2.crossorigin = "anonymous", i2.defer = true, i2.hasLoaded = false, i2.onreadystatechange = function() {
- i2.hasLoaded || i2.readyState && "loaded" !== i2.readyState && "complete" !== i2.readyState || (i2.hasLoaded = true, "function" == typeof o2 && o2(false), setTimeout(function() {
- r2.contains(i2) && r2.removeChild(i2);
- }));
- }, i2.onload = i2.onreadystatechange, i2.onerror = function() {
- "function" == typeof o2 && o2(true), setTimeout(function() {
- r2.contains(i2) && r2.removeChild(i2);
- });
- }, "complete" === document.readyState ? r2.appendChild(i2) : window.addEventListener("load", function() {
- r2.appendChild(i2);
- }));
- } catch (e4) {
- console.log("error on below is caused by " + a2 + " "), console.error(e4);
- }
- var e3, n2, o2, i2, r2;
- } }));
- }, U.prototype.publishPluginsLogs = function() {
- var e2 = U.installedPlugins.find(function(e3) {
- return "reportAssetSpeed" === e3.name;
- });
- null != e2 && e2.option.collectNotReportedLog(this);
- }, U.prototype.uploadLogs = function(e2, t2) {
- var n2;
- void 0 === e2 && (e2 = {}), void 0 === t2 && (t2 = {}), null != (n2 = this.lifeCycle) && n2.emit("uploadLogs", e2, t2);
- }, U.sessionID = "session-" + Date.now(), U.asyncPlugin = {}, U.urls = { aegisCollect: "https://aegis.qq.com/collect", flog: "https://cdn-go.cn/vasdev/web_webpersistance_v2/v1.8.2/flog.core.min.js" }, U), Rt = new i({ name: "offlineLog" }), o = Rt = new i({ name: "offlineLog", onNewAegis: function(e2) {
- ht(q.urls.flog, e2.config);
- } }), Ot = (new i({ name: "spa" }), ["replaceState", "pushState", "popstate", "hashchange"]), St = new i({ name: "spa", originFireUrl: "", onNewAegis: function(t2) {
- var n2 = this;
- history.pushState = this.wr("pushState") || history.pushState, history.replaceState = this.wr("replaceState") || history.replaceState, this.sendPv = this.sendPv.bind(this), t2.config.spa && this.sendPv(t2), Ot.forEach(function(e2) {
- return window.addEventListener(e2, function() {
- return n2.sendPv.call(n2, t2);
- });
- });
- }, wr: function(n2) {
- var o2 = history[n2], e2 = "__" + n2 + "__hasWrittenByTamSpa";
- return "function" == typeof o2 && !history[e2] && (Object.defineProperty(history, e2, { value: true, enumerable: false }), function() {
- var e3 = o2.apply(this, arguments), t2 = null;
- return "function" == typeof Event ? t2 = new Event(n2) : (t2 = document.createEvent("HTMLEvents")).initEvent(n2, false, true), window.dispatchEvent(t2), e3;
- });
- }, sendPv: function(i2) {
- var r2 = this;
- setTimeout(function() {
- var o2 = location.href, t2 = location.pathname + location.hash + i2.config.id;
- r2.$walk(function(e2) {
- var n2;
- e2 === i2 && (n2 = e2.config.pvUrl) && t2 && t2 !== r2.originFireUrl && (e2.sendPipeline([function(e3, t3) {
- t3({ url: n2 + "?from=" + encodeURIComponent(o2), beanFilter: ["from"], type: R.PV });
- }], R.PV)(null), r2.originFireUrl = t2);
- });
- }, 0);
- }, destroy: function() {
- this.option.sendPv = function() {
- };
- } });
- function U(e2) {
- var t2, n2, o2, a2, s2 = gt.call(this, e2) || this;
- s2.sendNow = false, s2.isReportReady = false, s2.reportRequestQueue = [], s2.speedLogPipeline = m([Z(s2), (a2 = s2.config, function(e3, t3) {
- var n3, o3, i2, r2 = "number" == typeof a2.repeat ? a2.repeat : 60;
- !a2.speedSample || r2 <= 0 ? t3(e3) : (n3 = (null == a2 ? void 0 : a2.id) || "0", o3 = y[n3] || {}, Array.isArray(e3) ? (i2 = e3.filter(function(e4) {
- var t4 = !o3[e4.url] || o3[e4.url] < r2;
- return t4 ? (o3[e4.url] = 1 + ~~o3[e4.url], y[n3] = o3) : v[n3] || ye(n3), t4;
- })).length && t3(i2) : !o3[e3.url] || o3[e3.url] < r2 ? (o3[e3.url] = 1 + ~~o3[e3.url], y[n3] = o3, t3(e3)) : v[n3] || ye(n3));
- }), (o2 = s2, function(t3, n3) {
- ze(function(e3) {
- o2.extendBean("netType", e3), n3(t3);
- });
- }), function(e3, t3) {
- null != (n3 = s2.lifeCycle) && n3.emit("beforeReportSpeed", e3);
- var n3, o3 = s2.config.beforeReportSpeed;
- if ((e3 = "function" == typeof o3 ? e3.filter(function(e4) {
- return false !== o3(e4);
- }) : e3).length)
- return t3(e3);
- }, function(e3, t3) {
- t3(e3.map(function(e4) {
- return void 0 !== e4.payload && delete e4.payload, e4;
- }));
- }, function(e3) {
- return s2.sendPipeline([function(e4, t3) {
- var n3, o3, i2, r2;
- t3({ type: R.SPEED, url: "" + s2.config.speedUrl, method: "post", data: (t3 = e4, n3 = E(E({}, s2.bean), { from: s2.getCurrentPageUrl() }), i2 = { fetch: [], static: [], bridge: [] }, r2 = new FormData(), Array.isArray(t3) ? t3.forEach(function(e5) {
- var t4 = Oe(e5);
- i2[e5.type].push(t4);
- }) : (o3 = Oe(t3), i2[t3.type].push(o3)), r2.append("payload", fe(E({ duration: i2 }, n3))), r2), log: e4 });
- }], R.SPEED)(e3);
- }]), e2.asyncPlugin = true;
- try {
- "undefined" != typeof document && (e2.uin = e2.uin || (null != (t2 = document.cookie.match(/\buin=\D+(\d*)/)) ? t2 : [])[1] || (null != (n2 = document.cookie.match(/\bilive_uin=\D*(\d+)/)) ? n2 : [])[1] || ""), s2.init(e2), s2.extendBean("sessionId", U.sessionID), s2.extendBean("from", s2.getCurrentPageUrl()), "undefined" != typeof document && s2.extendBean("referer", encodeURIComponent(document.referrer || "")), e2.ext1 && s2.extendBean("ext1", encodeURIComponent(e2.ext1)), e2.ext2 && s2.extendBean("ext2", encodeURIComponent(e2.ext2)), e2.ext3 && s2.extendBean("ext3", encodeURIComponent(e2.ext3));
- } catch (e3) {
- console.warn(e3), console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.", "color: red"), s2.sendSDKError(e3);
- }
- return s2;
- }
- function Tt() {
- this.constructor = mt;
- }
- new i({ name: "ie" }), new i({ name: "onClose" });
- var Pt = new i({ name: "onClose", onNewAegis: function(n2) {
- var o2, i2 = this;
- r.desktop() ? (o2 = window.onunload, window.onunload = function() {
- for (var e2 = [], t2 = 0; t2 < arguments.length; t2++)
- e2[t2] = arguments[t2];
- i2.publishNotReportedLog(n2), null != o2 && o2.call.apply(o2, u([window], e2));
- }) : ae(this.publishNotReportedLog.bind(this, n2), true);
- }, publishNotReportedLog: function(t2) {
- var n2 = this;
- this.$walk(function(e2) {
- e2 === t2 && (e2.sendNow = true, e2.publishPluginsLogs(), n2.publishThrottlePipeLogs(e2));
- });
- }, publishThrottlePipeLogs: function(e2) {
- null != e2 && e2.speedLogPipeline([]), null != e2 && e2.eventPipeline([]), null != e2 && e2.customTimePipeline([]), null != e2 && e2.normalLogPipeline([]);
- } });
- return new i({ name: "aid" }), q.use(nt), q.use(We), q.use(Te), q.use(it), q.use(bt), q.use(Re), q.use(T), q.use(o), q.use(St), q.use(Pt), q.use(Xe), q;
- });
- }
- });
- export default require_aegis_min();
- //# sourceMappingURL=aegis-web-sdk.js.map
|