@arms/js-sdk
Advanced tools
Comparing version 1.8.32 to 1.8.33
@@ -21,3 +21,3 @@ var util = require("./util"), sendBeacon = require("./common/sendBeacon"), selfId = "aokcdqn3ly@e629dabd48a9933", pushToQueue = function(e, t) { | ||
}, Base = function(e) { | ||
return this.ver = "1.8.32", this._conf = util.ext({}, Base.dftCon), this.sampleCache = {}, | ||
return this.ver = "1.8.33", this._conf = util.ext({}, Base.dftCon), this.sampleCache = {}, | ||
this.requestQueue = [], this.selfQueue = [], this.sdkFlag = !0, this.hash = util.seq(), | ||
@@ -68,8 +68,8 @@ this.resetPageview(), this.setConfig(e), this.rip = util.getRandIP(), this.record = 999, | ||
if (this.getConfig("debug")) return !0; | ||
var t = util.regionMap, r = !1; | ||
for (var i in t) if (t[i] === e) { | ||
r = !0; | ||
var t = util.regionMap; | ||
for (var r in t) if (t[r] === e) { | ||
!0; | ||
break; | ||
} | ||
return !r && util.warn("[retcode] invalid url: " + e), r; | ||
return !0; | ||
}, | ||
@@ -76,0 +76,0 @@ sendRequest: function() {}, |
module.exports = function(e, a) { | ||
var r = require("../util"), t = null, n = r.getCurDomain(), i = function(e, a, t, i, s, o, p, c, d, l, g, h, u) { | ||
var r = require("../util"), t = null, n = r.getCurDomain(), i = function(e, a, t, i, s, o, p, c, d, l, g, u, h) { | ||
var f = r.J(s) || null, y = r.safetyCall(a, [ f, i ], null); | ||
if (!y) return !1; | ||
var I = y.code || o, E = !("success" in y) || y.success; | ||
e.api(t, E, p, I, y.msg, c, d, l, g, n, h, u); | ||
e.api(t, E, p, I, y.msg, c, d, l, g, n, u, h); | ||
}, s = "fetch", o = "__oFetch_", p = "__oXMLHttpRequest_", c = "XMLHttpRequest"; | ||
@@ -22,34 +22,34 @@ return r.ext(e.prototype, { | ||
o || (o = {}); | ||
var d = Date.now(), l = c._conf, g = (s && "string" != typeof s ? s.url : s) || "", h = g; | ||
g = r.cutUrlSearch(g); | ||
var u = (l.ignore || {}).ignoreApis; | ||
if (!r.checkAPI(g, !0) || r.ignoreByRule(g, u)) return e.apply(a, p); | ||
g = r.filterByRule(g, h, l.ignoreApiPath ? l.ignoreApiPath : l.apiHelper); | ||
var f = l.enableLinkTrace, y = "", I = "", E = c.getConfig("pid"), v = null, S = c.getConfig("sample"), T = c.getConfig("linkType"), B = 1; | ||
if (S && !c.sampling(S) && (B = 0), f) { | ||
var X = ""; | ||
var d = Date.now(), l = c._conf, g = r.duration(), u = (s && "string" != typeof s ? s.url : s) || "", h = u; | ||
u = r.cutUrlSearch(u); | ||
var f = (l.ignore || {}).ignoreApis; | ||
if (!r.checkAPI(u, !0) || r.ignoreByRule(u, f)) return e.apply(a, p); | ||
u = r.filterByRule(u, h, l.ignoreApiPath ? l.ignoreApiPath : l.apiHelper); | ||
var y = l.enableLinkTrace, I = "", E = "", v = c.getConfig("pid"), S = null, T = c.getConfig("sample"), B = c.getConfig("linkType"), X = 1; | ||
if (T && !c.sampling(T) && (X = 0), y) { | ||
var m = ""; | ||
try { | ||
X = location.origin ? location.origin : location.protocol + "//" + location.hostname + (location.port ? ":" + location.port : ""); | ||
} catch (C) { | ||
X = ""; | ||
m = location.origin ? location.origin : location.protocol + "//" + location.hostname + (location.port ? ":" + location.port : ""); | ||
} catch (x) { | ||
m = ""; | ||
} | ||
var D = r.checkSameOrigin(h, X); | ||
var D = r.checkSameOrigin(h, m); | ||
if (c.getConfig("enableApiCors") || D) if (s && "string" != typeof s) try { | ||
if (p[0].headers && "function" == typeof p[0].headers.get && "function" == typeof p[0].headers.append) switch (T) { | ||
if (p[0].headers && "function" == typeof p[0].headers.get && "function" == typeof p[0].headers.append) switch (B) { | ||
case "arms": | ||
var m = p[0].headers.get("EagleEye-TraceID"), b = p[0].headers.get("EagleEye-SessionID"), k = p[0].headers.get("EagleEye-pAppName"); | ||
m ? y = m : (y = c.getTraceId()["EagleEye-TraceID"], p[0].headers.append("EagleEye-TraceID", y)), | ||
b ? I = b : (I = c.getPageviewId()["EagleEye-SessionID"], p[0].headers.append("EagleEye-SessionID", I)), | ||
k || p[0].headers.append("EagleEye-pAppName", E); | ||
var b = p[0].headers.get("EagleEye-TraceID"), k = p[0].headers.get("EagleEye-SessionID"), A = p[0].headers.get("EagleEye-pAppName"); | ||
b ? I = b : (I = c.getTraceId()["EagleEye-TraceID"], p[0].headers.append("EagleEye-TraceID", I)), | ||
k ? E = k : (E = c.getPageviewId()["EagleEye-SessionID"], p[0].headers.append("EagleEye-SessionID", E)), | ||
A || p[0].headers.append("EagleEye-pAppName", v); | ||
break; | ||
case "b3": | ||
var A = p[0].headers.get("X-B3-TraceId"); | ||
if (A) y = A; else { | ||
var w = c.getB3TraceId(B); | ||
p[0].headers.append("X-B3-TraceId", w["X-B3-TraceId"]), p[0].headers.append("X-B3-ParentSpanId", w["X-B3-ParentSpanId"]), | ||
p[0].headers.append("X-B3-SpanId", w["X-B3-SpanId"]), p[0].headers.append("X-B3-Sampled", w["X-B3-Sampled"]), | ||
p[0].headers.append("X-Request-ID", r.guid()), y = w["X-B3-TraceId"]; | ||
var w = p[0].headers.get("X-B3-TraceId"); | ||
if (w) I = w; else { | ||
var H = c.getB3TraceId(X); | ||
p[0].headers.append("X-B3-TraceId", H["X-B3-TraceId"]), p[0].headers.append("X-B3-ParentSpanId", H["X-B3-ParentSpanId"]), | ||
p[0].headers.append("X-B3-SpanId", H["X-B3-SpanId"]), p[0].headers.append("X-B3-Sampled", H["X-B3-Sampled"]), | ||
p[0].headers.append("X-Request-ID", r.guid()), I = H["X-B3-TraceId"]; | ||
} | ||
I = c.pageview; | ||
E = c.pageview; | ||
break; | ||
@@ -59,23 +59,23 @@ | ||
default: | ||
var H = p[0].headers.get("uber-trace-id"); | ||
H ? y = H.split(":")[0] : (H = c.getUberTraceId(B), p[0].headers.append("uber-trace-id", H["uber-trace-id"]), | ||
y = H.traceId), I = c.pageview; | ||
var P = p[0].headers.get("uber-trace-id"); | ||
P ? I = P.split(":")[0] : (P = c.getUberTraceId(X), p[0].headers.append("uber-trace-id", P["uber-trace-id"]), | ||
I = P.traceId), E = c.pageview; | ||
} | ||
} catch (x) { | ||
r.warn("[retcode] fetch failed to set header, exception is :\n" + x); | ||
} else switch (o.headers = o.headers ? o.headers : {}, T) { | ||
} catch (_) { | ||
r.warn("[retcode] fetch failed to set header, exception is :\n" + _); | ||
} else switch (o.headers = o.headers ? o.headers : {}, B) { | ||
case "arms": | ||
o.headers["EagleEye-TraceID"] ? y = o.headers["EagleEye-TraceID"] : (y = c.getTraceId()["EagleEye-TraceID"], | ||
o.headers["EagleEye-TraceID"] = y), o.headers["EagleEye-SessionID"] ? I = o.headers["EagleEye-SessionID"] : (I = c.getPageviewId()["EagleEye-SessionID"], | ||
o.headers["EagleEye-SessionID"] = I), o.headers["EagleEye-pAppName"] || (o.headers["EagleEye-pAppName"] = E); | ||
o.headers["EagleEye-TraceID"] ? I = o.headers["EagleEye-TraceID"] : (I = c.getTraceId()["EagleEye-TraceID"], | ||
o.headers["EagleEye-TraceID"] = I), o.headers["EagleEye-SessionID"] ? E = o.headers["EagleEye-SessionID"] : (E = c.getPageviewId()["EagleEye-SessionID"], | ||
o.headers["EagleEye-SessionID"] = E), o.headers["EagleEye-pAppName"] || (o.headers["EagleEye-pAppName"] = v); | ||
break; | ||
case "b3": | ||
if (o.headers["X-B3-TraceId"]) y = o.headers["X-B3-TraceId"]; else { | ||
var P = c.getB3TraceId(B); | ||
o.headers["X-B3-TraceId"] = P["X-B3-TraceId"], o.headers["X-B3-ParentSpanId"] = P["X-B3-ParentSpanId"], | ||
o.headers["X-B3-SpanId"] = P["X-B3-SpanId"], o.headers["X-B3-Sampled"] = P["X-B3-Sampled"], | ||
o.headers["X-Request-ID"] = r.guid(), y = P["X-B3-TraceId"]; | ||
if (o.headers["X-B3-TraceId"]) I = o.headers["X-B3-TraceId"]; else { | ||
var R = c.getB3TraceId(X); | ||
o.headers["X-B3-TraceId"] = R["X-B3-TraceId"], o.headers["X-B3-ParentSpanId"] = R["X-B3-ParentSpanId"], | ||
o.headers["X-B3-SpanId"] = R["X-B3-SpanId"], o.headers["X-B3-Sampled"] = R["X-B3-Sampled"], | ||
o.headers["X-Request-ID"] = r.guid(), I = R["X-B3-TraceId"]; | ||
} | ||
I = c.getPageviewId()["EagleEye-SessionID"]; | ||
E = c.getPageviewId()["EagleEye-SessionID"]; | ||
break; | ||
@@ -85,7 +85,7 @@ | ||
default: | ||
if (o.headers["uber-trace-id"]) y = o.headers["uber-trace-id"].split(":")[0]; else { | ||
var R = c.getUberTraceId(B); | ||
o.headers["uber-trace-id"] = R["uber-trace-id"], y = R.traceId; | ||
if (o.headers["uber-trace-id"]) I = o.headers["uber-trace-id"].split(":")[0]; else { | ||
var C = c.getUberTraceId(X); | ||
o.headers["uber-trace-id"] = C["uber-trace-id"], I = C.traceId; | ||
} | ||
I = c.getPageviewId()["EagleEye-SessionID"]; | ||
E = c.getPageviewId()["EagleEye-SessionID"]; | ||
} | ||
@@ -101,19 +101,19 @@ } | ||
if (s && !/(text)|(json)/.test(s)) return e; | ||
if (!y) { | ||
if (!I) { | ||
var o = r.parseFetchHeaders(t); | ||
"object" == typeof o && o["eagleeye-traceid"] && (y = o["eagleeye-traceid"], v = "response"); | ||
"object" == typeof o && o["eagleeye-traceid"] && (I = o["eagleeye-traceid"], S = "response"); | ||
} | ||
} | ||
var u = Date.now() - d; | ||
var f = g(); | ||
return a.text().then(function(e) { | ||
var s = r.getFetchSnapshot(p, e, t); | ||
a.ok ? i(c, l.parseResponse, g, h, e, a.status || 200, u, d, y, I, s, v, B) : c.api(g, !1, u, a.status || 404, a.statusText, d, y, I, s, n, v, B); | ||
a.ok ? i(c, l.parseResponse, u, h, e, a.status || 200, f, d, I, E, s, S, X) : c.api(u, !1, f, a.status || 404, a.statusText, d, I, E, s, n, S, X); | ||
}), e; | ||
} catch (C) { | ||
return r.warn("[ARMS] fetch response error :", C), e; | ||
} catch (x) { | ||
return r.warn("[ARMS] fetch response error :", x), e; | ||
} | ||
})["catch"](function(e) { | ||
if (!c || !c.api) throw e; | ||
var a = Date.now() - d; | ||
throw c.api(g, !1, a, e.name || "Error", e.message, d, y, I, {}, n), e; | ||
var a = g(); | ||
throw c.api(u, !1, a, e.name || "Error", e.message, d, I, E, {}, n), e; | ||
}); | ||
@@ -129,10 +129,10 @@ }, a[s].toString = r.createFakeToString(s); | ||
if (!p || !p.api || !o.addEventListener) return o; | ||
var c, d, l, g = o.send, h = o.open, u = o.setRequestHeader, f = p._conf, y = (f.ignore || {}).ignoreApis, I = p.getConfig("enableLinkTrace"), E = "", v = "", S = "", T = null, B = p.getConfig("sample"), X = p.getConfig("linkType"), D = 1; | ||
return B && !p.sampling(B) && (D = 0), o.open = function(a, t) { | ||
var c, d, l, g, u = o.send, h = o.open, f = o.setRequestHeader, y = p._conf, I = (y.ignore || {}).ignoreApis, E = p.getConfig("enableLinkTrace"), v = "", S = "", T = "", B = null, X = p.getConfig("sample"), m = p.getConfig("linkType"), D = 1; | ||
return X && !p.sampling(X) && (D = 0), o.open = function(a, t) { | ||
e = a; | ||
var n = 1 === arguments.length ? [ arguments[0] ] : Array.apply(null, arguments); | ||
h.apply(o, n), l = t || "", d = r.cutUrlSearch(l); | ||
var i = !r.checkAPI(d, !0) || r.ignoreByRule(d, y); | ||
if (d = d ? r.filterByRule(d, l, f.ignoreApiPath ? f.ignoreApiPath : f.apiHelper) : "", | ||
!i && I) { | ||
h.apply(o, n), g = t || "", l = r.cutUrlSearch(g); | ||
var i = !r.checkAPI(l, !0) || r.ignoreByRule(l, I); | ||
if (l = l ? r.filterByRule(l, g, y.ignoreApiPath ? y.ignoreApiPath : y.apiHelper) : "", | ||
!i && E) { | ||
var s = ""; | ||
@@ -144,14 +144,14 @@ try { | ||
} | ||
var c = r.checkSameOrigin(l, s); | ||
if ((p.getConfig("enableApiCors") || c) && u && "function" == typeof u) switch (X) { | ||
var c = r.checkSameOrigin(g, s); | ||
if ((p.getConfig("enableApiCors") || c) && f && "function" == typeof f) switch (m) { | ||
case "arms": | ||
E = p.getTraceId()["EagleEye-TraceID"], u.apply(o, [ "EagleEye-TraceID", E ]), v = p.getPageviewId()["EagleEye-SessionID"], | ||
u.apply(o, [ "EagleEye-SessionID", v ]), S = p.getConfig("pid"), u.apply(o, [ "EagleEye-pAppName", S ]); | ||
v = p.getTraceId()["EagleEye-TraceID"], f.apply(o, [ "EagleEye-TraceID", v ]), S = p.getPageviewId()["EagleEye-SessionID"], | ||
f.apply(o, [ "EagleEye-SessionID", S ]), T = p.getConfig("pid"), f.apply(o, [ "EagleEye-pAppName", T ]); | ||
break; | ||
case "b3": | ||
var g = p.getB3TraceId(D); | ||
u.apply(o, [ "X-B3-TraceId", g["X-B3-TraceId"] ]), u.apply(o, [ "X-B3-ParentSpanId", g["X-B3-ParentSpanId"] ]), | ||
u.apply(o, [ "X-B3-SpanId", g["X-B3-SpanId"] ]), u.apply(o, [ "X-B3-Sampled", g["X-B3-Sampled"] ]), | ||
u.apply(o, [ "X-Request-ID", r.guid() ]), E = g["X-B3-TraceId"], v = p.getPageviewId()["EagleEye-SessionID"]; | ||
var d = p.getB3TraceId(D); | ||
f.apply(o, [ "X-B3-TraceId", d["X-B3-TraceId"] ]), f.apply(o, [ "X-B3-ParentSpanId", d["X-B3-ParentSpanId"] ]), | ||
f.apply(o, [ "X-B3-SpanId", d["X-B3-SpanId"] ]), f.apply(o, [ "X-B3-Sampled", d["X-B3-Sampled"] ]), | ||
f.apply(o, [ "X-Request-ID", r.guid() ]), v = d["X-B3-TraceId"], S = p.getPageviewId()["EagleEye-SessionID"]; | ||
break; | ||
@@ -161,19 +161,19 @@ | ||
default: | ||
var T = p.getUberTraceId(D); | ||
u.apply(o, [ "uber-trace-id", T["uber-trace-id"] ]), E = T.traceId, v = p.getPageviewId()["EagleEye-SessionID"]; | ||
var u = p.getUberTraceId(D); | ||
f.apply(o, [ "uber-trace-id", u["uber-trace-id"] ]), v = u.traceId, S = p.getPageviewId()["EagleEye-SessionID"]; | ||
} | ||
} | ||
}, o.send = function() { | ||
c = Date.now(); | ||
c = Date.now(), d = r.duration(); | ||
var e = 1 === arguments.length ? [ arguments[0] ] : Array.apply(null, arguments); | ||
g.apply(o, e); | ||
u.apply(o, e); | ||
}, r.on(o, "readystatechange", function() { | ||
if (d && 4 === o.readyState) { | ||
var a = Date.now() - c, t = r.getXhrSnapshot(l, e, o); | ||
if (!E) { | ||
if (l && 4 === o.readyState) { | ||
var a = d(), t = r.getXhrSnapshot(g, e, o); | ||
if (!v) { | ||
var s = r.parseXhrHeaders("function" == typeof o.getAllResponseHeaders && o.getAllResponseHeaders() || ""); | ||
"object" == typeof s && s["eagleeye-traceid"] && (E = s["eagleeye-traceid"], T = "response"); | ||
"object" == typeof s && s["eagleeye-traceid"] && (v = s["eagleeye-traceid"], B = "response"); | ||
} | ||
if (o.status >= 200 && o.status <= 299) { | ||
var g = o.status || 200; | ||
var u = o.status || 200; | ||
if ("function" == typeof o.getResponseHeader) { | ||
@@ -183,8 +183,10 @@ var h = o.getResponseHeader("Content-Type"); | ||
} | ||
o.responseType && "text" !== o.responseType ? p.api(d, !0, a, g, "", c, E, v, {}, n, T, D) : i(p, f.parseResponse, d, l, o.responseText, g, a, c, E, v, t, T, D); | ||
} else p.api(d, !1, a, o.status || "FAILED", o.statusText, c, E, v, t, n, T, D); | ||
o.responseType && "text" !== o.responseType ? p.api(l, !0, a, u, "", c, v, S, {}, n, B, D) : i(p, y.parseResponse, l, g, o.responseText, u, a, c, v, S, t, B, D); | ||
} else p.api(l, !1, a, o.status || "FAILED", o.statusText, c, v, S, t, n, B, D); | ||
} | ||
}), o; | ||
}; | ||
o.prototype = s.prototype, a[c] = o, a[c].toString = r.createFakeToString(c); | ||
o.prototype = s.prototype, r.each(Object.keys(s), function(e) { | ||
o[e] = s[e]; | ||
}), a[c] = o, a[c].toString = r.createFakeToString(c); | ||
} | ||
@@ -191,0 +193,0 @@ }()), t = this, this); |
var platform = require("./platform"), util = require("../util"); | ||
module.exports = function(e) { | ||
function i(e, i, t) { | ||
if (e[i]) { | ||
var n = e[i]; | ||
e[i] = function() { | ||
function t(e, t, i) { | ||
if (e[t]) { | ||
var n = e[t]; | ||
e[t] = function() { | ||
var e = Array.apply(null, arguments); | ||
t.apply(this, e), n.apply(this, e); | ||
i.apply(this, e), n.apply(this, e); | ||
}; | ||
} else e[i] = function() { | ||
} else e[t] = function() { | ||
var e = Array.apply(null, arguments); | ||
t.apply(this, e); | ||
i.apply(this, e); | ||
}; | ||
} | ||
var t, n, a, o = platform.sdk, s = function() { | ||
var e = this; | ||
if (o && "function" == typeof o.request) { | ||
t = o.request, Object.defineProperty(o, "request", { | ||
var i = platform.sdk, n = { | ||
request: null, | ||
httpRequest: null, | ||
app: null, | ||
page: null | ||
}, a = function(e) { | ||
var t = this; | ||
if (i && "function" == typeof i[e]) { | ||
Object.defineProperty(i, e, { | ||
configurable: !0, | ||
@@ -24,61 +29,45 @@ enumerable: !0, | ||
value: function() { | ||
return function(i) { | ||
var t = new Date().getTime(), n = e._conf.parseResponse; | ||
if (i && "object" == typeof i && i[0]) { | ||
var a, o, s = i[0], r = util.cutUrlSearch(s.url), c = s.success, u = s.fail, l = s && s.header; | ||
l && "object" == typeof l || (l = {}); | ||
var p = {}; | ||
if (e.getConfig("enableLinkTrace")) { | ||
var f = l["EagleEye-pAppName"]; | ||
if (a = l["EagleEye-TraceID"], o = l["EagleEye-SessionID"], a || (a = e.getTraceId()["EagleEye-TraceID"], | ||
p["EagleEye-TraceID"] = a), o || (o = e.getPageviewId()["EagleEye-SessionID"], p["EagleEye-SessionID"] = o), | ||
!f) { | ||
var g = e.getConfig("pid"); | ||
p["EagleEye-pAppName"] = g; | ||
return function(e) { | ||
var i = Date.now(), n = util.duration(), a = t._conf || {}, o = a.parseResponse; | ||
if (e && "object" == typeof e && e[0]) { | ||
var s = e[0], u = s.url, r = util.cutUrlSearch(s.url); | ||
r = r ? util.filterByRule(r, u, a.ignoreApiPath ? a.ignoreApiPath : a.apiHelper) : ""; | ||
var p, l, c = s.success, f = s.fail, h = (a.ignore || {}).ignoreApis, g = s.header; | ||
g && "object" == typeof g || (g = {}); | ||
var y = {}; | ||
if (t.getConfig("enableLinkTrace")) { | ||
var d = g["EagleEye-pAppName"]; | ||
if (p = g["EagleEye-TraceID"], l = g["EagleEye-SessionID"], p || (p = t.getTraceId()["EagleEye-TraceID"], | ||
y["EagleEye-TraceID"] = p), l || (l = t.getPageviewId()["EagleEye-SessionID"], y["EagleEye-SessionID"] = l), | ||
!d) { | ||
var v = t.getConfig("pid"); | ||
y["EagleEye-pAppName"] = v; | ||
} | ||
} | ||
s.success = function() { | ||
var s = new Date().getTime(); | ||
if (util.checkAPI(r, !0)) { | ||
var u = undefined, l = arguments && arguments[0] && arguments[0].statusCode || 200, p = !0; | ||
if ("function" == typeof n) { | ||
var f = n(arguments[0]); | ||
f && (l = "code" in f ? f.code : l, u = "msg" in f ? f.msg : u, p = !!("success" in f ? f.success : p)); | ||
var q = function(a, s, c) { | ||
var f = a.statusCode || c, g = "", y = s; | ||
if ("number" == typeof f && (f < 200 || f >= 300) && (y = !1), util.checkAPI(r, !0) || util.ignoreByRule(u, h)) { | ||
if ("function" == typeof o) { | ||
var d = o(a); | ||
d && (f = "code" in d ? d.code : f, g = "msg" in d ? d.msg : g, y = !!("success" in d ? d.success : y)); | ||
} | ||
e.api({ | ||
api: i[0].url, | ||
success: p, | ||
time: s - t, | ||
code: l, | ||
msg: u, | ||
begin: t, | ||
traceId: a, | ||
pv_id: o | ||
util.isString(g) && g && (g = g.substring(0, 1e3)), t.api({ | ||
api: e[0].url, | ||
success: y, | ||
time: n(), | ||
code: f, | ||
msg: g, | ||
begin: i, | ||
traceId: p, | ||
pv_id: l | ||
}); | ||
} | ||
c && c.apply(e, [].slice.call(arguments)); | ||
}; | ||
s.success = function() { | ||
q(arguments[0], !0, 200), c && c.apply(t, [].slice.call(arguments)); | ||
}, s.fail = function() { | ||
var s = new Date().getTime(); | ||
if (util.checkAPI(r, !0)) { | ||
var c = "", l = arguments && arguments[0] && arguments[0].statusCode || "FAILED", p = !1; | ||
if (arguments && arguments[0] && "object" == typeof arguments[0] && (c = JSON.stringify(arguments[0])), | ||
"function" == typeof n) { | ||
var f = n(arguments[0]); | ||
f && (l = "code" in f ? f.code : l, c = "msg" in f ? f.msg : c, p = !!("success" in f ? f.success : p)); | ||
} | ||
c = c.substring(0, 1e3), e.api({ | ||
api: i[0].url, | ||
success: p, | ||
time: s - t, | ||
code: l, | ||
msg: c, | ||
begin: t, | ||
traceId: a, | ||
pv_id: o | ||
}); | ||
} | ||
u && u.apply(e, [].slice.call(arguments)); | ||
}, s.header = util.ext({}, l, p); | ||
q(arguments[0], !1, "FAILED"), f && f.apply(t, [].slice.call(arguments)); | ||
}, s.header = util.ext({}, g, y); | ||
} | ||
}(arguments), t.apply(this, arguments); | ||
}(arguments), n[e].apply(this, arguments); | ||
} | ||
@@ -90,18 +79,20 @@ }); | ||
addHook: function() { | ||
return this.isHookInstantiated ? this : (s.call(this), function() { | ||
return this.isHookInstantiated ? this : (i && ("function" == typeof i.request && (n.request = i.request, | ||
a.call(this, "request")), "function" == typeof i.httpRequest && (n.httpRequest = i.httpRequest, | ||
a.call(this, "httpRequest"))), function() { | ||
var e = this; | ||
n = App, a = Page, App = function(t) { | ||
i(t, "onLaunch", function() { | ||
n.app = App, n.page = Page, App = function(i) { | ||
t(i, "onLaunch", function() { | ||
e.appLaunch(); | ||
}), i(t, "onError", function(i) { | ||
e.error(i), "function" == typeof e.reportBehavior && e.reportBehavior(); | ||
}), n(t); | ||
}, Page = function(t) { | ||
i(t, "onShow", function() { | ||
}), t(i, "onError", function(t) { | ||
e.error(t), "function" == typeof e.reportBehavior && e.reportBehavior(); | ||
}), n.app(i); | ||
}, Page = function(i) { | ||
t(i, "onShow", function() { | ||
e.pageShow(); | ||
}), i(t, "onHide", function() { | ||
}), t(i, "onHide", function() { | ||
e.pageHide(); | ||
}), i(t, "onUnload", function() { | ||
}), t(i, "onUnload", function() { | ||
e.pageHide(); | ||
}), a(t); | ||
}), n.page(i); | ||
}; | ||
@@ -112,5 +103,6 @@ }.call(this), this.isHookInstantiated = !0, this); | ||
return this.isHookInstantiated ? (function() { | ||
void 0 !== o && o && t && (o.request = t, t = null); | ||
void 0 !== i && i && (n.request && (i.request = n.request, n.request = null), n.httpRequest && (i.httpRequest = n.httpRequest, | ||
n.httpRequest = null)); | ||
}.call(this), function() { | ||
n && (App = n), a && (Page = a); | ||
n.app && (App = n.app), n.page && (Page = n.page); | ||
}.call(this), this.isHookInstantiated = !1, this) : this; | ||
@@ -117,0 +109,0 @@ }, |
@@ -7,8 +7,9 @@ var util = require("../util"), MiniProgramLogger = require("../miniProgramLogger"), platform = require("./platform"), sdk = platform.sdk, ARMS_STORAGE_MINIPROGRAM_UID_KEY = "ARMS_STORAGE_MINIPROGRAM_UID_KEY", MiniLogger = function(e) { | ||
sendRequest: function(e, t) { | ||
if (sdk && "function" == typeof sdk.request) try { | ||
var r, o = "GET"; | ||
t && (o = "POST", r = JSON.stringify(t)), sdk.request({ | ||
var r = sdk.request || sdk.httpRequest; | ||
if (sdk && "function" == typeof r) try { | ||
var o, i = "GET"; | ||
t && (i = "POST", o = JSON.stringify(t)), r({ | ||
url: e, | ||
method: o, | ||
data: r, | ||
method: i, | ||
data: o, | ||
fail: function(e) { | ||
@@ -18,4 +19,4 @@ util.warn("[arms] sendRequest fail", e); | ||
}); | ||
} catch (i) { | ||
util.warn("[arms] error in conf sendRequest", i); | ||
} catch (n) { | ||
util.warn("[arms] error in conf sendRequest", n); | ||
} | ||
@@ -42,9 +43,9 @@ }, | ||
uid: this._conf.uid | ||
}); else if (void 0 !== sdk && sdk && "function" == typeof sdk.getStorageSync) try { | ||
var e = sdk.getStorageSync(ARMS_STORAGE_MINIPROGRAM_UID_KEY); | ||
}); else if (void 0 !== sdk && sdk) try { | ||
var e = platform.getStorageSync(ARMS_STORAGE_MINIPROGRAM_UID_KEY); | ||
if (e && "string" == typeof e) this.setCommonInfo({ | ||
uid: e | ||
}); else if ("function" == typeof sdk.setStorageSync) { | ||
}); else if ("function" == typeof platform.setStorageSync) { | ||
var t = util.uu(); | ||
sdk.setStorageSync(ARMS_STORAGE_MINIPROGRAM_UID_KEY, t), this.setCommonInfo({ | ||
platform.setStorageSync(ARMS_STORAGE_MINIPROGRAM_UID_KEY, t), this.setCommonInfo({ | ||
uid: t | ||
@@ -51,0 +52,0 @@ }); |
function getSDK() { | ||
var t; | ||
return "object" == typeof wx ? t = wx : "object" == typeof dd ? t = dd : "object" == typeof my ? t = my : "object" == typeof tt ? t = tt : "object" == typeof qq ? t = qq : "object" == typeof swan && (t = swan), | ||
return "object" == typeof qq ? t = qq : "object" == typeof tt ? t = tt : "object" == typeof wx ? t = wx : "object" == typeof dd ? t = dd : "object" == typeof my ? t = my : "object" == typeof swan && (t = swan), | ||
t; | ||
@@ -9,9 +9,26 @@ } | ||
var t = "unknown"; | ||
return "object" == typeof wx ? t = "wechat" : "object" == typeof dd ? t = "dingtalk" : "object" == typeof my ? t = "alipay" : "object" == typeof tt ? t = "bytedance" : "object" == typeof qq ? t = "qq" : "object" == typeof swan && (t = "swan"), | ||
return "object" == typeof qq ? t = "qq" : "object" == typeof tt ? t = "bytedance" : "object" == typeof wx ? t = "wechat" : "object" == typeof dd ? t = "dingtalk" : "object" == typeof my ? t = "alipay" : "object" == typeof swan && (t = "swan"), | ||
t; | ||
} | ||
function getStorageSync(t) { | ||
if ("function" == typeof sdk.getStorageSync) return "alipay" === appName || "dingtalk" === appName ? sdk.getStorageSync({ | ||
key: t | ||
}).data : sdk.getStorageSync(t); | ||
} | ||
function setStorageSync(t, e) { | ||
if ("function" == typeof sdk.setStorageSync) return "alipay" === appName || "dingtalk" === appName ? sdk.setStorageSync({ | ||
key: t, | ||
data: e | ||
}) : sdk.setStorageSync(t, e); | ||
} | ||
var sdk = getSDK(), appName = getAppName(); | ||
module.exports = { | ||
sdk: getSDK(), | ||
appName: getAppName() | ||
appName: getAppName(), | ||
getStorageSync: getStorageSync, | ||
setStorageSync: setStorageSync | ||
}; |
@@ -1,1 +0,1 @@ | ||
/** retcode cloud sdk | @version 1.8.32 | @copyright Alibaba Group Holding Limited. */ !function(){function e(t,r,n){function a(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[o]={exports:{}};t[o][0].call(f.exports,function(e){return a(t[o][1][e]||e)},f,f.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}return e}()({1:[function(e,t,r){var n=e("./util"),a=e("./common/sendBeacon"),i="aokcdqn3ly@e629dabd48a9933",o=function(e,t){var r;{if("error"!==t.t||!(r=e.$a1[0])||"error"!==r.t||t.msg!==r.msg){if("behavior"===t.t){var a=e.$a1&&e.$a1.length;if(a>0&&"behavior"===e.$a1[a-1].t){var i=t.behavior||[];e.$a1[a-1].behavior.concat(i)}else e.$a1.push(t)}else e.$a1.unshift(t);return e.$a2(function(){e.$a3=n.delay(function(){e.$a4()},e.$a1[0]&&"error"===e.$a1[0].t?3e3:-1)}),!0}r.times++}},s=function(e){return this.ver="1.8.32",this._conf=n.ext({},s.dftCon),this.$a5={},this.$a1=[],this.$a6=[],this.sdkFlag=!0,this.hash=n.seq(),this.$a7(),this.setConfig(e),this.rip=n.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};s.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:undefined,environment:"prod",beforeReport:null},s.prototype={constructor:s,$a2:function(e){return e()},$a8:function(){var e=this._conf.page;return n.$a9(e,[],e+"")},setPage:function(){},setConfig:function(e){e&&"object"==typeof e&&(n.$aa(e),e=this.$ab(e),this._conf=n.ext({},this._conf,e))},$ab:function(e){var t=e.region,r=e.imgUrl;if(t){var a=n.regionMap[t];return e.imgUrl=a||n.defaultImgUrl,e}return r&&(e.imgUrl=r),e},$ac:function(e){if(this.getConfig("debug"))return!0;var t=n.regionMap,r=!1;for(var a in t)if(t[a]===e){r=!0;break}return!r&&n.warn("[retcode] invalid url: "+e),r},$ad:function(){},$ae:function(e){a(e,this.getConfig("imgUrl"))},$af:function(){},$ag:function(){return{}},setCommonInfo:function(e){e&&"object"==typeof e&&(this._common=n.ext({},this._common,e))},$a7:function(){this.pageview=n.uu(),this.sBegin=Date.now()},$ah:function(){if(this.username)return this.username;var e=this._conf,t=e&&e.setUsername;if("function"==typeof t)try{var r=t();"string"==typeof r&&(r=r.substr(0,40),this.username=r)}catch(a){n.warn("[arms] setUsername fail",a)}return this.username},getTraceId:function(){var e=this.rip,t=Date.now(),r=n.getSortNum(this.record),a=e+t+r+n.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=a,this.record=r,{"EagleEye-TraceID":a}},getUberTraceId:function(e){var t=this.rip,r=Date.now(),a=n.getSortNum(this.record),i=n.getRandNum(this._conf.pid),o=t+r+a+n.getNum(2)+i,s=o.substring(0,16);return e=e?"1":"0","0"===o[0]&&(o[0]="1"),"0"===o[16]&&(o[16]="1"),{"uber-trace-id":o+":"+s+":0:"+e,traceId:o}},getB3TraceId:function(e){var t=this.rip,r=Date.now(),a=n.getSortNum(this.record),i=n.getRandNum(this._conf.pid),o=t+r+a+n.getNum(2)+i,s=o.substring(0,16);return e=e?"1":"0","0"===o[0]&&(o[0]="1"),"0"===o[16]&&(o[16]="1"),{b3:o+"-"+s+"-"+e+"-0","X-B3-TraceId":o,"X-B3-ParentSpanId":"0","X-B3-SpanId":s,"X-B3-Sampled":e}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(e){return e?this._conf[e]:n.ext({},this._conf)},$ai:function(e){return 1===e||("boolean"==typeof this.$a5[e]?this.$a5[e]:(this.$a5[e]=n.pick(e),this.$a5[e]))},$a4:function(e){var t;clearTimeout(this.$a3),this.$a3=null;for(var r=this._conf&&"function"==typeof this._conf.sendRequest;t=this.$a1.pop();)"res"===t.t?this.$af(t,"res"):"resource"===t.t?this.$af(t,"resource"):"error"===t.t?this.$af(t,"err"):"api"===t.t?this.$af(t,"apiSnapshot"):"behavior"===t.t?this.$af(t,"behavior"):"health"===t.t&&!r&&window&&window.navigator&&"function"==typeof window.navigator.sendBeacon?this.$ae(t):this.$ad(t);return e&&this.$aj(),this},$aj:function(){var e;for(clearTimeout(this.$ak),this.$ak=null;e=this.$a6.pop();)this.$af(e,"err");return this},_lg:function(e,t,r,a){var i=this,s=i._conf,c=i.$a8(),u=s.ignore||{},f=u.ignoreErrors,l=u.ignoreResErrors,p=u.ignoreUrls,d=u.ignoreApis;if(i._isRobot)return i;if(n.$al(c,p)||n.$al(n.decode(c),p))return i;if("error"===e&&(n.$al(t.msg,f)||n.$al(n.decode(t.msg),f)))return i;if("resourceError"===e&&(n.$al(t.src,l)||n.$al(n.decode(t.src),l)))return i;if("api"===e&&(n.$al(t.api,d)||n.$al(n.decode(t.api),d)))return i;if(!i.$ac(s.imgUrl))return i;if(!t||s.disabled||!s.pid)return i;if(0===a)return i;var g=t.dl;if(delete t.dl,t=n.ext({t:e,times:1,page:c,tag:s.tag||"",release:s.release||"",environment:s.environment,begin:Date.now(),c1:s.c1,c2:s.c2,c3:s.c3},t,i.$ag(),i._common,{pid:s.pid,_v:i.ver,pv_id:i.pageview,username:i.$ah(),sampling:r||1,dl:g,z:n.seq()}),"Function"===n.T(s.beforeReport))try{if(!(t=s.beforeReport(t)))return i}catch(h){return i}return 1===a?o(i,t):r&&!i.$ai(r)?i:o(i,t)},_self:function(e,t,r){var a=this,o=a._conf;if("error"!==e)return a;if(!a.$ac(o.imgUrl))return a;if(!t||o.disabled||!o.pid)return a;if(r&&!a.$ai(r))return a;t=n.ext({t:e,times:1,page:n.selfErrPage,tag:o.pid,begin:Date.now()},t,{pid:i,_v:a.ver,sampling:r||1,z:n.seq()});var s=a.$a6[0];if(s){s.times++;try{if(s.err&&t.err&&s.err.msg_raw&&t.err.msg_raw){s.err.msg_raw.split("&").indexOf(t.err.msg_raw)<0&&s.err.msg_raw.length<1e3&&(s.err.msg_raw+="&"+t.err.msg_raw)}}catch(c){}}else a.$a6.unshift(t),a.$a2(function(){a.sdkFlag&&(a.sdkFlag=!1,a.$ak=n.delay(function(){a.$aj()},1e4))})},custom:function(e,t){if(!e||"object"!=typeof e)return this;var r=!1,a={begin:Date.now()};return n.each(e,function(e,t){return!(r=t&&t.length<=20)&&n.warn("[retcode] invalid key: "+t),a["x-"+t]=e,r}),r?this._lg("custom",a,t||1):this}},t.exports=s},{"./common/sendBeacon":13,"./util":17}],2:[function(e,t,r){var n=e("../util");t.exports=function(e,t){var r=[],a=null,i=t&&t.location&&t.location.href,o=0,s=undefined,c=null,u=function(e,t,r){if(null!==e){var n=e[t];e[t]=r(n)}},f=function(e){var t,r,n,a,i,o=[];if(!e||"string"!=typeof e.tagName)return"";if(o.push(e.tagName.toLowerCase()),"string"==typeof e.id&&o.push("#".concat(e.id)),"string"==typeof(t=e.className))for(r=t.split(/\s+/),i=0;i<r.length;i++)o.push(".".concat(r[i]));var s=["type","name","title","alt","data-arms-attr"];for(i=0;i<s.length;i++)n=s[i],"string"==typeof(a=e.getAttribute(n))&&o.push("[".concat(n,'="').concat(a,'"]'));return o.join("")},l=function(e,t){return function(r){if(r&&r!==c){c=r;var n;try{n=r.target}catch(u){n="<unknown>"}if(0!==n.length){var i={type:"ui.".concat(e),data:{message:function(e){if(!e||1!==e.nodeType)return"";for(var t=e||null,r=[],n=0,a=0,i=" > ".length,o="";t&&n++<5&&!("html"===(o=f(t))||n>1&&a+r.length*i+o.length>=80);)r.push(o),a+=o.length,t=t.parentNode;return r.reverse().join(" > ")}(n)},timestamp:Date.now()};"click"===e?(o&&clearTimeout(o),t?o=setTimeout(function(){a&&a.addBehavior(i)},0):a&&a.addBehavior(i)):"keypress"===e&&(s||a&&a.addBehavior(i),clearTimeout(s),s=setTimeout(function(){s=undefined},100))}}}},p=function(){if(function(){var e=t&&t.chrome,r=e&&e.app&&e.app.runtime,n="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!r&&n}()){var e=function(e,t){var r={type:"navigation",data:{from:e,to:t}};a&&a.addBehavior(r),i=t},r=t.onpopstate;t.onpopstate=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=t.location.href;if(e(i,s),r)return r.apply(this,a)};var n=function(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];var o=n.length>2?n[2]:undefined;return o&&e(i,String(o)),t.apply(this,n)}};u(t.history,"pushState",n),u(t.history,"replaceState",n)}};n.ext(e.prototype,{addBehavior:function(e){if(this.getConfig("behavior")&&e&&"object"==typeof e){var a={},i=e.data||{};if(e.type)a=i;else{if("string"!=typeof i.name||"string"!=typeof i.message)return;a.name=i.name.substr(0,20),a.message=i.message.substr(0,200)}a.message&&(a.message=n.encode(a.message));var o={type:e.type||"custom",data:a||{},timestamp:e.timestamp||Date.now(),page:e.page||t&&t.location&&t.location.pathname};return r.push(o),r=r.slice(-100)}},getBehavior:function(){return r||[]},setBehavior:function(e){return e&&(r=e),r},reportBehavior:function(e){var t=this;t.getConfig("behavior")&&(t.$am&&(clearTimeout(t.$am),t.$am=undefined),t.$am=setTimeout(function(){r&&r.length>0&&(t.behavior(r),r=[],t.$am=undefined,e&&"function"==typeof e&&e())},0))},$an:function(){if(!this.hasInitBehavior&&!a){try{!function(){if(document&&document.referrer&&document.location){var e=document.referrer,t=document.location.href;if(""!==e){var r={type:"navigation",data:{from:e,to:t}};i=t,a&&a.addBehavior(r)}}}(),t&&t.document&&t.document.addEventListener&&(t.document.addEventListener("click",l("click"),!1),t.document.addEventListener("keypress",l("keypress"),!1)),p(),this.getConfig("enableConsole")&&function(){if(t&&t.console)for(var e=["debug","info","warn","log","error","assert"],r=0;r<e.length;r++){var n=e[r];t.console[n]&&"function"==typeof t.console[n]&&u(t.console,n,function(e){var r=n;return function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s={type:"console",data:{level:r,message:i}};if(a&&a.addBehavior(s),"error"===r)for(var c=0;c<i.length;c++){var u=i[c];u&&u.message&&u.stack&&a&&a.errorHandler(new ErrorEvent("error",{error:u,message:u.message}))}e&&Function.prototype.apply.call(e,t.console,i)}})}}()}catch(e){n.warn("[arms] error in initBehavior",e)}a=this,this.hasInitBehavior=!0}return this}})}},{"../util":17}],3:[function(e,t,r){var n=e("../util"),a=e("../reporter"),i=e("../common/sender"),o=e("../common/post"),s=n.win,c=s.document,u=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,f=function(e){var t=this;return a.call(t,e),t._initialPage=e.page&&n.$a9(e.page,[],e.page+"")||null,t._isRobot=n.isRobot(),t._health={errcount:0,apisucc:0,apifail:0},t.$ao=function(e,r){"error"===e?t._health.errcount++:"api"===e&&t._health[r.success?"apisucc":"apifail"]++},!1!==e.enableInstanceAutoSend&&(t.$ap(),t.$aq(),t.$ar(1e4),t._conf&&t._conf.behavior&&"function"==typeof t.$an&&t.$an(),t._conf&&t._conf.enableResource&&"function"==typeof t.$as&&t.$as()),Object.defineProperty&&s.addEventListener&&Object.defineProperty(t,"pipe",{set:t.$at}),t};f.prototype=n.$au(a.prototype),n.ext(a._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(e){return(e?n.$aw(e.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(e){if(!e||"object"!=typeof e)return{};var t=e.code,r=e.msg||e.message||e.subMsg||e.errorMsg||e.ret||e.errorResponse||"";return"object"==typeof r&&(t=t||r.code,r=r.msg||r.message||r.info||r.ret||JSON.stringify(r)),{msg:r,code:t,success:!0}}}),n.ext(f.prototype,{constructor:f,_super:a,$a2:function(e){var t=this;if(t.hasReady)return e();"complete"===c.readyState?(t.hasReady=!0,e()):n.on(s,"load",function(){t.hasReady=!0,e()},!0)},$a8:function(e){var t=this._conf,r=t.page,a=location,i=a.host+a.pathname;return r&&!e?n.$a9(r,[],r+""):this._initialPage||n.$av(t.ignoreUrlCase?i.toLowerCase():i,a.href,t.ignoreUrlPath?t.ignoreUrlPath:t.urlHelper)},setPage:function(e,t){var r=this,n=r.$ax;if(!1!==t){if(!e||e===n)return r;r.$ax=e,clearTimeout(r.$ay),r.$az(1),r.$a7(),r.$ay=setTimeout(function(){r.$b0()},10)}else r.$ax=e;return r._conf.page=e,r},setConfig:function(e,t){if(e&&"object"==typeof e){n.$aa(e),e=this.$ab(e);var r=this._conf;if(this._conf=n.ext({},r,e),!t){var a="disableHook";a in e&&r[a]!==e[a]&&(e[a]?this.removeHook():this.addHook()),(a="enableSPA")in e&&r[a]!==e[a]&&this.$b1(e[a])}}},$ad:function(e){i(e,this.getConfig("imgUrl"))},$af:function(e,t){var r={};r[t]=e[t],delete e[t];var a="";"object"==typeof e&&(a=n.serialize(e)),o(r,this.getConfig("imgUrl")+a+"&post_res=")},$at:function(e){var t=this;if(!e||!e.length)return t;try{if("Array"===n.T(e[0]))return n.each(e,function(e){return t.$at(e)});if("Array"!==n.T(e))return t;var r=e.shift();if(!u.test(r))return t;t[r].apply(t,e)}catch(a){return n.warn("[retcode] error in sendPipe",a),t}},$b2:function(){var e=n.ext({},this._health);e.healthy=e.errcount>0?0:1,e.begin=Date.now();var t=e.begin-this.sBegin;e.stay=t,this._lg("health",e,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(e){e=n.ext({pid:this._conf.pid},e);var t=this.__proto__.constructor(e);return e.page&&t.$b0(),t}}),e("./behavior")(f,s),e("./handler")(f,s,c),e("./fmp")(f,s,c),e("./hook")(f,s),e("./hack")(f,s),e("./resource")(f,s),f._super=a,f._root=a._root,a.Browser=f,t.exports=f},{"../common/post":11,"../common/sender":14,"../reporter":16,"../util":17,"./behavior":2,"./fmp":4,"./hack":5,"./handler":6,"./hook":7,"./resource":8}],4:[function(e,t,r){var n=e("../util"),a=500;t.exports=function(e,t,r){function i(e,t,r){var n=0,a=e.tagName;if("SCRIPT"!==a&&"STYLE"!==a&&"META"!==a&&"HEAD"!==a){var o=e.children?e.children.length:0;if(o>0)for(var c=e.children,u=o-1;u>=0;u--)n+=i(c[u],t+1,n>0);if(n<=0&&!r){if(!(e.getBoundingClientRect&&e.getBoundingClientRect().top<s))return 0}n+=1+.5*t}return n}function o(e){for(var t=1;t<e.length;t++)if(e[t].score<e[t-1].score)return e.splice(t,1),o(e);return e}var s=t.innerHeight||0,c=[],u=null,f=0;n.ext(e.prototype,{$ar:function(e){var a=this;if(!a._conf||!a._conf.useFmp)return null;if(!t.MutationObserver)return n.warn("[retcode] first meaningful paint can not be retrieved"),a.$b3(),null;n.on(t,"beforeunload",function(){a.$b4(0,!0)});var o=t.MutationObserver;return(u=new o(function(){!function(e){var t=Date.now()-e,n=r.querySelector("body");if(n){var a=0;a+=i(n,1,!1),c.push({score:a,t:t})}else c.push({score:0,t:t})}(a._startTime)})).observe(document,{childList:!0,subtree:!0}),f=1,a.$a2(function(){a.$b4(e)}),u},$b4:function(e,t){var r=this;if(u&&f)if(r.$b5&&(clearTimeout(r.$b5),r.$b5=null),t||!function(e,t){var r=Date.now()-e;return!(r>t||r-(c&&c.length&&c[c.length-1].t||0)>2*a)}(r._startTime,e)){u.disconnect(),f=0,c=o(c);for(var i=null,s=1;s<c.length;s++)if(c[s].t>=c[s-1].t){var l=c[s].score-c[s-1].score;(!i||i.rate<=l)&&(i={t:c[s].t,rate:l})}i&&i.t>0&&i.t<36e5?r.$b3({fmp:i.t}):r.$b3()}else r.$b5=n.delay(function(){r.$b4(e)},a)}})}},{"../util":17}],5:[function(e,t,r){t.exports=function(t,r){var n=e("../util"),a=r.history||{},i=r.document,o=function(e,t){var n;r.CustomEvent?n=new CustomEvent(e,{detail:t}):((n=i.createEvent("HTMLEvents")).initEvent(e,!1,!0),n.detail=t),r.dispatchEvent(n)},s=function(e){var t=a[e];"function"==typeof t&&(a[e]=function(r,i,s){var c=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),u=location.href,f=t.apply(a,c);if(!s||"string"!=typeof s)return f;if(s===u)return f;try{var l=u.split("#"),p=s.split("#"),d=n.$aw(l[0]),g=n.$aw(p[0]),h=l[1]&&l[1].replace(/^\/?(.*)/,"$1"),v=p[1]&&p[1].replace(/^\/?(.*)/,"$1");d!==g?o("historystatechange",g):h!==v&&o("historystatechange",v)}catch(m){n.warn("[retcode] error in "+e+": "+m)}return f},a[e].toString=n.$b6(e))};n.ext(t.prototype,{$b7:function(){return this.$b8?this:(s("pushState"),s("replaceState"),this.$b8=!0,this)}})}},{"../util":17}],6:[function(e,t,r){t.exports=function(t,r,n){var a=e("../util"),i=e("../common/res"),o=e("../common/perf"),s=null,c=n.documentElement,u=r.innerWidth||c.clientWidth||n.body.clientWidth,f=r.innerHeight||c.clientHeight||n.body.clientHeight,l=r.navigator.connection,p={sr:screen.width+"x"+screen.height,vp:u+"x"+f,ct:l?l.effectiveType||l.type:""},d={},g=function(e,t,r,i,o){if(t===undefined){var s,c;if(!d[e]){s=new RegExp(e+"=([^;]+)");try{c=s.exec(n.cookie)}catch(f){return a.warn("[retcode] can not get cookie:",f),null}c&&(d[e]=c[1])}return d[e]}var u=e+"="+t;i&&(u+="; domain="+i),u+="; path="+(o||"/"),r&&(u+="; max-age="+r);try{return n.cookie=u,!!n.cookie}catch(f){return a.warn("[retcode] can not set cookie: ",f),!1}},h=function(e){var t=e._conf.uid||g("_nk_")||g("_bl_uid");if(!t){t=a.uu();if(!g("_bl_uid",t,15552e3))return null}return t};return a.ext(t.prototype,{activeErrHandler:function(e){return s&&!e?this:(s=this,this)},errorHandler:function(e){if(!e)return this;var t=e.type;if("error"===t){var r=e.target||e.srcElement;!(!r||!r.tagName||e.message||e.filename||e.lineno||e.colno)?this.$b9(e):this.error(e.error||{message:e.message},e)}else"unhandledrejection"===t&&a.T(e.reason,"Error")&&a.$ba(e.reason)&&this.error(e.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(e){}return this},$b9:function(e){var t=this,r=e.target||e.srcElement;try{var n=t.$bb(r),i="string"==typeof r.tagName?r.tagName.toLowerCase():"",o=t.$bc(r,5),s=a.getURL(n),c={src:n&&n.substring(0,1e3),node_name:i,xpath:o,res_type:a.getResType(i,n),res_name:s.path,domain:s.domain};return t._conf.enableResource&&t.setResource&&t.setResource([a.ext({success:0},c)]),t._lg("resourceError",c),t}catch(u){return a.warn("[ARMS] $b9 error :",u),t}},$bb:function(e){var t=e.src||e.href;try{if(!t){var r="object"===("string"==typeof e.tagName?e.tagName.toLowerCase():""),n=e.getAttribute("classid")&&"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"===e.getAttribute("classid").toLowerCase()||"application/x-shockwave-flash"===e.getAttribute("type");r&&n&&(t=e.getAttribute("data")||e.getAttribute("codebase")),t||(t=e.outerHTML||e.innerHTML)}}catch(a){t=""}return t},$bc:function(e,t){var r=e.id?"#"+e.id:"",n="string"==typeof e.className?"."+e.className.split(" ").join("."):"",a=("string"==typeof e.tagName?e.tagName.toLowerCase():"")+r+n;return e.parentNode&&e.parentNode.tagName&&t-1!=0?this.$bc(e.parentNode,t-1)+" > "+a:a},$b3:function(e){var t=this;t.$a2(function(){var r=o();r&&r.load&&r.load>0&&(r.page=t.$a8(!0),e&&(r=a.ext(r,e)),r.autoSend=!0,t.performance(r))})},$bd:function(e){var t=this;t.$a2(function(){var r=i();r&&r.load&&r.load>0&&(r.load&&r.load<=2e3||r.load&&r.load<=8e3&&Math.random()>.05||(r.page=t.$a8(!0),r.dl=location.href,e&&(r=a.ext(r,e)),t._lg("res",r,t.getConfig("sample"))))})},$b0:function(){var e=this;e.$a2(function(){var t=function(e){var t=h(e),a=r.devicePixelRatio||1;return{uid:t,dt:n.title,dl:location.href,dr:n.referrer,dpr:a.toFixed(2),de:(n.characterSet||n.defaultCharset||"").toLowerCase(),ul:c.lang,begin:Date.now()}}(e);t&&t.uid&&e._lg("pv",t,e.getConfig("pvSample"))})},$ag:function(){return p.uid=h(this),p.sid=function(e){if(e.session)return e.session;var t;try{if("object"==typeof window&&"object"==typeof sessionStorage&&"function"==typeof sessionStorage.getItem)return"string"==typeof(t=sessionStorage.getItem("_bl_sid"))?(e.session=t,t):(t=a.uu(),e.session=t,"function"==typeof sessionStorage.setItem&&sessionStorage.setItem("_bl_sid",t),t)}catch(r){a.warn("[ARMS] getSid error :",r)}return e.session=t=a.uu(),t}(this),p},$az:function(e){var t=Date.now();if(t-this._lastUnload<200)return this;this._lastUnload=t,this.$b2(e),this.$be&&(this._lg("speed",this.$be),this.$be=null,clearTimeout(this.$bf)),this.$a4(!0)},$b1:function(e){var t=this;if(!e^t.$bg)return t;e?(t.$b7(),t.$bg=function(e){var r=t._conf.parseHash(location.hash);r&&t.setPage(r,!1!==e)},t.$bh=function(e){var r=t._conf.parseHash(e.detail);r&&t.setPage(r)},a.on(r,"hashchange",t.$bg),a.on(r,"historystatechange",t.$bh),t.$bg(!1)):(a.off(r,"hashchange",t.$bg),a.off(r,"historystatechange",t.$bh),t.$bg=null,t.$bh=null)},$ap:function(){var e=this;if(e.$bi)return e;var t=e._conf;return a.on(r,"beforeunload",function(){e.$az(0)}),e.$b1(t.enableSPA),e.activeErrHandler(!1),e.$bi=!0,e}}),a.on(r,"error",function(e){s&&s.errorHandler(e)},!1,!0).on(r,"unhandledrejection",function(e){s&&s.errorHandler(e)}),t}},{"../common/perf":10,"../common/res":12,"../util":17}],7:[function(e,t,r){t.exports=function(t,r){var n=e("../util"),a=null,i=n.getCurDomain(),o=function(e,t,r,a,o,s,c,u,f,l,p,d,g){var h=n.J(o)||null,v=n.$a9(t,[h,a],null);if(!v)return!1;var m=v.code||s,y=!("success"in v)||v.success;e.api(r,y,c,m,v.msg,u,f,l,p,i,d,g)},s="fetch",c="__oFetch_",u="__oXMLHttpRequest_",f="XMLHttpRequest";return n.ext(t.prototype,{removeHook:function(e,t){return a&&(t||this===a)?(r[c]&&(r[s]=r[c],delete r[c]),r[u]&&(r[f]=r[u],delete r[u]),a=null,this):this},addHook:function(e){return!e&&a?this:(a||(function(){if("function"==typeof r[s]){var e=r[s];r[c]=e,r[s]=function(t,s){var c=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),u=a;if(!u||!u.api)return e.apply(r,c);if(s&&("HEAD"===s.method||"no-cors"===s.mode))return e.apply(r,c);s||(s={});var f=Date.now(),l=u._conf,p=(t&&"string"!=typeof t?t.url:t)||"",d=p;p=n.$aw(p);var g=(l.ignore||{}).ignoreApis;if(!n.$bj(p,!0)||n.$al(p,g))return e.apply(r,c);p=n.$av(p,d,l.ignoreApiPath?l.ignoreApiPath:l.apiHelper);var h=l.enableLinkTrace,v="",m="",y=u.getConfig("pid"),b=null,$=u.getConfig("sample"),w=u.getConfig("linkType"),_=1;if($&&!u.$ai($)&&(_=0),h){var S="";try{S=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(B){S=""}var E=n.checkSameOrigin(d,S);if(u.getConfig("enableApiCors")||E)if(t&&"string"!=typeof t)try{if(c[0].headers&&"function"==typeof c[0].headers.get&&"function"==typeof c[0].headers.append)switch(w){case"arms":var x=c[0].headers.get("EagleEye-TraceID"),I=c[0].headers.get("EagleEye-SessionID"),T=c[0].headers.get("EagleEye-pAppName");x?v=x:(v=u.getTraceId()["EagleEye-TraceID"],c[0].headers.append("EagleEye-TraceID",v)),I?m=I:(m=u.getPageviewId()["EagleEye-SessionID"],c[0].headers.append("EagleEye-SessionID",m)),T||c[0].headers.append("EagleEye-pAppName",y);break;case"b3":var k=c[0].headers.get("X-B3-TraceId");if(k)v=k;else{var R=u.getB3TraceId(_);c[0].headers.append("X-B3-TraceId",R["X-B3-TraceId"]),c[0].headers.append("X-B3-ParentSpanId",R["X-B3-ParentSpanId"]),c[0].headers.append("X-B3-SpanId",R["X-B3-SpanId"]),c[0].headers.append("X-B3-Sampled",R["X-B3-Sampled"]),c[0].headers.append("X-Request-ID",n.guid()),v=R["X-B3-TraceId"]}m=u.pageview;break;case"tracing":default:var j=c[0].headers.get("uber-trace-id");j?v=j.split(":")[0]:(j=u.getUberTraceId(_),c[0].headers.append("uber-trace-id",j["uber-trace-id"]),v=j.traceId),m=u.pageview}}catch(A){n.warn("[retcode] fetch failed to set header, exception is :\n"+A)}else switch(s.headers=s.headers?s.headers:{},w){case"arms":s.headers["EagleEye-TraceID"]?v=s.headers["EagleEye-TraceID"]:(v=u.getTraceId()["EagleEye-TraceID"],s.headers["EagleEye-TraceID"]=v),s.headers["EagleEye-SessionID"]?m=s.headers["EagleEye-SessionID"]:(m=u.getPageviewId()["EagleEye-SessionID"],s.headers["EagleEye-SessionID"]=m),s.headers["EagleEye-pAppName"]||(s.headers["EagleEye-pAppName"]=y);break;case"b3":if(s.headers["X-B3-TraceId"])v=s.headers["X-B3-TraceId"];else{var C=u.getB3TraceId(_);s.headers["X-B3-TraceId"]=C["X-B3-TraceId"],s.headers["X-B3-ParentSpanId"]=C["X-B3-ParentSpanId"],s.headers["X-B3-SpanId"]=C["X-B3-SpanId"],s.headers["X-B3-Sampled"]=C["X-B3-Sampled"],s.headers["X-Request-ID"]=n.guid(),v=C["X-B3-TraceId"]}m=u.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(s.headers["uber-trace-id"])v=s.headers["uber-trace-id"].split(":")[0];else{var D=u.getUberTraceId(_);s.headers["uber-trace-id"]=D["uber-trace-id"],v=D.traceId}m=u.getPageviewId()["EagleEye-SessionID"]}}return e.apply(r,c).then(function(e){if(!u||!u.api)return e;try{if(!e||"function"!=typeof e.clone)return e;var t=e.clone(),r=t.headers;if(r&&"function"==typeof r.get){var a=r.get("content-type");if(a&&!/(text)|(json)/.test(a))return e;if(!v){var s=n.parseFetchHeaders(r);"object"==typeof s&&s["eagleeye-traceid"]&&(v=s["eagleeye-traceid"],b="response")}}var g=Date.now()-f;return t.text().then(function(e){var a=n.getFetchSnapshot(c,e,r);t.ok?o(u,l.parseResponse,p,d,e,t.status||200,g,f,v,m,a,b,_):u.api(p,!1,g,t.status||404,t.statusText,f,v,m,a,i,b,_)}),e}catch(B){return n.warn("[ARMS] fetch response error :",B),e}})["catch"](function(e){if(!u||!u.api)throw e;var t=Date.now()-f;throw u.api(p,!1,t,e.name||"Error",e.message,f,v,m,{},i),e})},r[s].toString=n.$b6(s)}}(),function(){if("function"==typeof r[f]){var e,t=r[f];r[u]=t;var s=function(r){var s=new t(r),c=a;if(!c||!c.api||!s.addEventListener)return s;var u,f,l,p=s.send,d=s.open,g=s.setRequestHeader,h=c._conf,v=(h.ignore||{}).ignoreApis,m=c.getConfig("enableLinkTrace"),y="",b="",$="",w=null,_=c.getConfig("sample"),S=c.getConfig("linkType"),E=1;return _&&!c.$ai(_)&&(E=0),s.open=function(t,r){e=t;var a=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);d.apply(s,a),l=r||"",f=n.$aw(l);var i=!n.$bj(f,!0)||n.$al(f,v);if(f=f?n.$av(f,l,h.ignoreApiPath?h.ignoreApiPath:h.apiHelper):"",!i&&m){var o="";try{o=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(_){o=""}var u=n.checkSameOrigin(l,o);if((c.getConfig("enableApiCors")||u)&&g&&"function"==typeof g)switch(S){case"arms":y=c.getTraceId()["EagleEye-TraceID"],g.apply(s,["EagleEye-TraceID",y]),b=c.getPageviewId()["EagleEye-SessionID"],g.apply(s,["EagleEye-SessionID",b]),$=c.getConfig("pid"),g.apply(s,["EagleEye-pAppName",$]);break;case"b3":var p=c.getB3TraceId(E);g.apply(s,["X-B3-TraceId",p["X-B3-TraceId"]]),g.apply(s,["X-B3-ParentSpanId",p["X-B3-ParentSpanId"]]),g.apply(s,["X-B3-SpanId",p["X-B3-SpanId"]]),g.apply(s,["X-B3-Sampled",p["X-B3-Sampled"]]),g.apply(s,["X-Request-ID",n.guid()]),y=p["X-B3-TraceId"],b=c.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var w=c.getUberTraceId(E);g.apply(s,["uber-trace-id",w["uber-trace-id"]]),y=w.traceId,b=c.getPageviewId()["EagleEye-SessionID"]}}},s.send=function(){u=Date.now();var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);p.apply(s,e)},n.on(s,"readystatechange",function(){if(f&&4===s.readyState){var t=Date.now()-u,r=n.getXhrSnapshot(l,e,s);if(!y){var a=n.parseXhrHeaders("function"==typeof s.getAllResponseHeaders&&s.getAllResponseHeaders()||"");"object"==typeof a&&a["eagleeye-traceid"]&&(y=a["eagleeye-traceid"],w="response")}if(s.status>=200&&s.status<=299){var p=s.status||200;if("function"==typeof s.getResponseHeader){var d=s.getResponseHeader("Content-Type");if(d&&!/(text)|(json)/.test(d))return}s.responseType&&"text"!==s.responseType?c.api(f,!0,t,p,"",u,y,b,{},i,w,E):o(c,h.parseResponse,f,l,s.responseText,p,t,u,y,b,r,w,E)}else c.api(f,!1,t,s.status||"FAILED",s.statusText,u,y,b,r,i,w,E)}}),s};s.prototype=t.prototype,r[f]=s,r[f].toString=n.$b6(f)}}()),a=this,this)},$aq:function(){return this.$bk?this:(this.getConfig("disableHook")||this.addHook(),this.$bk=!0,this)}}),t}},{"../util":17}],8:[function(e,t,r){var n=e("../util"),a=e("../common/constants").TIMING_KEYS;t.exports=function(e,t){function r(e){if(e instanceof t.PerformanceResourceTiming&&e.initiatorType){var r=n.getResType(e.initiatorType,e.name);if(r){var i=e[a[0]],o=e[a[1]],s=e[a[2]],c=e[a[3]],u=e[a[4]],f=e[a[5]],l=e[a[6]],p=e[a[7]],d=e[a[8]],g=e[a[17]],h=e[a[18]],v=e[a[19]];if(n.areInOrder(i,o,s,c,u,f,l,p,d)&&(h<i&&(h=i),v<i&&(v=o),n.areInOrder(i,h,v,o))){var m={success:1,redirect:Math.round(v-h),dns:Math.round(c-s),tcp:Math.round(f-u),ssl:Math.round(f-g),ttfb:Math.round(p-l),trans:Math.round(d-p),load:Math.round(d-i)};f===o&&delete m.tcp,(g<i||f<g)&&delete m.ssl;var y={};y.redirect=Math.round(h-i),y.dns=Math.round(s-i),"tcp"in m&&(y.tcp=Math.round(u-i)),"ssl"in m&&(y.ssl=Math.round(g-i)),y.ttfb=Math.round(l-i),y.trans=Math.round(p-i),m.res_start_time=JSON.stringify(y),m.res_type=r,m.src=e.name,i<p&&(m.size=Math.round(e.decodedBodySize));var b=n.getURL(m.src);return n.ext(m,{res_name:b.path,domain:b.domain})}}}}n.ext(e.prototype,{$as:function(){var e=this,r=t.performance,n=t.PerformanceObserver;if(!r||!n||"object"!=typeof r||"function"!=typeof r.getEntriesByType)return null;var a=r.getEntriesByType("resource")||[];e.setResource(a);return new n(function(t){e.setResource(t.getEntries())}).observe({entryTypes:["resource"]}),e.$bl(),e},setResource:function(e){var t=(this._conf.ignore||{}).ignoreResources;if(n.isArray(e)&&e.length){this._resource_list||(this._resource_list=[]);for(var a=0,i=e.length;a<i;a+=1){var o=e[a],s=0===o.success?o:r(e[a]);!s||n.$al(s.src,t)||n.$al(n.decode(s.src),t)||this._resource_list.push(s)}return this}},$bl:function(){var e=this._resource_list||[];if(setTimeout(this.$bl.bind(this),5e3),this._resource_list=[],e.length){var r={_combo:1,resource:JSON.stringify(e)},n=t.navigator.connection;r.ct=n?n.effectiveType||n.type:"";var a=n?n.downlink||n.downlinkMax||n.bandwidth||null:null;(a=a>999?999:a)&&(r.bandwidth=a),this._lg("resource",r,this.getConfig("sample"))}}})}},{"../common/constants":9,"../util":17}],9:[function(e,t,r){r.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]},{}],10:[function(e,t,r){var n=e("../util"),a=e("./constants").TIMING_KEYS;t.exports=function(){var e=n.win||{},t=e.performance;if(!t||"object"!=typeof t)return null;var r={},i=t.timing||{},o=Date.now(),s=1;if("function"==typeof e.PerformanceNavigationTiming){var c=t.getEntriesByType("navigation")[0];c&&(i=c,s=2)}n.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(e,t){var n=i[a[e[1]]],o=i[a[e[0]]];if(2===s||n>0&&o>0){var c=Math.round(o-n);c>=0&&c<6e5&&(r[t]=c)}});var u=e.navigator.connection,f=t.navigation||{};r.ct=u?u.effectiveType||u.type:"";var l=u?u.downlink||u.downlinkMax||u.bandwidth||null:null;if((l=l>999?999:l)&&(r.bandwidth=l),r.navtype=1===f.type?"Reload":"Other",1===s&&i[a[16]]>0&&i[a[1]]>0){var p=i[a[16]]-i[a[1]];p>=0&&p<36e5&&(r.fpt=p)}return 1===s&&i[a[1]]>0?r.begin=i[a[1]]:2===s&&r.load>0?r.begin=o-r.load:r.begin=o,r}},{"../util":17,"./constants":9}],11:[function(e,t,r){var n=e("../util"),a="object"==typeof window?window:{},i=a.__oXMLHttpRequest_||a.XMLHttpRequest;i="function"==typeof i?i:undefined,t.exports=function(e,t){try{var r=new i;r.open("POST",t,!0),r.setRequestHeader("Content-Type","text/plain"),r.send(JSON.stringify(e))}catch(a){n.warn("[retcode] Failed to log, exception is :\n"+a)}}},{"../util":17}],12:[function(e,t,r){var n=e("../util"),a=e("./constants").TIMING_KEYS;t.exports=function(){var e=n.win||{},t=e.performance;if(!t||"object"!=typeof t||"function"!=typeof t.getEntriesByType)return null;var r={},i=t.timing||{},o=t.getEntriesByType("resource")||[];if(r.begin=i[a[1]]||Date.now(),"function"==typeof e.PerformanceNavigationTiming){var s=t.getEntriesByType("navigation")[0];s&&(i=s)}return n.each({dom:[10,8],load:[14,1]},function(e,t){var n=i[a[e[1]]],o=i[a[e[0]]];if(n>0&&o>0){var s=Math.round(o-n);s>=0&&s<6e5&&(r[t]=s)}}),r.res=JSON.stringify(o),r}},{"../util":17,"./constants":9}],13:[function(e,t,r){var n=e("../util");t.exports=function(e,t){"object"==typeof e&&(e=n.serialize(e));var r=t+e;window&&window.navigator&&"function"==typeof window.navigator.sendBeacon?window.navigator.sendBeacon(r,"&post_res="):n.warn("[arms] navigator.sendBeacon not surported")}},{"../util":17}],14:[function(e,t,r){var n=e("../util"),a="object"==typeof window?window:{},i=a.__oFetch_||a.fetch;i="function"==typeof i?i:undefined,t.exports=function(e,t){var r=-1;"object"==typeof e&&(r=e.z,e=n.serialize(e));var o=t+e;if(i)return i(o,{method:"HEAD",mode:"no-cors"})["catch"](n.noop);if(a.document&&a.document.createElement){var s="__request_hold_"+r,c=a[s]=new Image;c.onload=c.onerror=function(){a[s]=undefined},c.src=o,c=null}}},{"../util":17}],15:[function(e,t,r){"use strict";function n(e,t){var r=a[o]=new i(e);r.$at(t);var n=r._conf;return!1!==n.autoSendPv&&r.$b0(),n&&n.useFmp||r.$b3(),n&&n.sendResource&&r.$bd(),a[s]=!0,r}var a=window,i=a.BrowserLogger=e("./biz.browser/clazz"),o=e("./util").key,s="__hasInitBlSdk";i.singleton=function(e,t){return a[s]?a[o]:n(e,t)},i.createExtraInstance=function(e){e&&"object"==typeof e&&!0!==e.enableInstanceAutoSend&&(e.enableInstanceAutoSend=!1);var t=new i(e),r=t._conf;return r.enableInstanceAutoSend&&(!1!==r.autoSendPv&&t.$b0(),r&&r.useFmp||t.$b3(),r&&r.sendResource&&t.$bd()),t};"object"==typeof window&&!!window.navigator&&a[o]&&(i.bl=function(){if(a[s])return a[o];var e={},t=[];return o in a&&(e=a[o].config||{},t=a[o].pipe||[]),n(e,t)}(a.__hasInitBlSdk)),t.exports=i},{"./biz.browser/clazz":3,"./util":17}],16:[function(e,t,r){var n=e("./util"),a=e("./base"),i=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag"],o=function(e){var t=(e.key||"default").split("::");return t.length>1?n.ext(e,{group:t[0],key:t[1]}):n.ext(e,{group:"default_group",key:t[0]})},s=function(e){a.call(this,e);var t;try{t="object"==typeof performance?performance.timing.fetchStart:Date.now()}catch(r){t=Date.now()}return this._startTime=t,this};s.prototype=n.$au(a.prototype),n.ext(a.dftCon,{startTime:null}),n.ext(s.prototype,{constructor:s,_super:a,sum:function(e,t,r){try{var a=n.$bm(e,t,1);return this._lg("sum",o(a),r)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},avg:function(e,t,r){try{var a=n.$bm(e,t,0);return this._lg("avg",o(a),r)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},percent:function(e,t,r,a){try{return this._lg("percent",o({key:e,subkey:t,val:r||0,begin:Date.now()}),a)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},msg:function(e,t){if(e&&!(e.length>180))return this.custom({msg:e},t)},error:function(e,t){if(!e)return n.warn("[retcode] invalid param e: "+e),this;1===arguments.length?("string"==typeof e&&(e={message:e},t={}),"object"==typeof e&&(t=e=e.error||e)):("string"==typeof e&&(e={message:e}),"object"!=typeof t&&(t={}));var r=e.name||"CustomError",a=e.message||"",i=e.stack||"";t=t||{};var o="object"==typeof location&&"string"==typeof location.href&&location.href.substring(0,500)||"";if(n.$bn(a,t.filename)){var s=/^Script error\.?$/,c=e.msg||e.message;if(n.$al(c,s)||n.$al(n.decode(c),s))return this;var u={msg:n.selfErrKey,err:{msg_raw:n.encode(e.msg||e.message)}};return this._self("error",u,1)}for(var f={begin:Date.now(),cate:r,msg:a&&a.substring(0,1e3),stack:i&&i.substring(0,1e3),file:n.$bo(t.filename||""),line:t.lineno||"",col:t.colno||"",err:{msg_raw:n.encode(a),stack_raw:n.encode(i)},dl:o},l=["tag","c1","c2","c3"],p=0;p<l.length;p++){var d=l[p];t[d]&&(f[d]=t[d])}var g=(this.getConfig("ignore")||{}).ignoreErrors;return n.$al(f.msg,g)||n.$al(n.decode(f.msg),g)?this:(this.$ao&&this.$ao("error",f),this._lg("error",f,1))},behavior:function(e){if(e){var t="object"==typeof e&&e.behavior?e:{behavior:e};return this.$ao&&this.$ao("behavior",t),this._lg("behavior",t,1)}},api:function(e,t,r,a,o,s,c,u,f,l,p,d){if(!e)return n.warn("[retcode] api is null"),this;if(e="string"==typeof e?{api:e,success:t,time:r,code:a,msg:o,begin:s,traceId:c,pv_id:u,apiSnapshot:f,domain:l,flag:d}:n.sub(e,i),!n.$bj(e.api,!0))return this;e.code=e.code||"";var g=e.msg||"";if(g="string"==typeof g?g.substring(0,1e3):g,e.msg=g,e.success=e.success?1:0,e.time=+e.time,e.begin=e.begin,e.traceId=e.traceId||"",e.pv_id=e.pv_id||"",e.domain=e.domain||"",e.flag=e.flag,e.dl="object"==typeof location&&"string"==typeof location.href&&location.href.substring(0,500)||"",e.success?e.apiSnapshot&&delete e.apiSnapshot:e.apiSnapshot=f,p&&(e.traceOrigin=p),!e.api||isNaN(e.time))return n.warn("[retcode] invalid time or api"),this;var h=(this.getConfig("ignore")||{}).ignoreApis;return n.$al(e.api,h)||n.$al(n.decode(e.api),h)?this:(this.$ao&&this.$ao("api",e),this._lg("api",e,e.success&&this.getConfig("sample"),e.flag))},speed:function(e,t,r){var a=this,i=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(e)?(t="number"!=typeof t?Date.now()-i:t>=i?t-i:t,a.$be=a.$be||{},a.$be[e]=t,a.$be.begin=i,clearTimeout(a.$bf),a.$bf=setTimeout(function(){r||(a.$be.page=a.$a8(!0)),a._lg("speed",a.$be),a.$be=null},5e3),a):(n.warn("[retcode] invalid point: "+e),a)},performance:function(e){if(e&&"object"==typeof e&&!this.$bp){var t={},r={},a=this.getConfig("autoSendPerf");if(e.autoSend&&a)return r=n.ext(this.$bq||{},e),this.$bp=!0,this._lg("perf",r,this.getConfig("sample"));if(e.autoSend&&!a)return delete e.autoSend,this.$bq?(r=n.ext(this.$bq||{},e),this.$bp=!0,this._lg("perf",r,this.getConfig("sample"))):void(this.$bq=e);for(var i in e)(/^t([1-9]|1[0])$/.test(i)||"ctti"===i||"cfpt"===i)&&(t[i]=e[i]);if(!0===e.autoSend||!a&&(a||this.$bq))return!0!==e.autoSend&&!1===a&&this.$bq?(t=n.ext(this.$bq||{},t),this.$bp=!0,this._lg("perf",t,this.getConfig("sample"))):void 0;this.$bq=n.ext(this.$bq||{},t)}},resource:function(e,t){if(!e||!n.isPlainObject(e))return n.warn("[arms] invalid param data: "+e),this;var r=Object.keys(e),a=["begin","dom","load","res","dl"],i=!1;for(var o in a){if(r.indexOf(a[o])<0){i=!0;break}}if(i)return n.warn("[arms] lack param data: "+e),this;var s={begin:e.begin||Date.now(),dom:e.dom||"",load:e.load||"",res:n.isArray(e.res)?JSON.stringify(e.res):JSON.stringify([]),dl:e.dl||""};return this._lg("res",s,t)},event:function(e,t){if("object"==typeof e&&e&&e.key){var r={},n=["key","success","time","c1","c2","c3"];for(var a in e)n.indexOf(a)>-1&&(r[a]=e[a]);r.success=!1===e.success?0:1,this._lg("event",r,t)}}}),s._super=a,s._root=a,a.Reporter=s,t.exports=s},{"./base":1,"./util":17}],17:[function(e,t,r){Date.now=Date.now||function(){return(new Date).getTime()};var n=Date.now(),a=function(){},i={noop:a,warn:function(){var e="object"==typeof console?console.warn:a;try{var t={warn:e};t.warn.call(t)}catch(r){return a}return e}(),key:"__bl",selfErrKey:"ARMS_SDK_ERROR",selfErrPage:"ARMSSDK",win:"object"==typeof window&&window.document?window:undefined,regionMap:{cn:"https://arms-retcode.aliyuncs.com/r.png?",sg:"https://arms-retcode-sg.aliyuncs.com/r.png?",sg_2:"https://retcode-sg-lazada.arms.aliyuncs.com/r.png?",daily:"http://arms-retcode-daily.alibaba.net/r.png?",daily_2:"https://arms-retcode-daily.alibaba.net/r.png?",daily_3:"http://arms-retcode-daily.aliyun.test/r.png?",us:"https://retcode-us-west-1.arms.aliyuncs.com/r.png?",tw:"https://arms-retcode.orientalgame.com.tw/r.png?",tw_sg:"https://arms-retcode-sg.orientalgame.com.tw/r.png?",hz_finance:"https://arms-retcode-hz-finance.aliyuncs.com/r.png?"},defaultImgUrl:"https://arms-retcode.aliyuncs.com/r.png?",$au:function(e){if(Object.create)return Object.create(e);var t=function(){};return t.prototype=e,new t},each:function(e,t){var r=0,n=e.length;if(this.T(e,"Array"))for(;r<n&&!1!==t.call(e[r],e[r],r);r++);else for(r in e)if(!1===t.call(e[r],e[r],r))break;return e},$a9:function(e,t,r){if("function"!=typeof e)return r;try{return e.apply(this,t)}catch(n){return r}},T:function(e,t){var r=Object.prototype.toString.call(e).substring(8).replace("]","");return t?r===t:r},$av:function(){var e=[].slice.call(arguments),t=e.length;if(t<2)return e[0];var r=e[t-1],n=e[0];if(!n)return"";if(!r)return n;var a=this,i=a.T(r),o=e.slice(0,t-1);return"Function"===i?a.$a9(r,o,n):"Array"===i?(this.each(r,function(e){o[0]=n=a.$av.apply(a,[].concat(o,e))}),n):"Object"===i?n.replace(r.rule,r.target||""):n.replace(r,"")},$al:function(e,t){if(!e||!t)return!1;if((this.isString(t)||t.source||"Function"===this.T(t))&&(t=[t]),!this.isArray(t))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var r,n=[],a=0,i=t.length;a<i;a++)if(r=t[a],this.isString(r))n.push(r.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(r&&r.source)n.push(r.source);else if(r&&"Function"===this.T(r)&&!0===this.$a9(r,[e],!1))return!0;var o=new RegExp(n.join("|"),"i");return!!(n.length&&o.test&&o.test(e))},J:function(e){if(!e||"string"!=typeof e)return e;var t=null;try{t=JSON.parse(e)}catch(r){}return t},pick:function(e){return 1===e||1===Math.ceil(Math.random()*e)},$aa:function(e){if("sample"in e){var t=e.sample,r=t;t&&/^\d+(\.\d+)?%$/.test(t)&&(r=parseInt(100/parseFloat(t))),0<r&&1>r&&(r=parseInt(1/r)),r>=1&&r<=100?e.sample=r:delete e.sample}return e},on:function(e,t,r,n,a){return e.addEventListener?(a=a||!1,e.addEventListener(t,function i(o){n&&e.removeEventListener(t,i,a),r.call(this,o)},a)):e.attachEvent&&e.attachEvent("on"+t,function o(a){n&&e.detachEvent("on"+t,o),r.call(this,a)}),this},off:function(e,t,r){return r?(e.removeEventListener?e.removeEventListener(t,r):e.detachEvent&&e.detachEvent(t,r),this):this},delay:function(e,t){return-1===t?(e(),null):setTimeout(e,t||0)},ext:function(e){for(var t=1,r=arguments.length;t<r;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},sub:function(e,t){var r={};return this.each(e,function(e,n){-1!==t.indexOf(n)&&(r[n]=e)}),r},uu:function(){for(var e,t,r=20,n=new Array(r),a=Date.now().toString(36).split("");r-- >0;)t=(e=36*Math.random()|0).toString(36),n[r]=e%3?t:t.toUpperCase();for(var i=0;i<8;i++)n.splice(3*i+2,0,a[i]);return n.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},seq:function(){return(n++).toString(36)},decode:function(e){try{e=decodeURIComponent(e)}catch(t){}return e},encode:function(e,t){try{e=t?encodeURIComponent(e).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(e)}catch(r){}return e},serialize:function(e){e=e||{};var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==undefined&&t.push(r+"="+this.encode(e[r],"msg"===r));return t.join("&")},$bj:function(e,t){if(!e||"string"!=typeof e)return!1;var r=/arms-retcode[\w-]*\.aliyuncs/.test(e);return!r&&t&&(r=/(\.png)|(\.gif)|(alicdn\.com)|(mmstat\.com)/.test(e)),!r},$ba:function(e){return!(!e||!e.message)&&!/failed[\w\s]+fetch/i.test(e.message)},$aw:function(e){return e&&"string"==typeof e?e.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},$bo:function(e){return e&&"string"==typeof e?e.replace(/\?.*$/,""):""},$b6:function(e){return function(){return e+"() { [native code] }"}},checkSameOrigin:function(e,t){if(!t||!e)return!1;var r="//"+t.split("/")[2];return e===t||e.slice(0,t.length+1)===t+"/"||e===r||e.slice(0,r.length+1)===r+"/"||!/^(\/\/|http:|https:).*/.test(e)},getRandIP:function(){for(var e=[],t=0;t<4;t++){var r=Math.floor(256*Math.random());e[t]=(r>15?"":"0")+r.toString(16)}return e.join("").replace(/^0/,"1")},getSortNum:function(e){return e?(e+=1)>=1e3&&e<=9999?e:e<1e3?e+1e3:e%1e4+1e3:1e3},getRandNum:function(e){return e&&"string"==typeof e?e.length<5?this.getNum(5):e.substring(e.length-5):this.getNum(5)},getNum:function(e){for(var t=[],r=0;r<e;r++){var n=Math.floor(16*Math.random());t[r]=n.toString(16)}return t.join("")},getCurDomain:function(){return location&&location.hostname||""},parseFetchHeaders:function(e){if(!e)return{};var t={};try{if("function"==typeof e.keys)for(var r=e.keys(),n=r.next();!n.done;){var a=n.value;t[a]=e.get(a),n=r.next()}else t=e}catch(i){t={}}return t},parseXhrHeaders:function(e){if(!e&&"string"!=typeof e)return{};var t={};try{var r=e.split("\r\n");t=r.reduce(function(e,t){var r=t.split(": ");return e[r[0]]=r[1],e},{})}catch(n){t={}}return t},getQuerys:function(e){if(!e)return"";var t={},r=[],n="",a="";try{var i=[];if(e.indexOf("?")>=0&&(i=e.substring(e.indexOf("?")+1,e.length).split("&")),i.length>0)for(var o in i)n=(r=i[o].split("="))[0],a=r[1],t[n]=a}catch(s){t={}}return t},getURL:function(e){if(!e)return null;var t={},r=e.length,n=e.indexOf("://");if(n<0)return null;t.protocol=e.substring(0,n+1);var a=e.indexOf("#"),i=e.indexOf("?");a<0&&(a=r),i<0&&(i=a),t.search=e.substring(i,a).substring(0,1e3);var o=e.substring(n+3,i),s=o.indexOf("/");return s<0&&(s=o.length),t.domain=o.substring(0,s).split(":")[0],t.path=o.substring(s,o.length).substring(0,1e3),t},getResType:function(e,t){if(["document","fetch","xmlhttprequest","beacon","iframe"].indexOf(e)>-1)return undefined;if(["script","img","other"].indexOf(e)>-1)return e;if(["video"].indexOf(e)>-1)return"media";var r=t?this.getURL(t):null,n=r&&r.path?r.path.lastIndexOf("."):-1,a=(n>0?r.path.substr(n+1):"").toLowerCase();if(a){if(["eot","woff","woff2","ttf"].indexOf(a)>-1)return"font";if("css"===a)return"css";if("js"===a)return"script"}return"other"},areInOrder:function(){for(var e=1;e<arguments.length;e+=1)if(arguments[e-1]>arguments[e])return!1;return!0},getFetchSnapshot:function(e,t,r){var n,a;try{var i=(e&&"string"!=typeof e[0]?e[0].url:e[0])||"",o=(e&&"string"!=typeof e[0]?e[0]:e[1])||{},s="POST"===o.method.toUpperCase()?o.body:this.getQuerys(i);n={originApi:i,method:o.method||"unknown",params:s,response:t||"",reqHeaders:this.parseFetchHeaders(o.headers||null),resHeaders:this.parseFetchHeaders(r)},a="function"==typeof encodeURIComponent&&JSON&&encodeURIComponent(JSON.stringify(n))||"{}"}catch(c){a="{}"}return a},getXhrSnapshot:function(e,t,r){if(!e||!t||!r)return{};var n,a;try{var i="";""===r.responseType||"text"===r.responseType?i=r.responseText:"document"===r.responseType&&(i=r.responseXML),n={originApi:e,method:t,params:this.getQuerys(e),response:i,reqHeaders:{},resHeaders:this.parseXhrHeaders("function"==typeof r.getAllResponseHeaders&&r.getAllResponseHeaders()||"")},a="function"==typeof encodeURIComponent&&JSON&&encodeURIComponent(JSON.stringify(n))||"{}"}catch(o){a="{}"}return a},isRobot:function(){var e=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||"string"!=typeof navigator.userAgent)return!1;try{for(var t=navigator.userAgent.toLowerCase(),r=0;r<e.length;r++){var n=e[r];if(t.lastIndexOf(n)>=0)return!0}}catch(a){this.warn("[arms] useragent parse error")}return!1},isFunction:function(e){return"function"==typeof e},isPlainObject:function(e){return"[object Object]"===Object.prototype.toString.call(e)},isString:function(e){return"[object String]"===Object.prototype.toString.call(e)},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},joinRegExp:function(e){for(var t,r=[],n=0,a=e.length;n<a;n++)t=e[n],this.isString(t)?r.push(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):t&&t.source&&r.push(t.source);return new RegExp(r.join("|"),"i")},reWriteMethod:function(e,t,r){if(null!==e){var n=e[t];e[t]=r(n)}},$bn:function(e,t){if(!e&&!t)return!1;if(new RegExp(this.selfErrKey,"i").test(e))return!0;return!!this.$al(t,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},$bs:function(e){return{msg:e,message:this.selfErrKey}},$bm:function(e,t,r){var n={};try{n=this.isPlainObject(e)?this.ext({key:e.key||"default",val:e.val||e.value||r},e,{begin:Date.now()}):{key:e||"default",val:t||r,begin:Date.now()}}catch(a){this.warn("[retcode] baseLog error: "+a)}return n}};t.exports=i},{}]},{},[15]); | ||
/** retcode cloud sdk | @version 1.8.33 | @copyright Alibaba Group Holding Limited. */ !function(){function e(t,r,n){function a(o,s){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[o]={exports:{}};t[o][0].call(f.exports,function(e){return a(t[o][1][e]||e)},f,f.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}return e}()({1:[function(e,t,r){var n=e("./util"),a=e("./common/sendBeacon"),i="aokcdqn3ly@e629dabd48a9933",o=function(e,t){var r;{if("error"!==t.t||!(r=e.$a1[0])||"error"!==r.t||t.msg!==r.msg){if("behavior"===t.t){var a=e.$a1&&e.$a1.length;if(a>0&&"behavior"===e.$a1[a-1].t){var i=t.behavior||[];e.$a1[a-1].behavior.concat(i)}else e.$a1.push(t)}else e.$a1.unshift(t);return e.$a2(function(){e.$a3=n.delay(function(){e.$a4()},e.$a1[0]&&"error"===e.$a1[0].t?3e3:-1)}),!0}r.times++}},s=function(e){return this.ver="1.8.33",this._conf=n.ext({},s.dftCon),this.$a5={},this.$a1=[],this.$a6=[],this.sdkFlag=!0,this.hash=n.seq(),this.$a7(),this.setConfig(e),this.rip=n.getRandIP(),this.record=999,this["EagleEye-TraceID"]=this.getTraceId()["EagleEye-TraceID"],this._common={},this};s.dftCon={sample:1,pvSample:1,tag:"",imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",region:null,ignore:{ignoreUrls:[],ignoreApis:[],ignoreErrors:[/^Script error\.?$/],ignoreResErrors:[],ignoreResources:[/\/(bl|wl)(.debug)?.js$/]},release:undefined,environment:"prod",beforeReport:null},s.prototype={constructor:s,$a2:function(e){return e()},$a8:function(){var e=this._conf.page;return n.$a9(e,[],e+"")},setPage:function(){},setConfig:function(e){e&&"object"==typeof e&&(n.$aa(e),e=this.$ab(e),this._conf=n.ext({},this._conf,e))},$ab:function(e){var t=e.region,r=e.imgUrl;if(t){var a=n.regionMap[t];return e.imgUrl=a||n.defaultImgUrl,e}return r&&(e.imgUrl=r),e},$ac:function(e){if(this.getConfig("debug"))return!0;var t=n.regionMap;for(var r in t)if(t[r]===e){!0;break}return!0},$ad:function(){},$ae:function(e){a(e,this.getConfig("imgUrl"))},$af:function(){},$ag:function(){return{}},setCommonInfo:function(e){e&&"object"==typeof e&&(this._common=n.ext({},this._common,e))},$a7:function(){this.pageview=n.uu(),this.sBegin=Date.now()},$ah:function(){if(this.username)return this.username;var e=this._conf,t=e&&e.setUsername;if("function"==typeof t)try{var r=t();"string"==typeof r&&(r=r.substr(0,40),this.username=r)}catch(a){n.warn("[arms] setUsername fail",a)}return this.username},getTraceId:function(){var e=this.rip,t=Date.now(),r=n.getSortNum(this.record),a=e+t+r+n.getRandNum(this._conf.pid);return this["EagleEye-TraceID"]=a,this.record=r,{"EagleEye-TraceID":a}},getUberTraceId:function(e){var t=this.rip,r=Date.now(),a=n.getSortNum(this.record),i=n.getRandNum(this._conf.pid),o=t+r+a+n.getNum(2)+i,s=o.substring(0,16);return e=e?"1":"0","0"===o[0]&&(o[0]="1"),"0"===o[16]&&(o[16]="1"),{"uber-trace-id":o+":"+s+":0:"+e,traceId:o}},getB3TraceId:function(e){var t=this.rip,r=Date.now(),a=n.getSortNum(this.record),i=n.getRandNum(this._conf.pid),o=t+r+a+n.getNum(2)+i,s=o.substring(0,16);return e=e?"1":"0","0"===o[0]&&(o[0]="1"),"0"===o[16]&&(o[16]="1"),{b3:o+"-"+s+"-"+e+"-0","X-B3-TraceId":o,"X-B3-ParentSpanId":"0","X-B3-SpanId":s,"X-B3-Sampled":e}},getPageviewId:function(){return{"EagleEye-SessionID":this.pageview}},getConfig:function(e){return e?this._conf[e]:n.ext({},this._conf)},$ai:function(e){return 1===e||("boolean"==typeof this.$a5[e]?this.$a5[e]:(this.$a5[e]=n.pick(e),this.$a5[e]))},$a4:function(e){var t;clearTimeout(this.$a3),this.$a3=null;for(var r=this._conf&&"function"==typeof this._conf.sendRequest;t=this.$a1.pop();)"res"===t.t?this.$af(t,"res"):"resource"===t.t?this.$af(t,"resource"):"error"===t.t?this.$af(t,"err"):"api"===t.t?this.$af(t,"apiSnapshot"):"behavior"===t.t?this.$af(t,"behavior"):"health"===t.t&&!r&&window&&window.navigator&&"function"==typeof window.navigator.sendBeacon?this.$ae(t):this.$ad(t);return e&&this.$aj(),this},$aj:function(){var e;for(clearTimeout(this.$ak),this.$ak=null;e=this.$a6.pop();)this.$af(e,"err");return this},_lg:function(e,t,r,a){var i=this,s=i._conf,c=i.$a8(),u=s.ignore||{},f=u.ignoreErrors,l=u.ignoreResErrors,p=u.ignoreUrls,d=u.ignoreApis;if(i._isRobot)return i;if(n.$al(c,p)||n.$al(n.decode(c),p))return i;if("error"===e&&(n.$al(t.msg,f)||n.$al(n.decode(t.msg),f)))return i;if("resourceError"===e&&(n.$al(t.src,l)||n.$al(n.decode(t.src),l)))return i;if("api"===e&&(n.$al(t.api,d)||n.$al(n.decode(t.api),d)))return i;if(!i.$ac(s.imgUrl))return i;if(!t||s.disabled||!s.pid)return i;if(0===a)return i;var g=t.dl;if(delete t.dl,t=n.ext({t:e,times:1,page:c,tag:s.tag||"",release:s.release||"",environment:s.environment,begin:Date.now(),c1:s.c1,c2:s.c2,c3:s.c3},t,i.$ag(),i._common,{pid:s.pid,_v:i.ver,pv_id:i.pageview,username:i.$ah(),sampling:r||1,dl:g,z:n.seq()}),"Function"===n.T(s.beforeReport))try{if(!(t=s.beforeReport(t)))return i}catch(h){return i}return 1===a?o(i,t):r&&!i.$ai(r)?i:o(i,t)},_self:function(e,t,r){var a=this,o=a._conf;if("error"!==e)return a;if(!a.$ac(o.imgUrl))return a;if(!t||o.disabled||!o.pid)return a;if(r&&!a.$ai(r))return a;t=n.ext({t:e,times:1,page:n.selfErrPage,tag:o.pid,begin:Date.now()},t,{pid:i,_v:a.ver,sampling:r||1,z:n.seq()});var s=a.$a6[0];if(s){s.times++;try{if(s.err&&t.err&&s.err.msg_raw&&t.err.msg_raw){s.err.msg_raw.split("&").indexOf(t.err.msg_raw)<0&&s.err.msg_raw.length<1e3&&(s.err.msg_raw+="&"+t.err.msg_raw)}}catch(c){}}else a.$a6.unshift(t),a.$a2(function(){a.sdkFlag&&(a.sdkFlag=!1,a.$ak=n.delay(function(){a.$aj()},1e4))})},custom:function(e,t){if(!e||"object"!=typeof e)return this;var r=!1,a={begin:Date.now()};return n.each(e,function(e,t){return!(r=t&&t.length<=20)&&n.warn("[retcode] invalid key: "+t),a["x-"+t]=e,r}),r?this._lg("custom",a,t||1):this}},t.exports=s},{"./common/sendBeacon":13,"./util":17}],2:[function(e,t,r){var n=e("../util");t.exports=function(e,t){var r=[],a=null,i=t&&t.location&&t.location.href,o=0,s=undefined,c=null,u=function(e,t,r){if(null!==e){var n=e[t];e[t]=r(n)}},f=function(e){var t,r,n,a,i,o=[];if(!e||"string"!=typeof e.tagName)return"";if(o.push(e.tagName.toLowerCase()),"string"==typeof e.id&&o.push("#".concat(e.id)),"string"==typeof(t=e.className))for(r=t.split(/\s+/),i=0;i<r.length;i++)o.push(".".concat(r[i]));var s=["type","name","title","alt","data-arms-attr"];for(i=0;i<s.length;i++)n=s[i],"string"==typeof(a=e.getAttribute(n))&&o.push("[".concat(n,'="').concat(a,'"]'));return o.join("")},l=function(e,t){return function(r){if(r&&r!==c){c=r;var n;try{n=r.target}catch(u){n="<unknown>"}if(0!==n.length){var i={type:"ui.".concat(e),data:{message:function(e){if(!e||1!==e.nodeType)return"";for(var t=e||null,r=[],n=0,a=0,i=" > ".length,o="";t&&n++<5&&!("html"===(o=f(t))||n>1&&a+r.length*i+o.length>=80);)r.push(o),a+=o.length,t=t.parentNode;return r.reverse().join(" > ")}(n)},timestamp:Date.now()};"click"===e?(o&&clearTimeout(o),t?o=setTimeout(function(){a&&a.addBehavior(i)},0):a&&a.addBehavior(i)):"keypress"===e&&(s||a&&a.addBehavior(i),clearTimeout(s),s=setTimeout(function(){s=undefined},100))}}}},p=function(){if(function(){var e=t&&t.chrome,r=e&&e.app&&e.app.runtime,n="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!r&&n}()){var e=function(e,t){var r={type:"navigation",data:{from:e,to:t}};a&&a.addBehavior(r),i=t},r=t.onpopstate;t.onpopstate=function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=t.location.href;if(e(i,s),r)return r.apply(this,a)};var n=function(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];var o=n.length>2?n[2]:undefined;return o&&e(i,String(o)),t.apply(this,n)}};u(t.history,"pushState",n),u(t.history,"replaceState",n)}};n.ext(e.prototype,{addBehavior:function(e){if(this.getConfig("behavior")&&e&&"object"==typeof e){var a={},i=e.data||{};if(e.type)a=i;else{if("string"!=typeof i.name||"string"!=typeof i.message)return;a.name=i.name.substr(0,20),a.message=i.message.substr(0,200)}a.message&&(a.message=n.encode(a.message));var o={type:e.type||"custom",data:a||{},timestamp:e.timestamp||Date.now(),page:e.page||t&&t.location&&t.location.pathname};return r.push(o),r=r.slice(-100)}},getBehavior:function(){return r||[]},setBehavior:function(e){return e&&(r=e),r},reportBehavior:function(e){var t=this;t.getConfig("behavior")&&(t.$am&&(clearTimeout(t.$am),t.$am=undefined),t.$am=setTimeout(function(){r&&r.length>0&&(t.behavior(r),r=[],t.$am=undefined,e&&"function"==typeof e&&e())},0))},$an:function(){if(!this.hasInitBehavior&&!a){try{!function(){if(document&&document.referrer&&document.location){var e=document.referrer,t=document.location.href;if(""!==e){var r={type:"navigation",data:{from:e,to:t}};i=t,a&&a.addBehavior(r)}}}(),t&&t.document&&t.document.addEventListener&&(t.document.addEventListener("click",l("click"),!1),t.document.addEventListener("keypress",l("keypress"),!1)),p(),this.getConfig("enableConsole")&&function(){if(t&&t.console)for(var e=["debug","info","warn","log","error","assert"],r=0;r<e.length;r++){var n=e[r];t.console[n]&&"function"==typeof t.console[n]&&u(t.console,n,function(e){var r=n;return function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var s={type:"console",data:{level:r,message:i}};if(a&&a.addBehavior(s),"error"===r)for(var c=0;c<i.length;c++){var u=i[c];u&&u.message&&u.stack&&a&&a.errorHandler(new ErrorEvent("error",{error:u,message:u.message}))}e&&Function.prototype.apply.call(e,t.console,i)}})}}()}catch(e){n.warn("[arms] error in initBehavior",e)}a=this,this.hasInitBehavior=!0}return this}})}},{"../util":17}],3:[function(e,t,r){var n=e("../util"),a=e("../reporter"),i=e("../common/sender"),o=e("../common/post"),s=n.win,c=s.document,u=/^(error|api|speed|sum|avg|percent|custom|msg|setPage|setConfig|behavior|performance)$/,f=function(e){var t=this;return a.call(t,e),t._initialPage=e.page&&n.$a9(e.page,[],e.page+"")||null,t._isRobot=n.isRobot(),t._health={errcount:0,apisucc:0,apifail:0},t.$ao=function(e,r){"error"===e?t._health.errcount++:"api"===e&&t._health[r.success?"apisucc":"apifail"]++},!1!==e.enableInstanceAutoSend&&(t.$ap(),t.$aq(),t.$ar(1e4),t._conf&&t._conf.behavior&&"function"==typeof t.$an&&t.$an(),t._conf&&t._conf.enableResource&&"function"==typeof t.$as&&t.$as()),Object.defineProperty&&s.addEventListener&&Object.defineProperty(t,"pipe",{set:t.$at}),t};f.prototype=n.$au(a.prototype),n.ext(a._root.dftCon,{uid:null,setUsername:null,ignoreUrlPath:null,ignoreApiPath:null,urlHelper:[{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},/\/$/],apiHelper:{rule:/\/([a-z\-_]+)?\d{2,20}/g,target:"/$1**"},ignoreUrlCase:!0,imgUrl:"https://arms-retcode.aliyuncs.com/r.png?",disableHook:!1,autoSendPv:!0,autoSendPerf:!0,enableSPA:!1,enableLinkTrace:!1,linkType:"arms",enableApiCors:!1,sendResource:!0,behavior:!0,enableConsole:!1,parseHash:function(e){return(e?n.$aw(e.replace(/^#\/?/,"")):"")||"[index]"},parseResponse:function(e){if(!e||"object"!=typeof e)return{};var t=e.code,r=e.msg||e.message||e.subMsg||e.errorMsg||e.ret||e.errorResponse||"";return"object"==typeof r&&(t=t||r.code,r=r.msg||r.message||r.info||r.ret||JSON.stringify(r)),{msg:r,code:t,success:!0}}}),n.ext(f.prototype,{constructor:f,_super:a,$a2:function(e){var t=this;if(t.hasReady)return e();"complete"===c.readyState?(t.hasReady=!0,e()):n.on(s,"load",function(){t.hasReady=!0,e()},!0)},$a8:function(e){var t=this._conf,r=t.page,a=location,i=a.host+a.pathname;return r&&!e?n.$a9(r,[],r+""):this._initialPage||n.$av(t.ignoreUrlCase?i.toLowerCase():i,a.href,t.ignoreUrlPath?t.ignoreUrlPath:t.urlHelper)},setPage:function(e,t){var r=this,n=r.$ax;if(!1!==t){if(!e||e===n)return r;r.$ax=e,clearTimeout(r.$ay),r.$az(1),r.$a7(),r.$ay=setTimeout(function(){r.$b0()},10)}else r.$ax=e;return r._conf.page=e,r},setConfig:function(e,t){if(e&&"object"==typeof e){n.$aa(e),e=this.$ab(e);var r=this._conf;if(this._conf=n.ext({},r,e),!t){var a="disableHook";a in e&&r[a]!==e[a]&&(e[a]?this.removeHook():this.addHook()),(a="enableSPA")in e&&r[a]!==e[a]&&this.$b1(e[a])}}},$ad:function(e){i(e,this.getConfig("imgUrl"))},$af:function(e,t){var r={};r[t]=e[t],delete e[t];var a="";"object"==typeof e&&(a=n.serialize(e)),o(r,this.getConfig("imgUrl")+a+"&post_res=")},$at:function(e){var t=this;if(!e||!e.length)return t;try{if("Array"===n.T(e[0]))return n.each(e,function(e){return t.$at(e)});if("Array"!==n.T(e))return t;var r=e.shift();if(!u.test(r))return t;t[r].apply(t,e)}catch(a){return n.warn("[retcode] error in sendPipe",a),t}},$b2:function(){var e=n.ext({},this._health);e.healthy=e.errcount>0?0:1,e.begin=Date.now();var t=e.begin-this.sBegin;e.stay=t,this._lg("health",e,1),this._health={errcount:0,apisucc:0,apifail:0}},createInstance:function(e){e=n.ext({pid:this._conf.pid},e);var t=this.__proto__.constructor(e);return e.page&&t.$b0(),t}}),e("./behavior")(f,s),e("./handler")(f,s,c),e("./fmp")(f,s,c),e("./hook")(f,s),e("./hack")(f,s),e("./resource")(f,s),f._super=a,f._root=a._root,a.Browser=f,t.exports=f},{"../common/post":11,"../common/sender":14,"../reporter":16,"../util":17,"./behavior":2,"./fmp":4,"./hack":5,"./handler":6,"./hook":7,"./resource":8}],4:[function(e,t,r){var n=e("../util"),a=500;t.exports=function(e,t,r){function i(e,t,r){var n=0,a=e.tagName;if("SCRIPT"!==a&&"STYLE"!==a&&"META"!==a&&"HEAD"!==a){var o=e.children?e.children.length:0;if(o>0)for(var c=e.children,u=o-1;u>=0;u--)n+=i(c[u],t+1,n>0);if(n<=0&&!r){if(!(e.getBoundingClientRect&&e.getBoundingClientRect().top<s))return 0}n+=1+.5*t}return n}function o(e){for(var t=1;t<e.length;t++)if(e[t].score<e[t-1].score)return e.splice(t,1),o(e);return e}var s=t.innerHeight||0,c=[],u=null,f=0;n.ext(e.prototype,{$ar:function(e){var a=this;if(!a._conf||!a._conf.useFmp)return null;if(!t.MutationObserver)return n.warn("[retcode] first meaningful paint can not be retrieved"),a.$b3(),null;n.on(t,"beforeunload",function(){a.$b4(0,!0)});var o=t.MutationObserver;return(u=new o(function(){!function(e){var t=Date.now()-e,n=r.querySelector("body");if(n){var a=0;a+=i(n,1,!1),c.push({score:a,t:t})}else c.push({score:0,t:t})}(a._startTime)})).observe(document,{childList:!0,subtree:!0}),f=1,a.$a2(function(){a.$b4(e)}),u},$b4:function(e,t){var r=this;if(u&&f)if(r.$b5&&(clearTimeout(r.$b5),r.$b5=null),t||!function(e,t){var r=Date.now()-e;return!(r>t||r-(c&&c.length&&c[c.length-1].t||0)>2*a)}(r._startTime,e)){u.disconnect(),f=0,c=o(c);for(var i=null,s=1;s<c.length;s++)if(c[s].t>=c[s-1].t){var l=c[s].score-c[s-1].score;(!i||i.rate<=l)&&(i={t:c[s].t,rate:l})}i&&i.t>0&&i.t<36e5?r.$b3({fmp:i.t}):r.$b3()}else r.$b5=n.delay(function(){r.$b4(e)},a)}})}},{"../util":17}],5:[function(e,t,r){t.exports=function(t,r){var n=e("../util"),a=r.history||{},i=r.document,o=function(e,t){var n;r.CustomEvent?n=new CustomEvent(e,{detail:t}):((n=i.createEvent("HTMLEvents")).initEvent(e,!1,!0),n.detail=t),r.dispatchEvent(n)},s=function(e){var t=a[e];"function"==typeof t&&(a[e]=function(r,i,s){var c=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),u=location.href,f=t.apply(a,c);if(!s||"string"!=typeof s)return f;if(s===u)return f;try{var l=u.split("#"),p=s.split("#"),d=n.$aw(l[0]),g=n.$aw(p[0]),h=l[1]&&l[1].replace(/^\/?(.*)/,"$1"),v=p[1]&&p[1].replace(/^\/?(.*)/,"$1");d!==g?o("historystatechange",g):h!==v&&o("historystatechange",v)}catch(m){n.warn("[retcode] error in "+e+": "+m)}return f},a[e].toString=n.$b6(e))};n.ext(t.prototype,{$b7:function(){return this.$b8?this:(s("pushState"),s("replaceState"),this.$b8=!0,this)}})}},{"../util":17}],6:[function(e,t,r){t.exports=function(t,r,n){var a=e("../util"),i=e("../common/res"),o=e("../common/perf"),s=null,c=n.documentElement,u=r.innerWidth||c.clientWidth||n.body.clientWidth,f=r.innerHeight||c.clientHeight||n.body.clientHeight,l=r.navigator.connection,p={sr:screen.width+"x"+screen.height,vp:u+"x"+f,ct:l?l.effectiveType||l.type:""},d={},g=function(e,t,r,i,o){if(t===undefined){var s,c;if(!d[e]){s=new RegExp(e+"=([^;]+)");try{c=s.exec(n.cookie)}catch(f){return a.warn("[retcode] can not get cookie:",f),null}c&&(d[e]=c[1])}return d[e]}var u=e+"="+t;i&&(u+="; domain="+i),u+="; path="+(o||"/"),r&&(u+="; max-age="+r);try{return n.cookie=u,!!n.cookie}catch(f){return a.warn("[retcode] can not set cookie: ",f),!1}},h=function(e){var t=e._conf.uid||g("_nk_")||g("_bl_uid");if(!t){t=a.uu();if(!g("_bl_uid",t,15552e3))return null}return t};return a.ext(t.prototype,{activeErrHandler:function(e){return s&&!e?this:(s=this,this)},errorHandler:function(e){if(!e)return this;var t=e.type;if("error"===t){var r=e.target||e.srcElement;!(!r||!r.tagName||e.message||e.filename||e.lineno||e.colno)?this.$b9(e):this.error(e.error||{message:e.message},e)}else"unhandledrejection"===t&&a.T(e.reason,"Error")&&a.$ba(e.reason)&&this.error(e.reason);try{this.getConfig("behavior")&&this.reportBehavior&&this.reportBehavior()}catch(e){}return this},$b9:function(e){var t=this,r=e.target||e.srcElement;try{var n=t.$bb(r),i="string"==typeof r.tagName?r.tagName.toLowerCase():"",o=t.$bc(r,5),s=a.getURL(n),c={src:n&&n.substring(0,1e3),node_name:i,xpath:o,res_type:a.getResType(i,n),res_name:s.path,domain:s.domain};return t._conf.enableResource&&t.setResource&&t.setResource([a.ext({success:0},c)]),t._lg("resourceError",c),t}catch(u){return a.warn("[ARMS] $b9 error :",u),t}},$bb:function(e){var t=e.src||e.href;try{if(!t){var r="object"===("string"==typeof e.tagName?e.tagName.toLowerCase():""),n=e.getAttribute("classid")&&"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"===e.getAttribute("classid").toLowerCase()||"application/x-shockwave-flash"===e.getAttribute("type");r&&n&&(t=e.getAttribute("data")||e.getAttribute("codebase")),t||(t=e.outerHTML||e.innerHTML)}}catch(a){t=""}return t},$bc:function(e,t){var r=e.id?"#"+e.id:"",n="string"==typeof e.className?"."+e.className.split(" ").join("."):"",a=("string"==typeof e.tagName?e.tagName.toLowerCase():"")+r+n;return e.parentNode&&e.parentNode.tagName&&t-1!=0?this.$bc(e.parentNode,t-1)+" > "+a:a},$b3:function(e){var t=this;t.$a2(function(){var r=o();r&&r.load&&r.load>0&&(r.page=t.$a8(!0),e&&(r=a.ext(r,e)),r.autoSend=!0,t.performance(r))})},$bd:function(e){var t=this;t.$a2(function(){var r=i();r&&r.load&&r.load>0&&(r.load&&r.load<=2e3||r.load&&r.load<=8e3&&Math.random()>.05||(r.page=t.$a8(!0),r.dl=location.href,e&&(r=a.ext(r,e)),t._lg("res",r,t.getConfig("sample"))))})},$b0:function(){var e=this;e.$a2(function(){var t=function(e){var t=h(e),a=r.devicePixelRatio||1;return{uid:t,dt:n.title,dl:location.href,dr:n.referrer,dpr:a.toFixed(2),de:(n.characterSet||n.defaultCharset||"").toLowerCase(),ul:c.lang,begin:Date.now()}}(e);t&&t.uid&&e._lg("pv",t,e.getConfig("pvSample"))})},$ag:function(){return p.uid=h(this),p.sid=function(e){if(e.session)return e.session;var t;try{if("object"==typeof window&&"object"==typeof sessionStorage&&"function"==typeof sessionStorage.getItem)return"string"==typeof(t=sessionStorage.getItem("_bl_sid"))?(e.session=t,t):(t=a.uu(),e.session=t,"function"==typeof sessionStorage.setItem&&sessionStorage.setItem("_bl_sid",t),t)}catch(r){a.warn("[ARMS] getSid error :",r)}return e.session=t=a.uu(),t}(this),p},$az:function(e){var t=Date.now();if(t-this._lastUnload<200)return this;this._lastUnload=t,this.$b2(e),this.$be&&(this._lg("speed",this.$be),this.$be=null,clearTimeout(this.$bf)),this.$a4(!0)},$b1:function(e){var t=this;if(!e^t.$bg)return t;e?(t.$b7(),t.$bg=function(e){var r=t._conf.parseHash(location.hash);r&&t.setPage(r,!1!==e)},t.$bh=function(e){var r=t._conf.parseHash(e.detail);r&&t.setPage(r)},a.on(r,"hashchange",t.$bg),a.on(r,"historystatechange",t.$bh),t.$bg(!1)):(a.off(r,"hashchange",t.$bg),a.off(r,"historystatechange",t.$bh),t.$bg=null,t.$bh=null)},$ap:function(){var e=this;if(e.$bi)return e;var t=e._conf;return a.on(r,"beforeunload",function(){e.$az(0)}),e.$b1(t.enableSPA),e.activeErrHandler(!1),e.$bi=!0,e}}),a.on(r,"error",function(e){s&&s.errorHandler(e)},!1,!0).on(r,"unhandledrejection",function(e){s&&s.errorHandler(e)}),t}},{"../common/perf":10,"../common/res":12,"../util":17}],7:[function(e,t,r){t.exports=function(t,r){var n=e("../util"),a=null,i=n.getCurDomain(),o=function(e,t,r,a,o,s,c,u,f,l,p,d,g){var h=n.J(o)||null,v=n.$a9(t,[h,a],null);if(!v)return!1;var m=v.code||s,y=!("success"in v)||v.success;e.api(r,y,c,m,v.msg,u,f,l,p,i,d,g)},s="fetch",c="__oFetch_",u="__oXMLHttpRequest_",f="XMLHttpRequest";return n.ext(t.prototype,{removeHook:function(e,t){return a&&(t||this===a)?(r[c]&&(r[s]=r[c],delete r[c]),r[u]&&(r[f]=r[u],delete r[u]),a=null,this):this},addHook:function(e){return!e&&a?this:(a||(function(){if("function"==typeof r[s]){var e=r[s];r[c]=e,r[s]=function(t,s){var c=1===arguments.length?[arguments[0]]:Array.apply(null,arguments),u=a;if(!u||!u.api)return e.apply(r,c);if(s&&("HEAD"===s.method||"no-cors"===s.mode))return e.apply(r,c);s||(s={});var f=Date.now(),l=u._conf,p=n.duration(),d=(t&&"string"!=typeof t?t.url:t)||"",g=d;d=n.$aw(d);var h=(l.ignore||{}).ignoreApis;if(!n.$bj(d,!0)||n.$al(d,h))return e.apply(r,c);d=n.$av(d,g,l.ignoreApiPath?l.ignoreApiPath:l.apiHelper);var v=l.enableLinkTrace,m="",y="",b=u.getConfig("pid"),$=null,w=u.getConfig("sample"),_=u.getConfig("linkType"),S=1;if(w&&!u.$ai(w)&&(S=0),v){var E="";try{E=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(A){E=""}var x=n.checkSameOrigin(g,E);if(u.getConfig("enableApiCors")||x)if(t&&"string"!=typeof t)try{if(c[0].headers&&"function"==typeof c[0].headers.get&&"function"==typeof c[0].headers.append)switch(_){case"arms":var I=c[0].headers.get("EagleEye-TraceID"),T=c[0].headers.get("EagleEye-SessionID"),k=c[0].headers.get("EagleEye-pAppName");I?m=I:(m=u.getTraceId()["EagleEye-TraceID"],c[0].headers.append("EagleEye-TraceID",m)),T?y=T:(y=u.getPageviewId()["EagleEye-SessionID"],c[0].headers.append("EagleEye-SessionID",y)),k||c[0].headers.append("EagleEye-pAppName",b);break;case"b3":var R=c[0].headers.get("X-B3-TraceId");if(R)m=R;else{var j=u.getB3TraceId(S);c[0].headers.append("X-B3-TraceId",j["X-B3-TraceId"]),c[0].headers.append("X-B3-ParentSpanId",j["X-B3-ParentSpanId"]),c[0].headers.append("X-B3-SpanId",j["X-B3-SpanId"]),c[0].headers.append("X-B3-Sampled",j["X-B3-Sampled"]),c[0].headers.append("X-Request-ID",n.guid()),m=j["X-B3-TraceId"]}y=u.pageview;break;case"tracing":default:var C=c[0].headers.get("uber-trace-id");C?m=C.split(":")[0]:(C=u.getUberTraceId(S),c[0].headers.append("uber-trace-id",C["uber-trace-id"]),m=C.traceId),y=u.pageview}}catch(O){n.warn("[retcode] fetch failed to set header, exception is :\n"+O)}else switch(s.headers=s.headers?s.headers:{},_){case"arms":s.headers["EagleEye-TraceID"]?m=s.headers["EagleEye-TraceID"]:(m=u.getTraceId()["EagleEye-TraceID"],s.headers["EagleEye-TraceID"]=m),s.headers["EagleEye-SessionID"]?y=s.headers["EagleEye-SessionID"]:(y=u.getPageviewId()["EagleEye-SessionID"],s.headers["EagleEye-SessionID"]=y),s.headers["EagleEye-pAppName"]||(s.headers["EagleEye-pAppName"]=b);break;case"b3":if(s.headers["X-B3-TraceId"])m=s.headers["X-B3-TraceId"];else{var D=u.getB3TraceId(S);s.headers["X-B3-TraceId"]=D["X-B3-TraceId"],s.headers["X-B3-ParentSpanId"]=D["X-B3-ParentSpanId"],s.headers["X-B3-SpanId"]=D["X-B3-SpanId"],s.headers["X-B3-Sampled"]=D["X-B3-Sampled"],s.headers["X-Request-ID"]=n.guid(),m=D["X-B3-TraceId"]}y=u.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:if(s.headers["uber-trace-id"])m=s.headers["uber-trace-id"].split(":")[0];else{var B=u.getUberTraceId(S);s.headers["uber-trace-id"]=B["uber-trace-id"],m=B.traceId}y=u.getPageviewId()["EagleEye-SessionID"]}}return e.apply(r,c).then(function(e){if(!u||!u.api)return e;try{if(!e||"function"!=typeof e.clone)return e;var t=e.clone(),r=t.headers;if(r&&"function"==typeof r.get){var a=r.get("content-type");if(a&&!/(text)|(json)/.test(a))return e;if(!m){var s=n.parseFetchHeaders(r);"object"==typeof s&&s["eagleeye-traceid"]&&(m=s["eagleeye-traceid"],$="response")}}var h=p();return t.text().then(function(e){var a=n.getFetchSnapshot(c,e,r);t.ok?o(u,l.parseResponse,d,g,e,t.status||200,h,f,m,y,a,$,S):u.api(d,!1,h,t.status||404,t.statusText,f,m,y,a,i,$,S)}),e}catch(A){return n.warn("[ARMS] fetch response error :",A),e}})["catch"](function(e){if(!u||!u.api)throw e;var t=p();throw u.api(d,!1,t,e.name||"Error",e.message,f,m,y,{},i),e})},r[s].toString=n.$b6(s)}}(),function(){if("function"==typeof r[f]){var e,t=r[f];r[u]=t;var s=function(r){var s=new t(r),c=a;if(!c||!c.api||!s.addEventListener)return s;var u,f,l,p,d=s.send,g=s.open,h=s.setRequestHeader,v=c._conf,m=(v.ignore||{}).ignoreApis,y=c.getConfig("enableLinkTrace"),b="",$="",w="",_=null,S=c.getConfig("sample"),E=c.getConfig("linkType"),x=1;return S&&!c.$ai(S)&&(x=0),s.open=function(t,r){e=t;var a=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);g.apply(s,a),p=r||"",l=n.$aw(p);var i=!n.$bj(l,!0)||n.$al(l,m);if(l=l?n.$av(l,p,v.ignoreApiPath?v.ignoreApiPath:v.apiHelper):"",!i&&y){var o="";try{o=location.origin?location.origin:location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}catch(_){o=""}var u=n.checkSameOrigin(p,o);if((c.getConfig("enableApiCors")||u)&&h&&"function"==typeof h)switch(E){case"arms":b=c.getTraceId()["EagleEye-TraceID"],h.apply(s,["EagleEye-TraceID",b]),$=c.getPageviewId()["EagleEye-SessionID"],h.apply(s,["EagleEye-SessionID",$]),w=c.getConfig("pid"),h.apply(s,["EagleEye-pAppName",w]);break;case"b3":var f=c.getB3TraceId(x);h.apply(s,["X-B3-TraceId",f["X-B3-TraceId"]]),h.apply(s,["X-B3-ParentSpanId",f["X-B3-ParentSpanId"]]),h.apply(s,["X-B3-SpanId",f["X-B3-SpanId"]]),h.apply(s,["X-B3-Sampled",f["X-B3-Sampled"]]),h.apply(s,["X-Request-ID",n.guid()]),b=f["X-B3-TraceId"],$=c.getPageviewId()["EagleEye-SessionID"];break;case"tracing":default:var d=c.getUberTraceId(x);h.apply(s,["uber-trace-id",d["uber-trace-id"]]),b=d.traceId,$=c.getPageviewId()["EagleEye-SessionID"]}}},s.send=function(){u=Date.now(),f=n.duration();var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);d.apply(s,e)},n.on(s,"readystatechange",function(){if(l&&4===s.readyState){var t=f(),r=n.getXhrSnapshot(p,e,s);if(!b){var a=n.parseXhrHeaders("function"==typeof s.getAllResponseHeaders&&s.getAllResponseHeaders()||"");"object"==typeof a&&a["eagleeye-traceid"]&&(b=a["eagleeye-traceid"],_="response")}if(s.status>=200&&s.status<=299){var d=s.status||200;if("function"==typeof s.getResponseHeader){var g=s.getResponseHeader("Content-Type");if(g&&!/(text)|(json)/.test(g))return}s.responseType&&"text"!==s.responseType?c.api(l,!0,t,d,"",u,b,$,{},i,_,x):o(c,v.parseResponse,l,p,s.responseText,d,t,u,b,$,r,_,x)}else c.api(l,!1,t,s.status||"FAILED",s.statusText,u,b,$,r,i,_,x)}}),s};s.prototype=t.prototype,n.each(Object.keys(t),function(e){s[e]=t[e]}),r[f]=s,r[f].toString=n.$b6(f)}}()),a=this,this)},$aq:function(){return this.$bk?this:(this.getConfig("disableHook")||this.addHook(),this.$bk=!0,this)}}),t}},{"../util":17}],8:[function(e,t,r){var n=e("../util"),a=e("../common/constants").TIMING_KEYS;t.exports=function(e,t){function r(e){if(e instanceof t.PerformanceResourceTiming&&e.initiatorType){var r=n.getResType(e.initiatorType,e.name);if(r){var i=e[a[0]],o=e[a[1]],s=e[a[2]],c=e[a[3]],u=e[a[4]],f=e[a[5]],l=e[a[6]],p=e[a[7]],d=e[a[8]],g=e[a[17]],h=e[a[18]],v=e[a[19]];if(n.areInOrder(i,o,s,c,u,f,l,p,d)&&(h<i&&(h=i),v<i&&(v=o),n.areInOrder(i,h,v,o))){var m={success:1,redirect:Math.round(v-h),dns:Math.round(c-s),tcp:Math.round(f-u),ssl:Math.round(f-g),ttfb:Math.round(p-l),trans:Math.round(d-p),load:Math.round(d-i)};f===o&&delete m.tcp,(g<i||f<g)&&delete m.ssl;var y={};y.redirect=Math.round(h-i),y.dns=Math.round(s-i),"tcp"in m&&(y.tcp=Math.round(u-i)),"ssl"in m&&(y.ssl=Math.round(g-i)),y.ttfb=Math.round(l-i),y.trans=Math.round(p-i),m.res_start_time=JSON.stringify(y),m.res_type=r,m.src=e.name,i<p&&(m.size=Math.round(e.decodedBodySize));var b=n.getURL(m.src);return n.ext(m,{res_name:b.path,domain:b.domain})}}}}n.ext(e.prototype,{$as:function(){var e=this,r=t.performance,n=t.PerformanceObserver;if(!r||!n||"object"!=typeof r||"function"!=typeof r.getEntriesByType)return null;var a=r.getEntriesByType("resource")||[];e.setResource(a);return new n(function(t){e.setResource(t.getEntries())}).observe({entryTypes:["resource"]}),e.$bl(),e},setResource:function(e){var t=(this._conf.ignore||{}).ignoreResources;if(n.isArray(e)&&e.length){this._resource_list||(this._resource_list=[]);for(var a=0,i=e.length;a<i;a+=1){var o=e[a],s=0===o.success?o:r(e[a]);!s||n.$al(s.src,t)||n.$al(n.decode(s.src),t)||this._resource_list.push(s)}return this}},$bl:function(){var e=this._resource_list||[];if(setTimeout(this.$bl.bind(this),5e3),this._resource_list=[],e.length){var r={_combo:1,resource:JSON.stringify(e)},n=t.navigator.connection;r.ct=n?n.effectiveType||n.type:"";var a=n?n.downlink||n.downlinkMax||n.bandwidth||null:null;(a=a>999?999:a)&&(r.bandwidth=a),this._lg("resource",r,this.getConfig("sample"))}}})}},{"../common/constants":9,"../util":17}],9:[function(e,t,r){r.TIMING_KEYS=["startTime","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","","domInteractive","","domContentLoadedEventEnd","","loadEventStart","","msFirstPaint","secureConnectionStart","redirectStart","redirectEnd"]},{}],10:[function(e,t,r){var n=e("../util"),a=e("./constants").TIMING_KEYS;t.exports=function(){var e=n.win||{},t=e.performance;if(!t||"object"!=typeof t)return null;var r={},i=t.timing||{},o=Date.now(),s=1;if("function"==typeof e.PerformanceNavigationTiming){var c=t.getEntriesByType("navigation")[0];c&&(i=c,s=2)}n.each({dns:[3,2],tcp:[5,4],ssl:[5,17],ttfb:[7,6],trans:[8,7],dom:[10,8],res:[14,12],firstbyte:[7,2],fpt:[8,1],tti:[10,1],ready:[12,1],load:[14,1]},function(e,t){var n=i[a[e[1]]],o=i[a[e[0]]];if(2===s||n>0&&o>0){var c=Math.round(o-n);c>=0&&c<6e5&&(r[t]=c)}});var u=e.navigator.connection,f=t.navigation||{};r.ct=u?u.effectiveType||u.type:"";var l=u?u.downlink||u.downlinkMax||u.bandwidth||null:null;if((l=l>999?999:l)&&(r.bandwidth=l),r.navtype=1===f.type?"Reload":"Other",1===s&&i[a[16]]>0&&i[a[1]]>0){var p=i[a[16]]-i[a[1]];p>=0&&p<36e5&&(r.fpt=p)}return 1===s&&i[a[1]]>0?r.begin=i[a[1]]:2===s&&r.load>0?r.begin=o-r.load:r.begin=o,r}},{"../util":17,"./constants":9}],11:[function(e,t,r){var n=e("../util"),a="object"==typeof window?window:{},i=a.__oXMLHttpRequest_||a.XMLHttpRequest;i="function"==typeof i?i:undefined,t.exports=function(e,t){try{var r=new i;r.open("POST",t,!0),r.setRequestHeader("Content-Type","text/plain"),r.send(JSON.stringify(e))}catch(a){n.warn("[retcode] Failed to log, exception is :\n"+a)}}},{"../util":17}],12:[function(e,t,r){var n=e("../util"),a=e("./constants").TIMING_KEYS;t.exports=function(){var e=n.win||{},t=e.performance;if(!t||"object"!=typeof t||"function"!=typeof t.getEntriesByType)return null;var r={},i=t.timing||{},o=t.getEntriesByType("resource")||[];if(r.begin=i[a[1]]||Date.now(),"function"==typeof e.PerformanceNavigationTiming){var s=t.getEntriesByType("navigation")[0];s&&(i=s)}return n.each({dom:[10,8],load:[14,1]},function(e,t){var n=i[a[e[1]]],o=i[a[e[0]]];if(n>0&&o>0){var s=Math.round(o-n);s>=0&&s<6e5&&(r[t]=s)}}),r.res=JSON.stringify(o),r}},{"../util":17,"./constants":9}],13:[function(e,t,r){var n=e("../util");t.exports=function(e,t){"object"==typeof e&&(e=n.serialize(e));var r=t+e;window&&window.navigator&&"function"==typeof window.navigator.sendBeacon?window.navigator.sendBeacon(r,"&post_res="):n.warn("[arms] navigator.sendBeacon not surported")}},{"../util":17}],14:[function(e,t,r){var n=e("../util"),a="object"==typeof window?window:{},i=a.__oFetch_||a.fetch;i="function"==typeof i?i:undefined,t.exports=function(e,t){var r=-1;"object"==typeof e&&(r=e.z,e=n.serialize(e));var o=t+e;if(i)return i(o,{method:"HEAD",mode:"no-cors"})["catch"](n.noop);if(a.document&&a.document.createElement){var s="__request_hold_"+r,c=a[s]=new Image;c.onload=c.onerror=function(){a[s]=undefined},c.src=o,c=null}}},{"../util":17}],15:[function(e,t,r){"use strict";function n(e,t){var r=a[o]=new i(e);r.$at(t);var n=r._conf;return!1!==n.autoSendPv&&r.$b0(),n&&n.useFmp||r.$b3(),n&&n.sendResource&&r.$bd(),a[s]=!0,r}var a=window,i=a.BrowserLogger=e("./biz.browser/clazz"),o=e("./util").key,s="__hasInitBlSdk";i.singleton=function(e,t){return a[s]?a[o]:n(e,t)},i.createExtraInstance=function(e){e&&"object"==typeof e&&!0!==e.enableInstanceAutoSend&&(e.enableInstanceAutoSend=!1);var t=new i(e),r=t._conf;return r.enableInstanceAutoSend&&(!1!==r.autoSendPv&&t.$b0(),r&&r.useFmp||t.$b3(),r&&r.sendResource&&t.$bd()),t};"object"==typeof window&&!!window.navigator&&a[o]&&(i.bl=function(){if(a[s])return a[o];var e={},t=[];return o in a&&(e=a[o].config||{},t=a[o].pipe||[]),n(e,t)}(a.__hasInitBlSdk)),t.exports=i},{"./biz.browser/clazz":3,"./util":17}],16:[function(e,t,r){var n=e("./util"),a=e("./base"),i=["api","success","time","code","msg","trace","traceId","begin","pv_id","sid","seq","domain","flag"],o=function(e){var t=(e.key||"default").split("::");return t.length>1?n.ext(e,{group:t[0],key:t[1]}):n.ext(e,{group:"default_group",key:t[0]})},s=function(e){a.call(this,e);var t;try{t="object"==typeof performance?performance.timing.fetchStart:Date.now()}catch(r){t=Date.now()}return this._startTime=t,this};s.prototype=n.$au(a.prototype),n.ext(a.dftCon,{startTime:null}),n.ext(s.prototype,{constructor:s,_super:a,sum:function(e,t,r){try{var a=n.$bm(e,t,1);return this._lg("sum",o(a),r)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},avg:function(e,t,r){try{var a=n.$bm(e,t,0);return this._lg("avg",o(a),r)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},percent:function(e,t,r,a){try{return this._lg("percent",o({key:e,subkey:t,val:r||0,begin:Date.now()}),a)}catch(i){n.warn("[retcode] can not get parseStatData: "+i)}},msg:function(e,t){if(e&&!(e.length>180))return this.custom({msg:e},t)},error:function(e,t){if(!e)return n.warn("[retcode] invalid param e: "+e),this;1===arguments.length?("string"==typeof e&&(e={message:e},t={}),"object"==typeof e&&(t=e=e.error||e)):("string"==typeof e&&(e={message:e}),"object"!=typeof t&&(t={}));var r=e.name||"CustomError",a=e.message||"",i=e.stack||"";t=t||{};var o="object"==typeof location&&"string"==typeof location.href&&location.href.substring(0,500)||"";if(n.$bn(a,t.filename)){var s=/^Script error\.?$/,c=e.msg||e.message;if(n.$al(c,s)||n.$al(n.decode(c),s))return this;var u={msg:n.selfErrKey,err:{msg_raw:n.encode(e.msg||e.message)}};return this._self("error",u,1)}for(var f={begin:Date.now(),cate:r,msg:a&&a.substring(0,1e3),stack:i&&i.substring(0,1e3),file:n.$bo(t.filename||""),line:t.lineno||"",col:t.colno||"",err:{msg_raw:n.encode(a),stack_raw:n.encode(i)},dl:o},l=["tag","c1","c2","c3"],p=0;p<l.length;p++){var d=l[p];t[d]&&(f[d]=t[d])}var g=(this.getConfig("ignore")||{}).ignoreErrors;return n.$al(f.msg,g)||n.$al(n.decode(f.msg),g)?this:(this.$ao&&this.$ao("error",f),this._lg("error",f,1))},behavior:function(e){if(e){var t="object"==typeof e&&e.behavior?e:{behavior:e};return this.$ao&&this.$ao("behavior",t),this._lg("behavior",t,1)}},api:function(e,t,r,a,o,s,c,u,f,l,p,d){if(!e)return n.warn("[retcode] api is null"),this;if(e="string"==typeof e?{api:e,success:t,time:r,code:a,msg:o,begin:s,traceId:c,pv_id:u,apiSnapshot:f,domain:l,flag:d}:n.sub(e,i),!n.$bj(e.api,!0))return this;e.code=e.code||"";var g=e.msg||"";if(g="string"==typeof g?g.substring(0,1e3):g,e.msg=g,e.success=e.success?1:0,e.time=+e.time,e.begin=e.begin,e.traceId=e.traceId||"",e.pv_id=e.pv_id||"",e.domain=e.domain||"",e.flag=e.flag,e.dl="object"==typeof location&&"string"==typeof location.href&&location.href.substring(0,500)||"",e.success?e.apiSnapshot&&delete e.apiSnapshot:e.apiSnapshot=f,p&&(e.traceOrigin=p),!e.api||isNaN(e.time))return n.warn("[retcode] invalid time or api"),this;var h=(this.getConfig("ignore")||{}).ignoreApis;return n.$al(e.api,h)||n.$al(n.decode(e.api),h)?this:e.time<0?this:(this.$ao&&this.$ao("api",e),this._lg("api",e,e.success&&this.getConfig("sample"),e.flag))},speed:function(e,t,r){var a=this,i=this.getConfig("startTime")||this._startTime;return/^s(\d|1[0])$/.test(e)?(t="number"!=typeof t?Date.now()-i:t>=i?t-i:t,a.$be=a.$be||{},a.$be[e]=t,a.$be.begin=i,clearTimeout(a.$bf),a.$bf=setTimeout(function(){r||(a.$be.page=a.$a8(!0)),a._lg("speed",a.$be),a.$be=null},5e3),a):(n.warn("[retcode] invalid point: "+e),a)},performance:function(e){if(e&&"object"==typeof e&&!this.$bp){var t={},r={},a=this.getConfig("autoSendPerf");if(e.autoSend&&a)return r=n.ext(this.$bq||{},e),this.$bp=!0,this._lg("perf",r,this.getConfig("sample"));if(e.autoSend&&!a)return delete e.autoSend,this.$bq?(r=n.ext(this.$bq||{},e),this.$bp=!0,this._lg("perf",r,this.getConfig("sample"))):void(this.$bq=e);for(var i in e)(/^t([1-9]|1[0])$/.test(i)||"ctti"===i||"cfpt"===i)&&(t[i]=e[i]);if(!0===e.autoSend||!a&&(a||this.$bq))return!0!==e.autoSend&&!1===a&&this.$bq?(t=n.ext(this.$bq||{},t),this.$bp=!0,this._lg("perf",t,this.getConfig("sample"))):void 0;this.$bq=n.ext(this.$bq||{},t)}},resource:function(e,t){if(!e||!n.isPlainObject(e))return n.warn("[arms] invalid param data: "+e),this;var r=Object.keys(e),a=["begin","dom","load","res","dl"],i=!1;for(var o in a){if(r.indexOf(a[o])<0){i=!0;break}}if(i)return n.warn("[arms] lack param data: "+e),this;var s={begin:e.begin||Date.now(),dom:e.dom||"",load:e.load||"",res:n.isArray(e.res)?JSON.stringify(e.res):JSON.stringify([]),dl:e.dl||""};return this._lg("res",s,t)},event:function(e,t){if("object"==typeof e&&e&&e.key){var r={},n=["key","success","time","c1","c2","c3"];for(var a in e)n.indexOf(a)>-1&&(r[a]=e[a]);r.success=!1===e.success?0:1,this._lg("event",r,t)}}}),s._super=a,s._root=a,a.Reporter=s,t.exports=s},{"./base":1,"./util":17}],17:[function(e,t,r){Date.now=Date.now||function(){return(new Date).getTime()};var n=Date.now(),a=function(){},i={noop:a,warn:function(){var e="object"==typeof console?console.warn:a;try{var t={warn:e};t.warn.call(t)}catch(r){return a}return e}(),key:"__bl",selfErrKey:"ARMS_SDK_ERROR",selfErrPage:"ARMSSDK",win:"object"==typeof window&&window.document?window:undefined,regionMap:{cn:"https://arms-retcode.aliyuncs.com/r.png?",sg:"https://arms-retcode-sg.aliyuncs.com/r.png?",sg_2:"https://retcode-sg-lazada.arms.aliyuncs.com/r.png?",daily:"http://arms-retcode-daily.alibaba.net/r.png?",daily_2:"https://arms-retcode-daily.alibaba.net/r.png?",daily_3:"http://arms-retcode-daily.aliyun.test/r.png?",us:"https://retcode-us-west-1.arms.aliyuncs.com/r.png?",tw:"https://arms-retcode.orientalgame.com.tw/r.png?",tw_sg:"https://arms-retcode-sg.orientalgame.com.tw/r.png?",hz_finance:"https://arms-retcode-hz-finance.aliyuncs.com/r.png?"},defaultImgUrl:"https://arms-retcode.aliyuncs.com/r.png?",$au:function(e){if(Object.create)return Object.create(e);var t=function(){};return t.prototype=e,new t},each:function(e,t){var r=0,n=e.length;if(this.T(e,"Array"))for(;r<n&&!1!==t.call(e[r],e[r],r);r++);else for(r in e)if(!1===t.call(e[r],e[r],r))break;return e},$a9:function(e,t,r){if("function"!=typeof e)return r;try{return e.apply(this,t)}catch(n){return r}},T:function(e,t){var r=Object.prototype.toString.call(e).substring(8).replace("]","");return t?r===t:r},duration:function(){var e=Date;try{performance&&this.T(performance.now,"Function")&&(e=performance)}catch(r){e=Date}var t=e.now();return function(){return Math.round(e.now()-t)}},$av:function(){var e=[].slice.call(arguments),t=e.length;if(t<2)return e[0];var r=e[t-1],n=e[0];if(!n)return"";if(!r)return n;var a=this,i=a.T(r),o=e.slice(0,t-1);return"Function"===i?a.$a9(r,o,n):"Array"===i?(this.each(r,function(e){o[0]=n=a.$av.apply(a,[].concat(o,e))}),n):"Object"===i?n.replace(r.rule,r.target||""):n.replace(r,"")},$al:function(e,t){if(!e||!t)return!1;if((this.isString(t)||t.source||"Function"===this.T(t))&&(t=[t]),!this.isArray(t))return this.warn("[arms] invalid rules of ignore config, (list of) String/RegExp/Funcitons are available"),!1;for(var r,n=[],a=0,i=t.length;a<i;a++)if(r=t[a],this.isString(r))n.push(r.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"));else if(r&&r.source)n.push(r.source);else if(r&&"Function"===this.T(r)&&!0===this.$a9(r,[e],!1))return!0;var o=new RegExp(n.join("|"),"i");return!!(n.length&&o.test&&o.test(e))},J:function(e){if(!e||"string"!=typeof e)return e;var t=null;try{t=JSON.parse(e)}catch(r){}return t},pick:function(e){return 1===e||1===Math.ceil(Math.random()*e)},$aa:function(e){if("sample"in e){var t=e.sample,r=t;t&&/^\d+(\.\d+)?%$/.test(t)&&(r=parseInt(100/parseFloat(t))),0<r&&1>r&&(r=parseInt(1/r)),r>=1&&r<=100?e.sample=r:delete e.sample}return e},on:function(e,t,r,n,a){return e.addEventListener?(a=a||!1,e.addEventListener(t,function i(o){n&&e.removeEventListener(t,i,a),r.call(this,o)},a)):e.attachEvent&&e.attachEvent("on"+t,function o(a){n&&e.detachEvent("on"+t,o),r.call(this,a)}),this},off:function(e,t,r){return r?(e.removeEventListener?e.removeEventListener(t,r):e.detachEvent&&e.detachEvent(t,r),this):this},delay:function(e,t){return-1===t?(e(),null):setTimeout(e,t||0)},ext:function(e){for(var t=1,r=arguments.length;t<r;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},sub:function(e,t){var r={};return this.each(e,function(e,n){-1!==t.indexOf(n)&&(r[n]=e)}),r},uu:function(){for(var e,t,r=20,n=new Array(r),a=Date.now().toString(36).split("");r-- >0;)t=(e=36*Math.random()|0).toString(36),n[r]=e%3?t:t.toUpperCase();for(var i=0;i<8;i++)n.splice(3*i+2,0,a[i]);return n.join("")},guid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},seq:function(){return(n++).toString(36)},decode:function(e){try{e=decodeURIComponent(e)}catch(t){}return e},encode:function(e,t){try{e=t?encodeURIComponent(e).replace(/\(/g,"%28").replace(/\)/g,"%29"):encodeURIComponent(e)}catch(r){}return e},serialize:function(e){e=e||{};var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==undefined&&t.push(r+"="+this.encode(e[r],"msg"===r));return t.join("&")},$bj:function(e,t){if(!e||"string"!=typeof e)return!1;var r=/arms-retcode[\w-]*\.aliyuncs/.test(e);return!r&&t&&(r=/(\.png)|(\.gif)|(alicdn\.com)|(mmstat\.com)/.test(e)),!r},$ba:function(e){return!(!e||!e.message)&&!/failed[\w\s]+fetch/i.test(e.message)},$aw:function(e){return e&&"string"==typeof e?e.replace(/^(https?:)?\/\//,"").replace(/\?.*$/,""):""},$bo:function(e){return e&&"string"==typeof e?e.replace(/\?.*$/,""):""},$b6:function(e){return function(){return e+"() { [native code] }"}},checkSameOrigin:function(e,t){if(!t||!e)return!1;var r="//"+t.split("/")[2];return e===t||e.slice(0,t.length+1)===t+"/"||e===r||e.slice(0,r.length+1)===r+"/"||!/^(\/\/|http:|https:).*/.test(e)},getRandIP:function(){for(var e=[],t=0;t<4;t++){var r=Math.floor(256*Math.random());e[t]=(r>15?"":"0")+r.toString(16)}return e.join("").replace(/^0/,"1")},getSortNum:function(e){return e?(e+=1)>=1e3&&e<=9999?e:e<1e3?e+1e3:e%1e4+1e3:1e3},getRandNum:function(e){return e&&"string"==typeof e?e.length<5?this.getNum(5):e.substring(e.length-5):this.getNum(5)},getNum:function(e){for(var t=[],r=0;r<e;r++){var n=Math.floor(16*Math.random());t[r]=n.toString(16)}return t.join("")},getCurDomain:function(){return location&&location.hostname||""},parseFetchHeaders:function(e){if(!e)return{};var t={};try{if("function"==typeof e.keys)for(var r=e.keys(),n=r.next();!n.done;){var a=n.value;t[a]=e.get(a),n=r.next()}else t=e}catch(i){t={}}return t},parseXhrHeaders:function(e){if(!e&&"string"!=typeof e)return{};var t={};try{var r=e.split("\r\n");t=r.reduce(function(e,t){var r=t.split(": ");return e[r[0]]=r[1],e},{})}catch(n){t={}}return t},getQuerys:function(e){if(!e)return"";var t={},r=[],n="",a="";try{var i=[];if(e.indexOf("?")>=0&&(i=e.substring(e.indexOf("?")+1,e.length).split("&")),i.length>0)for(var o in i)n=(r=i[o].split("="))[0],a=r[1],t[n]=a}catch(s){t={}}return t},getURL:function(e){if(!e)return null;var t={},r=e.length,n=e.indexOf("://");if(n<0)return null;t.protocol=e.substring(0,n+1);var a=e.indexOf("#"),i=e.indexOf("?");a<0&&(a=r),i<0&&(i=a),t.search=e.substring(i,a).substring(0,1e3);var o=e.substring(n+3,i),s=o.indexOf("/");return s<0&&(s=o.length),t.domain=o.substring(0,s).split(":")[0],t.path=o.substring(s,o.length).substring(0,1e3),t},getResType:function(e,t){if(["document","fetch","xmlhttprequest","beacon","iframe"].indexOf(e)>-1)return undefined;if(["script","img","other"].indexOf(e)>-1)return e;if(["video"].indexOf(e)>-1)return"media";var r=t?this.getURL(t):null,n=r&&r.path?r.path.lastIndexOf("."):-1,a=(n>0?r.path.substr(n+1):"").toLowerCase();if(a){if(["eot","woff","woff2","ttf"].indexOf(a)>-1)return"font";if("css"===a)return"css";if("js"===a)return"script"}return"other"},areInOrder:function(){for(var e=1;e<arguments.length;e+=1)if(arguments[e-1]>arguments[e])return!1;return!0},getFetchSnapshot:function(e,t,r){var n,a;try{var i=(e&&"string"!=typeof e[0]?e[0].url:e[0])||"",o=(e&&"string"!=typeof e[0]?e[0]:e[1])||{},s="POST"===o.method.toUpperCase()?o.body:this.getQuerys(i);n={originApi:i,method:o.method||"unknown",params:s,response:t||"",reqHeaders:this.parseFetchHeaders(o.headers||null),resHeaders:this.parseFetchHeaders(r)},a="function"==typeof encodeURIComponent&&JSON&&encodeURIComponent(JSON.stringify(n))||"{}"}catch(c){a="{}"}return a},getXhrSnapshot:function(e,t,r){if(!e||!t||!r)return{};var n,a;try{var i="";""===r.responseType||"text"===r.responseType?i=r.responseText:"document"===r.responseType&&(i=r.responseXML),n={originApi:e,method:t,params:this.getQuerys(e),response:i,reqHeaders:{},resHeaders:this.parseXhrHeaders("function"==typeof r.getAllResponseHeaders&&r.getAllResponseHeaders()||"")},a="function"==typeof encodeURIComponent&&JSON&&encodeURIComponent(JSON.stringify(n))||"{}"}catch(o){a="{}"}return a},isRobot:function(){var e=["nuhk","googlebot/","googlebot-image","yammybot","openbot","slurp","msnbot","ask jeeves/teoma","ia_archiver","baiduspider","bingbot/","adsbot"];if(!navigator||"string"!=typeof navigator.userAgent)return!1;try{for(var t=navigator.userAgent.toLowerCase(),r=0;r<e.length;r++){var n=e[r];if(t.lastIndexOf(n)>=0)return!0}}catch(a){this.warn("[arms] useragent parse error")}return!1},isFunction:function(e){return"function"==typeof e},isPlainObject:function(e){return"[object Object]"===Object.prototype.toString.call(e)},isString:function(e){return"[object String]"===Object.prototype.toString.call(e)},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},joinRegExp:function(e){for(var t,r=[],n=0,a=e.length;n<a;n++)t=e[n],this.isString(t)?r.push(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):t&&t.source&&r.push(t.source);return new RegExp(r.join("|"),"i")},reWriteMethod:function(e,t,r){if(null!==e){var n=e[t];e[t]=r(n)}},$bn:function(e,t){if(!e&&!t)return!1;if(new RegExp(this.selfErrKey,"i").test(e))return!0;return!!this.$al(t,[/retcode.alicdn.com\/retcode\/bl.js/,/g.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/laz-g-cdn.alicdn.com\/retcode\/cloud-sdk\/bl.js/,/local.taobao.com:8880\/build\/bl/])},$bs:function(e){return{msg:e,message:this.selfErrKey}},$bm:function(e,t,r){var n={};try{n=this.isPlainObject(e)?this.ext({key:e.key||"default",val:e.val||e.value||r},e,{begin:Date.now()}):{key:e||"default",val:t||r,begin:Date.now()}}catch(a){this.warn("[retcode] baseLog error: "+a)}return n}};t.exports=i},{}]},{},[15]); |
@@ -132,3 +132,3 @@ var util = require("./util"), Base = require("./base"), validApiKeys = [ "api", "success", "time", "code", "msg", "trace", "traceId", "begin", "pv_id", "sid", "seq", "domain", "flag" ], parseStatData = function(e) { | ||
var g = (this.getConfig("ignore") || {}).ignoreApis; | ||
return util.ignoreByRule(e.api, g) || util.ignoreByRule(util.decode(e.api), g) ? this : (this.beforeSend && this.beforeSend("api", e), | ||
return util.ignoreByRule(e.api, g) || util.ignoreByRule(util.decode(e.api), g) ? this : e.time < 0 ? this : (this.beforeSend && this.beforeSend("api", e), | ||
this._lg("api", e, e.success && this.getConfig("sample"), e.flag)); | ||
@@ -135,0 +135,0 @@ }, |
@@ -58,2 +58,14 @@ Date.now = Date.now || function() { | ||
}, | ||
duration: function() { | ||
var e = Date; | ||
try { | ||
performance && this.T(performance.now, "Function") && (e = performance); | ||
} catch (r) { | ||
e = Date; | ||
} | ||
var t = e.now(); | ||
return function() { | ||
return Math.round(e.now() - t); | ||
}; | ||
}, | ||
filterByRule: function() { | ||
@@ -60,0 +72,0 @@ var e = [].slice.call(arguments), t = e.length; |
{ | ||
"name": "@arms/js-sdk", | ||
"version": "1.8.32", | ||
"version": "1.8.33", | ||
"description": "arms rum javascript sdk", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -516,1 +516,77 @@ # ARMS RUM | ||
``` | ||
## 小程序 | ||
基础类的小程序监控,适用于钉钉、支付宝、微信、字节跳动、百度、京东等各类小程序,并支持Taro,Uniapp等跨端框架构建目标为上述小程序的场景。 | ||
**参考文档** | ||
> [eapp](https://open-doc.dingtalk.com/microapp/dev/framework-app) | ||
> [微信小程序开发](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/app.html) | ||
###1.开始使用 | ||
```ts | ||
/** | ||
* @desc 监控sdk初始化,debug模式仅打印日志,不发送日志 | ||
* 以钉钉中的用法为例 | ||
* monitor.js | ||
*/ | ||
import Logger from '@arms/js-sdk/miniapp'; | ||
module.exports = Logger.singleton({ | ||
debug: true, // 本地开发不发送日志,但打印日志 | ||
pid: 'your-project-id', | ||
// (可选)基础小程序监控需要手动传入rpc | ||
sendRequest: (url) => { | ||
dd.httpRequest({ | ||
url, | ||
method: 'GET' | ||
}); | ||
}, | ||
// (可选)拦截不想上报的数据,返回null,undefined,0, false等,会取消本次上报 | ||
beforeReport: (data) => { | ||
if (data.t === 'api' && data.time > 20000) { | ||
return | ||
} | ||
return data; | ||
}, | ||
// (可选)需要手动传入获取当前页面路径的方法 | ||
getCurrentPage: () => { | ||
if (typeof getCurrentPages !== 'undefined' && typeof getCurrentPages === 'function') { | ||
var pages = (getCurrentPages() || []); | ||
var pageLength = pages.length; | ||
var currPage = pages[pageLength - 1]; | ||
return (currPage && currPage.route) || null; | ||
} | ||
} | ||
}); | ||
/** | ||
* 启动页 app.js | ||
*/ | ||
import logger from './monitor'; | ||
App({ | ||
onLaunch(options) {}, | ||
onShow(options) {}, | ||
onError(msg) {}, | ||
}); | ||
``` | ||
### 2. 通用API | ||
api示例请参考 **Getting Started** | ||
| 方法 | 参数 | 备注 | 使用场景举例 | | ||
| -------- | -------- | -------- | -------- | | ||
| setCommonInfo | {[key: string]: string;} | 设置日志基础字段 | 灰度 | | ||
| appLaunch | {} | app launch打点 | | | ||
| appShow | {} | app show打点 | | | ||
| pageShow | {} | page show打点,发送pv数据 | | | ||
| pageHide | {} | page hide打点,发送health数据 | | | ||
| error | string|object | 错误日志打点 | | | ||
大部分日志上报api见上面的示例即可 | ||
### 3. 说明 | ||
> 小程序系列监控的项目必须符合标准小程序规范: App、Page。 | ||
即App层有 onLaunch、onShow、onError; | ||
Page层有 onShow、onHide、onUnload。 | ||
Sorry, the diff of this file is too big to display
377602
7239
592